forked from 18F/analytics-reporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_lambda_deploy.sh
More file actions
executable file
·39 lines (33 loc) · 1020 Bytes
/
create_lambda_deploy.sh
File metadata and controls
executable file
·39 lines (33 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# maybe a zip file was passed in?
if [ -z "$1" ]; then
OUTFILE='./lambda-deploy.zip';
else
OUTFILE="$1";
fi
# clear out existing node modules to get ready for lambda
rm -rf ./node_modules
# lambda already include a more recent version of aws-sdk
# so we just get rid of it as a dependency
# now the node_module directory is smaller for deploy
# this breaks local builds, however, so we put it back when done
sed -i.bkp '/"aws-sdk"/d' ./package.json
#npm install aws-sdk@2.395.0
rm -f ./package-lock.json
npm install --production
#npm install --no-optional --production
if [ -f "$OUTFILE" ]; then
rm $OUTFILE;
fi
# we only need these directories to function
zip -r $OUTFILE \
./bin \
./node_modules \
./src \
./reports \
index.js \
lambda.js
# put back original package file
mv package.json.bkp package.json
npm install
# deploy this out - this is just test code for local dev
aws lambda update-function-code --function-name analyticsReporterTest --zip-file fileb://$OUTFILE