-
Notifications
You must be signed in to change notification settings - Fork 173
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
feat: add cnpm to corepack #333
base: main
Are you sure you want to change the base?
Changes from all commits
faaac09
f281d19
de5f2a6
b1a8d92
e3bc1c5
4af1855
b994028
160dcd3
2162567
dd8f8a4
8ac771a
f3de099
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,6 +5,7 @@ export enum SupportedPackageManagers { | |||||||||||||||||
Npm = `npm`, | ||||||||||||||||||
Pnpm = `pnpm`, | ||||||||||||||||||
Yarn = `yarn`, | ||||||||||||||||||
Cnpm = `cnpm`, | ||||||||||||||||||
Comment on lines
5
to
+8
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. nit: ASCII/alphabetical order
Suggested change
|
||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
export const SupportedPackageManagerSet = new Set<SupportedPackageManagers>( | ||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,9 @@ const testedPackageManagers: Array<[string, string]> = [ | |
[`pnpm`, `6.6.2`], | ||
[`pnpm`, `6.6.2+sha1.7b4d6b176c1b93b5670ed94c24babb7d80c13854`], | ||
[`pnpm`, `6.6.2+sha224.eb5c0acad3b0f40ecdaa2db9aa5a73134ad256e17e22d1419a2ab073`], | ||
[`cnpm`, `9.3.2`], | ||
elrrrrrrr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[`cnpm`, `9.3.2+sha1.05a307b7c1d34a368b8d30ff159dfd0533c8c328`], | ||
[`cnpm`, `9.3.2+sha224.6d124ff3ac4ea4ba18833993e063fd8091156d6400ed7a2e5ad47ce3`], | ||
[`npm`, `6.14.2`], | ||
[`npm`, `6.14.2+sha1.f057d35cd4792c4c511bb1fa332edb43143d07b0`], | ||
[`npm`, `6.14.2+sha224.50512c1eb404900ee78586faa6d756b8d867ff46a328e6fb4cdf3a87`], | ||
|
@@ -93,7 +96,7 @@ for (const [name, version] of testedPackageManagers) { | |
await expect(runCli(cwd, [name, `--version`])).resolves.toMatchObject({ | ||
exitCode: 0, | ||
stderr: ``, | ||
stdout: `${version.split(`+`, 1)[0]}\n`, | ||
stdout: expect.stringContaining(version.split(`+`, 1)[0]), | ||
}); | ||
}); | ||
}); | ||
|
@@ -266,6 +269,12 @@ it(`should use the pinned version when local projects don't list any spec`, asyn | |
exitCode: 0, | ||
}); | ||
|
||
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({ | ||
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(`+`, 1)[0]}`), | ||
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
|
||
await expect(runCli(cwd, [`npm`, `--version`])).resolves.toMatchObject({ | ||
stdout: `${config.definitions.npm.default.split(`+`, 1)[0]}\n`, | ||
stderr: ``, | ||
|
@@ -366,6 +375,11 @@ it(`should refuse to run a different package manager within a configured project | |
exitCode: 1, | ||
}); | ||
|
||
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({ | ||
stdout: `Usage Error: This project is configured to use yarn\n\n$ cnpm ...\n`, | ||
exitCode: 1, | ||
}); | ||
|
||
// Disable strict checking to workaround the UsageError. | ||
process.env.COREPACK_ENABLE_STRICT = `0`; | ||
|
||
|
@@ -379,6 +393,11 @@ it(`should refuse to run a different package manager within a configured project | |
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({ | ||
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(`+`, 1)[0]}`), | ||
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
}); | ||
}); | ||
|
||
|
@@ -400,6 +419,11 @@ it(`should always use fallback version when project spec env is disabled`, async | |
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({ | ||
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(`+`, 1)[0]}`), | ||
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
}); | ||
}); | ||
|
||
|
@@ -433,6 +457,11 @@ it(`should allow to call "corepack install -g --all" to prepare all package mana | |
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({ | ||
stdout: expect.stringContaining(`cnpm@${config.definitions.cnpm.default.split(`+`, 1)[0]}`), | ||
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
}); | ||
}); | ||
|
||
|
@@ -517,7 +546,7 @@ it(`should support hydrating package managers if cache folder was removed`, asyn | |
|
||
it(`should support hydrating multiple package managers from cached archives`, async () => { | ||
await xfs.mktempPromise(async cwd => { | ||
await expect(runCli(cwd, [`pack`, `[email protected]`, `[email protected]`])).resolves.toMatchObject({ | ||
await expect(runCli(cwd, [`pack`, `[email protected]`, `[email protected]`, `[email protected]`])).resolves.toMatchObject({ | ||
exitCode: 0, | ||
stderr: ``, | ||
}); | ||
|
@@ -552,6 +581,16 @@ it(`should support hydrating multiple package managers from cached archives`, as | |
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
|
||
await xfs.writeJsonPromise(ppath.join(cwd, `package.json` as Filename), { | ||
packageManager: `[email protected]`, | ||
}); | ||
|
||
await expect(runCli(cwd, [`cnpm`, `--version`])).resolves.toMatchObject({ | ||
stdout: expect.stringContaining(`[email protected]`), | ||
stderr: ``, | ||
exitCode: 0, | ||
}); | ||
}); | ||
}, 180_000); | ||
|
||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
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 should probably provide mentioned for the npm package, see #339