You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,7 +143,19 @@ a callback function. These will still work for now for backward compatibility,
143
143
v0.10.36 is still supported, and can be targeted by changing the `AWS_RUNTIME` value to `nodejs` in the `.env` file.
144
144
145
145
## Post install script
146
-
When running `node-lambda deploy` if you need to do some action after `npm install --production` and before deploying to AWS Lambda (i.e. replace some modules with precompiled ones or download some libraries) you can create `post_install.sh` script. If the file exists the script will be executed (and output shown after execution) if not it is skipped. Make sure that the script is executable.
146
+
When running `node-lambda deploy` if you need to do some action after `npm install --production` and before deploying to AWS Lambda (e.g. replace some modules with precompiled ones or download some libraries, replace some config file depending on environment) you can create `post_install.sh` script. If the file exists the script will be executed (and output shown after execution) if not it is skipped. Environment string is passed to script as first parameter so you can use it if needed. Make sure that the script is executable.
147
+
148
+
Example `post_install.sh`:
149
+
```
150
+
printf "\n\n###### Post install script ###### \n"
151
+
ENV="production";
152
+
if [ ! -z $1 ]
153
+
then
154
+
ENV=$1;
155
+
fi
156
+
cp -v "config_$ENV.js" "config.js" \
157
+
&& printf "###### DONE! ###### \n\n"
158
+
```
147
159
148
160
## Prebuilt packages
149
161
The `--prebuiltDirectory` flag is useful for working with Webpack for example. It skips `npm install --production` and `post_install.sh` and simply packages the specified directory.
0 commit comments