@drbaher/draft-cli 0.1.0 → 0.1.1
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/CHANGELOG.md +26 -0
- package/draft-cli.mjs +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@ All notable changes to this project will be documented in this file. The
|
|
|
4
4
|
format is loosely based on [Keep a Changelog](https://keepachangelog.com/),
|
|
5
5
|
and the project adheres to semantic versioning once it leaves 0.x.
|
|
6
6
|
|
|
7
|
+
## 0.1.1 — 2026-05-16
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Globally-installed `draft` binary now runs `main()`.** The
|
|
12
|
+
entrypoint check at the bottom of `draft-cli.mjs` compared
|
|
13
|
+
`fileURLToPath(import.meta.url)` against `resolve(process.argv[1])`.
|
|
14
|
+
`resolve` only resolves relative → absolute; it does not resolve
|
|
15
|
+
symlinks. When `npm install -g` creates a bin symlink (e.g.
|
|
16
|
+
`/opt/homebrew/bin/draft → ../lib/node_modules/@drbaher/draft-cli/draft-cli.mjs`),
|
|
17
|
+
`process.argv[1]` is the symlink path, so the comparison failed,
|
|
18
|
+
`main()` was never called, and `draft --version` / `draft --demo`
|
|
19
|
+
silently exited 0 with no output. The fix wraps `resolve(...)` in
|
|
20
|
+
`realpathSync(...)` to canonicalize through symlinks.
|
|
21
|
+
|
|
22
|
+
### Hardened
|
|
23
|
+
|
|
24
|
+
- **CI smoke step asserts on stdout.** Previously the workflow ran
|
|
25
|
+
`draft --version` and `draft --demo` but did not check exit code or
|
|
26
|
+
expected output. Since the v0.1.0 bug made the bin a silent no-op
|
|
27
|
+
with exit 0, smoke passed. The step now greps `draft --version`
|
|
28
|
+
stdout for the `draft-cli ` prefix and `draft --demo` stdout for
|
|
29
|
+
the substituted Party A value (`Acme Corporation`) — proving both
|
|
30
|
+
that the bin runs and that substitution happens end-to-end. A
|
|
31
|
+
regression of either shape would now fail CI.
|
|
32
|
+
|
|
7
33
|
## 0.1.0 — 2026-05-16
|
|
8
34
|
|
|
9
35
|
Initial release. Single-file Node.js CLI for deterministic placeholder
|
package/draft-cli.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Part of the contract-operations suite. MIT. See LICENSE.
|
|
4
4
|
// Single-file Node.js CLI. Stdlib-only except `jszip` for .docx unzip.
|
|
5
5
|
|
|
6
|
-
import { readFileSync, writeFileSync, existsSync, statSync } from "node:fs";
|
|
6
|
+
import { readFileSync, writeFileSync, existsSync, statSync, realpathSync } from "node:fs";
|
|
7
7
|
import { resolve, dirname, basename, extname, join } from "node:path";
|
|
8
8
|
import { spawnSync } from "node:child_process";
|
|
9
9
|
import { createInterface } from "node:readline";
|
|
@@ -70,7 +70,7 @@ import { fileURLToPath } from "node:url";
|
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
72
|
/** @type {string} */
|
|
73
|
-
export const VERSION = "0.1.
|
|
73
|
+
export const VERSION = "0.1.1";
|
|
74
74
|
|
|
75
75
|
// ─── EXIT CODES ─────────────────────────────────────────────────────────────
|
|
76
76
|
/**
|
|
@@ -1746,7 +1746,7 @@ export async function main(argv, io = {}) {
|
|
|
1746
1746
|
|
|
1747
1747
|
// Entry point: only run when invoked directly (not when imported by tests).
|
|
1748
1748
|
const isMain = (() => {
|
|
1749
|
-
try { return process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1]); }
|
|
1749
|
+
try { return process.argv[1] && fileURLToPath(import.meta.url) === realpathSync(resolve(process.argv[1])); }
|
|
1750
1750
|
catch { return false; }
|
|
1751
1751
|
})();
|
|
1752
1752
|
if (isMain) {
|