Skip to content

Commit 995e01c

Browse files
committed
pass packages by name
Signed-off-by: Ajeet D'Souza <98ajeet@gmail.com>
1 parent ecd199e commit 995e01c

1 file changed

Lines changed: 9 additions & 24 deletions

File tree

scripts/publish.js

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ const packages = discoverPackages();
2929
validatePackages(packages);
3030

3131
const version = packages[0].version;
32-
npmPublish(version);
32+
33+
const pkgNames = packages.map((pkg) => pkg.name);
34+
npmPublish(pkgNames, version);
3335

3436
/**
37+
* Publish each workspace package by name.
38+
*
39+
* @param {string[]} pkgNames
3540
* @param {string} version
3641
*/
37-
function npmPublish(version) {
42+
function npmPublish(pkgNames, version) {
3843
const tag = determinePublishTag(version);
39-
execSync(`npm publish --dry-run --tag ${tag} --workspaces`, {
44+
const workspaceArgs = pkgNames.map((name) => `--workspace=${name}`).join(" ");
45+
execSync(`npm publish --dry-run --tag ${tag} ${workspaceArgs}`, {
4046
stdio: "inherit",
4147
});
4248
}
@@ -61,27 +67,6 @@ function validatePackages(packages) {
6167
}
6268
}
6369

64-
/**
65-
* Throws if the tag `v<version>` is not among the tags pointing at HEAD.
66-
*
67-
* @param {string} version
68-
*/
69-
function gitCheckReleaseTag(version) {
70-
const expected = `v${version}`;
71-
const out = execSync("git tag --points-at HEAD", {
72-
encoding: "utf-8",
73-
});
74-
const tags = out
75-
.split("\n")
76-
.map((line) => line.trim())
77-
.filter((line) => line.length > 0);
78-
if (!tags.includes(expected)) {
79-
throw new Error(
80-
`Expected git tag ${expected} on HEAD, found: ${tags.join(", ") || "(none)"}`,
81-
);
82-
}
83-
}
84-
8570
/**
8671
* @param {string} version
8772
* @returns {string}

0 commit comments

Comments
 (0)