Use the changesets bin.js to run version because pnpm has a different strategy for binaries which means the file in .bin isn't a js file

This commit is contained in:
mitchellhamilton
2020-02-14 11:08:07 +11:00
parent a082fd726f
commit 36242b9bc1
2 changed files with 29 additions and 26 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+28 -25
View File
@@ -68,7 +68,9 @@ import readChangesets from "@changesets/read";
console.log(
"No changesets found, attempting to publish any unpublished packages to npm"
);
let workspaces = await getWorkspaces({ tools: ["yarn", "bolt", "pnpm", "root"] });
let workspaces = await getWorkspaces({
tools: ["yarn", "bolt", "pnpm", "root"]
});
if (!workspaces) {
return core.setFailed("Could not find workspaces");
@@ -168,10 +170,7 @@ import readChangesets from "@changesets/read";
let cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0")
? "bump"
: "version";
await exec("node", [
"./node_modules/.bin/changeset",
cmd
]);
await exec("node", ["./node_modules/@changesets/cli/bin.js", cmd]);
let searchQuery = `repo:${repo}+state:open+head:${versionBranch}+base:${branch}`;
let searchResultPromise = octokit.search.issuesAndPullRequests({
q: searchQuery
@@ -198,33 +197,37 @@ ${
}
# Releases
` +
(await Promise.all(
changedWorkspaces.map(async workspace => {
let changelogContents = await fs.readFile(
path.join(workspace.dir, "CHANGELOG.md"),
"utf8"
);
(
await Promise.all(
changedWorkspaces.map(async workspace => {
let changelogContents = await fs.readFile(
path.join(workspace.dir, "CHANGELOG.md"),
"utf8"
);
let entry = getChangelogEntry(
changelogContents,
workspace.config.version
);
return {
highestLevel: entry.highestLevel,
private: !!workspace.config.private,
content:
`## ${workspace.name}@${workspace.config.version}\n\n` +
entry.content
};
})
))
let entry = getChangelogEntry(
changelogContents,
workspace.config.version
);
return {
highestLevel: entry.highestLevel,
private: !!workspace.config.private,
content:
`## ${workspace.name}@${workspace.config.version}\n\n` +
entry.content
};
})
)
)
.filter(x => x)
.sort(sortTheThings)
.map(x => x.content)
.join("\n ")
);
})();
const title = `ci(changeset): generate PR with changelog &${isInPreMode ? ` (${preState.tag})` : ""} version updates`
const title = `ci(changeset): generate PR with changelog &${
isInPreMode ? ` (${preState.tag})` : ""
} version updates`;
await exec("git", ["add", "."]);
await exec("git", ["commit", "-m", title]);
await exec("git", ["push", "origin", versionBranch, "--force"]);