Created
January 4, 2019 19:36
-
-
Save RichardBronosky/f5b67308b82ee8ea95ee2ec9b8e0d167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WHY? | |
# Because lambda function project directories tend to have unnecessary files (like tests, docs, etc.) | |
# This skips the cruft and zip up only these files: | |
# ./node_modules (This is recursive.) | |
# ./*.js (This is not recursive. All *.js files in the base directory are included, subdirectories are excluded.) | |
# ./*.json (This is not recursive. All *.json files in the base directory are included, subdirectories are excluded.) | |
# Note: | |
# Put your tests in ./tests/tests.js rather than ./tests.js to keep them from getting build into the zip | |
find -E . -iregex '^\./[^/]*\.js(on)?' -or -path './node_modules/*' | zip -@ lambda.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "example-package", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"build": "find -E . -iregex '^\\./[^/]*\\.js(on)?' -or -path './node_modules/*' | zip -@ lambda.zip", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"aws-sdk": "^2.382.0" | |
}, | |
"devDependencies": { | |
"mocha": "^5.2.0", | |
"standard": "^12.0.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment