From d9f96b5fbef1523cb45557e797bcfc55a77c3921 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 19 Feb 2023 11:04:29 +0100 Subject: [PATCH 1/3] Add `"exports"` to the `package.json` to make self-referencing imports work --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 5a7203747..969f78dd9 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,9 @@ "engines": { "node": ">=14.14.0" }, + "exports": { + "./package.json": "./package.json" + }, "license": "MIT", "packageManager": "yarn@4.0.0-rc.15+sha224.7fa5c1d1875b041cea8fcbf9a364667e398825364bf5c5c8cd5f6601", "devDependencies": { From 61aabd13e5987995baa22a74436a77b42340b8f7 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 22 Feb 2023 23:56:50 +0100 Subject: [PATCH 2/3] fix tests --- tests/_runCli.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/_runCli.ts b/tests/_runCli.ts index 0b3677452..4dcd6e6e2 100644 --- a/tests/_runCli.ts +++ b/tests/_runCli.ts @@ -1,5 +1,6 @@ import {PortablePath, npath} from '@yarnpkg/fslib'; import {spawn} from 'child_process'; +import {dirname, join} from 'path'; export async function runCli(cwd: PortablePath, argv: Array): Promise<{exitCode: number | null, stdout: string, stderr: string}> { const out: Array = []; @@ -8,7 +9,7 @@ export async function runCli(cwd: PortablePath, argv: Array): Promise<{e return new Promise((resolve, reject) => { if (process.env.RUN_CLI_ID) (process.env.RUN_CLI_ID as any)++; - const child = spawn(process.execPath, [`--no-warnings`, `-r`, require.resolve(`./recordRequests.js`), require.resolve(`corepack/dist/corepack.js`), ...argv], { + const child = spawn(process.execPath, [`--no-warnings`, `-r`, require.resolve(`./recordRequests.js`), join(dirname(require.resolve(`corepack/package.json`)), `dist/corepack.js`), ...argv], { cwd: npath.fromPortablePath(cwd), env: process.env, stdio: `pipe`, From 14162ec37fa06153000b733cea78cbddad6b3c7c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 23 Feb 2023 00:27:04 +0100 Subject: [PATCH 3/3] fixup! fix tests --- tests/_runCli.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/_runCli.ts b/tests/_runCli.ts index 4dcd6e6e2..e028af751 100644 --- a/tests/_runCli.ts +++ b/tests/_runCli.ts @@ -1,6 +1,5 @@ import {PortablePath, npath} from '@yarnpkg/fslib'; import {spawn} from 'child_process'; -import {dirname, join} from 'path'; export async function runCli(cwd: PortablePath, argv: Array): Promise<{exitCode: number | null, stdout: string, stderr: string}> { const out: Array = []; @@ -9,7 +8,7 @@ export async function runCli(cwd: PortablePath, argv: Array): Promise<{e return new Promise((resolve, reject) => { if (process.env.RUN_CLI_ID) (process.env.RUN_CLI_ID as any)++; - const child = spawn(process.execPath, [`--no-warnings`, `-r`, require.resolve(`./recordRequests.js`), join(dirname(require.resolve(`corepack/package.json`)), `dist/corepack.js`), ...argv], { + const child = spawn(process.execPath, [`--no-warnings`, `-r`, require.resolve(`./recordRequests.js`), require.resolve(`../dist/corepack.js`), ...argv], { cwd: npath.fromPortablePath(cwd), env: process.env, stdio: `pipe`,