File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,29 @@ module "package_with_commands_and_patterns" {
244
244
]
245
245
}
246
246
247
+ # Some use cases might require the production packages are deployed while maintaining local node_modules folder
248
+ # This example saves the node_modules folder by moving it to an ignored directory
249
+ # After the zip file is created with production node_modules, the dev node_modules folder is restored
250
+ module "package_with_commands_and_patterns" {
251
+ source = " ../../"
252
+
253
+ runtime = " nodejs18.x"
254
+ source_path = [
255
+ {
256
+ path = " ./app"
257
+ commands = [
258
+ " mv ./node_modules ./node_modules_temp" ,
259
+ " npm ci --production" ,
260
+ " :zip" ,
261
+ " rm -rf node_modules" ,
262
+ " mv ./node_modules_temp ./node_modules" ,
263
+ ]
264
+ patterns = [
265
+ " !node_modules_temp/.*"
266
+ ]
267
+ }
268
+ ]
269
+ }
247
270
# Create zip-archive with various sources and patterns.
248
271
# Note, that it is possible to write comments in patterns.
249
272
module "package_with_patterns" {
You can’t perform that action at this time.
0 commit comments