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

deps: add corepack #39608

Closed
wants to merge 2 commits into from
Closed

deps: add corepack #39608

wants to merge 2 commits into from

Conversation

arcanis
Copy link
Contributor

@arcanis arcanis commented Jul 31, 2021

This PR is a follow-up to #35398, where discussions were more about the idea than the implementation. With that out of the way after the vote in nodejs/TSC#1012 (comment), I updated the branch with the latest Corepack release on top of the Node trunk.

What is Corepack?

Corepack provides a way for Node project authors to define the package manager they intend to use inside their projects - both in terms of package manager type (Yarn, pnpm, ...) and version (x.y.z). This prevents a class of problem where a contributor would use a different version of a package manager than their colleagues and would thus be subject to ever so slightly different environments (due to new bugs, fixed bugs, or different feature sets).

Corepack got approved for inclusion in nodejs/TSC#1012 (comment).

How does Corepack work?

The sources are located inside nodejs/corepack. The gist is that Corepack installs "jumpers" next to the Node binary (just like what already happens for the npm and npx binaries) for the supported package managers (binaries are currently pnpm, pnpx, yarn, and yarnpkg, plus an extra one for corepack itself). They thus become exposed through the $PATH environment variable. Once called, these jumpers look into the local folder to find the top-most package.json, and read the packageManager field from them. Depending on the result:

  • If no packageManager field exists, the requested version is assumed to be the defaults ones in the Corepack configuration.
  • If a packageManager field exists, then it's used as the requested version.

Corepack then ensures that the given package manager is in its cache, downloading it if necessary, and runs it transparently.

How does it affect npm?

It doesn't have any effect on npm. While I wrote the code for Corepack to support npm (or any other package manager), the codepath isn't enabled and won't be until the npm team feels comfortable enabling it themselves. As such, the only two package managers currently impacted are Yarn and pnpm, which have both manifested interest in this project.

What are the risks?

The risks are low, even for Yarn & pnpm users. Corepack is currently opt-in: the shims won't be generated until users explicitly run the corepack enable command in their terminal. The goal is to gather information during the lifetime of Node 16 to then be able to make an informed decision regarding how to proceed in future releases.

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. labels Jul 31, 2021
@arcanis arcanis mentioned this pull request Jul 31, 2021
6 tasks
@jasnell
Copy link
Member

jasnell commented Jul 31, 2021

Rubber-stamp LGTM on corepack itself. The PR itself here should add some documentation in docs/api or docs/guides and I definitely think we should introduce it as experimental initially. Otherwise, very happy to see this moving forward.

deps/corepack/shims/vcc Outdated Show resolved Hide resolved
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

To fix the linter errors, you can run make test-doc -j and make lint-js-fix.

doc/api/corepack.md Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
deps/corepack/dist/corepack.js Outdated Show resolved Hide resolved
@aduh95
Copy link
Contributor

aduh95 commented Aug 1, 2021

Rubber-stamp LGTM on corepack itself. The PR itself here should add some documentation in docs/api or docs/guides and I definitely think we should introduce it as experimental initially. Otherwise, very happy to see this moving forward.

@jasnell this PR does introduce doc/api/corepack.md and updates doc/api/packages.md, with experimental status added to the new sections. Do you think it needs more work, or that it should be organized differently?

@aduh95 aduh95 added notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version. labels Aug 1, 2021
doc/api/corepack.md Outdated Show resolved Hide resolved
doc/api/corepack.md Outdated Show resolved Hide resolved
doc/api/corepack.md Outdated Show resolved Hide resolved
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Few doc nits but otherwise LGTM

@targos
Copy link
Member

targos commented Aug 8, 2021

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

PS C:\Users\WDAGUtilityAccount> corepack
TypeError: Cannot read property 'match' of undefined
    at main (C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:14727:68)
    at runMain (C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:14799:5)
    at C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:14811:5
    at C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:14813:3
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:14818:12)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)

@arcanis
Copy link
Contributor Author

arcanis commented Aug 18, 2021

TypeError: Cannot read property 'match' of undefined

Fixed upstream 👍

Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: nodejs#15244
Refs: nodejs/TSC#904
@aduh95 aduh95 requested a review from targos August 18, 2021 23:12
@targos
Copy link
Member

targos commented Aug 22, 2021

@targos
Copy link
Member

targos commented Aug 22, 2021

Seems to work fine on Windows. It would be nice if someone could try the macOS installer.

doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
@targos targos added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 25, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 25, 2021
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Aug 25, 2021

jasnell pushed a commit that referenced this pull request Aug 25, 2021
Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: #15244
Refs: nodejs/TSC#904

PR-URL: #39608
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@jasnell
Copy link
Member

jasnell commented Aug 25, 2021

Landed in 46598b8.

@jasnell jasnell closed this Aug 25, 2021
targos pushed a commit that referenced this pull request Sep 6, 2021
Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: #15244
Refs: nodejs/TSC#904

PR-URL: #39608
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
targos added a commit that referenced this pull request Sep 6, 2021
Notable changes:

crypto:
  * (SEMVER-MINOR) add RSA-PSS params to asymmetricKeyDetails (Tobias Nießen) #39851
deps:
  * (SEMVER-MINOR) add corepack (Maël Nison) #39608
  * (SEMVER-MINOR) update V8 to 9.3.345.16 (Michaël Zasso) #39947
module:
  * (SEMVER-MINOR) support pattern trailers (Guy Bedford) #39635
stream:
  * (SEMVER-MINOR) add stream.compose (Robert Nagy) #39029

PR-URL: #40011
@targos targos mentioned this pull request Sep 6, 2021
targos added a commit that referenced this pull request Sep 6, 2021
Notable changes:

crypto:
  * (SEMVER-MINOR) add RSA-PSS params to asymmetricKeyDetails (Tobias Nießen) #39851
deps:
  * (SEMVER-MINOR) add corepack (Maël Nison) #39608
  * (SEMVER-MINOR) update V8 to 9.3.345.16 (Michaël Zasso) #39947
module:
  * (SEMVER-MINOR) support pattern trailers (Guy Bedford) #39635
stream:
  * (SEMVER-MINOR) add stream.compose (Robert Nagy) #39029

PR-URL: #40011
targos added a commit that referenced this pull request Sep 7, 2021
Notable changes:

crypto:
  * (SEMVER-MINOR) add RSA-PSS params to asymmetricKeyDetails (Tobias Nießen) #39851
deps:
  * (SEMVER-MINOR) add corepack (Maël Nison) #39608
  * (SEMVER-MINOR) update V8 to 9.3.345.16 (Michaël Zasso) #39947
module:
  * (SEMVER-MINOR) support pattern trailers (Guy Bedford) #39635
stream:
  * (SEMVER-MINOR) add stream.compose (Robert Nagy) #39029

PR-URL: #40011
aduh95 pushed a commit to aduh95/node that referenced this pull request Oct 16, 2021
Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: nodejs#15244
Refs: nodejs/TSC#904

PR-URL: nodejs#39608
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Dec 7, 2021
Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: nodejs#15244
Refs: nodejs/TSC#904

PR-URL: nodejs#39608
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jan 14, 2022
Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: nodejs#15244
Refs: nodejs/TSC#904

PR-URL: nodejs#39608
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
richardlau pushed a commit that referenced this pull request Jan 25, 2022
Corepack provides shims for Yarn and pnpm in order to soften the
developer experience when working on Node projects.

Refs: #15244
Refs: nodejs/TSC#904

PR-URL: #39608
Backport-PR-URL: #40479
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
richardlau added a commit that referenced this pull request Jan 25, 2022
Notable changes:

Corepack:
Node.js now includes Corepack, a script that acts as a bridge between
Node.js projects and the package managers they are intended to be used
with during development.
In practical terms, Corepack will let you use Yarn and pnpm without
having to install them - just like what currently happens with npm,
which is shipped in Node.js by default.

Contributed by Maël Nison - #39608

ICU updated:
ICU has been updated to 70.1. This updates timezone database to 2021a3,
including bringing forward the start for DST for Jordan from March to
February.

Contributed by Michaël Zasso - #40658

New option to disable loading of native addons:
A new command line option `--no-addons` has been added to disallow
loading of native addons.

Contributed by Dominic Elm - #39977

Updated Root Certificates:
Root certificates have been updated to those from Mozilla's Network
Security Services 3.71.

Contributed by Richard Lau - #40280

Other Notable Changes:

crypto:
  * (SEMVER-MINOR) make FIPS related options always available (Vít Ondruch) #36341
lib:
  * (SEMVER-MINOR) add unsubscribe method to non-active DC channels (simon-id) #40433
  * (SEMVER-MINOR) add return value for DC channel.unsubscribe (simon-id) #40433
module:
  * (SEMVER-MINOR) support pattern trailers (Guy Bedford) #39635
src:
  * (SEMVER-MINOR) make napi_create_reference accept symbol (JckXia) #39926

