File tree 2 files changed +7
-8
lines changed 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -7853,15 +7853,16 @@ function run() {
7853
7853
}
7854
7854
exports.run = run;
7855
7855
function getVersionFromGlobalJson(globalJsonPath) {
7856
+ var _a;
7857
+ const optionValues = ['latestFeature', 'latestPatch'];
7856
7858
let version = '';
7857
7859
const globalJson = JSON.parse(
7858
7860
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
7859
7861
fs.readFileSync(globalJsonPath, { encoding: 'utf8' }).trim());
7860
7862
if (globalJson.sdk && globalJson.sdk.version) {
7861
7863
version = globalJson.sdk.version;
7862
- const rollForward = globalJson.sdk.rollForward;
7863
- if (rollForward &&
7864
- (rollForward === 'latestFeature' || rollForward === 'latestPatch')) {
7864
+ const rollForward = (_a = globalJson.sdk.rollForward) !== null && _a !== void 0 ? _a : '';
7865
+ if (optionValues.includes(rollForward)) {
7865
7866
const [major, minor] = version.split('.');
7866
7867
version = `${major}.${minor}`;
7867
7868
}
Original file line number Diff line number Diff line change @@ -49,18 +49,16 @@ export async function run() {
49
49
}
50
50
51
51
function getVersionFromGlobalJson ( globalJsonPath : string ) : string {
52
+ const optionValues = [ 'latestFeature' , 'latestPatch' ]
52
53
let version : string = '' ;
53
54
const globalJson = JSON . parse (
54
55
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
55
56
fs . readFileSync ( globalJsonPath , { encoding : 'utf8' } ) . trim ( )
56
57
) ;
57
58
if ( globalJson . sdk && globalJson . sdk . version ) {
58
59
version = globalJson . sdk . version ;
59
- const rollForward = globalJson . sdk . rollForward ;
60
- if (
61
- rollForward &&
62
- ( rollForward === 'latestFeature' || rollForward === 'latestPatch' )
63
- ) {
60
+ const rollForward = globalJson . sdk . rollForward ?? '' ;
61
+ if ( optionValues . includes ( rollForward ) ) {
64
62
const [ major , minor ] = version . split ( '.' ) ;
65
63
version = `${ major } .${ minor } ` ;
66
64
}
You can’t perform that action at this time.
0 commit comments