mirror of
https://github.com/actions/setup-node.git
synced 2025-11-21 00:45:28 +00:00
feat: add support for mise.toml file
This commit is contained in:
parent
d721415790
commit
367970386b
@ -106,10 +106,12 @@ describe('main tests', () => {
|
||||
${''} | ${''}
|
||||
${'unknown format'} | ${'unknown format'}
|
||||
${' 14.1.0 '} | ${'14.1.0'}
|
||||
${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'}| ${'>=14.0.0 <=17.0.0'}
|
||||
${'{"volta": {"extends": "./package.json"}}'}| ${'18.0.0'}
|
||||
${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'} | ${'>=14.0.0 <=17.0.0'}
|
||||
${'{"volta": {"extends": "./package.json"}}'} | ${'18.0.0'}
|
||||
${'{"engines": {"node": "17.0.0"}}'} | ${'17.0.0'}
|
||||
${'[tools]\ngo="latest"\nnode = "24.10"'} | ${'24.10'}
|
||||
${'[tools]\nnode = { version = "22.20" }'} | ${'22.20'}
|
||||
${'[tools]\nnode = { postinstall = "corepack enable" }'} | ${null}
|
||||
${'{}'} | ${null}
|
||||
`.it('parses "$contents"', ({contents, expected}) => {
|
||||
const existsSpy = jest.spyOn(fs, 'existsSync');
|
||||
|
||||
5
dist/cache-save/index.js
vendored
5
dist/cache-save/index.js
vendored
@ -93333,7 +93333,7 @@ function getNodeVersionFromFile(versionFilePath) {
|
||||
catch (_g) {
|
||||
core.info('Node version file is not JSON file');
|
||||
}
|
||||
// Try parsing the file as an MISE `mise.toml` file.
|
||||
// Try parsing the file as a mise `mise.toml` file.
|
||||
try {
|
||||
const manifest = (0, js_toml_1.load)(contents);
|
||||
if ((_d = manifest === null || manifest === void 0 ? void 0 : manifest.tools) === null || _d === void 0 ? void 0 : _d.node) {
|
||||
@ -93341,8 +93341,11 @@ function getNodeVersionFromFile(versionFilePath) {
|
||||
if (typeof node === 'object' && (node === null || node === void 0 ? void 0 : node.version)) {
|
||||
return node.version;
|
||||
}
|
||||
if (typeof node === 'string') {
|
||||
return node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (_h) {
|
||||
core.info('Node version file is not TOML file');
|
||||
|
||||
5
dist/setup/index.js
vendored
5
dist/setup/index.js
vendored
@ -103848,7 +103848,7 @@ function getNodeVersionFromFile(versionFilePath) {
|
||||
catch (_g) {
|
||||
core.info('Node version file is not JSON file');
|
||||
}
|
||||
// Try parsing the file as an MISE `mise.toml` file.
|
||||
// Try parsing the file as a mise `mise.toml` file.
|
||||
try {
|
||||
const manifest = (0, js_toml_1.load)(contents);
|
||||
if ((_d = manifest === null || manifest === void 0 ? void 0 : manifest.tools) === null || _d === void 0 ? void 0 : _d.node) {
|
||||
@ -103856,8 +103856,11 @@ function getNodeVersionFromFile(versionFilePath) {
|
||||
if (typeof node === 'object' && (node === null || node === void 0 ? void 0 : node.version)) {
|
||||
return node.version;
|
||||
}
|
||||
if (typeof node === 'string') {
|
||||
return node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (_h) {
|
||||
core.info('Node version file is not TOML file');
|
||||
|
||||
@ -57,7 +57,7 @@ export function getNodeVersionFromFile(versionFilePath: string): string | null {
|
||||
core.info('Node version file is not JSON file');
|
||||
}
|
||||
|
||||
// Try parsing the file as an MISE `mise.toml` file.
|
||||
// Try parsing the file as a mise `mise.toml` file.
|
||||
try {
|
||||
const manifest: Record<string, any> = load(contents);
|
||||
if (manifest?.tools?.node) {
|
||||
@ -67,8 +67,12 @@ export function getNodeVersionFromFile(versionFilePath: string): string | null {
|
||||
return node.version;
|
||||
}
|
||||
|
||||
if (typeof node === 'string') {
|
||||
return node;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
} catch {
|
||||
core.info('Node version file is not TOML file');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user