Format code
This commit is contained in:
parent
13fd5bf191
commit
078f7c4a73
|
@ -19,7 +19,7 @@ export async function run() {
|
||||||
core.debug('No version found, trying to find version from global.json');
|
core.debug('No version found, trying to find version from global.json');
|
||||||
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
||||||
if (fs.existsSync(globalJsonPath)) {
|
if (fs.existsSync(globalJsonPath)) {
|
||||||
version = getVersionFromGlobalJson(globalJsonPath)
|
version = getVersionFromGlobalJson(globalJsonPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,20 +49,23 @@ export async function run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVersionFromGlobalJson(globalJsonPath: string): string {
|
function getVersionFromGlobalJson(globalJsonPath: string): string {
|
||||||
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
|
||||||
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 = globalJson.sdk.rollForward;
|
||||||
if (rollForward && (rollForward === 'latestFeature' || rollForward === 'latestPatch')) {
|
if (
|
||||||
const [major, minor] = version.split('.')
|
rollForward &&
|
||||||
version = `${major}.${minor}`
|
(rollForward === 'latestFeature' || rollForward === 'latestPatch')
|
||||||
}
|
) {
|
||||||
|
const [major, minor] = version.split('.');
|
||||||
|
version = `${major}.${minor}`;
|
||||||
}
|
}
|
||||||
return version
|
}
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|
Loading…
Reference in New Issue