-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: install git repositories that use pnpm #3618
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
Draft
paul-soporan
wants to merge
6
commits into
master
Choose a base branch
from
paul/feat/git-pnpm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
761b332
feat: install git repositories that use pnpm
paul-soporan a9625ca
ci: enable corepack
paul-soporan c8e6f36
ci: force install corepack
paul-soporan 7c2c68b
fix: add workaround so that pnpm@5 can pack regular packages
paul-soporan d0751af
ci: manually install pnpm (corepack has an issue)
paul-soporan 75b031f
true
paul-soporan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
releases: | ||
"@yarnpkg/cli": minor | ||
"@yarnpkg/core": minor | ||
"@yarnpkg/plugin-git": minor | ||
"@yarnpkg/plugin-github": minor | ||
|
||
declined: | ||
- "@yarnpkg/plugin-compat" | ||
- "@yarnpkg/plugin-constraints" | ||
- "@yarnpkg/plugin-dlx" | ||
- "@yarnpkg/plugin-essentials" | ||
- "@yarnpkg/plugin-exec" | ||
- "@yarnpkg/plugin-file" | ||
- "@yarnpkg/plugin-http" | ||
- "@yarnpkg/plugin-init" | ||
- "@yarnpkg/plugin-interactive-tools" | ||
- "@yarnpkg/plugin-link" | ||
- "@yarnpkg/plugin-nm" | ||
- "@yarnpkg/plugin-npm" | ||
- "@yarnpkg/plugin-npm-cli" | ||
- "@yarnpkg/plugin-pack" | ||
- "@yarnpkg/plugin-patch" | ||
- "@yarnpkg/plugin-pnp" | ||
- "@yarnpkg/plugin-pnpm" | ||
- "@yarnpkg/plugin-stage" | ||
- "@yarnpkg/plugin-typescript" | ||
- "@yarnpkg/plugin-version" | ||
- "@yarnpkg/plugin-workspace-tools" | ||
- "@yarnpkg/builder" | ||
- "@yarnpkg/doctor" | ||
- "@yarnpkg/nm" | ||
- "@yarnpkg/pnpify" | ||
- "@yarnpkg/sdks" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/HEAD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ref: refs/heads/master |
4 changes: 4 additions & 0 deletions
4
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = false |
1 change: 1 addition & 0 deletions
1
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/description
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Unnamed repository; edit this file 'description' to name the repository. |
8 changes: 8 additions & 0 deletions
8
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/hooks/post-update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
# | ||
# An example hook script to prepare a packed repository for use over | ||
# dumb transports. | ||
# | ||
# To enable this hook, rename this file to "post-update". | ||
|
||
exec git update-server-info |
6 changes: 6 additions & 0 deletions
6
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/info/exclude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# git ls-files --others --exclude-from=.git/info/exclude | ||
# Lines that start with '#' are comments. | ||
# For a project mostly in C, the following would be a good set of | ||
# exclude patterns (uncomment them if you want to use them): | ||
# *.[oa] | ||
# *~ |
3 changes: 3 additions & 0 deletions
3
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/info/refs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
57d05601ca0e00e0047b2ea8a0f30b0dc760e40b refs/heads/master | ||
57d05601ca0e00e0047b2ea8a0f30b0dc760e40b refs/remotes/origin/HEAD | ||
57d05601ca0e00e0047b2ea8a0f30b0dc760e40b refs/remotes/origin/master |
1 change: 1 addition & 0 deletions
1
...-fixtures/repositories/pnpm-project.git/objects/04/d06cc440ad490ca4744395bb2c431b70b57898
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x5�1� �agNA:+���ۀv�(4-��b|���/�%h���T�d�!L(�6��s���d�%��3�ؿ�̑�<�CD��Y�,��N& 4�R���� � |
Binary file added
BIN
+15 Bytes
...-fixtures/repositories/pnpm-project.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904
Binary file not shown.
Binary file added
BIN
+784 Bytes
...-fixtures/repositories/pnpm-project.git/objects/57/d05601ca0e00e0047b2ea8a0f30b0dc760e40b
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
...-fixtures/repositories/pnpm-project.git/objects/cf/83f8c5aa9f800669eaf31b7b7d3f25f54b3549
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
xUͱ�0�ag���$��э�:8��j� | ||
\��ֻV!�wG���W��V��a�x���c�3�PM�,�^ r��e���Eja�O�;eߦ4��s���Η�v��C7�}"�)fEv& �yt@�X�;��/'�6� |
Binary file added
BIN
+70 Bytes
...-fixtures/repositories/pnpm-project.git/objects/d4/94dba3e6a710854e03497b7f1a26a63c0e7540
Binary file not shown.
Binary file added
BIN
+126 Bytes
...-fixtures/repositories/pnpm-project.git/objects/e1/2c0cd76796a67dbcbee21331bab75137aea7f6
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...ages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/objects/info/packs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
2 changes: 2 additions & 0 deletions
2
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/packed-refs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# pack-refs with: peeled fully-peeled sorted | ||
57d05601ca0e00e0047b2ea8a0f30b0dc760e40b refs/remotes/origin/master |
1 change: 1 addition & 0 deletions
1
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-project.git/refs/heads/master
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
57d05601ca0e00e0047b2ea8a0f30b0dc760e40b |
1 change: 1 addition & 0 deletions
1
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/HEAD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ref: refs/heads/master |
4 changes: 4 additions & 0 deletions
4
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = false |
1 change: 1 addition & 0 deletions
1
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/description
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Unnamed repository; edit this file 'description' to name the repository. |
8 changes: 8 additions & 0 deletions
8
...es/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/hooks/post-update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
# | ||
# An example hook script to prepare a packed repository for use over | ||
# dumb transports. | ||
# | ||
# To enable this hook, rename this file to "post-update". | ||
|
||
exec git update-server-info |
6 changes: 6 additions & 0 deletions
6
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/info/exclude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# git ls-files --others --exclude-from=.git/info/exclude | ||
# Lines that start with '#' are comments. | ||
# For a project mostly in C, the following would be a good set of | ||
# exclude patterns (uncomment them if you want to use them): | ||
# *.[oa] | ||
# *~ |
3 changes: 3 additions & 0 deletions
3
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/info/refs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
d16bc461ce9bd42690625105cd50ae5936ebce34 refs/heads/master | ||
d16bc461ce9bd42690625105cd50ae5936ebce34 refs/remotes/origin/HEAD | ||
d16bc461ce9bd42690625105cd50ae5936ebce34 refs/remotes/origin/master |
Binary file added
BIN
+57 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/1f/63fd5e42e4bd1d29b250f1365f833150d467a3
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...xtures/repositories/pnpm-workspaces.git/objects/61/3e4f2f72b8aea56b20475c016a6c8fad2485e2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x�A� =�}51<�;�b�6���x��L6V�xlKU*Y*�܇h�@n��|� :��0&���鉍[�F��g�J�&�2sm | ||
|
Binary file added
BIN
+63 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/74/1fe10cc250174d64297e5641ed9e67c73cd41d
Binary file not shown.
Binary file added
BIN
+156 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/93/5defbf4feda857ab6aa12f503c0dd42f3d8df4
Binary file not shown.
Binary file added
BIN
+33 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/b2/f187caccb2e84bd4c20f81a4f4be3fcbcb47e0
Binary file not shown.
Binary file added
BIN
+57 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/bb/848e3fdd3d7875dc179648ab98742f9761c8dd
Binary file not shown.
Binary file added
BIN
+55 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/be/4760eb142a0e427faca9811cb913d5917ad614
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
...xtures/repositories/pnpm-workspaces.git/objects/d1/6bc461ce9bd42690625105cd50ae5936ebce34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+72 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/dc/bdfa141295731efd57481923e80604520f0a35
Binary file not shown.
Binary file added
BIN
+55 Bytes
...xtures/repositories/pnpm-workspaces.git/objects/ee/09b194db8e42695fa9dca484a35715916cd089
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...s/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/objects/info/packs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
2 changes: 2 additions & 0 deletions
2
packages/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/packed-refs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# pack-refs with: peeled fully-peeled sorted | ||
d16bc461ce9bd42690625105cd50ae5936ebce34 refs/remotes/origin/master |
1 change: 1 addition & 0 deletions
1
...es/acceptance-tests/pkg-tests-fixtures/repositories/pnpm-workspaces.git/refs/heads/master
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
d16bc461ce9bd42690625105cd50ae5936ebce34 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ [email protected]:yarnpkg/berry.git#head=master | |
|
||
- Yarn will use either of Yarn, npm, or pnpm to pack the repository, based on the repository style (ie we'll use Yarn if there's a `yarn.lock`, npm if there's a `package-lock.json`, or pnpm if there's a `pnpm-lock.yaml`) | ||
|
||
- Workspaces can be cloned as long as the remote repository uses Yarn or npm (npm@>=7.x has to be installed on the system); we can't support pnpm because it doesn't have equivalent for the [`workspace` command](/cli/workspace). Just reference the workspace by name in your range (you can optionally enforce the tag as well): | ||
- Workspaces can be cloned as long as the remote repository uses Yarn, npm (npm@>=7.x has to be installed on the system), or pnpm (pnpm@>=6.x has to be installed on the system). Just reference the workspace by name in your range (you can optionally enforce the tag as well): | ||
|
||
``` | ||
[email protected]:yarnpkg/berry.git#workspace=@yarnpkg/shell&tag=@yarnpkg/shell/2.1.0 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,11 +348,44 @@ export async function prepareExternalProject(cwd: PortablePath, outputPath: Port | |
|
||
return 0; | ||
}], | ||
|
||
[PackageManager.Pnpm, async () => { | ||
const install = await execUtils.pipevp(`pnpm`, [`install`], {cwd, env, stdin, stdout, stderr, end: execUtils.EndStrategy.ErrorCode}); | ||
if (install.code !== 0) | ||
return install.code; | ||
|
||
const packStream = new PassThrough(); | ||
const packPromise = miscUtils.bufferStream(packStream); | ||
|
||
packStream.pipe(stdout); | ||
|
||
// It seems that pnpm doesn't support specifying the pack output path, | ||
// so we have to extract the stdout on top of forking it to the logs. | ||
|
||
// - `pnpm pack` doesn't support the `--filter` flag so we have to use `pnpm exec` | ||
// - We have to use the `--pack-destination` flag because otherwise pnpm generates the tarball inside the workspace cwd | ||
// - Only pnpm@>=6.x supports the `--pack-destination` flag (and previous versions throw an error) | ||
const packArgs = workspace !== null | ||
? [`--filter`, workspace, `exec`, `pnpm`, `pack`, `--pack-destination`, npath.fromPortablePath(cwd)] | ||
: [`pack`]; | ||
|
||
const pack = await execUtils.pipevp(`pnpm`, packArgs, {cwd, env, stdin, stdout: packStream, stderr}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to make sure we don't forget; this needs to apply the same fix as #4403 |
||
if (pack.code !== 0) | ||
return pack.code; | ||
|
||
const packOutput = (await packPromise).toString().trim().replace(/^.*\n/s, ``); | ||
const packTarget = ppath.resolve(cwd, npath.toPortablePath(packOutput)); | ||
|
||
// Only then can we move the pack to its rightful location | ||
await xfs.renamePromise(packTarget, outputPath); | ||
|
||
return 0; | ||
}], | ||
]); | ||
|
||
const workflow = workflows.get(effectivePackageManager); | ||
if (typeof workflow === `undefined`) | ||
throw new Error(`Assertion failed: Unsupported workflow`); | ||
throw new Error(`Assertion failed: Unsupported workflow: "${effectivePackageManager}"`); | ||
|
||
const code = await workflow(); | ||
if (code === 0 || typeof code === `undefined`) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we point
--pack-destination
to an empty temp folder and then just read its contents thus avoiding the parsing of stdout?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but after a bit more research it looks like only
pnpm@>=6.x
supports--pack-destination
. Because of this, I'd prefer to only pass the--pack-destination
option when packing a workspace so that pnpm 5 can be used to install regular packages too.