Skip to content

Commit

Permalink
feat(misc): remove unnecessary post-processing from nx-release
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Mar 4, 2024
1 parent a66460e commit 8f373b4
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions scripts/nx-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function parseArgs() {
'The version to publish. This does not need to be passed and can be inferred.',
default: 'minor',
coerce: (version) => {
if (version !== 'canary' && !version.startsWith('pr-')) {
if (version !== 'canary') {
return version;
}
/**
Expand All @@ -239,12 +239,6 @@ function parseArgs() {
// Get the current short git sha
const gitSha = execSync('git rev-parse --short HEAD').toString().trim();

if (version.startsWith('pr-') && validFormatForPRrelease(version)) {
return `0.0.0-${validFormatForPRrelease(
version
)}-${YYYYMMDD}-${gitSha}`;
}

const currentLatestVersion = execSync('npm view nx@latest version')
.toString()
.trim();
Expand Down Expand Up @@ -391,22 +385,3 @@ function determineDistTag(

return distTag;
}

function validFormatForPRrelease(input: string): string | undefined {
// Check that format is pr-<number>
const regex = /^pr-(\d+)$/;
const match = input.match(regex);

if (match) {
return input;
} else {
// If the input has a # (eg. pr-#1234), remove it and try again
const fixedInput = input.replace(/#/, '');
const matchFixed = fixedInput.match(regex);
if (matchFixed) {
return fixedInput;
} else {
return undefined;
}
}
}

0 comments on commit 8f373b4

Please sign in to comment.