Skip to content

Commit

Permalink
chore(repo): print version at the end of nx-release script (nrwl#21346)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav authored Jan 26, 2024
1 parent 2faaaf3 commit fc8cca4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/nx-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
})();

Expand Down

0 comments on commit fc8cca4

Please sign in to comment.