GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — build: move to `npm ci` where possible by Trott · Pull Request #21802 · nodejs/node

Conversation

@Trott

@Trott Trott commented Jul 13, 2018

Copy link
Copy Markdown
Member

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.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Trott
build: move to npm ci where possible
65ecc59
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.
@nodejs-github-bot

nodejs-github-bot commented Jul 13, 2018

Copy link
Copy Markdown
Collaborator

@Trott build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/269/pipeline

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. windows Issues and PRs related to the Windows platform. labels Jul 13, 2018
@Trott Trott mentioned this pull request Jul 13, 2018
Produce HTML documentation using unified/remark/rehype #21490
Closed
3 tasks done
@Trott

Trott commented Jul 13, 2018

Copy link
Copy Markdown
Member Author

@nodejs/build-files

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott added build Issues and PRs related to Node.js builds or CI infrastructure. and removed build Issues and PRs related to Node.js builds or CI infrastructure. labels Jul 13, 2018
@MylesBorins

MylesBorins commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Some what of a dupe of #21538

I discovered that npm ci will always nuke and re-install a directory, whereas npm install will no-op if the directory exists. The way we currently handle npm install this would likely increase the time is takes to do certain operations.

Thoughs?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 13, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Some what of a dupe of #21538

I discovered that npm ci will always nuke and re-install a directory, whereas npm install will no-op if the directory exists. The way we currently handle npm install this would likely increase the time is takes to do certain operations.

Thoughs?

@MylesBorins Not sure the increase is all that significant, to be honest. If you really want to avoid it, we can add a check for the existence of the relevant node_modules directory and only npm ci if it does not exist. That will also require adding rm -rf node_modules to the relevant *-clean tasks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TimothyGu
TimothyGu approved these changes Jul 15, 2018
View reviewed changes

@TimothyGu TimothyGu left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: does npm ci install devDependencies? We used to have --production which doesn't install those.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Trott

Trott commented Jul 15, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Question: does npm ci install devDependencies?

@TimothyGu Yes, it does, although you can specify --production to omit them like you do with npm install.

We used to have --production which doesn't install those.

The only place that has any effect is in tools/doc as the other package.json files do not have devDependencies. I have mixed feelings about this because they're all dev dependencies. We're stashing stuff that is required for the source-tarball only in devDependencies which feels...not quite right to me.

