From 108e90108c402eb6bc48f93e904bd444066cd438 Mon Sep 17 00:00:00 2001 From: Jacob Parish Date: Tue, 25 Mar 2025 10:02:05 -0500 Subject: [PATCH] fix: removed extra corepack commands --- __tests__/main.test.ts | 17 ----------------- action.yml | 2 +- dist/cache-save/index.js | 6 ------ dist/setup/index.js | 6 ------ docs/advanced-usage.md | 15 +-------------- src/util.ts | 6 ------ 6 files changed, 2 insertions(+), 50 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 076870eb..dd814ce5 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -305,23 +305,6 @@ describe('main tests', () => { inputs['corepack'] = 'true'; await main.run(); expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack'); - expect(getCommandOutputSpy).toHaveBeenCalledWith('corepack enable'); - }); - - it('should enable corepack with a single package manager', async () => { - inputs['corepack'] = 'npm'; - await main.run(); - expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack'); - expect(getCommandOutputSpy).toHaveBeenCalledWith('corepack enable npm'); - }); - - it('should enable corepack with multiple package managers', async () => { - inputs['corepack'] = 'npm yarn'; - await main.run(); - expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack'); - expect(getCommandOutputSpy).toHaveBeenCalledWith( - 'corepack enable npm yarn' - ); }); }); }); diff --git a/action.yml b/action.yml index 78fbfbbb..16d58835 100644 --- a/action.yml +++ b/action.yml @@ -26,7 +26,7 @@ inputs: cache-dependency-path: description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' corepack: - description: 'Used to specify whether to enable Corepack. Set to true to enable all package managers or set it to one or more package manager names separated by a space. Supported package manager names: npm, yarn, pnpm.' + description: 'Used to specify whether to enable Corepack.' default: 'false' # TODO: add input to control forcing to pull from cloud or dist. # escape valve for someone having issues or needing the absolute latest which isn't cached yet diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 9f982d98..dd2f9fb4 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -88341,13 +88341,7 @@ exports.unique = unique; function enableCorepack(input) { return __awaiter(this, void 0, void 0, function* () { if (input.length && input !== 'false') { - const corepackArgs = ['enable']; - if (input !== 'true') { - const packageManagers = input.split(' '); - corepackArgs.push(...packageManagers); - } yield (0, cache_utils_1.getCommandOutput)('npm i -g corepack'); - yield (0, cache_utils_1.getCommandOutput)(`corepack ${corepackArgs.join(' ')}`); } }); } diff --git a/dist/setup/index.js b/dist/setup/index.js index 499239be..c5ea08da 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -98019,13 +98019,7 @@ exports.unique = unique; function enableCorepack(input) { return __awaiter(this, void 0, void 0, function* () { if (input.length && input !== 'false') { - const corepackArgs = ['enable']; - if (input !== 'true') { - const packageManagers = input.split(' '); - corepackArgs.push(...packageManagers); - } yield (0, cache_utils_1.getCommandOutput)('npm i -g corepack'); - yield (0, cache_utils_1.getCommandOutput)(`corepack ${corepackArgs.join(' ')}`); } }); } diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index a1e947cd..cf84d0fd 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -427,21 +427,8 @@ steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: '18.x' + node-version: '22.x' corepack: true - name: Install dependencies run: yarn install --immutable ``` - -You can also pass package manager names separated by a space to enable corepack for specific package managers only. - -```yaml -steps: -- uses: actions/checkout@v4 -- uses: actions/setup-node@v4 - with: - node-version: '18.x' - corepack: yarn pnpm -- name: Install dependencies - run: yarn install --immutable -``` diff --git a/src/util.ts b/src/util.ts index 6aef3651..e5621aca 100644 --- a/src/util.ts +++ b/src/util.ts @@ -110,12 +110,6 @@ export const unique = () => { export async function enableCorepack(input: string): Promise { if (input.length && input !== 'false') { - const corepackArgs = ['enable']; - if (input !== 'true') { - const packageManagers = input.split(' '); - corepackArgs.push(...packageManagers); - } await getCommandOutput('npm i -g corepack'); - await getCommandOutput(`corepack ${corepackArgs.join(' ')}`); } }