Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builtin): use npm ci as default behaviour for installing node_modules #2328

Merged
merged 2 commits into from
Dec 18, 2020

Conversation

lukasholzer
Copy link
Collaborator

To be more hermetic with the install of the dependencies use npm ci to install the exact version from the package-lock.json file.

To update a dependency use the vendored npm binary with bazel run @nodejs//:npm install <dep-name>.

Fixes #159

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Currently, the npm_install rule will use the npm install command and installs the latest version that is possible in the range of the packag.json

Issue Number: #2327 159

What is the new behavior?

The new behaviour is using the npm ci command to install the dependencies, this means that it will install the exact version from the package-lock.json file

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

could you make the same change as for yarn frozen_lockfile - the examples shouldn't need to change, it's the integration test logic that's wrong

@@ -303,6 +312,18 @@ npm_install = repository_rule(
See npm CLI docs https://docs.npmjs.com/cli/install.html for complete list of supported arguments.""",
default = [],
),
"npm_ci": attr.bool(
Copy link
Collaborator

Choose a reason for hiding this comment

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

a boolean is a strange way to model a string.

what should a user expect that npm_ci = False means? I don't think it would be very clear that it means "use npm install instead"

maybe it should be

"npm_command": attr.string(default = "ci", doc = "which npm command to run to install dependencies", values = ["ci", "install"])

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A very good idea. I was not 100% happy with the naming but I don't have something better in mind. Your suggestion is a perfect solution, will adapt the changes :)

…dules

To be more hermetic with the install of the dependencies use npm ci to install the exact version from the package-lock.json file.

To update a dependency use the vendored npm binary with `bazel run @nodejs//:npm install <dep-name>`.

Fixes bazel-contrib#159
@google-cla
Copy link

google-cla bot commented Dec 18, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes labels Dec 18, 2020
@alexeagle
Copy link
Collaborator

@googlebot I consent.

@google-cla google-cla bot added cla: yes and removed cla: no labels Dec 18, 2020
Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

😎

@alexeagle alexeagle merged commit 1d650fb into bazel-contrib:3.x Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: support npm ci
2 participants