PR-URL: #41696
@richardlau richardlau mentioned this pull request Jan 25, 2022
richardlau added a commit that referenced this pull request Feb 1, 2022
Notable changes:

Corepack:
Node.js now includes Corepack, a script that acts as a bridge between
Node.js projects and the package managers they are intended to be used
with during development.
In practical terms, Corepack will let you use Yarn and pnpm without
having to install them - just like what currently happens with npm,
which is shipped in Node.js by default.

Contributed by Maël Nison - #39608

ICU updated:
ICU has been updated to 70.1. This updates timezone database to 2021a3,
including bringing forward the start for DST for Jordan from March to
February.

Contributed by Michaël Zasso - #40658

New option to disable loading of native addons:
A new command line option `--no-addons` has been added to disallow
loading of native addons.

Contributed by Dominic Elm - #39977

Updated Root Certificates:
Root certificates have been updated to those from Mozilla's Network
Security Services 3.71.

Contributed by Richard Lau - #40280

Other Notable Changes:

crypto:
  * (SEMVER-MINOR) make FIPS related options always available (Vít Ondruch) #36341
lib:
  * (SEMVER-MINOR) add unsubscribe method to non-active DC channels (simon-id) #40433
  * (SEMVER-MINOR) add return value for DC channel.unsubscribe (simon-id) #40433
module:
  * (SEMVER-MINOR) support pattern trailers (Guy Bedford) #39635
src:
  * (SEMVER-MINOR) make napi_create_reference accept symbol (JckXia) #39926

