Skip to content

Commit 4c5fc5c

Browse files
Trotttargos
authored andcommitted
build: move to npm ci where possible
Recent events (involving a maliciously published version of a popular module's dependency) have reinvigorated my interest in seeing us move to `npm ci` instead of `npm install`. This moves us to `npm ci` where possible in Makefile and vcbuild.bat. PR-URL: #21802 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 1e15581 commit 4c5fc5c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ available-node = \
659659
fi;
660660

661661
run-npm-install = $(PWD)/$(NPM) install --production --no-package-lock
662+
run-npm-ci = $(PWD)/$(NPM) ci
662663

663664
tools/doc/node_modules/js-yaml/package.json:
664665
cd tools/doc && $(call available-node,$(run-npm-install))
@@ -1068,12 +1069,12 @@ lint-md-clean:
10681069

10691070
tools/remark-cli/node_modules: tools/remark-cli/package.json
10701071
@echo "Markdown linter: installing remark-cli into tools/"
1071-
@cd tools/remark-cli && $(call available-node,$(run-npm-install))
1072+
@cd tools/remark-cli && $(call available-node,$(run-npm-ci))
10721073

10731074
tools/remark-preset-lint-node/node_modules: \
10741075
tools/remark-preset-lint-node/package.json
10751076
@echo "Markdown linter: installing remark-preset-lint-node into tools/"
1076-
@cd tools/remark-preset-lint-node && $(call available-node,$(run-npm-install))
1077+
@cd tools/remark-preset-lint-node && $(call available-node,$(run-npm-ci))
10771078

10781079
.PHONY: lint-md-build
10791080
lint-md-build: tools/remark-cli/node_modules \

vcbuild.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -614,12 +614,12 @@ if not defined lint_md_build goto lint-md
614614
SETLOCAL
615615
echo Markdown linter: installing remark-cli into tools\
616616
cd tools\remark-cli
617-
%npm_exe% install
617+
%npm_exe% ci
618618
cd ..\..
619619
if errorlevel 1 goto lint-md-build-failed
620620
echo Markdown linter: installing remark-preset-lint-node into tools\
621621
cd tools\remark-preset-lint-node
622-
%npm_exe% install
622+
%npm_exe% ci
623623
cd ..\..
624624
if errorlevel 1 goto lint-md-build-failed
625625
ENDLOCAL

0 commit comments

Comments
 (0)