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

Switching from yarn to npm #2329

Merged
merged 4 commits into from
Sep 5, 2018
Merged

Switching from yarn to npm #2329

merged 4 commits into from
Sep 5, 2018

Conversation

julienben
Copy link
Member

Following our conversation in #2327, I did some quick benchmarking on yarn vs npm (3 runs each, clean node_modules, with both lock files present). Yarn was faster but only by 10-12 seconds.

IMO, this switch still makes sense. First, for the reasons discussed earlier (audit and ci) but also because it just makes our code and docs more consistent. Some of our commands require yarn (mostly installing dependencies) and while everything can be done with yarn, our docs go back and forth and are overwhelmingly npm-oriented.

I took advantage of this to refactor setup.js. We were using parseFloat to check node and npm versions. This was inaccurate since our requirement is 8.10 and parseFloat will return 8.1. We're now using a semVer comparison library.

@coveralls
Copy link

coveralls commented Aug 30, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling d4b07d3 on switch-to-npm into fc4dc29 on dev.

@jwinn
Copy link
Collaborator

jwinn commented Aug 30, 2018

@julienben Thank you for taking the time to do this. Great work! 👍

A few thoughts/questions:

Should appveyor.yml use npm ci instead of npm install?

Regarding npm audit:

  • While out of this project's direct control, I get https://nodesecurity.io/advisories/598 referenced 9 times, related to tunnel-agent used by image-webpack-loader--necessitating image-webpack-loader to be updated with >=tunnel-agent@0.6.0.
  • Should we think about having npm audit as part of the commit pipeline?

Should docs/general/faq.md be updated?

  • I'm using Node v0.12 and the server doesn't work? -- Is this really relevant anymore? If it is, should we change the language to be more along the lines of "We settled on supporting the LTS and Current versions of Node.js for the boilerplate..."
  • Use CI with bitbucket pipelines -- Should npm install be changed to npm ci?

@julienben
Copy link
Member Author

I'm using Node v0.12 and the server doesn't work? -- Is this really relevant anymore? If it is, should we change the language to be more along the lines of "We settled on supporting the LTS and Current versions of Node.js for the boilerplate..."

Good catch. The "engines" entry in package.json will take care of warning users on old Node.js versions and we also have version checks before install and before the setup script. IMO, this is more than enough and makes this question irrelevant.

Use CI with bitbucket pipelines -- Should npm install be changed to npm ci?

Yup. Changing that.

Should appveyor.yml use npm ci instead of npm install?

That too.

Regarding npm audit

Can you expand on what you mean by having audit as part of the commit pipeline? Are there other projects that do this? How does it work?

@julienben
Copy link
Member Author

(Note that Travis already uses npm ci by default.)

@julienben julienben mentioned this pull request Sep 4, 2018
Copy link
Collaborator

@jwinn jwinn left a comment

Choose a reason for hiding this comment

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

Travis handles it nicely, let's keep AppVeyor using npm install until the LTS npm version changes to >= 5.7.

Can you expand on what you mean by having audit as part of the commit pipeline? Are there other projects that do this? How does it work?

Was just a thinking out loud; there aren't a lot of other projects, I've seen/know about, leveraging npm audit in any automated manner.

LGTM 👍 Great work on this.

@justingreenberg
Copy link
Member

with respect to npm audit, as of v6.4 audit can be configured to fail based on vuln score, eg. npm audit --audit-level=high will exit 0 if only low or moderate level vulnerability is detected. this should resolve the issue with current deps, however this would also mean dropping support for npm v5.x so it may not make sense at this time

we can add audit in future release @julienben awesome work

@julienben julienben merged commit ff36edc into dev Sep 5, 2018
@julienben julienben deleted the switch-to-npm branch September 5, 2018 08:59
@julienben
Copy link
Member Author

Good to know about npm audit! Let's remember for whenever npm v6.4 ships with node LTS.

@jwinn I'll restore appveyor to using npm install in the babel fixes branch.

@lock
Copy link

lock bot commented Oct 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants