From fc8cca44c52040bf9a295bff71ed20e6eb4a9fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Fri, 26 Jan 2024 14:03:38 +0100 Subject: [PATCH] chore(repo): print version at the end of nx-release script (#21346) --- scripts/nx-release.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/nx-release.ts b/scripts/nx-release.ts index af12bf9faed49..7e5da8fc34193 100755 --- a/scripts/nx-release.ts +++ b/scripts/nx-release.ts @@ -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); })();