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
code on this site's /mcp
CLI
none: the JSON below is the answer
JSON
/christopher/abso-core/files/scripts/pack-npm.mjs?format=json
73 linesnode20 100%Last change node20 in version 172, 1 version changed it
1// Packs the npm package @abso-cli/abso from this checkout: the client as scripts/build-client.mjs builds it,
2// for Node 20 or later. It never publishes and never reads npm's sign-in.
3//
4// npm ci && npm run pack:npm -- <version> (e.g. 0.171.0)
5//
6// It writes the package to dist/npm/package/ and its tarball, as npm pack names it, to dist/npm/.
7// The package's layout: bin/abso.mjs checks Node's version and loads dist/abso.mjs, the bundle, stamped
8// with the version so the client knows it is an installed package.
9import { execFileSync } from "node:child_process";
10import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
11import { dirname, join, resolve } from "node:path";
12import { fileURLToPath } from "node:url";
13import { buildClient } from "./build-client.mjs";
15const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
16const version = process.argv[2];
17if (!version || !/^\d+\.\d+\.\d+$/.test(version)) {
18 process.stderr.write("Use: npm run pack:npm -- <version>, such as 0.171.0\n");
19 process.exit(2);
21const node = 20;
23const files = {
24 "package.json": `${JSON.stringify(
25 {
26 name: "@abso-cli/abso",
27 version,
28 description: "abso: version control built for AI agents first. The command line client.",
29 license: "MIT",
30 homepage: "https://abso.dev",
31 keywords: ["version control", "vcs", "agents", "ai", "abso"],
32 type: "module",
33 engines: { node: `>=${node}` },
34 bin: { abso: "bin/abso.mjs" },
35 files: ["bin", "dist"],
36 publishConfig: { access: "public" },
37 },
38 null,
39 2,
40 )}\n`,
41 // A dynamic import, so an older Node reaches the version check before it reads the bundle.
42 "bin/abso.mjs": `#!/usr/bin/env node
43const major = Number(process.versions.node.split(".")[0]);
44if (major < ${node}) {
45 process.stderr.write("abso needs Node ${node} or later, and this is Node " + process.versions.node + ". Install a newer Node from https://nodejs.org and run abso again.\\n");
46 process.exit(1);
48await import("../dist/abso.mjs");
49`,
50 "dist/abso.mjs": buildClient([`globalThis.__ABSO_PACKAGE_VERSION__ = ${JSON.stringify(version)};`]),
51 "README.md": `# abso\n\nabso is version control for agents. This package is the abso command line.\n\nIt needs Node ${node} or later. Install it with \`npm install -g @abso-cli/abso\`, or run \`npx @abso-cli/abso help\`.\n\n[abso.dev](https://abso.dev)\n`,
52 LICENSE: readFileSync(join(root, "LICENSE"), "utf8"),
53};
55const out = join(root, "dist", "npm");
56const pkg = join(out, "package");
57rmSync(pkg, { recursive: true, force: true });
58for (const [path, text] of Object.entries(files)) {
59 mkdirSync(dirname(join(pkg, path)), { recursive: true });
60 writeFileSync(join(pkg, path), text);
62// Under npm run, npm_execpath is npm's own script, which runs without a shell on every platform.
63const npm = process.env.npm_execpath;
64const pack = ["pack", pkg, "--pack-destination", out, "--ignore-scripts"];
65const tarball = (
66 npm
67 ? execFileSync(process.execPath, [npm, ...pack], { cwd: root, encoding: "utf8" })
68 : execFileSync("npm", pack, { cwd: root, encoding: "utf8", shell: process.platform === "win32" })
70 .trim()
71 .split("\n")
72 .pop();
73process.stdout.write(`Packed @abso-cli/abso ${version}: dist/npm/${tarball}\n`);