chore(repo): print version at the end of nx-release script (#21346)

This commit is contained in:
Miroslav Jonaš 2024-01-26 14:03:38 +01:00 committed by GitHub
parent 2faaaf3a19
commit fc8cca44c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@ import { URL } from 'node:url';
import { isRelativeVersionKeyword } from 'nx/src/command-line/release/utils/semver';
import { ReleaseType, inc, major, parse } from 'semver';
import * as yargs from 'yargs';
import * as chalk from 'chalk';
const LARGE_BUFFER = 1024 * 1000000;
@ -119,7 +120,7 @@ const LARGE_BUFFER = 1024 * 1000000;
// If publishing locally, force all projects to not be private first
if (options.local) {
console.log(
'\nPublishing locally, so setting all resolved packages to not be private'
chalk.dim`\n Publishing locally, so setting all resolved packages to not be private`
);
const projectGraph = await createProjectGraphAsync();
for (const proj of Object.values(projectGraph.nodes)) {
@ -160,6 +161,20 @@ const LARGE_BUFFER = 1024 * 1000000;
});
}
let version;
if (['minor', 'major', 'patch'].includes(options.version)) {
const currentLatestVersion = execSync('npm view nx@latest version')
.toString()
.trim();
version = inc(currentLatestVersion, options.version, undefined);
} else {
version = options.version;
}
console.log(chalk.green` > Published version: ` + version);
console.log(chalk.dim` Use: npx create-nx-workspace@${version}\n`);
process.exit(0);
})();