@homepages/create-workspace 0.9.0-dev-20260719224319 → 0.9.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/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // `npm create @homepages/workspace <name>` — stamp a workspace container: shared
3
3
  // root context + one working starter template, then install and git-init.
4
4
  import { execFileSync } from "node:child_process";
5
- import { existsSync, readFileSync, realpathSync } from "node:fs";
5
+ import { existsSync, realpathSync } from "node:fs";
6
6
  import { mkdir } from "node:fs/promises";
7
7
  import { dirname, join, resolve } from "node:path";
8
8
  import { createInterface } from "node:readline/promises";
@@ -10,6 +10,14 @@ import { fileURLToPath } from "node:url";
10
10
  import { stampTree } from "./stamp.js";
11
11
  const ASSETS = join(dirname(fileURLToPath(import.meta.url)), "..", "scaffold");
12
12
  const NAME_RE = /^[a-z][a-z0-9-]*$/;
13
+ /**
14
+ * The kit's caret pin. The kit versions independently of this scaffolder, so
15
+ * it cannot be derived from this package's own version and is a committed
16
+ * constant — same reasoning as ESLINT_PLUGIN_VERSION below — bumped when the
17
+ * kit releases a new minor. A scaffolded workspace pinned to a stale range
18
+ * never picks up the kit's current contract.
19
+ */
20
+ const KIT_VERSION = "0.9.0";
13
21
  /**
14
22
  * The authoring ESLint preset's caret pin. Unlike the kit it cannot be derived from
15
23
  * this package's own version — @homepages/eslint-plugin-template versions
@@ -18,12 +26,43 @@ const NAME_RE = /^[a-z][a-z0-9-]*$/;
18
26
  * on fails at `npm install`, not at lint time, so this is not optional.
19
27
  */
20
28
  const ESLINT_PLUGIN_VERSION = "0.1.0";
