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

Prevent npm@6-related Netlify failures on release-3.6 branch #9112

Merged
merged 3 commits into from
Nov 23, 2021

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Nov 23, 2021

For the time being, the documentation team is sticking to npm@6 for managing the docs/ directories of our various projects, which mostly entails sticking with lockfileVersion:1 in docs/package-lock.json, instead of lockfileVersion:2 (like ./package-lock.json).

Apollo Client itself welcomes contributors using the latest versions of Node.js and npm, so we've switched to lockfileVersion:2 in the root package-lock.json file, even defending it from reversion with checks like #9068.

However, when Netlify attempts to run npm@6 in the root directory of the apollo-client repository, the newer lockfileVersion:2 in package-lock.json causes failures on npm install like this one.

Reading over PR #9006 where the cd .. && npm i && npm run build commands were introduced, it doesn't seem to be absolutely necessary to build Apollo Client itself when building the docs, so I propose we fix the Netlify build failures by running npm i with appropriate npm versions in each directory during the Netlify build, and skip running npm run build in the root apollo-client directory (unless @hwillson or @brainkim or anyone else can think of a reason that's necessary for building the docs).

For the time being, the documentation team is sticking to npm@6 for
managing the `docs/` directories of our various projects, which mostly
entails sticking with `lockfileVersion:1` in `docs/package-lock.json`,
instead of `lockfileVersion:2` (like `./package-lock.json`).

Apollo Client itself welcomes contributors using the latest versions of
Node.js and npm, so we've embraced `lockfileVersion:2` in the root
`package-lock.json` file, even defending it from reversion with checks
like #9068.

However, when Netlify attempts to run npm@6 in the root directory of the
apollo-client repository, the newer `lockfileVersion:2` in
`package-lock.json` causes failures on `npm install` such as
https://app.netlify.com/sites/apollo-client-docs/deploys/619d49161cd5b80007973178

Reading over PR #9006 where the `cd .. && npm i && npm run build`
commands were introduced, it doesn't seem to be absolutely necessary to
build Apollo Client itself when building the docs, so I propose we fix
the Netlify build failures by running `npm i` with appropriate npm
versions in each directory during the Netlify build, and not running
`npm run build` in the root apollo-client directory.
@benjamn benjamn self-assigned this Nov 23, 2021
I don't think building Apollo Client itself should be necessary for
Netlify to build the docs, but it doesn't hurt, and I don't want to risk
breaking the docs in some unforeseen way.
netlify.toml Show resolved Hide resolved
Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

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

Awesome @benjamn - thanks!

@benjamn benjamn merged commit 35fd523 into release-3.6 Nov 23, 2021
@benjamn benjamn deleted the prevent-npm6-netlify-failures branch November 23, 2021 22:24
benjamn added a commit that referenced this pull request Nov 29, 2021
…9112)"

This reverts commit efe61de, which did
not, in fact, prevent the Netlify failures. Instead, updating `acorn`
seems to have been the ticket.
@benjamn benjamn mentioned this pull request Nov 29, 2021
7 tasks
benjamn added a commit that referenced this pull request Feb 4, 2022
PR #9187 by @renovate keeps failing because it resets lockfileVersion to
1 in package-lock.json, which our tests from PR #9112 forbid.

Closes #9187.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants