@decohere/ci-tools 0.0.1-dev.124 → 0.0.1-dev.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* First-publish a new package name (
|
|
2
|
+
* First-publish a new package name (public) and give it its Trusted Publisher,
|
|
3
3
|
* so `publish.yml` can release it over OIDC from then on.
|
|
4
4
|
*
|
|
5
5
|
* pnpm npm:bootstrap [--otp <code>] [--dry-run] [--channel dev] [<package-name>...]
|
|
@@ -31,15 +31,15 @@ export function needsPrereleaseTag(version) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* npm arguments for a name-only first publish.
|
|
35
|
-
* so
|
|
34
|
+
* npm arguments for a name-only first publish. Scoped names default to restricted,
|
|
35
|
+
* so `--access public`. `./` stops npm reading the path as a GitHub `owner/repo`.
|
|
36
36
|
*
|
|
37
37
|
* @param {{ dir: string, version?: string }} pkg
|
|
38
38
|
* @param {string} channel
|
|
39
39
|
*/
|
|
40
40
|
export function publishArgs(pkg, channel) {
|
|
41
41
|
const tag = needsPrereleaseTag(pkg.version) ? ["--tag", channel] : [];
|
|
42
|
-
return ["publish", `./projects/${pkg.dir}`, ...tag];
|
|
42
|
+
return ["publish", `./projects/${pkg.dir}`, "--access", "public", ...tag];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/** @param {string} name */
|
|
@@ -33,7 +33,7 @@ export function firstPublishCommands(packages, channel = "dev") {
|
|
|
33
33
|
}
|
|
34
34
|
return packages.map((pkg) => {
|
|
35
35
|
const tag = needsPrereleaseTag(pkg.version) ? ` --tag ${channel}` : "";
|
|
36
|
-
return `npm publish ./projects/${pkg.dir}${tag}`;
|
|
36
|
+
return `npm publish ./projects/${pkg.dir} --access public${tag}`;
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -95,7 +95,7 @@ export function buildDescription(options) {
|
|
|
95
95
|
"",
|
|
96
96
|
"That does steps 1 and 2 below, skipping what is already done. To do them by hand instead:",
|
|
97
97
|
"",
|
|
98
|
-
"1. First-publish each name **
|
|
98
|
+
"1. First-publish each name **public** (`--access public`: scoped names default to restricted). From a trusted machine, `npm login` to the org, then from the **repo root**. Use `./` so npm does not treat the path as a GitHub `owner/repo`. `--tag` is required for prerelease versions (`x.y.z-dev.N`). Missing `bin`/`es6` warnings are OK for this name-only bootstrap; CI `forge publish` ships the built tarball later:",
|
|
99
99
|
"",
|
|
100
100
|
"```bash",
|
|
101
101
|
...firstPublishCommands(packages, channel),
|
|
@@ -58,7 +58,7 @@ afterEach(() => {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
describe("npm-bootstrap", () => {
|
|
61
|
-
it("first-publishes unpublished names
|
|
61
|
+
it("first-publishes unpublished names public, then sets the Trusted Publisher", async () => {
|
|
62
62
|
seedWorkspace();
|
|
63
63
|
const registry = fakeNpm({ published: ["@decohere/scribe"] });
|
|
64
64
|
|
|
@@ -67,7 +67,7 @@ describe("npm-bootstrap", () => {
|
|
|
67
67
|
expect(code).toBe(0);
|
|
68
68
|
expect(registry.calls).toEqual([
|
|
69
69
|
"whoami",
|
|
70
|
-
"publish ./projects/scribe/scribe-console --tag dev [otp 123456]",
|
|
70
|
+
"publish ./projects/scribe/scribe-console --access public --tag dev [otp 123456]",
|
|
71
71
|
"trust list @decohere/scribe-console --json [otp 123456]",
|
|
72
72
|
"trust github @decohere/scribe-console --file publish.yml --repo typesmiths/decohere --env npm-publish --allow-publish --yes [otp 123456]",
|
|
73
73
|
]);
|
|
@@ -107,7 +107,7 @@ describe("npm-bootstrap", () => {
|
|
|
107
107
|
expect(code).toBe(0);
|
|
108
108
|
expect(registry.calls).toEqual(["whoami"]);
|
|
109
109
|
expect(lines).toContain(
|
|
110
|
-
"[dry run] npm publish ./projects/scribe/scribe-console --tag dev",
|
|
110
|
+
"[dry run] npm publish ./projects/scribe/scribe-console --access public --tag dev",
|
|
111
111
|
);
|
|
112
112
|
});
|
|
113
113
|
|
|
@@ -47,16 +47,15 @@ describe("oidc-bootstrap-nudge", () => {
|
|
|
47
47
|
expect(needsPrereleaseTag("0.0.1-dev.18")).toBe(true);
|
|
48
48
|
expect(needsPrereleaseTag("1.2.3")).toBe(false);
|
|
49
49
|
expect(firstPublishCommands([pkg], "dev")).toEqual([
|
|
50
|
-
"npm publish ./projects/scaffold --tag dev",
|
|
50
|
+
"npm publish ./projects/scaffold --access public --tag dev",
|
|
51
51
|
]);
|
|
52
52
|
expect(firstPublishCommands([{ ...pkg, version: "1.0.0" }], "dev")).toEqual([
|
|
53
|
-
"npm publish ./projects/scaffold",
|
|
53
|
+
"npm publish ./projects/scaffold --access public",
|
|
54
54
|
]);
|
|
55
|
-
expect(body).toContain("npm publish ./projects/scaffold --tag dev");
|
|
55
|
+
expect(body).toContain("npm publish ./projects/scaffold --access public --tag dev");
|
|
56
56
|
expect(body).toContain("pnpm npm:bootstrap --otp <code> @decohere/scaffold");
|
|
57
57
|
expect(body).not.toMatch(/# @decohere\/scaffold/);
|
|
58
|
-
expect(body).toContain("
|
|
59
|
-
expect(firstPublishCommands([pkg], "dev").join("\n")).not.toContain("--access public");
|
|
58
|
+
expect(body).toContain("First-publish each name **public**");
|
|
60
59
|
expect(body).toContain("Workflow filename: `publish.yml`");
|
|
61
60
|
expect(body).toContain("Environment: `npm-publish`");
|
|
62
61
|
expect(body).toContain("gh run rerun --failed");
|