29
+ /**
30
+ * The CLI's caret pin. Same reasoning as ESLINT_PLUGIN_VERSION: @homepages/template-cli
31
+ * versions independently of the kit, so it cannot be derived from this package's own
32
+ * version and is a committed constant, bumped when that package releases a new minor.
33
+ *
34
+ * It is what supplies the `template-kit` command the scaffolded scripts invoke — the
35
+ * kit no longer carries a bin — so a workspace missing it fails on `npm run dev` with
36
+ * "command not found", which reads as a broken scaffold rather than a missing pin.
37
+ */
38
+ const TEMPLATE_CLI_VERSION = "0.1.0";
39
+ /**
40
+ * The dev media pack's caret pin. Same committed-constant reasoning as the pins
41
+ * above — the pack versions independently of this scaffolder.
42
+ *
43
+ * The pack is what the `dev` server serves asset BYTES from: the kit carries only
44
+ * the manifest (copied into its dist at build time), so a workspace without this
45
+ * dependency has an index of media it cannot resolve a single pixel of, and every
46
+ * fixture image renders broken.
47
+ *
48
+ * It is a devDependency, not a dependency: media is dev-time authoring content, in
49
+ * the same category as vite and the rest of the toolchain, and nothing in a packed
50
+ * template references it.
51
+ *
52
+ * This range must cover the pack's actual published version on npm, or a
53
+ * scaffolded workspace outside this monorepo dies on `npm install` with a 404 —
54
+ * the drift guard in `src/index.test.ts` (the stamped dev-media range covers the
55
+ * pack's actual version) fails the moment this constant falls behind a real bump.
56
+ */
57
+ const DEV_MEDIA_VERSION = "0.0.0";
21
58
  export async function scaffoldWorkspace(name, targetDir, opts) {
22
59
  await mkdir(targetDir, { recursive: true });
23
60
  await stampTree(join(ASSETS, "workspace"), targetDir, {
24
61
  WORKSPACE_NAME: name,
25
- KIT_VERSION: opts.kitVersion,
62
+ KIT_VERSION: opts.kitVersion ?? KIT_VERSION,
26
63
  ESLINT_PLUGIN_VERSION: opts.eslintPluginVersion ?? ESLINT_PLUGIN_VERSION,
64
+ TEMPLATE_CLI_VERSION: opts.templateCliVersion ?? TEMPLATE_CLI_VERSION,
65
+ DEV_MEDIA_VERSION: opts.devMediaVersion ?? DEV_MEDIA_VERSION,
27
66
  });
28
67
  await stampTree(join(ASSETS, "template"), join(targetDir, "templates", "starter"), {
29
68
  TEMPLATE_KEY: "starter",
@@ -34,17 +73,6 @@ export async function scaffoldWorkspace(name, targetDir, opts) {
34
73
  if (opts.install !== false)
35
74
  execFileSync("npm", ["install"], { cwd: targetDir, stdio: "inherit" });
36
75
  }
37
- /**
38
- * The kit version to caret-pin: this scaffolder is published version-synced
39
- * with the kit, so its own `version` IS the kit version. Read at runtime
40
- * (rather than a static JSON import) because `../package.json` sits outside
41
- * `rootDir: "src"` and trips TS6059 under a static import.
42
- */
43
- function kitVersion() {
44
- const raw = readFileSync(new URL("../package.json", import.meta.url), "utf8");
45
- const pkg = JSON.parse(raw);
46
- return typeof pkg.version === "string" ? pkg.version : "0.0.0";
47
- }
48
76
  async function promptName() {
49
77
  const rl = createInterface({ input: process.stdin, output: process.stdout });
50
78
  try {
@@ -66,7 +94,7 @@ async function main() {
66
94
  process.stderr.write(`create-workspace: ${name}/ already exists.\n`);
67
95
  return 1;
68
96
  }
69
- await scaffoldWorkspace(name, targetDir, { kitVersion: kitVersion() });
97
+ await scaffoldWorkspace(name, targetDir, {});
70
98
  process.stdout.write(`\nCreated ${name}/\n\n` +
71
99
  ` cd ${name}\n` +
72
100
  ` npm run dev # preview the starter (the island hydrates)\n` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homepages/create-workspace",
3
- "version": "0.9.0-dev-20260719224319",
3
+ "version": "0.9.1",
4
4
  "description": "Scaffold a HomePages template workspace.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -9,9 +9,12 @@ You are authoring HomePages marketing-section templates in this workspace.
9
9
  - **Templates live in `templates/`.** Each is a plain folder — not an npm package.
10
10
  Add one with `npx template-kit new <name>`; add a section with
11
11
  `npx template-kit new-section <name>`.
12
- - **One kit, one version.** `@homepages/template-kit` is the only toolchain
13
- dependency; every template shares it. Do not add per-template `package.json`,
14
- `tsconfig`, or `eslint` files there is exactly one of each, at this root.
12
+ - **One kit, one version.** `@homepages/template-kit` carries the authoring
13
+ contract every template imports; `@homepages/template-cli` provides the
14
+ `template-kit` command and `@homepages/eslint-plugin-template` the lint preset.
15
+ All three are declared once, at this root, and every template shares them. Do not
16
+ add per-template `package.json`, `tsconfig`, or `eslint` files — there is exactly
17
+ one of each, at this root.
15
18
  - **The docs corpus is your whole universe:** `node_modules/@homepages/template-kit/guide/`
16
19
  (`llms.txt` is the router). Read it before authoring; do not guess the contract.
17
20
 
@@ -7,9 +7,12 @@ You are authoring HomePages marketing-section templates in this workspace.
7
7
  - **Templates live in `templates/`.** Each is a plain folder — not an npm package.
8
8
  Add one with `npx template-kit new <name>`; add a section with
9
9
  `npx template-kit new-section <name>`.
10
- - **One kit, one version.** `@homepages/template-kit` is the only toolchain
11
- dependency; every template shares it. Do not add per-template `package.json`,
12
- `tsconfig`, or `eslint` files there is exactly one of each, at this root.
10
+ - **One kit, one version.** `@homepages/template-kit` carries the authoring
11
+ contract every template imports; `@homepages/template-cli` provides the
12
+ `template-kit` command and `@homepages/eslint-plugin-template` the lint preset.
13
+ All three are declared once, at this root, and every template shares them. Do not
14
+ add per-template `package.json`, `tsconfig`, or `eslint` files — there is exactly
15
+ one of each, at this root.
13
16
  - **The docs corpus is your whole universe:** `node_modules/@homepages/template-kit/guide/`
14
17
  (`llms.txt` is the router). Read it before authoring; do not guess the contract.
15
18
 
@@ -1,7 +1,10 @@
1
1
  # {{WORKSPACE_NAME}}
2
2
 
3
- A HomePages template workspace. Templates live in `templates/`. The kit toolchain
4
- is one dependency (`@homepages/template-kit`) shared by every template here.
3
+ A HomePages template workspace. Templates live in `templates/`. The toolchain is
4
+ declared once at this root — `@homepages/template-kit` (the authoring contract),
5
+ `@homepages/template-cli` (the `template-kit` command) and
6
+ `@homepages/eslint-plugin-template` (the lint preset) — and shared by every
7
+ template here.
5
8
 
6
9
  ## Commands
7
10
 
@@ -13,7 +13,9 @@
13
13
  "react-dom": "^19.0.0"
14
14
  },
15
15
  "devDependencies": {
16
+ "@homepages/dev-media": "^{{DEV_MEDIA_VERSION}}",
16
17
  "@homepages/eslint-plugin-template": "^{{ESLINT_PLUGIN_VERSION}}",
18
+ "@homepages/template-cli": "^{{TEMPLATE_CLI_VERSION}}",
17
19
  "@tailwindcss/cli": "^4.3.0",
18
20
  "@types/react": "^19.0.0",
19
21
  "@types/react-dom": "^19.0.0",