Improve condition
This commit is contained in:
parent
f3822c3b02
commit
2c3efd1f04
|
@ -7853,15 +7853,16 @@ function run() {
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
function getVersionFromGlobalJson(globalJsonPath) {
|
function getVersionFromGlobalJson(globalJsonPath) {
|
||||||
|
var _a;
|
||||||
|
const optionValues = ['latestFeature', 'latestPatch'];
|
||||||
let version = '';
|
let version = '';
|
||||||
const globalJson = JSON.parse(
|
const globalJson = JSON.parse(
|
||||||
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
|
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
|
||||||
fs.readFileSync(globalJsonPath, { encoding: 'utf8' }).trim());
|
fs.readFileSync(globalJsonPath, { encoding: 'utf8' }).trim());
|
||||||
if (globalJson.sdk && globalJson.sdk.version) {
|
if (globalJson.sdk && globalJson.sdk.version) {
|
||||||
version = globalJson.sdk.version;
|
version = globalJson.sdk.version;
|
||||||
const rollForward = globalJson.sdk.rollForward;
|
const rollForward = (_a = globalJson.sdk.rollForward) !== null && _a !== void 0 ? _a : '';
|
||||||
if (rollForward &&
|
if (optionValues.includes(rollForward)) {
|
||||||
(rollForward === 'latestFeature' || rollForward === 'latestPatch')) {
|
|
||||||
const [major, minor] = version.split('.');
|
const [major, minor] = version.split('.');
|
||||||
version = `${major}.${minor}`;
|
version = `${major}.${minor}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ export async function run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVersionFromGlobalJson(globalJsonPath: string): string {
|
function getVersionFromGlobalJson(globalJsonPath: string): string {
|
||||||
|
const optionValues = ['latestFeature', 'latestPatch']
|
||||||
let version: string = '';
|
let version: string = '';
|
||||||
const globalJson = JSON.parse(
|
const globalJson = JSON.parse(
|
||||||
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
|
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
|
||||||
|
@ -56,11 +57,8 @@ function getVersionFromGlobalJson(globalJsonPath: string): string {
|
||||||
);
|
);
|
||||||
if (globalJson.sdk && globalJson.sdk.version) {
|
if (globalJson.sdk && globalJson.sdk.version) {
|
||||||
version = globalJson.sdk.version;
|
version = globalJson.sdk.version;
|
||||||
const rollForward = globalJson.sdk.rollForward;
|
const rollForward = globalJson.sdk.rollForward ?? '';
|
||||||
if (
|
if (optionValues.includes(rollForward)) {
|
||||||
rollForward &&
|
|
||||||
(rollForward === 'latestFeature' || rollForward === 'latestPatch')
|
|
||||||
) {
|
|
||||||
const [major, minor] = version.split('.');
|
const [major, minor] = version.split('.');
|
||||||
version = `${major}.${minor}`;
|
version = `${major}.${minor}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue