File tree Expand file tree Collapse file tree 5 files changed +46
-0
lines changed Expand file tree Collapse file tree 5 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ Note that this example may create resources which cost money. Run `terraform des
37
37
| <a name =" module_lambda_layer " ></a > [ lambda\_ layer] ( #module\_ lambda\_ layer ) | ../../ | n/a |
38
38
| <a name =" module_lambda_layer_pip_requirements " ></a > [ lambda\_ layer\_ pip\_ requirements] ( #module\_ lambda\_ layer\_ pip\_ requirements ) | ../.. | n/a |
39
39
| <a name =" module_lambda_layer_poetry " ></a > [ lambda\_ layer\_ poetry] ( #module\_ lambda\_ layer\_ poetry ) | ../../ | n/a |
40
+ | <a name =" module_npm_package_with_commands_and_patterns " ></a > [ npm\_ package\_ with\_ commands\_ and\_ patterns] ( #module\_ npm\_ package\_ with\_ commands\_ and\_ patterns ) | ../../ | n/a |
40
41
| <a name =" module_package_dir " ></a > [ package\_ dir] ( #module\_ package\_ dir ) | ../../ | n/a |
41
42
| <a name =" module_package_dir_pip_dir " ></a > [ package\_ dir\_ pip\_ dir] ( #module\_ package\_ dir\_ pip\_ dir ) | ../../ | n/a |
42
43
| <a name =" module_package_dir_poetry " ></a > [ package\_ dir\_ poetry] ( #module\_ package\_ dir\_ poetry ) | ../../ | n/a |
Original file line number Diff line number Diff line change @@ -244,6 +244,31 @@ 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 "npm_package_with_commands_and_patterns" {
251
+ source = " ../../"
252
+
253
+ create_function = false
254
+
255
+ runtime = " nodejs18.x"
256
+ source_path = [
257
+ {
258
+ path = " ${ path . module } /../fixtures/node-app"
259
+ commands = [
260
+ " [ ! -d node_modules ] || mv node_modules node_modules_temp" ,
261
+ " npm install --production" ,
262
+ " :zip" ,
263
+ " rm -rf node_modules" ,
264
+ " [ ! -d node_modules_temp ] || mv node_modules_temp node_modules" ,
265
+ ]
266
+ patterns = [
267
+ " !node_modules_temp/.*"
268
+ ]
269
+ }
270
+ ]
271
+ }
247
272
# Create zip-archive with various sources and patterns.
248
273
# Note, that it is possible to write comments in patterns.
249
274
module "package_with_patterns" {
Original file line number Diff line number Diff line change @@ -779,6 +779,9 @@ def commands_step(path, commands):
779
779
)
780
780
else :
781
781
batch .append (c )
782
+ if batch :
783
+ step ("sh" , path , "\n " .join (batch ))
784
+ batch .clear ()
782
785
783
786
for claim in claims :
784
787
if isinstance (claim , str ):
Original file line number Diff line number Diff line change
1
+ // test
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " app" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test" : " echo \" Error: no test specified\" && exit 1"
8
+ },
9
+ "author" : " " ,
10
+ "license" : " ISC" ,
11
+ "dependencies" : {
12
+ },
13
+ "devDependencies" : {
14
+ "axios" : " ^1.7.3"
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments