Skip to content

Commit

Permalink
fix(scripts): Prevent publishing without a tag (#3223)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed May 18, 2022
1 parent d141d68 commit b4fb6c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 12 additions & 1 deletion scripts/publish-private.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ function getTaggedVersion() {
return output.replace(/^v/g, "");
}

/**
* @param {string} dir
* @param {string} tag
*/
function publish(dir, tag) {
execSync(`npm publish --tag ${tag} ${dir}`, { stdio: "inherit" });
}
Expand All @@ -23,7 +27,14 @@ async function run() {
}

let prerelease = semver.prerelease(taggedVersion);
let tag = prerelease ? prerelease[0] : "latest";
let prereleaseTag = prerelease ? String(prerelease[0]) : undefined;
let tag = prereleaseTag
? prereleaseTag.includes("nightly")
? "nightly"
: prereleaseTag.includes("experimental")
? "experimental"
: prereleaseTag
: "latest";

// Publish all @remix-run/* packages
for (let name of [
Expand Down
13 changes: 8 additions & 5 deletions scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ function getTaggedVersion() {
return output.replace(/^v/g, "");
}

/**
* @param {string} dir
* @param {string} tag
*/
function publish(dir, tag) {
execSync(
`npm publish --access public${tag != null ? ` --tag ${tag}` : ""} ${dir}`,
{ stdio: "inherit" }
);
execSync(`npm publish --access public --tag ${tag} ${dir}`, {
stdio: "inherit",
});
}

async function run() {
Expand All @@ -31,7 +34,7 @@ async function run() {
? prereleaseTag.includes("nightly")
? "nightly"
: prereleaseTag.includes("experimental")
? null
? "experimental"
: prereleaseTag
: "latest";

Expand Down

0 comments on commit b4fb6c5

Please sign in to comment.