Compare commits

..

1 Commits

Author SHA1 Message Date
Jacob Parish (JP250552)
6b03b8ab18
Merge 4478bd4702 into 40337cb8f7 2025-03-25 10:10:37 -05:00
6 changed files with 6 additions and 40 deletions

View File

@ -301,28 +301,10 @@ describe('main tests', () => {
);
});
it('should install latest corepack when input is "true"', async () => {
it('should enable corepack when input is "true"', async () => {
inputs['corepack'] = 'true';
await main.run();
expect(getCommandOutputSpy).toHaveBeenCalledWith(
'npm i -g corepack@latest'
);
});
it('should install latest corepack when input is "latest"', async () => {
inputs['corepack'] = 'latest';
await main.run();
expect(getCommandOutputSpy).toHaveBeenCalledWith(
'npm i -g corepack@latest'
);
});
it('should install a specific version of corepack when specified', async () => {
inputs['corepack'] = '0.32.0';
await main.run();
expect(getCommandOutputSpy).toHaveBeenCalledWith(
'npm i -g corepack@0.32.0'
);
expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack');
});
});
});

View File

@ -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: 'Enables Corepack which allows the use of other package managers. Can provide a version string to install a specific version.'
description: 'Enables Corepack which allows the use of other package managers.'
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

View File

@ -88341,8 +88341,7 @@ exports.unique = unique;
function enableCorepack(input) {
return __awaiter(this, void 0, void 0, function* () {
if (input.length && input !== 'false') {
const version = input === 'true' ? 'latest' : input;
yield (0, cache_utils_1.getCommandOutput)(`npm i -g corepack@${version}`);
yield (0, cache_utils_1.getCommandOutput)('npm i -g corepack');
}
});
}

3
dist/setup/index.js vendored
View File

@ -98019,8 +98019,7 @@ exports.unique = unique;
function enableCorepack(input) {
return __awaiter(this, void 0, void 0, function* () {
if (input.length && input !== 'false') {
const version = input === 'true' ? 'latest' : input;
yield (0, cache_utils_1.getCommandOutput)(`npm i -g corepack@${version}`);
yield (0, cache_utils_1.getCommandOutput)('npm i -g corepack');
}
});
}

View File

@ -432,16 +432,3 @@ steps:
- name: Install dependencies
run: yarn install --immutable
```
You can also pass a version string to install a specific version of corepack.
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
corepack: '0.32.0'
- name: Install dependencies
run: yarn install --immutable
```

View File

@ -110,7 +110,6 @@ export const unique = () => {
export async function enableCorepack(input: string): Promise<void> {
if (input.length && input !== 'false') {
const version = input === 'true' ? 'latest' : input;
await getCommandOutput(`npm i -g corepack@${version}`);
await getCommandOutput('npm i -g corepack');
}
}