This PR currently does not apply to that package.json, but when we add it, we'll have to make a decision to either add --production or else fix up the package.json somehow so that there isn't this use of devDependencies that seems not quite right (to me, at least).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 16, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Checklist of stuff to do after this lands:

  1. Separate out devDependencies in tools/doc/package.json to its own directory/package.json. (The devDependencies are actually used for "stuff that builds the apiAssets".) That will require modifying Makefile too (and maybe vcbuild.bat, haven't looked yet to see if it includes the apiAssets building stuff.)
  2. Move the rest of Makefile/vcbuild.bat to npm ci.
  3. Profit!
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 16, 2018

Copy link
Copy Markdown
Member Author

CI: https://ci.nodejs.org/job/node-test-pull-request/15903/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 17, 2018

Copy link
Copy Markdown
Member Author

CI: https://ci.nodejs.org/job/node-test-pull-request/15918/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 18, 2018

Copy link
Copy Markdown
Member Author

This is landable, but I'd like a second review. @nodejs/npm @nodejs/build-files

Even though (as Myles pointed out) npm ci removes an existing node_modules every time, it doesn't seem to be an issue with the two tasks in this PR because there is some other mechanism letting make know that the task does not need to be run if it has been run before:

$ make lint-md-clean
rm -f -r tools/remark-cli/node_modules
rm -f -r tools/remark-preset-lint-node/node_modules
rm -f tools/.*mdlintstamp
$ make lint-md-build
Markdown linter: installing remark-cli into tools/
added 160 packages in 1.704s
Markdown linter: installing remark-preset-lint-node into tools/
added 53 packages in 1.089s
$ make lint-md-build
make: Nothing to be done for `lint-md-build'.
$ 
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

richardlau
richardlau approved these changes Jul 18, 2018
View reviewed changes
@richardlau

richardlau commented Jul 18, 2018

Copy link
Copy Markdown
Member

Even though (as Myles pointed out) npm ci removes an existing node_modules every time, it doesn't seem to be an issue with the two tasks in this PR because there is some other mechanism letting make know that the task does not need to be run if it has been run before

That's because for the two tasks (which in this case are directories) they are only run if the relevant package.json prerequisite is missing or newer than the target (i.e. directory):

node/Makefile

Line 1062 in b75bde3

tools/remark-cli/node_modules: tools/remark-cli/package.json

node/Makefile

Lines 1066 to 1067 in b75bde3

tools/remark-preset-lint-node/node_modules: \
tools/remark-preset-lint-node/package.json

Unfortunately there's no equivalent mechanism in vcbuild.bat at the moment.

Trott reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Jul 18, 2018

Copy link
Copy Markdown
Member Author

Unfortunately there's no equivalent mechanism in vcbuild.bat at the moment.

@richardlau I wonder if that means we should back out the changes in this to vcbuild.bat and allow it to continue to use npm install there (so that multiple runs don't install over and over again).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@richardlau

richardlau commented Jul 19, 2018

Copy link
Copy Markdown
Member

Unfortunately there's no equivalent mechanism in vcbuild.bat at the moment.

@richardlau I wonder if that means we should back out the changes in this to vcbuild.bat and allow it to continue to use npm install there (so that multiple runs don't install over and over again).

@Trott AFAIK neither the makefile nor vcbuild.bat runs lint-md-build by default, which means the user has to opt in to running the tasks and I don't envisage a multiple install run scenario.

If I'm understanding correctly the motivation for using npm ci is that fixed levels of modules are installed, rather than the latest? In which case I'd prefer we are consistent (npm ci vs npm install) for the equivalent tasks in the makefile and vcbuild.bat and am happy with this PR as-is.

cc @nodejs/platform-windows

Trott and refack reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

refack
refack approved these changes Jul 19, 2018
View reviewed changes
jasnell
jasnell approved these changes Jul 19, 2018
View reviewed changes
Trott added a commit to Trott/io.js that referenced this pull request Jul 19, 2018
@Trott
build: move to npm ci where possible
fe67287
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: nodejs#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]>
@Trott

Trott commented Jul 19, 2018

Copy link
Copy Markdown
Member Author

Landed in fe67287

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott closed this Jul 19, 2018
targos pushed a commit that referenced this pull request Jul 20, 2018
@Trott @targos
build: move to npm ci where possible
4c5fc5c
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]>
@targos targos mentioned this pull request Jul 31, 2018
v10.8.0 proposal #22040
Merged
This was referenced Aug 1, 2018
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-nodejs#212
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#223
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#224
Closed
This was referenced Aug 2, 2018
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#225
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#226
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#227
Closed
@refack refack mentioned this pull request Aug 19, 2018
build: use npm ci #22399
Merged
2 tasks done
refack added a commit to refack/node that referenced this pull request Aug 23, 2018
@refack
build: use npm ci
d320511
* remove obsolete `node_modules/js-yaml/package.json` target
* remove `@touch` since `npm ci` is always destructive

PR-URL: nodejs#22399
Refs: nodejs#21802
Refs: nodejs#21490
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Sam Ruby <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
targos pushed a commit that referenced this pull request Aug 24, 2018
@refack @targos
build: use npm ci
34af0e8
* remove obsolete `node_modules/js-yaml/package.json` target
* remove `@touch` since `npm ci` is always destructive

PR-URL: #22399
Refs: #21802
Refs: #21490
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Sam Ruby <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
targos pushed a commit that referenced this pull request Sep 3, 2018
@refack @targos
build: use npm ci
fc1259b
* remove obsolete `node_modules/js-yaml/package.json` target
* remove `@touch` since `npm ci` is always destructive

PR-URL: #22399
Refs: #21802
Refs: #21490
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Sam Ruby <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
@Trott
Trott deleted the npm-ci branch January 13, 2022 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@richardlau richardlau richardlau approved these changes
+2 more reviewers
@refack refack refack approved these changes
@TimothyGu TimothyGu TimothyGu approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. windows Issues and PRs related to the Windows platform.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@Trott @nodejs-github-bot @MylesBorins @richardlau @refack @jasnell @TimothyGu
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.