Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm committed Apr 19, 2024
2 parents 9cf3b0b + e7c4938 commit dfbe0de
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions scripts/get-workspace-publish-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,25 @@ Looks at the version used in the workspace, and returns one of:
*/

const version = findWorkspaceVersion("packages");
const tag = determinePublishTag(version);
process.stdout.write(tag);

if (/^\d\.\d\.\d$/.test(version)) {
process.stdout.write("latest");
} else if (/^\d\.\d\.\d-alpha.*$/.test(version)) {
process.stdout.write("alpha");
} else if (/^\d\.\d\.\d-beta.*$/.test(version)) {
process.stdout.write("beta");
} else if (/^\d\.\d\.\d-rc.*$/.test(version)) {
process.stdout.write("rc");
} else {
throw new Error(`Unable to determine publish tag from version ${version}`);
/**
* @param {string} version
* @returns {string}
*/
function determinePublishTag(version) {
if (/^\d+\.\d+\.\d+$/.test(version)) {
return "latest";
} else if (/^\d+\.\d+\.\d+-alpha.*$/.test(version)) {
return "alpha";
} else if (/^\d+\.\d+\.\d+-beta.*$/.test(version)) {
return "beta";
} else if (/^\d+\.\d+\.\d+-rc.*$/.test(version)) {
return "rc";
} else {
throw new Error(`Unable to determine publish tag from version ${version}`);
}
}

/**
Expand Down

0 comments on commit dfbe0de

Please sign in to comment.