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

Upgrade to NPM 7/8, lockfile v2 #1602

Merged

Conversation

victorlin
Copy link
Member

@victorlin victorlin commented Nov 23, 2022

Description of proposed changes

Changes to support the latest NPM version.

Note: this requires a coordinated dev environment upgrade for all contributors. While lockfile v2 is backwards-compatible with older NPM versions, all developers should use NPM 7/8 which is shipped with Node.js 16.

Related issue(s)

Pre-merge tasks

Testing

@victorlin victorlin requested a review from a team November 23, 2022 21:24
@victorlin victorlin self-assigned this Nov 23, 2022
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-updat-vbblde November 23, 2022 21:24 Inactive
@victorlin victorlin marked this pull request as draft November 23, 2022 21:31
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-updat-jsrmyh November 23, 2022 23:47 Inactive
@victorlin victorlin force-pushed the victorlin/update-npm-and-lockfile branch from 4acd365 to 198816c Compare November 28, 2022 20:21
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-updat-qlcdgy November 28, 2022 20:21 Inactive
@victorlin victorlin force-pushed the victorlin/update-npm-and-lockfile branch from 198816c to 782c1a1 Compare November 28, 2022 22:06
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-updat-qlcdgy November 28, 2022 22:06 Inactive
@victorlin victorlin force-pushed the victorlin/update-npm-and-lockfile branch from 782c1a1 to ae1b242 Compare November 28, 2022 23:30
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-updat-qlcdgy November 28, 2022 23:30 Inactive
@victorlin victorlin changed the title Update NPM/lockfile version Upgrade NPM/lockfile version Nov 28, 2022
@victorlin victorlin force-pushed the victorlin/update-npm-and-lockfile branch from ae1b242 to 7be662d Compare November 28, 2022 23:59
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-updat-qlcdgy November 29, 2022 00:00 Inactive
@victorlin victorlin changed the title Upgrade NPM/lockfile version Upgrade to NPM 7/8, lockfile v2 Nov 29, 2022
@victorlin victorlin marked this pull request as ready for review November 29, 2022 01:57
Copy link
Member

@jameshadfield jameshadfield left a comment

Choose a reason for hiding this comment

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

This seems to be working well -- I tested together with (the parent) #1520 under node 16.17.1, npm 8.15.0 on both arch=osx-64 (i.e. rosetta emulation on M1) and arch=arm64 (M1). The notification animations seem unchanged, which seemed to be the main code change introduced here.

NPM 7 comes with a new lockfile version which we will be using for a
more consistent and up-to-date developer experience. NPM 8 is also
supported since it uses the same lockfile version.

The lockfile was upgraded from a fresh environment (node v16.17.1, npm
8.15.0) using `npm ci --ignore-scripts && npm install --ignore-scripts`.
Now that NPM 7 tries to install peer dependencies, having an old version
of react-addons-css-transition-group alongside a newer version of React
will not work with `npm install` as it used to.

However, simply upgrading the old package does not work since there are
no newer versions compatible with React 16. Instead, it has been
deprecated in favor of react-transition-group¹. Luckily, version 1 of
the new package provides a drop-in replacement.

Commands used²:

    npm uninstall react-addons-css-transition-group --legacy-peer-deps
    npm install react-transition-group@1 --legacy-peer-deps

¹ https://www.npmjs.com/package/react-addons-css-transition-group
² --legacy-peer-deps is necessary with NPM 7 until other peer dependency
  issues are resolved by future commits.
Now that NPM 7 tries to install peer dependencies, having an old version
of css-loader alongside a newer version of webpack will not work with
`npm install` as it used to.

This is the earliest version of css-loader that supports the installed
webpack version.

Command used¹:

    npm info css-loader@3 peerDependencies

    npm install --legacy-peer-deps \
        css-loader@3.4.0

¹ --legacy-peer-deps is necessary with NPM 7 until other peer dependency
  issues are resolved by future commits.
Now that NPM 7 tries to install peer dependencies, having an old version
of eslint alongside a newer version of @babel/eslint-parser will not
work with `npm install` as it used to.

This is the earliest version of eslint that is supported by the
installed eslint-parser version.

Command used¹:

    npm info @babel/eslint-parser@7.16.3 peerDependencies

    npm install --legacy-peer-deps \
        eslint@7.5.0

¹ --legacy-peer-deps is necessary with NPM 7 until other peer dependency
  issues are resolved by future commits.
Now that NPM 7 tries to install peer dependencies, having an old version
of these packages alongside a newer version of eslint will not work with
`npm install` as it used to.

These are the earliest versions that support the installed eslint
version.

Commands used¹:

    npm info eslint-config-airbnb@18 peerDependencies
    npm info eslint-plugin-jsx-a11y@6 peerDependencies
    npm info eslint-plugin-react-hooks@4 peerDependencies

    npm install \
        eslint-config-airbnb@18.2.0 \
        eslint-plugin-jsx-a11y@6.3.0 \
        eslint-plugin-react-hooks@4.0.1
The package version upgrades in previous commits introduced some new
rules. Disabling them for now.

Command used:

    npx eslint src --format json \
        | jq -r '.[] | .messages[] | .ruleId' \
        | sort | uniq
@victorlin victorlin force-pushed the victorlin/update-npm-and-lockfile branch from 7be662d to 8c2c996 Compare December 3, 2022 03:11
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-updat-qlcdgy December 3, 2022 03:12 Inactive
@victorlin victorlin mentioned this pull request Dec 6, 2022
3 tasks
@jameshadfield jameshadfield merged commit 783e467 into victorlin/update-versions Dec 7, 2022
@jameshadfield jameshadfield deleted the victorlin/update-npm-and-lockfile branch December 7, 2022 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

3 participants