Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
show on this site's /mcp
CLI
abso show 91 --json
JSON
/christopher/abso-core/versions/91?format=json

npm-publish jobs take an optional tag: the npm dist-tag to publish under (latest if none)

of shared·infra-pipeline··Not checked

Version 90 · Files at version 91

2 files, 30 lines added, 2 removed.

--- a/src/pipeline/pipeline.ts
+++ b/src/pipeline/pipeline.ts
@@ -76,10 +76,13 @@
7676 deploy: ["worker", "staging", "live"],
7777 preview: [],
7878 notify: ["to"],
79− // The npm packages it may publish, from the .tgz files its from: job kept.
80− "npm-publish": ["packages"],
79+ // The npm packages it may publish, from the .tgz files its from: job kept, and the dist-tag (latest if none).
80+ "npm-publish": ["packages", "tag"],
8181};
8282
83+/** An npm dist-tag: npm refuses one that reads as a version, so it starts with a letter. */
84+const DIST_TAG = /^[a-z][a-z0-9_-]{0,31}$/;
8386/** An npm package name: lower case, URL-safe, optionally under a @scope/. */
8487const NPM_NAME = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
8588
@@ -293,6 +296,8 @@
293296 if (typeof p !== "string" || p.length > 214 || !NPM_NAME.test(p))
294297 say(`${at}.packages[${i}]`, `${q(p)} isn't an npm package name`);
295298 });
299+ if (j.tag !== undefined && (typeof j.tag !== "string" || !DIST_TAG.test(j.tag)))
300+ say(`${at}.tag`, `${q(j.tag)} isn't an npm dist-tag (a lower-case name such as next, not a version)`);
296301 }
297302 return {
298303 name,
--- a/src/pipeline/test/pipeline.test.ts
+++ b/src/pipeline/test/pipeline.test.ts
@@ -245,6 +245,29 @@
245245 has(ps, "pipelines.p.jobs.c.packages[2]", /isn't an npm package name/);
246246 });
247247
248+ it("npm-publish: an optional dist-tag", () => {
249+ const pack = { run: "npm pack --pack-destination out", keep: ["out"] };
250+ const read = checkPipelines(
251+ one({ pack, publish: { uses: "npm-publish", from: "p.pack", packages: ["tool"], tag: "next" } }),
252+ );
253+ ok(read);
254+ const job = read.ok ? read.file.pipelines[0]!.jobs.find((j) => j.name === "publish") : undefined;
255+ assert.deepEqual(job?.with, { packages: ["tool"], tag: "next" });
256+ const ps = problems(
257+ checkPipelines(
258+ one({
259+ pack,
260+ a: { uses: "npm-publish", from: "p.pack", packages: ["tool"], tag: "1.2.0" },
261+ b: { uses: "npm-publish", from: "p.pack", packages: ["tool"], tag: "Next" },
262+ c: { uses: "npm-publish", from: "p.pack", packages: ["tool"], tag: 7 },
263+ }),
264+ ),
265+ );
266+ has(ps, "pipelines.p.jobs.a.tag", /isn't an npm dist-tag/);
267+ has(ps, "pipelines.p.jobs.b.tag", /isn't an npm dist-tag/);
268+ has(ps, "pipelines.p.jobs.c.tag", /isn't an npm dist-tag/);
269+ });
248271 it("keys it doesn't know, at every level", () => {
249272 const ps = problems(
250273 checkPipelines({