Skip to content

Commit

Permalink
fix: scripts - make sure to use project-local sls
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Jul 13, 2018
1 parent e1e2d03 commit 1bc40ae
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"gen:fixtures": "node ./lib/scripts/gen-fixtures.js && npm run copy-static-assets",
"gen:samples": "node ./lib/scripts/gen-samples.js",
"gen:localsamples": "node ./lib/scripts/gen-samples.js --local",
"gen:localresources": "./src/scripts/init-local.sh",
"gen:localresources": "./src/scripts/gen-local-resources.sh",
"gen:localstack": "sls dynamodb migrate & sls s3 create & wait",
"gen:resourcedefs": "node ./lib/scripts/gen-resource-defs.js",
"gen:modelmap": "node ./lib/scripts/map-models-to-buckets.js",
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/addfriend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ if [ -z "$stage" ] || [ -z "url" ]; then
fi

set -x
echo "{ \"url\": \"$url\" }" | sls invoke --stage=$stage -f addfriend
echo "{ \"url\": \"$url\" }" | ./node_modules/.bin/sls invoke --stage=$stage -f addfriend
2 changes: 1 addition & 1 deletion src/scripts/addfriends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
Promise.all(
friends.map(({ domain, url }) => {
const payload = JSON.stringify({ domain, url })
const command = `echo '${payload}' | sls invoke --stage=${stage} -f addfriend`
const command = `echo '${payload}' | ./node_modules/.bin/sls invoke --stage=${stage} -f addfriend`
console.log(`executing: ${command}`)
return proc.exec(command, {
cwd: process.cwd(),
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (!/^[a-zA-Z-_]+$/.test(stage)) {
throw new Error('invalid stage: ' + stage)
}

const command = `sls deploy --stage=${stage}`
const command = `./node_modules/.bin/sls deploy --stage=${stage}`
let pathToNtfy
try {
pathToNtfy = proc.execSync('command -v ntfy', {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/force-init.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

echo '{"force": true}' | sls invoke -f init
echo '{"force": true}' | ./node_modules/.bin/sls invoke -f init
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
npm run build:yml
npm run gen:localstack
sleep 6
echo "{\"RequestType\": \"Create\", \"ResourceProperties\": $(cat ./src/serverless-interpolated.json | jq .custom.org --raw-output -c)}" | sls invoke local -f bot_oninit
echo "{\"RequestType\": \"Create\", \"ResourceProperties\": $(cat ./src/serverless-interpolated.json | jq .custom.org --raw-output -c)}" | ./node_modules/.bin/sls invoke local -f bot_oninit
2 changes: 1 addition & 1 deletion src/scripts/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import co from 'co'
import buildResource from '@tradle/build-resource'
import { PERMALINK } from '@tradle/constants'

const info = proc.execSync('sls info', {
const info = proc.execSync('./node_modules/.bin/sls info', {
cwd: process.cwd()
})
.toString()
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/interpolate-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

npm run gen:versioninfo

VALUE=$(sls print "$@")
VALUE=$(./node_modules/.bin/sls print "$@")
if [ "$?" == "0" ]; then
echo "$VALUE" > serverless-interpolated.yml
cat serverless-interpolated.yml | node ./lib/scripts/yaml2json.js > src/serverless-interpolated.json
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/invoke-unzip.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

RESP=$(sls invoke $@)
RESP=$(./node_modules/.bin/sls invoke $@)
STATUS=$(echo $RESP | jq .statusCode --raw-output)
BODY=$(echo $RESP | jq .isBase64Encoded --raw-output)
DECODE=$()
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/nuke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ echo "This will empty and delete all buckets, tables, lambdas, etc. for"
echo "service: $SERVICE"
echo "stage: $STAGE"

ask "delete resources stack?" && sls remove --stage="$STAGE"
ask "delete resources stack?" && ./node_modules/.bin/sls remove --stage="$STAGE"
ask "delete all buckets in stack?" && node ./lib/scripts/delete-remote-buckets.js
2 changes: 1 addition & 1 deletion src/scripts/tail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ function minutesago () {
}

echo "logging invocations starting $MINUTES_AGO minutes ago"
sls logs -f "$LAMBDA" --startTime $(minutesago $MINUTES_AGO) --tail
./node_modules/.bin/sls logs -f "$LAMBDA" --startTime $(minutesago $MINUTES_AGO) --tail
2 changes: 1 addition & 1 deletion src/scripts/test-local-warmup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ echo "faking warming up: $(echo $FUNCTIONS | xargs)"
for fn in $FUNCTIONS;
do
echo "warming up $fn"
echo '{"source": "warmup"}' | sls invoke local -f "$fn"
echo '{"source": "warmup"}' | ./node_modules/.bin/sls invoke local -f "$fn"
done
4 changes: 2 additions & 2 deletions src/scripts/updateconf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ EVENT="{\"RequestType\":\"UpdateConf\",\"ResourceProperties\":{}}"
# set -x
if [ "$IS_LOCAL" ]
then
echo "$EVENT" | sls invoke local -f bot_oninit
echo "$EVENT" | ./node_modules/.bin/sls invoke local -f bot_oninit
else
echo "$EVENT" | sls invoke -f bot_oninit
echo "$EVENT" | ./node_modules/.bin/sls invoke -f bot_oninit
fi

0 comments on commit 1bc40ae

Please sign in to comment.