Skip to content

Commit

Permalink
build: move to npm ci where possible
Browse files Browse the repository at this point in the history
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 <timothygu99@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and targos committed Jul 20, 2018
1 parent 1e15581 commit 4c5fc5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ available-node = \
fi;

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

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

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

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

.PHONY: lint-md-build
lint-md-build: tools/remark-cli/node_modules \
Expand Down
4 changes: 2 additions & 2 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,12 @@ if not defined lint_md_build goto lint-md
SETLOCAL
echo Markdown linter: installing remark-cli into tools\
cd tools\remark-cli
%npm_exe% install
%npm_exe% ci
cd ..\..
if errorlevel 1 goto lint-md-build-failed
echo Markdown linter: installing remark-preset-lint-node into tools\
cd tools\remark-preset-lint-node
%npm_exe% install
%npm_exe% ci
cd ..\..
if errorlevel 1 goto lint-md-build-failed
ENDLOCAL
Expand Down

0 comments on commit 4c5fc5c

Please sign in to comment.