mirror of
https://github.com/actions/setup-node.git
synced 2026-07-11 10:45:38 +00:00
Compare commits
1 Commits
9a7d84c337
...
6b03b8ab18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b03b8ab18 |
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -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
|
||||
|
||||
3
dist/cache-save/index.js
vendored
3
dist/cache-save/index.js
vendored
@ -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
3
dist/setup/index.js
vendored
@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user