PR-URL: #41696
mwalbeck pushed a commit to mwalbeck/docker-jellyfin-livestream that referenced this pull request Mar 16, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [node](https://github.com/nodejs/node) | stage | minor | `14.18.3-bullseye-slim` -> `14.19.0-bullseye-slim` |

---

### Release Notes

<details>
<summary>nodejs/node</summary>

### [`v14.19.0`](https://github.com/nodejs/node/releases/v14.19.0)

[Compare Source](nodejs/node@v14.18.3...v14.19.0)

##### Notable Changes

##### Corepack

Node.js now includes Corepack, a script that acts as a bridge between Node.js projects and the package managers they are intended to be used with during development.
In practical terms, **Corepack will let you use Yarn and pnpm without having to install them** - just like what currently happens with npm, which is shipped in Node.js by default.
Please head over to the [Corepack documentation page](https://nodejs.org/dist/latest-v14.x/docs/api/corepack.html) for more information on how to use it.

Contributed by Maël Nison - [#&#8203;39608](nodejs/node#39608)

##### ICU updated

ICU has been updated to 70.1. This updates timezone database to 2021a3, including bringing forward the start for DST for Jordan from March to February.

Contributed by Michaël Zasso - [#&#8203;40658](nodejs/node#40658)

##### New option to disable loading of native addons

A new command line option `--no-addons` has been added to disallow loading of native addons.

Contributed by Dominic Elm - [#&#8203;39977](nodejs/node#39977)

##### Updated Root Certificates

Root certificates have been updated to those from Mozilla's Network Security Services 3.71.

Contributed by Richard Lau - [#&#8203;40280](nodejs/node#40280)

##### Other Notable Changes

-   \[[`0d448eaab5`](nodejs/node@0d448eaab5)] - **(SEMVER-MINOR)** **crypto**: make FIPS related options always available (Vít Ondruch) [#&#8203;36341](nodejs/node#36341)
-   \[[`004eafbebf`](nodejs/node@004eafbebf)] - **(SEMVER-MINOR)** **lib**: add unsubscribe method to non-active DC channels (simon-id) [#&#8203;40433](nodejs/node#40433)
-   \[[`625be7585d`](nodejs/node@625be7585d)] - **(SEMVER-MINOR)** **lib**: add return value for DC channel.unsubscribe (simon-id) [#&#8203;40433](nodejs/node#40433)
-   \[[`607bc74eae`](nodejs/node@607bc74eae)] - **(SEMVER-MINOR)** **module**: support pattern trailers (Guy Bedford) [#&#8203;39635](nodejs/node#39635)
-   \[[`f74fe2a59c`](nodejs/node@f74fe2a59c)] - **(SEMVER-MINOR)** **src**: make napi_create_reference accept symbol (JckXia) [#&#8203;39926](nodejs/node#39926)

##### Commits

-   \[[`0231ffa501`](nodejs/node@0231ffa501)] - **build**: add `--without-corepack` (Jonah Snider) [#&#8203;41060](nodejs/node#41060)
-   \[[`5389b8ab05`](nodejs/node@5389b8ab05)] - **crypto**: update root certificates (Richard Lau) [#&#8203;40280](nodejs/node#40280)
-   \[[`0d448eaab5`](nodejs/node@0d448eaab5)] - **(SEMVER-MINOR)** **crypto**: make FIPS related options always available (Vít Ondruch) [#&#8203;36341](nodejs/node#36341)
-   \[[`cd20ecc7cb`](nodejs/node@cd20ecc7cb)] - **deps**: upgrade Corepack to 0.10 (Maël Nison) [#&#8203;40374](nodejs/node#40374)
-   \[[`737df75e17`](nodejs/node@737df75e17)] - **(SEMVER-MINOR)** **deps**: add corepack (Maël Nison) [#&#8203;39608](nodejs/node#39608)
-   \[[`b85aa5a143`](nodejs/node@b85aa5a143)] - **deps**: upgrade npm to 6.14.16 (Ruy Adorno) [#&#8203;41603](nodejs/node#41603)
-   \[[`2755d391a5`](nodejs/node@2755d391a5)] - **deps**: update ICU to 70.1 (Michaël Zasso) [#&#8203;40658](nodejs/node#40658)
-   \[[`3089326d89`](nodejs/node@3089326d89)] - **deps**: update archs files for OpenSSL-1.1.1m (Richard Lau) [#&#8203;41173](nodejs/node#41173)
-   \[[`59da7c12aa`](nodejs/node@59da7c12aa)] - **deps**: upgrade openssl sources to 1.1.1m (Richard Lau) [#&#8203;41173](nodejs/node#41173)
-   \[[`cede1f26f6`](nodejs/node@cede1f26f6)] - **deps**: add -fno-strict-aliasing flag to libuv (Daniel Bevenius) [#&#8203;40631](nodejs/node#40631)
-   \[[`4477da858f`](nodejs/node@4477da858f)] - **doc**: fix corepack grammar for `--force` flag (Steven) [#&#8203;40762](nodejs/node#40762)
-   \[[`5971d58600`](nodejs/node@5971d58600)] - **doc**: add missing YAML tag in `esm.md` (Antoine du Hamel) [#&#8203;41516](nodejs/node#41516)
-   \[[`e903798ae1`](nodejs/node@e903798ae1)] - **doc**: add note regarding unfinished TLA (Antoine du Hamel) [#&#8203;41434](nodejs/node#41434)
-   \[[`a90defebcf`](nodejs/node@a90defebcf)] - **esm**: make `process.exit()` default to exit code 0 (Gang Chen) [#&#8203;41388](nodejs/node#41388)
-   \[[`fc328f1ab0`](nodejs/node@fc328f1ab0)] - **fs**: nullish coalescing to respect zero positional reads (Omar El-Mihilmy) [#&#8203;40716](nodejs/node#40716)
-   \[[`004eafbebf`](nodejs/node@004eafbebf)] - **(SEMVER-MINOR)** **lib**: add unsubscribe method to non-active DC channels (simon-id) [#&#8203;40433](nodejs/node#40433)
-   \[[`625be7585d`](nodejs/node@625be7585d)] - **(SEMVER-MINOR)** **lib**: add return value for DC channel.unsubscribe (simon-id) [#&#8203;40433](nodejs/node#40433)
-   \[[`2c365961d0`](nodejs/node@2c365961d0)] - **module**: support pattern trailers for imports field (Guy Bedford) [#&#8203;40041](nodejs/node#40041)
-   \[[`607bc74eae`](nodejs/node@607bc74eae)] - **(SEMVER-MINOR)** **module**: support pattern trailers (Guy Bedford) [#&#8203;39635](nodejs/node#39635)
-   \[[`f74fe2a59c`](nodejs/node@f74fe2a59c)] - **(SEMVER-MINOR)** **src**: make napi_create_reference accept symbol (JckXia) [#&#8203;39926](nodejs/node#39926)
-   \[[`b050c65885`](nodejs/node@b050c65885)] - **src**: add option to disable loading native addons (Dominic Elm) [#&#8203;39977](nodejs/node#39977)
-   \[[`c1695ac68a`](nodejs/node@c1695ac68a)] - **tools**: update certdata.txt (Richard Lau) [#&#8203;40280](nodejs/node#40280)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Reviewed-on: https://git.walbeck.it/mwalbeck/docker-jellyfin-livestream/pulls/97
Co-authored-by: renovate-bot <bot@walbeck.it>
Co-committed-by: renovate-bot <bot@walbeck.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants