Skip to content

Commit f6c9f2b

Browse files
fix: replace deprecated npm --production with --omit=dev (#553) (#828)
The --production flag is deprecated in npm 8+ and causes warnings that can be treated as errors. Replace with --omit=dev which is the modern equivalent, supported in npm 7+. Co-authored-by: Reed Hamilton <reedham@amazon.com>
1 parent ff755bc commit f6c9f2b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

aws_lambda_builders/workflows/nodejs_npm/actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def execute(self):
111111
try:
112112
LOG.debug("NODEJS installing production dependencies in: %s", self.install_dir)
113113

114-
command = ["install", "-q", "--no-audit", "--no-save", "--unsafe-perm", "--production"]
114+
command = ["install", "-q", "--no-audit", "--no-save", "--unsafe-perm", "--omit=dev"]
115115
self.subprocess_npm.run(command, cwd=self.install_dir)
116116

117117
except NpmExecutionError as ex:
@@ -140,7 +140,7 @@ def execute(self):
140140
"--no-audit",
141141
"--no-save",
142142
"--unsafe-perm",
143-
"--production",
143+
"--omit=dev",
144144
"--no-package-lock",
145145
"--install-links",
146146
]

aws_lambda_builders/workflows/nodejs_npm_esbuild/DESIGN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ operation is designed to be faster than installing dependencies using `npm insta
2626
in automated CI environments.
2727

2828
If the directory does not contain lockfiles, but contains `package.json`,
29-
execute [`npm install --production`] to download production dependencies.
29+
execute [`npm install --omit=dev`] to download production dependencies.
3030

3131
#### Step 2: bundle the main Lambda file
3232

tests/unit/workflows/nodejs_npm/test_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_installs_npm_production_dependencies_for_npm_project(self, SubprocessNp
6767

6868
action.execute()
6969

70-
expected_args = ["install", "-q", "--no-audit", "--no-save", "--unsafe-perm", "--production"]
70+
expected_args = ["install", "-q", "--no-audit", "--no-save", "--unsafe-perm", "--omit=dev"]
7171

7272
subprocess_npm.run.assert_called_with(expected_args, cwd="artifacts")
7373

0 commit comments

Comments
 (0)