mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 05:14:44 +00:00
fix: pr review adjustments
This commit is contained in:
parent
c871b9da45
commit
c73bf9098a
4 changed files with 21 additions and 39 deletions
|
@ -3,6 +3,7 @@ import * as exec from '@actions/exec';
|
|||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import {getCommandOutput} from './cache-utils';
|
||||
|
||||
export function getNodeVersionFromFile(versionFilePath: string): string | null {
|
||||
if (!fs.existsSync(versionFilePath)) {
|
||||
|
@ -107,14 +108,12 @@ export const unique = () => {
|
|||
};
|
||||
|
||||
export async function enableCorepack(input: string): Promise<void> {
|
||||
const corepackArgs = ['enable'];
|
||||
if (input.length > 0 && input !== 'false') {
|
||||
if (input.length && input !== 'false') {
|
||||
const corepackArgs = ['enable'];
|
||||
if (input !== 'true') {
|
||||
const packageManagers = input.split(' ');
|
||||
corepackArgs.push(...packageManagers);
|
||||
}
|
||||
await exec.getExecOutput('corepack', corepackArgs, {
|
||||
ignoreReturnCode: true
|
||||
});
|
||||
await getCommandOutput(`corepack ${corepackArgs.join(' ')}`);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue