@donezone/cli 0.1.3 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +15 -0
  2. package/dist/index.js +55 -23
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,3 +6,18 @@ The Done CLI is being rebuilt from the ground up. The four commands described in
6
6
 
7
7
  Use this package as a starting point when implementing the new workflow—wire each command to the
8
8
  logic outlined in the spec, add supporting modules under `src/`, and extend the tests accordingly.
9
+
10
+ ## Binary releases
11
+
12
+ Single-file binaries for `@donezone/cli` are built automatically via
13
+ `.github/workflows/done-cli-binaries.yml`. Every publishable tag uploads archives for linux (glibc and musl),
14
+ macOS (arm64 + x64), and Windows. Each release also includes a `manifest.json` file used by the installer.
15
+
16
+ To install the latest CLI binary without cloning this repo, run:
17
+
18
+ ```bash
19
+ curl -fsSL https://raw.githubusercontent.com/mccallofthewild/cw-js/main/packages/done-cli/install.sh | bash
20
+ ```
21
+
22
+ Pass an explicit tag or version (`bash install.sh v0.1.4`) to install a historical build. Set
23
+ `DONECLI_BIN_DIR` to override the installation directory.
package/dist/index.js CHANGED
@@ -441,36 +441,68 @@ async function ensureEntryExists(entryPath, contractName) {
441
441
  }
442
442
  }
443
443
  async function runBunBuild(entryPath, outFilePath) {
444
- const bun = getBunRuntime();
445
- const result = await bun.build({
446
- entrypoints: [entryPath],
447
- target: "bun",
448
- format: "esm",
449
- splitting: false,
450
- sourcemap: "none",
451
- external: ["bun:*", "node:*"],
452
- define: {
453
- "process.env.NODE_ENV": '"production"',
454
- },
455
- });
456
- if (!result.success) {
457
- const logs = (result.logs ?? []).map((log) => log?.message ?? String(log));
458
- throw new Error(logs.join("\n") || "Bun.build failed");
459
- }
460
- const [output] = result.outputs;
461
- if (!output) {
462
- throw new Error("Bun.build did not emit an output file");
444
+ const bun = getEmbeddedBunRuntime();
445
+ if (bun) {
446
+ const result = await bun.build({
447
+ entrypoints: [entryPath],
448
+ target: "bun",
449
+ format: "esm",
450
+ splitting: false,
451
+ sourcemap: "none",
452
+ external: ["bun:*", "node:*"],
453
+ define: {
454
+ "process.env.NODE_ENV": '"production"',
455
+ },
456
+ });
457
+ if (!result.success) {
458
+ const logs = (result.logs ?? []).map((log) => log?.message ?? String(log));
459
+ throw new Error(logs.join("\n") || "Bun.build failed");
460
+ }
461
+ const [output] = result.outputs;
462
+ if (!output) {
463
+ throw new Error("Bun.build did not emit an output file");
464
+ }
465
+ const bundledSource = await output.text();
466
+ await fs.writeFile(outFilePath, bundledSource);
467
+ return;
463
468
  }
464
- const bundledSource = await output.text();
465
- await fs.writeFile(outFilePath, bundledSource);
469
+ await runBunCliBuild(entryPath, outFilePath);
466
470
  }
467
- function getBunRuntime() {
471
+ function getEmbeddedBunRuntime() {
468
472
  const bun = globalThis.Bun;
469
473
  if (!bun || typeof bun.build !== "function") {
470
- throw new Error("Bun runtime unavailable. Rebuild the done CLI using Bun to embed the runtime.");
474
+ return null;
471
475
  }
472
476
  return bun;
473
477
  }
478
+ async function runBunCliBuild(entryPath, outFilePath) {
479
+ const args = [
480
+ "build",
481
+ entryPath,
482
+ "--outfile",
483
+ outFilePath,
484
+ "--target",
485
+ "bun",
486
+ "--format",
487
+ "esm",
488
+ "--sourcemap",
489
+ "none",
490
+ "--define",
491
+ 'process.env.NODE_ENV="production"',
492
+ ];
493
+ for (const external of ["bun:*", "node:*"]) {
494
+ args.push("--external", external);
495
+ }
496
+ try {
497
+ await runCommand("bun", args);
498
+ }
499
+ catch (error) {
500
+ if (error.code === "ENOENT") {
501
+ throw new Error("Bun executable not found in PATH. Install Bun from https://bun.sh and re-run the build.");
502
+ }
503
+ throw error;
504
+ }
505
+ }
474
506
  function formatDuration(ms) {
475
507
  if (ms < 1000) {
476
508
  return `${ms}ms`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donezone/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {