Skip to content

Commit

Permalink
Merge branch 'main' into merceyz/test/vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Jul 16, 2024
2 parents 576928e + d337b34 commit ddf3a10
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 179 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## [0.29.2](https://github.com/nodejs/corepack/compare/v0.29.1...v0.29.2) (2024-07-13)


### Bug Fixes

* trigger release after 0.29.1 failed to publish ([18e29ce](https://github.com/nodejs/corepack/commit/18e29ce3c465b64d48ccf3feef7cd1be94da70b0))

## [0.29.1](https://github.com/nodejs/corepack/compare/v0.29.0...v0.29.1) (2024-07-13)


### Bug Fixes

* trigger release after 0.29.0 failed to publish ([e6ba066](https://github.com/nodejs/corepack/commit/e6ba06657b0985c112f288932ca39c0562129566))

## [0.29.0](https://github.com/nodejs/corepack/compare/v0.28.2...v0.29.0) (2024-07-12)


### Features

* parallelize linking, unlinking and installing ([#524](https://github.com/nodejs/corepack/issues/524)) ([f0734e6](https://github.com/nodejs/corepack/commit/f0734e6e8023ff361dac179c0d8656740d550c27))
* update package manager versions ([#492](https://github.com/nodejs/corepack/issues/492)) ([3e3b046](https://github.com/nodejs/corepack/commit/3e3b04619cb4a91f207a72fb450f6fc4e2f01aec))


### Bug Fixes

* replace npm registry domain in tarball URL ([#502](https://github.com/nodejs/corepack/issues/502)) ([db6fae5](https://github.com/nodejs/corepack/commit/db6fae50cf44884d1e9a6f7e99402e7e807ba3ca))
* selectively import required semver functions ([#511](https://github.com/nodejs/corepack/issues/511)) ([e7ad533](https://github.com/nodejs/corepack/commit/e7ad533d43dc9495493f0d883c3cbbb94caa1d41))

## [0.28.2](https://github.com/nodejs/corepack/compare/v0.28.1...v0.28.2) (2024-05-31)


Expand Down
6 changes: 3 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"definitions": {
"npm": {
"default": "10.8.1+sha1.1f1cb1305cd9246b9efe07d8629874df23157a2f",
"default": "10.8.2+sha1.3c123c7f14409dc0395478e7269fdbc32ae179d8",
"fetchLatestFrom": {
"type": "npm",
"package": "npm"
Expand Down Expand Up @@ -38,7 +38,7 @@
}
},
"pnpm": {
"default": "9.1.4+sha1.2432063d815cfa88fd9fef1d85a445e3f609851d",
"default": "9.5.0+sha1.8c155dc114e1689d18937974f6571e0ceee66f1d",
"fetchLatestFrom": {
"type": "npm",
"package": "pnpm"
Expand Down Expand Up @@ -102,7 +102,7 @@
"package": "yarn"
},
"transparent": {
"default": "4.2.2+sha224.1e50daf19e5e249a025569752c60b88005fddf57d10fcde5fc68b88f",
"default": "4.3.1+sha224.934d21773e22af4b69a7032a2d3b4cb38c1f7c019624777cc9916b23",
"commands": [
[
"yarn",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "corepack",
"version": "0.28.2",
"version": "0.29.2",
"homepage": "https://github.com/nodejs/corepack#readme",
"bugs": {
"url": "https://github.com/nodejs/corepack/issues"
Expand All @@ -16,7 +16,7 @@
"./package.json": "./package.json"
},
"license": "MIT",
"packageManager": "yarn@4.1.1+sha224.00f08619463229f8ba40c4ee90e8c2e4ced1f11c3115c26f3b98432e",
"packageManager": "yarn@4.3.1+sha224.934d21773e22af4b69a7032a2d3b4cb38c1f7c019624777cc9916b23",
"devDependencies": {
"@types/debug": "^4.1.5",
"@types/node": "^20.4.6",
Expand All @@ -36,7 +36,7 @@
"semver": "^7.5.2",
"supports-color": "^9.0.0",
"tar": "^6.2.1",
"ts-node": "^10.0.0",
"tsx": "^4.16.2",
"typescript": "^5.3.3",
"undici": "^6.19.2",
"v8-compile-cache": "^2.3.0",
Expand All @@ -47,10 +47,10 @@
"undici-types": "6.x"
},
"scripts": {
"build": "run clean && run build:bundle && ts-node ./mkshims.ts",
"build": "run clean && run build:bundle && tsx ./mkshims.ts",
"build:bundle": "esbuild ./sources/_lib.ts --bundle --platform=node --target=node18.17.0 --external:corepack --outfile='./dist/lib/corepack.cjs' --resolve-extensions='.ts,.mjs,.js'",
"clean": "run rimraf dist shims",
"corepack": "ts-node ./sources/_cli.ts",
"corepack": "tsx ./sources/_cli.ts",
"lint": "eslint .",
"prepack": "yarn build",
"postpack": "run clean",
Expand Down
17 changes: 10 additions & 7 deletions sources/commands/Disable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,21 @@ export class DisableCommand extends Command<Context> {
? SupportedPackageManagerSetWithoutNpm
: this.names;

const allBinNames: Array<string> = [];

for (const name of new Set(names)) {
if (!isSupportedPackageManager(name))
throw new UsageError(`Invalid package manager name '${name}'`);

for (const binName of this.context.engine.getBinariesFor(name)) {
if (process.platform === `win32`) {
await this.removeWin32Link(installDirectory, binName);
} else {
await this.removePosixLink(installDirectory, binName);
}
}
const binNames = this.context.engine.getBinariesFor(name);
allBinNames.push(...binNames);
}

const removeLink = process.platform === `win32` ?
(binName: string) => this.removeWin32Link(installDirectory, binName) :
(binName: string) => this.removePosixLink(installDirectory, binName);

await Promise.all(allBinNames.map(removeLink));
}

async removePosixLink(installDirectory: string, binName: string) {
Expand Down
17 changes: 10 additions & 7 deletions sources/commands/Enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ export class EnableCommand extends Command<Context> {
? SupportedPackageManagerSetWithoutNpm
: this.names;

const allBinNames: Array<string> = [];

for (const name of new Set(names)) {
if (!isSupportedPackageManager(name))
throw new UsageError(`Invalid package manager name '${name}'`);

for (const binName of this.context.engine.getBinariesFor(name)) {
if (process.platform === `win32`) {
await this.generateWin32Link(installDirectory, distFolder, binName);
} else {
await this.generatePosixLink(installDirectory, distFolder, binName);
}
}
const binNames = this.context.engine.getBinariesFor(name);
allBinNames.push(...binNames);
}

const generateLink = process.platform === `win32` ?
(binName: string) => this.generateWin32Link(installDirectory, distFolder, binName) :
(binName: string) => this.generatePosixLink(installDirectory, distFolder, binName);

await Promise.all(allBinNames.map(generateLink));
}

async generatePosixLink(installDirectory: string, distFolder: string, binName: string) {
Expand Down
9 changes: 4 additions & 5 deletions sources/commands/InstallGlobal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export class InstallGlobalCommand extends BaseCommand {
if (this.args.length === 0)
throw new UsageError(`No package managers specified`);

for (const arg of this.args) {
await Promise.all(this.args.map(arg => {
if (arg.endsWith(`.tgz`)) {
await this.installFromTarball(path.resolve(this.context.cwd, arg));
return this.installFromTarball(path.resolve(this.context.cwd, arg));
} else {
await this.installFromDescriptor(specUtils.parseSpec(arg, `CLI arguments`, {enforceExactVersion: false}));
return this.installFromDescriptor(specUtils.parseSpec(arg, `CLI arguments`, {enforceExactVersion: false}));
}
}
}));
}

log(locator: Locator) {
Expand Down Expand Up @@ -86,7 +86,6 @@ export class InstallGlobalCommand extends BaseCommand {
if (segments.length > 0 && segments[segments.length - 1] !== `.corepack`)
return;


if (segments.length < 3) {
hasShortEntries = true;
} else {
Expand Down
Binary file modified tests/nocks.db
Binary file not shown.
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
},
"ts-node": {
"transpileOnly": true
}
}
Loading

0 comments on commit ddf3a10

Please sign in to comment.