Versions 102 to 318
new file, 73 lines
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. 4+// npm ci && npm run pack:npm -- <version> (e.g. 0.171.0) 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. 9+import { execFileSync } from "node:child_process"; 10+import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; 11+import { dirname, join, resolve } from "node:path"; 12+import { fileURLToPath } from "node:url"; 13+import { buildClient } from "./build-client.mjs"; 15+const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); 16+const version = process.argv[2]; 17+if (!version || !/^\d+\.\d+\.\d+$/.test(version)) { 18+ process.stderr.write("Use: npm run pack:npm -- <version>, such as 0.171.0\n"); 24+ "package.json": `${JSON.stringify( 26+ name: "@abso-cli/abso", 28+ description: "abso: version control built for AI agents first. The command line client.", 30+ homepage: "https://abso.dev", 31+ keywords: ["version control", "vcs", "agents", "ai", "abso"], 33+ engines: { node: `>=${node}` }, 34+ bin: { abso: "bin/abso.mjs" }, 35+ files: ["bin", "dist"], 36+ publishConfig: { access: "public" }, 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 43+const major = Number(process.versions.node.split(".")[0]); 44+if (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"); 48+await import("../dist/abso.mjs"); 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"), 55+const out = join(root, "dist", "npm"); 56+const pkg = join(out, "package"); 57+rmSync(pkg, { recursive: true, force: true }); 58+for (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. 63+const npm = process.env.npm_execpath; 64+const pack = ["pack", pkg, "--pack-destination", out, "--ignore-scripts"]; 67+ ? execFileSync(process.execPath, [npm, ...pack], { cwd: root, encoding: "utf8" }) 68+ : execFileSync("npm", pack, { cwd: root, encoding: "utf8", shell: process.platform === "win32" }) 73+process.stdout.write(`Packed @abso-cli/abso ${version}: dist/npm/${tarball}\n`);