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

RFC: Mount package.json for Corepack #1512

Merged
merged 1 commit into from
Apr 2, 2024
Merged

RFC: Mount package.json for Corepack #1512

merged 1 commit into from
Apr 2, 2024

Conversation

72636c
Copy link
Member

@72636c 72636c commented Mar 27, 2024

  • Add changeset if we're happy with this change

Our Dockerfiles currently run corepack enable pnpm without any versioning information:

RUN corepack enable pnpm

This may use a different (newer) version than is specified in package.json:

"packageManager": "pnpm@8.15.4",

This can result in a subsequent pnpm install --offline hanging in CI on the following prompt:

Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-8.15.4.tgz.

Do you want to continue? [Y/n]

Couple options:

  1. Stop pinning pnpm version in package.json
  2. Mount package.json on that Dockerfile command

This implements option 2, but I could be convinced the other way.

Our Dockerfiles currently run `corepack enable pnpm` without any
versioning information:

https://github.com/seek-oss/skuba/blob/bc2c69d3b85a6aba738c5d63d01f810a69b1a248/template/greeter/Dockerfile#L5

This may use a different version than is specified in package.json:

https://github.com/seek-oss/skuba/blob/bc2c69d3b85a6aba738c5d63d01f810a69b1a248/template/greeter/package.json

This can result in a subsequent `pnpm install --offline` to hang in CI
on the following prompt:

```console
Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-8.15.4.tgz.

Do you want to continue? [Y/n]
```
Copy link

changeset-bot bot commented Mar 27, 2024

⚠️ No Changeset found

Latest commit: ba4e92f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -279,7 +281,7 @@ This migration guide assumes that your project was scaffolded with a **skuba** t
Your build pipeline may have previously output an ephemeral `.npmrc` with an auth token on the build agent.
This needs to be output elsewhere to avoid overwriting the new pnpm configuration stored in `.npmrc`.

Swap out caching on `package.json` and `yarn.lock` for `.npmrc` and `pnpm-lock.yaml` at the same time.
Swap out caching on `yarn.lock` for `.npmrc` and `pnpm-lock.yaml` at the same time.
Copy link
Member Author

Choose a reason for hiding this comment

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

cc @samchungy as I know you have opinions about caching

Copy link
Contributor

Choose a reason for hiding this comment

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

Sadge but there is no better solution imo

@72636c 72636c marked this pull request as ready for review March 27, 2024 22:22
@72636c 72636c requested review from a team as code owners March 27, 2024 22:22
@tadhglewis
Copy link
Member

tadhglewis commented Mar 28, 2024

Mount package.json on that Dockerfile command

This renovate upgrade the packageManager version if we do option 2? One pro is we have run into issues in the past with version upgrades where we THEN need to pin pnpm

@72636c
Copy link
Member Author

72636c commented Mar 28, 2024

@tadhglewis Yup, Renovate will raise PRs 👍

@72636c 72636c merged commit c1dc8db into main Apr 2, 2024
18 checks passed
@72636c 72636c deleted the package-json-corepack branch April 2, 2024 00:27
@72636c
Copy link
Member Author

72636c commented Apr 2, 2024

🤦 forgot a changeset

72636c added a commit that referenced this pull request Apr 2, 2024
I finally decided to read the Corepack documentation and skim its code.
It turns out `corepack enable` doesn't actually do any installing.

https://github.com/nodejs/corepack?tab=readme-ov-file#utility-commands
@72636c 72636c mentioned this pull request Apr 2, 2024
72636c added a commit that referenced this pull request Apr 9, 2024
I finally decided to read the Corepack documentation and skim its code.
It turns out `corepack enable` doesn't actually do any installing.

https://github.com/nodejs/corepack?tab=readme-ov-file#utility-commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants