@alxia/create 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.
Files changed (34) hide show
  1. package/README.md +26 -5
  2. package/dist/index.js +57 -102
  3. package/dist/index.js.map +8 -8
  4. package/dist/main.d.ts.map +1 -1
  5. package/dist/registry.d.ts +28 -7
  6. package/dist/registry.d.ts.map +1 -1
  7. package/dist/templates/react-router.d.ts +9 -18
  8. package/dist/templates/react-router.d.ts.map +1 -1
  9. package/dist/versions.d.ts +0 -2
  10. package/dist/versions.d.ts.map +1 -1
  11. package/dist/write.d.ts +2 -1
  12. package/dist/write.d.ts.map +1 -1
  13. package/docs/README.md +2 -2
  14. package/docs/guide.md +57 -26
  15. package/docs/roadmap.md +26 -9
  16. package/docs/troubleshooting.md +44 -63
  17. package/package.json +3 -2
  18. package/templates/react-router/.dockerignore +4 -0
  19. package/templates/react-router/Dockerfile +29 -0
  20. package/templates/react-router/README.md +87 -0
  21. package/templates/react-router/_bunfig.toml +4 -0
  22. package/templates/react-router/app/app.css +15 -0
  23. package/templates/react-router/app/root.tsx +75 -0
  24. package/templates/react-router/app/routes/home.tsx +13 -0
  25. package/templates/react-router/app/routes.ts +3 -0
  26. package/templates/react-router/app/welcome/logo-dark.svg +23 -0
  27. package/templates/react-router/app/welcome/logo-light.svg +23 -0
  28. package/templates/react-router/app/welcome/welcome.tsx +89 -0
  29. package/templates/react-router/gitignore +7 -0
  30. package/templates/react-router/package.json +31 -0
  31. package/templates/react-router/public/favicon.ico +0 -0
  32. package/templates/react-router/react-router.config.ts +7 -0
  33. package/templates/react-router/tsconfig.json +26 -0
  34. package/templates/react-router/vite.config.ts +11 -0
package/README.md CHANGED
@@ -29,7 +29,7 @@ bun create @alxia my-site --template react-router
29
29
  | template | what it writes |
30
30
  | --- | --- |
31
31
  | `api` | an `@alxia/core` app with Zod: `POST /todos` validates its body, behind `requireKey`, a hook made with `defineHook` that answers 401 without an API key; a `bun test` spec calling it with `app.request()` and through `@alxia/client`, typed; `bun dev` restarting on change, `typecheck`, `build`, a strict `tsconfig.json`, `.gitignore` and a README |
32
- | `react-router` | React Router's own template, written by its `create-react-router`, then [`@alxia/react-router`](https://www.npmjs.com/package/@alxia/react-router) added as its README says: `alxia()` in `vite.config.ts`'s plugins, `start` running `bun build/server/index.js`, a `bunfig.toml` starting React Router's CLI on Bun. No server file: the default one serves the pages; `bunx alxia-react-router reveal` writes it out to customise |
32
+ | `react-router` | React Router's official template, as `create-react-router` writes it, shipped in this package and copied, with [`@alxia/react-router`](https://www.npmjs.com/package/@alxia/react-router) added as its README says: `alxia()` in `vite.config.ts`'s plugins, `start` running `bun build/server/index.js`, a `bunfig.toml` starting React Router's CLI on Bun, and a `Dockerfile` on `oven/bun:1` in place of React Router's Node one. No server file: the default one serves the pages; `bunx alxia-react-router reveal` writes it out to customise |
33
33
 
34
34
  The heart of the `api` project, its route and hook (the whole file, with
35
35
  its imports and schemas, is in the [guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md#the-api-template)):
@@ -51,6 +51,23 @@ export const app = alxia()
51
51
  });
52
52
  ```
53
53
 
54
+ ## Docker
55
+
56
+ The `react-router` project builds into an image as it is written: its
57
+ `Dockerfile` installs, builds and runs on `oven/bun:1`, and the image runs
58
+ `bun build/server/index.js` as the non-root `bun` user.
59
+
60
+ ```sh
61
+ cd my-site
62
+ docker build -t my-site .
63
+ docker run -p 3000:3000 my-site
64
+ ```
65
+
66
+ Commit the `bun.lock` that `bun install` wrote: the image installs from it
67
+ with `--frozen-lockfile`. The
68
+ [guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md#docker)
69
+ has the stages.
70
+
54
71
  ## Options
55
72
 
56
73
  | option | |
@@ -65,9 +82,13 @@ or CI.
65
82
 
66
83
  ## Versions
67
84
 
68
- - **alxia's packages** are at the versions this release of `@alxia/create`
69
- was published with, as `^` ranges: `@alxia/core`, `@alxia/client`,
70
- `@alxia/react-router`. `bunx @alxia/create@<version>` picks an older set.
85
+ - **alxia's packages** — `@alxia/core`, `@alxia/client`,
86
+ `@alxia/react-router` — are moved to the newest version on the registry
87
+ within the ranges this release of `@alxia/create` was published with:
88
+ `^0.3.1` writes `^0.3.4` once 0.3.4 is out, never `^0.4.0`. Just after a
89
+ release, while the registry does not serve that version yet, the newest of
90
+ the same minor is written (`^0.3.0`, which takes 0.3.1 once it arrives),
91
+ and the output says so. `bunx @alxia/create@<version>` picks an older set.
71
92
  - **Everything else** — Zod, TypeScript, Vite, React, React Router, Tailwind
72
93
  — is moved to the newest version on the registry when the project is
73
94
  written, within the range alxia's packages accept: TypeScript within
@@ -96,6 +117,6 @@ the project it writes installs with `bun install`.
96
117
 
97
118
  ## Documentation
98
119
 
99
- - [Guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md): each template file by file, what the `react-router` template changes in React Router's, how versions are chosen, and running it in CI.
120
+ - [Guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md): each template file by file, what the `react-router` template adds to React Router's, how versions are chosen, and running it in CI.
100
121
  - [Troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/create/docs/troubleshooting.md): each message the command prints, and what to do about it.
101
122
  - [Roadmap](https://github.com/softistx/alxia/blob/develop/packages/create/docs/roadmap.md): what is coming, and what is not planned.
package/dist/index.js CHANGED
@@ -78,9 +78,6 @@ async function clean(target, existed) {
78
78
  }
79
79
  }
80
80
 
81
- // src/templates/react-router.ts
82
- import { join as join2 } from "node:path";
83
-
84
81
  // src/versions.ts
85
82
  import { dirname } from "node:path";
86
83
  var ALXIA_PACKAGES = [
@@ -94,12 +91,6 @@ var PEER_RANGES = {
94
91
  "react-router": "^8.0.0",
95
92
  vite: "^7.0.0 || ^8.0.0"
96
93
  };
97
- function highestMajor(range) {
98
- const majors = [...range.matchAll(/(?:^|[\s|^~>=])(\d+)/g)].map((match) => Number(match[1]));
99
- if (majors.length === 0)
100
- throw new Error(`no major in range ${range}`);
101
- return Math.max(...majors);
102
- }
103
94
  async function alxiaRanges(manifestUrl = new URL("../package.json", import.meta.url)) {
104
95
  const manifest = await Bun.file(manifestUrl).json();
105
96
  const declared = manifest.devDependencies ?? {};
@@ -120,83 +111,9 @@ async function workspaceRange(name, range, from) {
120
111
  return prefix === "*" ? version : `${prefix}${version}`;
121
112
  }
122
113
 
123
- // src/templates/react-router.ts
124
- function scaffoldCommand(dir) {
125
- return [
126
- `create-react-router@${highestMajor(PEER_RANGES["react-router"])}`,
127
- dir,
128
- "--yes",
129
- "--no-install",
130
- "--no-git-init",
131
- "--no-agent-skills",
132
- "--no-motion"
133
- ];
134
- }
135
-
136
- class ScaffoldChanged extends Error {
137
- constructor(file, expected) {
138
- super(`create-react-router's ${file} is not what this @alxia/create expects: ${expected}. ` + "Nothing was kept. Try the newest @alxia/create, or add @alxia/react-router to a React Router app by hand, as its README shows.");
139
- this.name = "ScaffoldChanged";
140
- }
141
- }
142
- var BUNFIG = `[run]
143
- # The React Router CLI is a node script: this starts it on Bun, which
144
- # alxia's server needs, even where a node is installed.
145
- bun = true
146
- `;
147
- var IMPORT = `import { alxia } from "@alxia/react-router/vite";
148
- `;
149
- function addPlugin(config) {
150
- const calls = config.match(/\breactRouter\(\)/g) ?? [];
151
- if (!config.includes('from "@react-router/dev/vite"') || !/plugins:\s*\[[^\]]*\breactRouter\(\)[^\]]*\]/.test(config) || calls.length !== 1) {
152
- throw new ScaffoldChanged("vite.config.ts", 'reactRouter() from "@react-router/dev/vite", called once in plugins: [...]');
153
- }
154
- if (config.includes("@alxia/react-router/vite")) {
155
- throw new ScaffoldChanged("vite.config.ts", "it already imports @alxia/react-router/vite");
156
- }
157
- return IMPORT + config.replace(/\breactRouter\(\)/, "reactRouter(), alxia()");
158
- }
159
- function addAlxia(manifest, alxia) {
160
- const scripts = manifest["scripts"];
161
- if (scripts?.["dev"] !== "react-router dev" || scripts["build"] !== "react-router build" || scripts["start"] === undefined || manifest.dependencies?.["react-router"] === undefined) {
162
- throw new ScaffoldChanged("package.json", "react-router in its dependencies, and the scripts `dev: react-router dev`, `build: react-router build` and a `start`");
163
- }
164
- const dependencies = sorted({
165
- ...manifest.dependencies,
166
- "@alxia/core": alxia["@alxia/core"],
167
- "@alxia/react-router": alxia["@alxia/react-router"]
168
- });
169
- return {
170
- ...manifest,
171
- scripts: { ...scripts, start: "bun build/server/index.js" },
172
- dependencies
173
- };
174
- }
175
- function sorted(deps) {
176
- return Object.fromEntries(Object.entries(deps).sort(([a], [b]) => a < b ? -1 : 1));
177
- }
178
- async function alxiaLayer(dir, alxia) {
179
- const read = async (file) => {
180
- const handle = Bun.file(join2(dir, file));
181
- if (!await handle.exists()) {
182
- throw new ScaffoldChanged(file, "it is missing");
183
- }
184
- return handle.text();
185
- };
186
- const manifest = addAlxia(JSON.parse(await read("package.json")), alxia);
187
- const config = addPlugin(await read("vite.config.ts"));
188
- if (await Bun.file(join2(dir, "bunfig.toml")).exists()) {
189
- throw new ScaffoldChanged("bunfig.toml", "none, and there is one");
190
- }
191
- return {
192
- manifest,
193
- files: { "vite.config.ts": config, "bunfig.toml": BUNFIG }
194
- };
195
- }
196
-
197
114
  // src/write.ts
198
- import { mkdir } from "node:fs/promises";
199
- import { basename as basename2, dirname as dirname2, join as join3 } from "node:path";
115
+ import { join as join3 } from "node:path";
116
+ import { fileURLToPath } from "node:url";
200
117
 
201
118
  // src/registry.ts
202
119
  function registryUrl(env) {
@@ -227,9 +144,19 @@ function choose(versions, range, latest) {
227
144
  return newestWithin(versions, range);
228
145
  return latest && versions.includes(latest) ? latest : newestWithin(versions, "*");
229
146
  }
230
- async function bumpDependencies(manifest, registry, keep = new Set) {
147
+ function sameMinor(range) {
148
+ const match = /(\d+)\.(\d+)\.\d+/.exec(range);
149
+ return match ? `~${match[1]}.${match[2]}.0` : undefined;
150
+ }
151
+ function newestOfMinor(versions, range) {
152
+ const minor = sameMinor(range);
153
+ const start = /\d+\.\d+\.\d+/.exec(range)?.[0];
154
+ const version = minor && newestWithin(versions, minor);
155
+ return version && start && Bun.semver.satisfies(start, `^${version}`) ? version : undefined;
156
+ }
157
+ async function bumpDependencies(manifest, registry, built = {}) {
231
158
  const fields = ["dependencies", "devDependencies"];
232
- const names = fields.flatMap((field) => Object.keys(manifest[field] ?? {}).filter((name) => !keep.has(name)));
159
+ const names = fields.flatMap((field) => Object.keys(manifest[field] ?? {}));
233
160
  const fetched = new Map(await Promise.all(names.map(async (name) => [
234
161
  name,
235
162
  await packument(name, registry).catch(() => {
@@ -240,6 +167,7 @@ async function bumpDependencies(manifest, registry, keep = new Set) {
240
167
  const held = [];
241
168
  const failed = [];
242
169
  const unmatched = [];
170
+ const behind = [];
243
171
  const chosen = new Map;
244
172
  const ordered = [...names].sort((a, b) => Number(b === "react-router") - Number(a === "react-router"));
245
173
  for (const name of ordered) {
@@ -254,10 +182,17 @@ async function bumpDependencies(manifest, registry, keep = new Set) {
254
182
  continue;
255
183
  }
256
184
  const versions = Object.keys(meta.versions);
257
- const range = allowedRange(name);
185
+ const pinned = built[name];
186
+ const range = pinned ?? allowedRange(name);
258
187
  const latest = meta["dist-tags"]?.["latest"];
259
188
  const follow = chosen.get("react-router");
260
- const version = name.startsWith("@react-router/") && follow && versions.includes(follow) ? follow : choose(versions, range, latest);
189
+ let version = name.startsWith("@react-router/") && follow && versions.includes(follow) ? follow : choose(versions, range, latest);
190
+ if (version === undefined && pinned !== undefined) {
191
+ version = newestOfMinor(versions, pinned);
192
+ if (version !== undefined) {
193
+ behind.push(`${name}: the registry has no release within ${range} yet; wrote ^${version}, the newest of ${sameMinor(pinned)}`);
194
+ }
195
+ }
261
196
  if (version === undefined) {
262
197
  unmatched.push(`${name}: no release within ${range ?? "any range"}; kept ${current}`);
263
198
  continue;
@@ -271,7 +206,7 @@ async function bumpDependencies(manifest, registry, keep = new Set) {
271
206
  moved.push(`${name} ${current} -> ${next}`);
272
207
  deps[name] = next;
273
208
  }
274
- return { moved, held, failed, unmatched };
209
+ return { moved, held, failed, unmatched, behind };
275
210
  }
276
211
 
277
212
  // src/templates/api.ts
@@ -450,26 +385,46 @@ function apiFiles(name) {
450
385
  };
451
386
  }
452
387
 
388
+ // src/templates/react-router.ts
389
+ import { join as join2 } from "node:path";
390
+ var RENAMED = {
391
+ gitignore: ".gitignore",
392
+ "_bunfig.toml": "bunfig.toml"
393
+ };
394
+ async function reactRouterTemplate(dir, name, alxia) {
395
+ const stored = await Bun.file(join2(dir, "package.json")).json();
396
+ const dependencies = { ...stored.dependencies };
397
+ for (const pkg of Object.keys(dependencies)) {
398
+ if (pkg in alxia)
399
+ dependencies[pkg] = alxia[pkg];
400
+ }
401
+ const manifest = { ...stored, name, dependencies };
402
+ const files = {};
403
+ for await (const path of new Bun.Glob("**").scan({ cwd: dir, dot: true })) {
404
+ if (path === "package.json" || path.endsWith(".DS_Store"))
405
+ continue;
406
+ files[RENAMED[path] ?? path] = Bun.file(join2(dir, path));
407
+ }
408
+ return { manifest, files };
409
+ }
410
+
453
411
  // src/write.ts
412
+ var REACT_ROUTER = fileURLToPath(new URL("../templates/react-router", import.meta.url));
454
413
  async function write(target, template, alxia, io) {
414
+ const name = packageName(target);
455
415
  let manifest;
456
416
  let files;
457
417
  if (template === "api") {
458
- manifest = apiManifest(packageName(target), alxia);
459
- files = apiFiles(packageName(target));
418
+ manifest = apiManifest(name, alxia);
419
+ files = apiFiles(name);
460
420
  } else {
461
- await mkdir(dirname2(target), { recursive: true });
462
- const code = await io.run([process.execPath, "x", ...scaffoldCommand(basename2(target))], dirname2(target));
463
- if (code !== 0) {
464
- throw new Error(`create-react-router exited with ${code}.`);
465
- }
466
- ({ manifest, files } = await alxiaLayer(target, alxia));
421
+ ({ manifest, files } = await reactRouterTemplate(REACT_ROUTER, name, alxia));
467
422
  }
468
423
  io.out("Resolving the newest versions alxia accepts...");
469
- const bumped = await bumpDependencies(manifest, { url: registryUrl(io.env), ...io.fetch ? { fetch: io.fetch } : {} }, new Set(Object.keys(alxia)));
424
+ const bumped = await bumpDependencies(manifest, { url: registryUrl(io.env), ...io.fetch ? { fetch: io.fetch } : {} }, alxia);
470
425
  for (const line of bumped.moved)
471
426
  io.out(` ${line}`);
472
- for (const line of [...bumped.held, ...bumped.unmatched])
427
+ for (const line of [...bumped.held, ...bumped.unmatched, ...bumped.behind])
473
428
  io.out(` ${line}`);
474
429
  if (bumped.failed.length > 0) {
475
430
  io.err(`${NAME}: warning: the registry did not answer for ${bumped.failed.join(", ")}; ` + "kept the versions the template ships.");
@@ -553,7 +508,7 @@ ${USAGE}`);
553
508
  }) !== undefined;
554
509
  const made = await alxiaRanges().then((alxia) => write(target, template, alxia, io)).catch(async (error) => {
555
510
  await clean(target, existed);
556
- io.err(`${NAME}: ${error instanceof ScaffoldChanged ? "" : "failed: "}${error instanceof Error ? error.message : String(error)}`);
511
+ io.err(`${NAME}: failed: ${error instanceof Error ? error.message : String(error)}`);
557
512
  return false;
558
513
  });
559
514
  if (!made)
@@ -595,5 +550,5 @@ function askTemplate(io) {
595
550
  // src/index.ts
596
551
  process.exitCode = await main(process.argv.slice(2), process.cwd(), processIo());
597
552
 
598
- //# debugId=8B48AE430B9AACCF64756E2164756E21
553
+ //# debugId=793DE037BCA1C3D464756E2164756E21
599
554
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/main.ts", "../src/args.ts", "../src/target.ts", "../src/templates/react-router.ts", "../src/versions.ts", "../src/write.ts", "../src/registry.ts", "../src/templates/api.ts", "../src/io.ts", "../src/index.ts"],
3
+ "sources": ["../src/main.ts", "../src/args.ts", "../src/target.ts", "../src/versions.ts", "../src/write.ts", "../src/registry.ts", "../src/templates/api.ts", "../src/templates/react-router.ts", "../src/io.ts", "../src/index.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * The `create-alxia` command: its arguments or answers, the project it\n * writes, what it prints, and its exit code. `index.ts` runs it on the\n * process's own streams; a spec runs it on its own.\n */\nimport { stat } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { isTemplate, NAME, parseArgs, TEMPLATES, type Template } from './args';\nimport type { Io } from './io';\nimport { clean, refusal } from './target';\nimport { ScaffoldChanged } from './templates/react-router';\nimport { alxiaRanges } from './versions';\nimport { write } from './write';\n\nexport { NAME } from './args';\nexport type { Io } from './io';\nexport { processIo } from './io';\nexport { packageName, refusal } from './target';\n\nexport const USAGE = `Usage: bun create @alxia [dir] [options]\n\nWrites a new alxia app in dir, which must be empty or not exist yet. Asks\nfor what is not given.\n\nOptions:\n -t, --template <name> api an alxia app with Zod, a spec and the typed client\n react-router React Router's official template, served by alxia\n --no-install write the files, skip bun install\n -h, --help show this help`;\n\n/** Runs the command in `cwd`; resolves to the process's exit code. */\nexport async function main(\n\targs: readonly string[],\n\tcwd: string,\n\tio: Io,\n): Promise<number> {\n\tconst options = parseArgs(args);\n\tif ('error' in options) {\n\t\tio.err(`${NAME}: ${options.error}\\n\\n${USAGE}`);\n\t\treturn 1;\n\t}\n\tif (options.help) {\n\t\tio.out(USAGE);\n\t\treturn 0;\n\t}\n\n\tconst dir =\n\t\toptions.dir ?? io.ask('Where should the project go?', 'alxia-app');\n\tif (dir === null) {\n\t\tio.err(`${NAME}: cancelled, nothing written.`);\n\t\treturn 1;\n\t}\n\tif (dir === undefined) {\n\t\tio.err(\n\t\t\t`${NAME}: no directory given, and no terminal to ask in.\\n\\n${USAGE}`,\n\t\t);\n\t\treturn 1;\n\t}\n\tconst template = options.template ?? askTemplate(io);\n\tif (template === null) {\n\t\tio.err(`${NAME}: cancelled, nothing written.`);\n\t\treturn 1;\n\t}\n\tif (typeof template === 'object') {\n\t\tio.err(`${NAME}: ${template.error}\\n\\n${USAGE}`);\n\t\treturn 1;\n\t}\n\n\tconst target = resolve(cwd, dir);\n\tconst refused = await refusal(target, dir);\n\tif (refused) {\n\t\tio.err(`${NAME}: ${refused}`);\n\t\treturn 1;\n\t}\n\n\tconst existed = (await stat(target).catch(() => undefined)) !== undefined;\n\tconst made = await alxiaRanges()\n\t\t.then((alxia) => write(target, template, alxia, io))\n\t\t.catch(async (error) => {\n\t\t\t// The directory was empty or absent: what is in it now is ours.\n\t\t\tawait clean(target, existed);\n\t\t\tio.err(\n\t\t\t\t`${NAME}: ${error instanceof ScaffoldChanged ? '' : 'failed: '}${error instanceof Error ? error.message : String(error)}`,\n\t\t\t);\n\t\t\treturn false;\n\t\t});\n\tif (!made) return 1;\n\n\tlet installed = true;\n\tif (options.install) {\n\t\tio.out('\\nInstalling dependencies with bun install...');\n\t\tinstalled = (await io.run([process.execPath, 'install'], target)) === 0;\n\t\tif (!installed)\n\t\t\tio.err(`${NAME}: bun install failed; the files are written.`);\n\t}\n\tio.out(\n\t\tdone(relative(cwd, target) || '.', template, options.install && installed),\n\t);\n\treturn installed ? 0 : 1;\n}\n\n/** The last thing printed: what was written, and the commands to run next. */\nfunction done(where: string, template: Template, installed: boolean): string {\n\tconst steps = [\n\t\twhere === '.' ? undefined : `cd ${where}`,\n\t\tinstalled ? undefined : 'bun install',\n\t\t'bun dev',\n\t].filter((step) => step !== undefined);\n\treturn `\\nDone: ${where === '.' ? 'this directory' : where} holds the ${template} template. Next:\\n\\n${steps\n\t\t.map((step) => ` ${step}`)\n\t\t.join('\\n')}\\n`;\n}\n\n/** The template answered; null when cancelled. */\nfunction askTemplate(io: Io): Template | { error: string } | null {\n\tconst answer = io.ask(`Which template? ${TEMPLATES.join(' or ')}`, 'api');\n\tif (answer === null) return null;\n\tif (answer === undefined) {\n\t\treturn { error: 'no --template given, and no terminal to ask in.' };\n\t}\n\treturn isTemplate(answer)\n\t\t? answer\n\t\t: { error: `unknown template ${answer}: use ${TEMPLATES.join(' or ')}.` };\n}\n",
5
+ "/**\n * The `create-alxia` command: its arguments or answers, the project it\n * writes, what it prints, and its exit code. `index.ts` runs it on the\n * process's own streams; a spec runs it on its own.\n */\nimport { stat } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { isTemplate, NAME, parseArgs, TEMPLATES, type Template } from './args';\nimport type { Io } from './io';\nimport { clean, refusal } from './target';\nimport { alxiaRanges } from './versions';\nimport { write } from './write';\n\nexport { NAME } from './args';\nexport type { Io } from './io';\nexport { processIo } from './io';\nexport { packageName, refusal } from './target';\n\nexport const USAGE = `Usage: bun create @alxia [dir] [options]\n\nWrites a new alxia app in dir, which must be empty or not exist yet. Asks\nfor what is not given.\n\nOptions:\n -t, --template <name> api an alxia app with Zod, a spec and the typed client\n react-router React Router's official template, served by alxia\n --no-install write the files, skip bun install\n -h, --help show this help`;\n\n/** Runs the command in `cwd`; resolves to the process's exit code. */\nexport async function main(\n\targs: readonly string[],\n\tcwd: string,\n\tio: Io,\n): Promise<number> {\n\tconst options = parseArgs(args);\n\tif ('error' in options) {\n\t\tio.err(`${NAME}: ${options.error}\\n\\n${USAGE}`);\n\t\treturn 1;\n\t}\n\tif (options.help) {\n\t\tio.out(USAGE);\n\t\treturn 0;\n\t}\n\n\tconst dir =\n\t\toptions.dir ?? io.ask('Where should the project go?', 'alxia-app');\n\tif (dir === null) {\n\t\tio.err(`${NAME}: cancelled, nothing written.`);\n\t\treturn 1;\n\t}\n\tif (dir === undefined) {\n\t\tio.err(\n\t\t\t`${NAME}: no directory given, and no terminal to ask in.\\n\\n${USAGE}`,\n\t\t);\n\t\treturn 1;\n\t}\n\tconst template = options.template ?? askTemplate(io);\n\tif (template === null) {\n\t\tio.err(`${NAME}: cancelled, nothing written.`);\n\t\treturn 1;\n\t}\n\tif (typeof template === 'object') {\n\t\tio.err(`${NAME}: ${template.error}\\n\\n${USAGE}`);\n\t\treturn 1;\n\t}\n\n\tconst target = resolve(cwd, dir);\n\tconst refused = await refusal(target, dir);\n\tif (refused) {\n\t\tio.err(`${NAME}: ${refused}`);\n\t\treturn 1;\n\t}\n\n\tconst existed = (await stat(target).catch(() => undefined)) !== undefined;\n\tconst made = await alxiaRanges()\n\t\t.then((alxia) => write(target, template, alxia, io))\n\t\t.catch(async (error) => {\n\t\t\t// The directory was empty or absent: what is in it now is ours.\n\t\t\tawait clean(target, existed);\n\t\t\tio.err(\n\t\t\t\t`${NAME}: failed: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t);\n\t\t\treturn false;\n\t\t});\n\tif (!made) return 1;\n\n\tlet installed = true;\n\tif (options.install) {\n\t\tio.out('\\nInstalling dependencies with bun install...');\n\t\tinstalled = (await io.run([process.execPath, 'install'], target)) === 0;\n\t\tif (!installed)\n\t\t\tio.err(`${NAME}: bun install failed; the files are written.`);\n\t}\n\tio.out(\n\t\tdone(relative(cwd, target) || '.', template, options.install && installed),\n\t);\n\treturn installed ? 0 : 1;\n}\n\n/** The last thing printed: what was written, and the commands to run next. */\nfunction done(where: string, template: Template, installed: boolean): string {\n\tconst steps = [\n\t\twhere === '.' ? undefined : `cd ${where}`,\n\t\tinstalled ? undefined : 'bun install',\n\t\t'bun dev',\n\t].filter((step) => step !== undefined);\n\treturn `\\nDone: ${where === '.' ? 'this directory' : where} holds the ${template} template. Next:\\n\\n${steps\n\t\t.map((step) => ` ${step}`)\n\t\t.join('\\n')}\\n`;\n}\n\n/** The template answered; null when cancelled. */\nfunction askTemplate(io: Io): Template | { error: string } | null {\n\tconst answer = io.ask(`Which template? ${TEMPLATES.join(' or ')}`, 'api');\n\tif (answer === null) return null;\n\tif (answer === undefined) {\n\t\treturn { error: 'no --template given, and no terminal to ask in.' };\n\t}\n\treturn isTemplate(answer)\n\t\t? answer\n\t\t: { error: `unknown template ${answer}: use ${TEMPLATES.join(' or ')}.` };\n}\n",
6
6
  "/** The command line of `create-alxia`, read into what to create. */\n\n/** The command's name, which starts every line it prints to stderr. */\nexport const NAME = 'create-alxia';\n\n/** The templates, in the order the prompt lists them. */\nexport const TEMPLATES = ['api', 'react-router'] as const;\nexport type Template = (typeof TEMPLATES)[number];\n\nexport function isTemplate(value: string): value is Template {\n\treturn (TEMPLATES as readonly string[]).includes(value);\n}\n\n/** What the arguments asked for. A missing `dir` or `template` is prompted. */\nexport interface Options {\n\treadonly dir?: string;\n\treadonly template?: Template;\n\treadonly install: boolean;\n\treadonly help: boolean;\n}\n\n/** The arguments as options, or the message that refuses them. */\nexport function parseArgs(\n\targs: readonly string[],\n): Options | { readonly error: string } {\n\tlet dir: string | undefined;\n\tlet template: Template | undefined;\n\tlet install = true;\n\tlet help = false;\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i] as string;\n\t\tif (arg === '--help' || arg === '-h') help = true;\n\t\telse if (arg === '--no-install') install = false;\n\t\telse if (\n\t\t\targ === '--template' ||\n\t\t\targ === '-t' ||\n\t\t\targ.startsWith('--template=')\n\t\t) {\n\t\t\tconst value = arg.includes('=')\n\t\t\t\t? arg.slice(arg.indexOf('=') + 1)\n\t\t\t\t: args[++i];\n\t\t\tif (value === undefined || value === '') {\n\t\t\t\treturn { error: `${arg} needs a template: ${TEMPLATES.join(' or ')}.` };\n\t\t\t}\n\t\t\tif (!isTemplate(value)) {\n\t\t\t\treturn {\n\t\t\t\t\terror: `unknown template ${value}: use ${TEMPLATES.join(' or ')}.`,\n\t\t\t\t};\n\t\t\t}\n\t\t\ttemplate = value;\n\t\t} else if (arg.startsWith('-')) return { error: `unknown option ${arg}.` };\n\t\telse if (dir === undefined) dir = arg;\n\t\telse return { error: `one directory only, given ${dir} and ${arg}.` };\n\t}\n\treturn {\n\t\t...(dir === undefined ? {} : { dir }),\n\t\t...(template === undefined ? {} : { template }),\n\t\tinstall,\n\t\thelp,\n\t};\n}\n",
7
7
  "/** The directory a project is written into: its name, whether it may be, and undoing it. */\nimport { readdir, rm, stat } from 'node:fs/promises';\nimport { basename, join } from 'node:path';\n\n/** A directory name as a package name: lowercased, `-` for the rest. */\nexport function packageName(dir: string): string {\n\tconst name = basename(dir)\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9._~-]+/g, '-')\n\t\t.replace(/^[._-]+|-+$/g, '');\n\treturn name || 'alxia-app';\n}\n\n/** Why `target` cannot take a new project, or undefined when it can. */\nexport async function refusal(\n\ttarget: string,\n\tshown: string = target,\n): Promise<string | undefined> {\n\tconst info = await stat(target).catch(() => undefined);\n\tif (!info) return undefined;\n\tif (!info.isDirectory()) return `${shown} exists and is not a directory.`;\n\tconst entries = (await readdir(target)).sort();\n\tif (entries.length === 0) return undefined;\n\treturn (\n\t\t`${shown} is not empty (${entries.slice(0, 3).join(', ')}${entries.length > 3 ? ', ...' : ''}), ` +\n\t\t'and create-alxia writes only into an empty directory. Choose another directory, or empty this one.'\n\t);\n}\n\n/** Removes what was written: the directory, or what is in the one that was there. */\nexport async function clean(target: string, existed: boolean): Promise<void> {\n\tif (!existed) {\n\t\tawait rm(target, { recursive: true, force: true });\n\t\treturn;\n\t}\n\tfor (const entry of await readdir(target).catch(() => [])) {\n\t\tawait rm(join(target, entry), { recursive: true, force: true });\n\t}\n}\n",
8
- "/**\n * The `react-router` template: React Router's official one, from its own\n * `create-react-router`, then alxia added as `examples/react-router` adds it\n * — `@alxia/core` and `@alxia/react-router` as dependencies, `alxia()` in\n * the Vite plugins, `start` running the build on Bun, and a `bunfig.toml`\n * that starts React Router's CLI on Bun. Each edit checks the file is the one\n * it expects first, and refuses rather than write a project that does not\n * work.\n */\nimport { join } from 'node:path';\nimport type { Manifest } from '../registry';\nimport { type AlxiaPackage, highestMajor, PEER_RANGES } from '../versions';\n\n/**\n * The scaffold's command line: the newest `create-react-router` of the\n * highest React Router major `@alxia/react-router` accepts, with no prompt,\n * no install and no git repository — the install is ours, once alxia is in.\n */\nexport function scaffoldCommand(dir: string): string[] {\n\treturn [\n\t\t`create-react-router@${highestMajor(PEER_RANGES['react-router'])}`,\n\t\tdir,\n\t\t'--yes',\n\t\t'--no-install',\n\t\t'--no-git-init',\n\t\t'--no-agent-skills',\n\t\t'--no-motion',\n\t];\n}\n\n/** The scaffold is not what the edits expect: nothing more is written, and `main` removes it. */\nexport class ScaffoldChanged extends Error {\n\tconstructor(file: string, expected: string) {\n\t\tsuper(\n\t\t\t`create-react-router's ${file} is not what this @alxia/create expects: ${expected}. ` +\n\t\t\t\t'Nothing was kept. Try the newest @alxia/create, or add @alxia/react-router to a React Router app by hand, as its README shows.',\n\t\t);\n\t\tthis.name = 'ScaffoldChanged';\n\t}\n}\n\nexport const BUNFIG = `[run]\n# The React Router CLI is a node script: this starts it on Bun, which\n# alxia's server needs, even where a node is installed.\nbun = true\n`;\n\nconst IMPORT = 'import { alxia } from \"@alxia/react-router/vite\";\\n';\n\n/** `vite.config.ts` with `alxia()` after `reactRouter()`. */\nexport function addPlugin(config: string): string {\n\tconst calls = config.match(/\\breactRouter\\(\\)/g) ?? [];\n\tif (\n\t\t!config.includes('from \"@react-router/dev/vite\"') ||\n\t\t!/plugins:\\s*\\[[^\\]]*\\breactRouter\\(\\)[^\\]]*\\]/.test(config) ||\n\t\tcalls.length !== 1\n\t) {\n\t\tthrow new ScaffoldChanged(\n\t\t\t'vite.config.ts',\n\t\t\t'reactRouter() from \"@react-router/dev/vite\", called once in plugins: [...]',\n\t\t);\n\t}\n\tif (config.includes('@alxia/react-router/vite')) {\n\t\tthrow new ScaffoldChanged(\n\t\t\t'vite.config.ts',\n\t\t\t'it already imports @alxia/react-router/vite',\n\t\t);\n\t}\n\treturn IMPORT + config.replace(/\\breactRouter\\(\\)/, 'reactRouter(), alxia()');\n}\n\n/** The manifest with alxia's dependencies and `start` on Bun. */\nexport function addAlxia(\n\tmanifest: Manifest,\n\talxia: Record<AlxiaPackage, string>,\n): Manifest {\n\tconst scripts = manifest['scripts'] as Record<string, string> | undefined;\n\tif (\n\t\tscripts?.['dev'] !== 'react-router dev' ||\n\t\tscripts['build'] !== 'react-router build' ||\n\t\tscripts['start'] === undefined ||\n\t\tmanifest.dependencies?.['react-router'] === undefined\n\t) {\n\t\tthrow new ScaffoldChanged(\n\t\t\t'package.json',\n\t\t\t'react-router in its dependencies, and the scripts `dev: react-router dev`, `build: react-router build` and a `start`',\n\t\t);\n\t}\n\tconst dependencies = sorted({\n\t\t...manifest.dependencies,\n\t\t'@alxia/core': alxia['@alxia/core'],\n\t\t'@alxia/react-router': alxia['@alxia/react-router'],\n\t});\n\treturn {\n\t\t...manifest,\n\t\tscripts: { ...scripts, start: 'bun build/server/index.js' },\n\t\tdependencies,\n\t};\n}\n\nfunction sorted(deps: Record<string, string>): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(deps).sort(([a], [b]) => (a < b ? -1 : 1)),\n\t);\n}\n\n/**\n * Reads what the scaffold wrote in `dir` and checks it, without writing:\n * the manifest with alxia in, and the files to write beside it.\n */\nexport async function alxiaLayer(\n\tdir: string,\n\talxia: Record<AlxiaPackage, string>,\n): Promise<{ manifest: Manifest; files: Record<string, string> }> {\n\tconst read = async (file: string) => {\n\t\tconst handle = Bun.file(join(dir, file));\n\t\tif (!(await handle.exists())) {\n\t\t\tthrow new ScaffoldChanged(file, 'it is missing');\n\t\t}\n\t\treturn handle.text();\n\t};\n\tconst manifest = addAlxia(JSON.parse(await read('package.json')), alxia);\n\tconst config = addPlugin(await read('vite.config.ts'));\n\tif (await Bun.file(join(dir, 'bunfig.toml')).exists()) {\n\t\tthrow new ScaffoldChanged('bunfig.toml', 'none, and there is one');\n\t}\n\treturn {\n\t\tmanifest,\n\t\tfiles: { 'vite.config.ts': config, 'bunfig.toml': BUNFIG },\n\t};\n}\n",
9
- "/**\n * The versions a generated project starts from: alxia's own packages at the\n * versions this release of `@alxia/create` was published beside, and the\n * ranges alxia's peers accept, which the registry's newest versions must\n * stay within.\n */\nimport { dirname } from 'node:path';\n\n/** The `@alxia/*` packages a template depends on. */\nexport type AlxiaPackage =\n\t| '@alxia/client'\n\t| '@alxia/core'\n\t| '@alxia/react-router';\n\nconst ALXIA_PACKAGES: readonly AlxiaPackage[] = [\n\t'@alxia/client',\n\t'@alxia/core',\n\t'@alxia/react-router',\n];\n\n/**\n * The peer ranges of alxia's packages that a template's other dependencies\n * must stay within, by the package they constrain: `typescript` is every\n * package's, `zod` is `@alxia/zod`'s, `react-router` and `vite` are\n * `@alxia/react-router`'s. `versions.spec.ts` checks each against the\n * package that declares it, so a widened peer fails there until it is\n * widened here too.\n */\nexport const PEER_RANGES = {\n\ttypescript: '^6.0.3 || ^7.0.0',\n\tzod: '^4.2.0',\n\t'react-router': '^8.0.0',\n\tvite: '^7.0.0 || ^8.0.0',\n} as const;\n\n/** The highest major a range such as `^7.0.0 || ^8.0.0` names. */\nexport function highestMajor(range: string): number {\n\tconst majors = [...range.matchAll(/(?:^|[\\s|^~>=])(\\d+)/g)].map((match) =>\n\t\tNumber(match[1]),\n\t);\n\tif (majors.length === 0) throw new Error(`no major in range ${range}`);\n\treturn Math.max(...majors);\n}\n\n/**\n * The range a generated project declares for each `@alxia/*` package: what\n * this package's own `package.json` says. Published, that is `^<version>`,\n * which `bun publish` writes in place of `workspace:^` from the version\n * beside it in the workspace. Inside the workspace, `workspace:^` is\n * resolved the same way, from the sibling's installed `package.json`.\n */\nexport async function alxiaRanges(\n\tmanifestUrl: URL = new URL('../package.json', import.meta.url),\n): Promise<Record<AlxiaPackage, string>> {\n\tconst manifest = await Bun.file(manifestUrl).json();\n\tconst declared: Record<string, string> = manifest.devDependencies ?? {};\n\tconst ranges = {} as Record<AlxiaPackage, string>;\n\tfor (const name of ALXIA_PACKAGES) {\n\t\tconst range = declared[name];\n\t\tif (range === undefined) {\n\t\t\tthrow new Error(`@alxia/create: its package.json names no ${name}`);\n\t\t}\n\t\tranges[name] = range.startsWith('workspace:')\n\t\t\t? await workspaceRange(name, range, dirname(manifestUrl.pathname))\n\t\t\t: range;\n\t}\n\treturn ranges;\n}\n\n/** `workspace:^` as `bun publish` rewrites it: `^` and the sibling's version. */\nasync function workspaceRange(\n\tname: string,\n\trange: string,\n\tfrom: string,\n): Promise<string> {\n\tconst file = Bun.resolveSync(`${name}/package.json`, from);\n\tconst { version } = await Bun.file(file).json();\n\tconst prefix = range.slice('workspace:'.length);\n\treturn prefix === '*' ? version : `${prefix}${version}`;\n}\n",
10
- "/** Writes a template's project, its dependencies moved to the registry's newest. */\nimport { mkdir } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport { NAME, type Template } from './args';\nimport type { Io } from './io';\nimport { bumpDependencies, type Manifest, registryUrl } from './registry';\nimport { packageName } from './target';\nimport { apiFiles, apiManifest } from './templates/api';\nimport { alxiaLayer, scaffoldCommand } from './templates/react-router';\nimport type { AlxiaPackage } from './versions';\n\n/** Writes the project into `target`; throws on a scaffold that changed. */\nexport async function write(\n\ttarget: string,\n\ttemplate: Template,\n\talxia: Record<AlxiaPackage, string>,\n\tio: Io,\n): Promise<true> {\n\tlet manifest: Manifest;\n\tlet files: Record<string, string>;\n\tif (template === 'api') {\n\t\tmanifest = apiManifest(packageName(target), alxia);\n\t\tfiles = apiFiles(packageName(target));\n\t} else {\n\t\tawait mkdir(dirname(target), { recursive: true });\n\t\tconst code = await io.run(\n\t\t\t[process.execPath, 'x', ...scaffoldCommand(basename(target))],\n\t\t\tdirname(target),\n\t\t);\n\t\tif (code !== 0) {\n\t\t\tthrow new Error(`create-react-router exited with ${code}.`);\n\t\t}\n\t\t({ manifest, files } = await alxiaLayer(target, alxia));\n\t}\n\n\tio.out('Resolving the newest versions alxia accepts...');\n\tconst bumped = await bumpDependencies(\n\t\tmanifest,\n\t\t{ url: registryUrl(io.env), ...(io.fetch ? { fetch: io.fetch } : {}) },\n\t\tnew Set(Object.keys(alxia)),\n\t);\n\tfor (const line of bumped.moved) io.out(` ${line}`);\n\tfor (const line of [...bumped.held, ...bumped.unmatched]) io.out(` ${line}`);\n\tif (bumped.failed.length > 0) {\n\t\tio.err(\n\t\t\t`${NAME}: warning: the registry did not answer for ${bumped.failed.join(', ')}; ` +\n\t\t\t\t'kept the versions the template ships.',\n\t\t);\n\t}\n\n\tfiles['package.json'] = `${JSON.stringify(manifest, null, 2)}\\n`;\n\tfor (const [file, content] of Object.entries(files)) {\n\t\tawait Bun.write(join(target, file), content);\n\t}\n\treturn true;\n}\n",
11
- "/**\n * Moves a generated project's dependencies to their newest versions on the\n * registry, within what alxia accepts: a template ships the versions it was\n * written with, and React Router's lags behind its own releases.\n */\nimport { PEER_RANGES } from './versions';\n\n/** The dependency fields of a manifest, as a template writes them. */\nexport interface Manifest {\n\tdependencies?: Record<string, string>;\n\tdevDependencies?: Record<string, string>;\n\t[key: string]: unknown;\n}\n\n/** How to reach the registry: its URL, and the `fetch` to call it with. */\nexport interface Registry {\n\treadonly url: string;\n\treadonly fetch?: (request: Request) => Promise<Response>;\n\t/** How long one package's metadata may take, in milliseconds. */\n\treadonly timeout?: number;\n}\n\n/** What a bump changed, and what it could not. */\nexport interface Bumped {\n\t/** One line per dependency moved: `vite ^8.0.3 -> ^8.3.2`. */\n\treadonly moved: string[];\n\t/** A newer major that was left out, because a range refuses it. */\n\treadonly held: string[];\n\t/** A package whose metadata did not arrive: its version is unchanged. */\n\treadonly failed: string[];\n\t/** A package with no release within its range: its version is unchanged. */\n\treadonly unmatched: string[];\n}\n\n/** The registry to resolve against: the one Bun or npm was given, or npm's. */\nexport function registryUrl(env: Record<string, string | undefined>): string {\n\tconst url =\n\t\tenv['BUN_CONFIG_REGISTRY'] ||\n\t\tenv['npm_config_registry'] ||\n\t\t'https://registry.npmjs.org';\n\treturn url.replace(/\\/+$/, '');\n}\n\n/**\n * The range alxia's peers hold `name` to — React Router's packages follow\n * `react-router`'s — or undefined when none does, and npm's `latest` is\n * taken.\n */\nexport function allowedRange(name: string): string | undefined {\n\tif (name === 'react-router' || name.startsWith('@react-router/')) {\n\t\treturn PEER_RANGES['react-router'];\n\t}\n\treturn name in PEER_RANGES\n\t\t? PEER_RANGES[name as keyof typeof PEER_RANGES]\n\t\t: undefined;\n}\n\ninterface Packument {\n\treadonly 'dist-tags'?: Record<string, string>;\n\treadonly versions?: Record<string, unknown>;\n}\n\n/** The newest release (not a prerelease) of `versions` within `range`. */\nexport function newestWithin(\n\tversions: readonly string[],\n\trange: string,\n): string | undefined {\n\treturn versions\n\t\t.filter((v) => !v.includes('-') && Bun.semver.satisfies(v, range))\n\t\t.sort(Bun.semver.order)\n\t\t.at(-1);\n}\n\nasync function packument(name: string, registry: Registry): Promise<Packument> {\n\tconst call = registry.fetch ?? ((request: Request) => fetch(request));\n\tconst response = await call(\n\t\tnew Request(`${registry.url}/${name.replace('/', '%2f')}`, {\n\t\t\theaders: { accept: 'application/vnd.npm.install-v1+json' },\n\t\t\tsignal: AbortSignal.timeout(registry.timeout ?? 5000),\n\t\t}),\n\t);\n\tif (!response.ok) throw new Error(`${response.status}`);\n\treturn (await response.json()) as Packument;\n}\n\n/** Within `range`, the newest; with none, npm's `latest`. */\nfunction choose(\n\tversions: readonly string[],\n\trange: string | undefined,\n\tlatest: string | undefined,\n): string | undefined {\n\tif (range !== undefined) return newestWithin(versions, range);\n\treturn latest && versions.includes(latest)\n\t\t? latest\n\t\t: newestWithin(versions, '*');\n}\n\n/**\n * Rewrites every dependency of `manifest` but those in `keep` to `^` its\n * newest version: within the range alxia's peers hold it to, or npm's\n * `latest` when none does. React Router's own packages take the\n * version `react-router` resolved to, when they have it: `@react-router/node`\n * pins `react-router` exactly. A package whose metadata fails to arrive keeps\n * its version, and is named in `failed`.\n */\nexport async function bumpDependencies(\n\tmanifest: Manifest,\n\tregistry: Registry,\n\tkeep: ReadonlySet<string> = new Set(),\n): Promise<Bumped> {\n\tconst fields = ['dependencies', 'devDependencies'] as const;\n\tconst names = fields.flatMap((field) =>\n\t\tObject.keys(manifest[field] ?? {}).filter((name) => !keep.has(name)),\n\t);\n\tconst fetched = new Map(\n\t\tawait Promise.all(\n\t\t\tnames.map(\n\t\t\t\tasync (name) =>\n\t\t\t\t\t[\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tawait packument(name, registry).catch(() => undefined),\n\t\t\t\t\t] as const,\n\t\t\t),\n\t\t),\n\t);\n\tconst moved: string[] = [];\n\tconst held: string[] = [];\n\tconst failed: string[] = [];\n\tconst unmatched: string[] = [];\n\tconst chosen = new Map<string, string>();\n\t// react-router first: its siblings follow the version it settles on.\n\tconst ordered = [...names].sort(\n\t\t(a, b) => Number(b === 'react-router') - Number(a === 'react-router'),\n\t);\n\tfor (const name of ordered) {\n\t\tconst field = fields.find((f) => manifest[f]?.[name] !== undefined);\n\t\tconst deps = field && manifest[field];\n\t\tconst current = deps?.[name];\n\t\tif (!deps || current === undefined) continue;\n\t\tconst meta = fetched.get(name);\n\t\tif (!meta?.versions) {\n\t\t\tfailed.push(name);\n\t\t\tcontinue;\n\t\t}\n\t\tconst versions = Object.keys(meta.versions);\n\t\tconst range = allowedRange(name);\n\t\tconst latest = meta['dist-tags']?.['latest'];\n\t\tconst follow = chosen.get('react-router');\n\t\tconst version =\n\t\t\tname.startsWith('@react-router/') && follow && versions.includes(follow)\n\t\t\t\t? follow\n\t\t\t\t: choose(versions, range, latest);\n\t\tif (version === undefined) {\n\t\t\tunmatched.push(\n\t\t\t\t`${name}: no release within ${range ?? 'any range'}; kept ${current}`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tchosen.set(name, version);\n\t\tif (\n\t\t\trange !== undefined &&\n\t\t\tlatest &&\n\t\t\tBun.semver.order(latest, version) > 0 &&\n\t\t\t!Bun.semver.satisfies(latest, range)\n\t\t) {\n\t\t\theld.push(\n\t\t\t\t`${name}: kept to ${range}, where the newest is ${version}; npm's latest, ${latest}, is outside it`,\n\t\t\t);\n\t\t}\n\t\tconst next = `^${version}`;\n\t\tif (next !== current) moved.push(`${name} ${current} -> ${next}`);\n\t\tdeps[name] = next;\n\t}\n\treturn { moved, held, failed, unmatched };\n}\n",
8
+ "/**\n * The versions a generated project starts from: alxia's own packages at the\n * versions this release of `@alxia/create` was published beside, and the\n * ranges alxia's peers accept, which the registry's newest versions must\n * stay within.\n */\nimport { dirname } from 'node:path';\n\n/** The `@alxia/*` packages a template depends on. */\nexport type AlxiaPackage =\n\t| '@alxia/client'\n\t| '@alxia/core'\n\t| '@alxia/react-router';\n\nconst ALXIA_PACKAGES: readonly AlxiaPackage[] = [\n\t'@alxia/client',\n\t'@alxia/core',\n\t'@alxia/react-router',\n];\n\n/**\n * The peer ranges of alxia's packages that a template's other dependencies\n * must stay within, by the package they constrain: `typescript` is every\n * package's, `zod` is `@alxia/zod`'s, `react-router` and `vite` are\n * `@alxia/react-router`'s. `versions.spec.ts` checks each against the\n * package that declares it, so a widened peer fails there until it is\n * widened here too.\n */\nexport const PEER_RANGES = {\n\ttypescript: '^6.0.3 || ^7.0.0',\n\tzod: '^4.2.0',\n\t'react-router': '^8.0.0',\n\tvite: '^7.0.0 || ^8.0.0',\n} as const;\n\n/**\n * The range a generated project declares for each `@alxia/*` package: what\n * this package's own `package.json` says. Published, that is `^<version>`,\n * which `bun publish` writes in place of `workspace:^` from the version\n * beside it in the workspace. Inside the workspace, `workspace:^` is\n * resolved the same way, from the sibling's installed `package.json`.\n */\nexport async function alxiaRanges(\n\tmanifestUrl: URL = new URL('../package.json', import.meta.url),\n): Promise<Record<AlxiaPackage, string>> {\n\tconst manifest = await Bun.file(manifestUrl).json();\n\tconst declared: Record<string, string> = manifest.devDependencies ?? {};\n\tconst ranges = {} as Record<AlxiaPackage, string>;\n\tfor (const name of ALXIA_PACKAGES) {\n\t\tconst range = declared[name];\n\t\tif (range === undefined) {\n\t\t\tthrow new Error(`@alxia/create: its package.json names no ${name}`);\n\t\t}\n\t\tranges[name] = range.startsWith('workspace:')\n\t\t\t? await workspaceRange(name, range, dirname(manifestUrl.pathname))\n\t\t\t: range;\n\t}\n\treturn ranges;\n}\n\n/** `workspace:^` as `bun publish` rewrites it: `^` and the sibling's version. */\nasync function workspaceRange(\n\tname: string,\n\trange: string,\n\tfrom: string,\n): Promise<string> {\n\tconst file = Bun.resolveSync(`${name}/package.json`, from);\n\tconst { version } = await Bun.file(file).json();\n\tconst prefix = range.slice('workspace:'.length);\n\treturn prefix === '*' ? version : `${prefix}${version}`;\n}\n",
9
+ "/** Writes a template's project, its dependencies moved to the registry's newest. */\n\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { NAME, type Template } from './args';\nimport type { Io } from './io';\nimport { bumpDependencies, type Manifest, registryUrl } from './registry';\nimport { packageName } from './target';\nimport { apiFiles, apiManifest } from './templates/api';\nimport { reactRouterTemplate } from './templates/react-router';\nimport type { AlxiaPackage } from './versions';\n\n/**\n * The `react-router` template's files, beside `src/` here and beside\n * `dist/` published: this module is bundled into `dist/index.js`, as\n * `versions.ts` reads `../package.json`.\n */\nconst REACT_ROUTER = fileURLToPath(\n\tnew URL('../templates/react-router', import.meta.url),\n);\n\n/** Writes the project into `target`. */\nexport async function write(\n\ttarget: string,\n\ttemplate: Template,\n\talxia: Record<AlxiaPackage, string>,\n\tio: Io,\n): Promise<true> {\n\tconst name = packageName(target);\n\tlet manifest: Manifest;\n\tlet files: Record<string, string | Blob>;\n\tif (template === 'api') {\n\t\tmanifest = apiManifest(name, alxia);\n\t\tfiles = apiFiles(name);\n\t} else {\n\t\t({ manifest, files } = await reactRouterTemplate(\n\t\t\tREACT_ROUTER,\n\t\t\tname,\n\t\t\talxia,\n\t\t));\n\t}\n\n\tio.out('Resolving the newest versions alxia accepts...');\n\tconst bumped = await bumpDependencies(\n\t\tmanifest,\n\t\t{ url: registryUrl(io.env), ...(io.fetch ? { fetch: io.fetch } : {}) },\n\t\talxia,\n\t);\n\tfor (const line of bumped.moved) io.out(` ${line}`);\n\tfor (const line of [...bumped.held, ...bumped.unmatched, ...bumped.behind])\n\t\tio.out(` ${line}`);\n\tif (bumped.failed.length > 0) {\n\t\tio.err(\n\t\t\t`${NAME}: warning: the registry did not answer for ${bumped.failed.join(', ')}; ` +\n\t\t\t\t'kept the versions the template ships.',\n\t\t);\n\t}\n\n\tfiles['package.json'] = `${JSON.stringify(manifest, null, 2)}\\n`;\n\tfor (const [file, content] of Object.entries(files)) {\n\t\tawait Bun.write(join(target, file), content);\n\t}\n\treturn true;\n}\n",
10
+ "/**\n * Moves a generated project's dependencies to their newest versions on the\n * registry, within what alxia accepts: a template ships the versions it was\n * written with, and React Router's lags behind its own releases. alxia's own\n * packages move within the ranges this `@alxia/create` was published with,\n * and fall back on the same minor when the registry does not have the\n * version those ranges start at yet.\n */\nimport { PEER_RANGES } from './versions';\n\n/** The dependency fields of a manifest, as a template writes them. */\nexport interface Manifest {\n\tdependencies?: Record<string, string>;\n\tdevDependencies?: Record<string, string>;\n\t[key: string]: unknown;\n}\n\n/** How to reach the registry: its URL, and the `fetch` to call it with. */\nexport interface Registry {\n\treadonly url: string;\n\treadonly fetch?: (request: Request) => Promise<Response>;\n\t/** How long one package's metadata may take, in milliseconds. */\n\treadonly timeout?: number;\n}\n\n/** What a bump changed, and what it could not. */\nexport interface Bumped {\n\t/** One line per dependency moved: `vite ^8.0.3 -> ^8.3.2`. */\n\treadonly moved: string[];\n\t/** A newer major that was left out, because a range refuses it. */\n\treadonly held: string[];\n\t/** A package whose metadata did not arrive: its version is unchanged. */\n\treadonly failed: string[];\n\t/** A package with no release within its range: its version is unchanged. */\n\treadonly unmatched: string[];\n\t/**\n\t * An `@alxia/*` package whose version the range starts at is not on the\n\t * registry yet, as just after a release: the newest of the same minor\n\t * was written instead.\n\t */\n\treadonly behind: string[];\n}\n\n/** The registry to resolve against: the one Bun or npm was given, or npm's. */\nexport function registryUrl(env: Record<string, string | undefined>): string {\n\tconst url =\n\t\tenv['BUN_CONFIG_REGISTRY'] ||\n\t\tenv['npm_config_registry'] ||\n\t\t'https://registry.npmjs.org';\n\treturn url.replace(/\\/+$/, '');\n}\n\n/**\n * The range alxia's peers hold `name` to — React Router's packages follow\n * `react-router`'s — or undefined when none does, and npm's `latest` is\n * taken.\n */\nexport function allowedRange(name: string): string | undefined {\n\tif (name === 'react-router' || name.startsWith('@react-router/')) {\n\t\treturn PEER_RANGES['react-router'];\n\t}\n\treturn name in PEER_RANGES\n\t\t? PEER_RANGES[name as keyof typeof PEER_RANGES]\n\t\t: undefined;\n}\n\ninterface Packument {\n\treadonly 'dist-tags'?: Record<string, string>;\n\treadonly versions?: Record<string, unknown>;\n}\n\n/** The newest release (not a prerelease) of `versions` within `range`. */\nexport function newestWithin(\n\tversions: readonly string[],\n\trange: string,\n): string | undefined {\n\treturn versions\n\t\t.filter((v) => !v.includes('-') && Bun.semver.satisfies(v, range))\n\t\t.sort(Bun.semver.order)\n\t\t.at(-1);\n}\n\nasync function packument(name: string, registry: Registry): Promise<Packument> {\n\tconst call = registry.fetch ?? ((request: Request) => fetch(request));\n\tconst response = await call(\n\t\tnew Request(`${registry.url}/${name.replace('/', '%2f')}`, {\n\t\t\theaders: { accept: 'application/vnd.npm.install-v1+json' },\n\t\t\tsignal: AbortSignal.timeout(registry.timeout ?? 5000),\n\t\t}),\n\t);\n\tif (!response.ok) throw new Error(`${response.status}`);\n\treturn (await response.json()) as Packument;\n}\n\n/** Within `range`, the newest; with none, npm's `latest`. */\nfunction choose(\n\tversions: readonly string[],\n\trange: string | undefined,\n\tlatest: string | undefined,\n): string | undefined {\n\tif (range !== undefined) return newestWithin(versions, range);\n\treturn latest && versions.includes(latest)\n\t\t? latest\n\t\t: newestWithin(versions, '*');\n}\n\n/**\n * `range`'s own minor, from its first version: `~0.3.0` for `^0.3.1`, or\n * undefined for a range that names no version.\n */\nexport function sameMinor(range: string): string | undefined {\n\tconst match = /(\\d+)\\.(\\d+)\\.\\d+/.exec(range);\n\treturn match ? `~${match[1]}.${match[2]}.0` : undefined;\n}\n\n/**\n * For a `built` range with no release on the registry: the newest of its\n * own minor whose `^` still takes the version the range starts at, or\n * undefined. Below 0.1, `^0.0.2` does not take 0.0.3: no fallback there.\n */\nexport function newestOfMinor(\n\tversions: readonly string[],\n\trange: string,\n): string | undefined {\n\tconst minor = sameMinor(range);\n\tconst start = /\\d+\\.\\d+\\.\\d+/.exec(range)?.[0];\n\tconst version = minor && newestWithin(versions, minor);\n\treturn version && start && Bun.semver.satisfies(start, `^${version}`)\n\t\t? version\n\t\t: undefined;\n}\n\n/**\n * Rewrites every dependency of `manifest` to `^` its newest version: within\n * `built[name]` for a package it names — alxia's, at the ranges this\n * `@alxia/create` was published with — else within the range alxia's peers\n * hold it to, else npm's `latest`. A package of `built` with no release in\n * its range, as when npm has not yet propagated a version published minutes\n * ago, takes the newest of the range's own minor, named in `behind`: `^` it\n * is still within the range. React Router's own packages take the version\n * `react-router` resolved to, when they have it: `@react-router/node` pins\n * `react-router` exactly. A package whose metadata fails to arrive keeps its\n * version, and is named in `failed`.\n */\nexport async function bumpDependencies(\n\tmanifest: Manifest,\n\tregistry: Registry,\n\tbuilt: Readonly<Record<string, string>> = {},\n): Promise<Bumped> {\n\tconst fields = ['dependencies', 'devDependencies'] as const;\n\tconst names = fields.flatMap((field) => Object.keys(manifest[field] ?? {}));\n\tconst fetched = new Map(\n\t\tawait Promise.all(\n\t\t\tnames.map(\n\t\t\t\tasync (name) =>\n\t\t\t\t\t[\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tawait packument(name, registry).catch(() => undefined),\n\t\t\t\t\t] as const,\n\t\t\t),\n\t\t),\n\t);\n\tconst moved: string[] = [];\n\tconst held: string[] = [];\n\tconst failed: string[] = [];\n\tconst unmatched: string[] = [];\n\tconst behind: string[] = [];\n\tconst chosen = new Map<string, string>();\n\t// react-router first: its siblings follow the version it settles on.\n\tconst ordered = [...names].sort(\n\t\t(a, b) => Number(b === 'react-router') - Number(a === 'react-router'),\n\t);\n\tfor (const name of ordered) {\n\t\tconst field = fields.find((f) => manifest[f]?.[name] !== undefined);\n\t\tconst deps = field && manifest[field];\n\t\tconst current = deps?.[name];\n\t\tif (!deps || current === undefined) continue;\n\t\tconst meta = fetched.get(name);\n\t\tif (!meta?.versions) {\n\t\t\tfailed.push(name);\n\t\t\tcontinue;\n\t\t}\n\t\tconst versions = Object.keys(meta.versions);\n\t\tconst pinned = built[name];\n\t\tconst range = pinned ?? allowedRange(name);\n\t\tconst latest = meta['dist-tags']?.['latest'];\n\t\tconst follow = chosen.get('react-router');\n\t\tlet version =\n\t\t\tname.startsWith('@react-router/') && follow && versions.includes(follow)\n\t\t\t\t? follow\n\t\t\t\t: choose(versions, range, latest);\n\t\tif (version === undefined && pinned !== undefined) {\n\t\t\tversion = newestOfMinor(versions, pinned);\n\t\t\tif (version !== undefined) {\n\t\t\t\tbehind.push(\n\t\t\t\t\t`${name}: the registry has no release within ${range} yet; wrote ^${version}, the newest of ${sameMinor(pinned)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (version === undefined) {\n\t\t\tunmatched.push(\n\t\t\t\t`${name}: no release within ${range ?? 'any range'}; kept ${current}`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tchosen.set(name, version);\n\t\tif (\n\t\t\trange !== undefined &&\n\t\t\tlatest &&\n\t\t\tBun.semver.order(latest, version) > 0 &&\n\t\t\t!Bun.semver.satisfies(latest, range)\n\t\t) {\n\t\t\theld.push(\n\t\t\t\t`${name}: kept to ${range}, where the newest is ${version}; npm's latest, ${latest}, is outside it`,\n\t\t\t);\n\t\t}\n\t\tconst next = `^${version}`;\n\t\tif (next !== current) moved.push(`${name} ${current} -> ${next}`);\n\t\tdeps[name] = next;\n\t}\n\treturn { moved, held, failed, unmatched, behind };\n}\n",
12
11
  "/**\n * The `api` template: an alxia app with Zod, one validated route behind a\n * hook of its own, a spec that calls it in process and through the typed\n * client, and the scripts to run, test, typecheck and build it.\n */\nimport type { Manifest } from '../registry';\nimport type { AlxiaPackage } from '../versions';\n\n/**\n * The template's manifest. The versions of `zod`, `typescript` and\n * `@types/bun` are where it starts: `bumpDependencies` moves each to the\n * registry's newest within alxia's peer ranges.\n */\nexport function apiManifest(\n\tname: string,\n\talxia: Record<AlxiaPackage, string>,\n): Manifest {\n\treturn {\n\t\tname,\n\t\tprivate: true,\n\t\ttype: 'module',\n\t\tscripts: {\n\t\t\tdev: 'bun --watch src/server.ts',\n\t\t\tbuild: 'bun build src/server.ts --target=bun --outdir=dist',\n\t\t\tstart: 'bun dist/server.js',\n\t\t\ttest: 'bun test',\n\t\t\ttypecheck: 'tsc --noEmit',\n\t\t},\n\t\tdependencies: {\n\t\t\t'@alxia/core': alxia['@alxia/core'],\n\t\t\tzod: '^4.2.0',\n\t\t},\n\t\tdevDependencies: {\n\t\t\t'@alxia/client': alxia['@alxia/client'],\n\t\t\t'@types/bun': '^1.4.2',\n\t\t\ttypescript: '^6.0.3',\n\t\t},\n\t};\n}\n\nconst APP = `import { alxia, defineHook } from '@alxia/core';\nimport { z } from 'zod';\n\nconst Todo = z.object({ id: z.number(), title: z.string(), done: z.boolean() });\nconst NewTodo = z.object({ title: z.string().min(1) });\n\n/** Set API_KEY in the environment: this default is for development. */\nexport const apiKey = Bun.env['API_KEY'] ?? 'dev-key';\n\n// A hook of the routes it is given to: it answers 401 without the key, and\n// that 401 joins the type of each, so the client reads it.\nconst requireKey = defineHook(({ request, reply }) =>\n\trequest.headers.get('x-api-key') === apiKey\n\t\t? undefined\n\t\t: reply(401, { error: 'unauthorized' as const }),\n);\n\nconst todos: z.infer<typeof Todo>[] = [];\n\nexport const app = alxia()\n\t.decorate({ todos })\n\t.post(\n\t\t'/todos',\n\t\t[requireKey],\n\t\t{ body: NewTodo, response: { 201: Todo } },\n\t\t({ body, todos, reply }) => {\n\t\t\tconst todo = { id: todos.length + 1, title: body.title, done: false };\n\t\t\ttodos.push(todo);\n\t\t\treturn reply.created(todo);\n\t\t},\n\t);\n\nexport type App = typeof app;\n`;\n\nconst SERVER = `import { app } from './app';\n\nconst server = app.listen(Number(Bun.env['PORT'] ?? 3000));\nconsole.log(\\`listening on \\${server.url}\\`);\n`;\n\nconst SPEC = `import { expect, test } from 'bun:test';\nimport { client } from '@alxia/client';\nimport { apiKey, app } from './app';\n\nconst json = { 'content-type': 'application/json', 'x-api-key': apiKey };\n\ntest('creates a todo from JSON', async () => {\n\tconst response = await app.request('/todos', {\n\t\tmethod: 'POST',\n\t\theaders: json,\n\t\tbody: JSON.stringify({ title: 'Write a route' }),\n\t});\n\texpect(response.status).toBe(201);\n\texpect(await response.json()).toEqual({\n\t\tid: expect.any(Number),\n\t\ttitle: 'Write a route',\n\t\tdone: false,\n\t});\n});\n\ntest('refuses an empty title with a 400 naming it', async () => {\n\tconst response = await app.request('/todos', {\n\t\tmethod: 'POST',\n\t\theaders: json,\n\t\tbody: JSON.stringify({ title: '' }),\n\t});\n\texpect(response.status).toBe(400);\n\texpect((await response.json()).issues[0].path).toEqual(['title']);\n});\n\ntest('the typed client reads each status the route answers', async () => {\n\t// Given the app itself, the client calls its fetch in process.\n\tconst api = client(app, { headers: { 'x-api-key': apiKey } });\n\tconst created = await api.post('/todos', { body: { title: 'Call it typed' } });\n\tif (created.status !== 201) throw new Error(\\`got \\${created.status}\\`);\n\texpect(created.data.title).toBe('Call it typed'); // data is the Todo schema's type\n\n\tconst anonymous = await client(app).post('/todos', { body: { title: 'No key' } });\n\texpect(anonymous.status).toBe(401);\n\tif (anonymous.status === 401) expect(anonymous.data.error).toBe('unauthorized');\n});\n`;\n\nconst TSCONFIG = `{\n\t\"compilerOptions\": {\n\t\t\"types\": [\"bun\"],\n\t\t\"lib\": [\"ESNext\", \"DOM\"],\n\t\t\"target\": \"ESNext\",\n\t\t\"module\": \"ESNext\",\n\t\t\"moduleDetection\": \"force\",\n\t\t\"moduleResolution\": \"bundler\",\n\t\t\"verbatimModuleSyntax\": true,\n\t\t\"noEmit\": true,\n\t\t\"skipLibCheck\": true,\n\t\t\"resolveJsonModule\": true,\n\t\t\"strict\": true,\n\t\t\"noImplicitOverride\": true,\n\t\t\"noImplicitReturns\": true,\n\t\t\"noFallthroughCasesInSwitch\": true,\n\t\t\"noUncheckedIndexedAccess\": true,\n\t\t\"exactOptionalPropertyTypes\": true,\n\t\t\"noPropertyAccessFromIndexSignature\": true,\n\t\t\"noUnusedLocals\": true,\n\t\t\"noUnusedParameters\": true,\n\t\t\"forceConsistentCasingInFileNames\": true\n\t},\n\t\"include\": [\"src\"]\n}\n`;\n\nconst GITIGNORE = `node_modules\ndist\n*.log\n.DS_Store\n.env\n.env.local\n`;\n\nconst readme = (name: string) => `# ${name}\n\nAn [alxia](https://github.com/softistx/alxia) app with\n[Zod](https://zod.dev), made with \\`bun create @alxia\\`.\n\n\\`\\`\\`sh\nbun dev # http://localhost:3000, restarted on every change\nbun test # src/app.spec.ts: in process, and through the typed client\nbun run typecheck\nbun run build # dist/server.js, run with \\`bun start\\`\n\\`\\`\\`\n\n\\`\\`\\`sh\ncurl -X POST localhost:3000/todos \\\\\n -H 'content-type: application/json' -H 'x-api-key: dev-key' \\\\\n -d '{\"title\":\"Write a route\"}'\n\\`\\`\\`\n\n- \\`src/app.ts\\`: the app. \\`POST /todos\\` validates its body with Zod, and\n its own hook, \\`requireKey\\`, answers 401 without the \\`x-api-key\\` header.\n Set \\`API_KEY\\` in the environment outside development.\n- \\`src/server.ts\\`: listens on \\`PORT\\`, 3000 by default.\n- \\`src/app.spec.ts\\`: \\`app.request()\\` and \\`@alxia/client\\`, no port.\n\nNext: [Getting started](https://github.com/softistx/alxia/blob/develop/packages/core/docs/guide/getting-started.md)\nand the rest of [\\`@alxia/core\\`'s guide](https://github.com/softistx/alxia/tree/develop/packages/core/docs).\n`;\n\n/** The template's files but its manifest, by path. */\nexport function apiFiles(name: string): Record<string, string> {\n\treturn {\n\t\t'src/app.ts': APP,\n\t\t'src/server.ts': SERVER,\n\t\t'src/app.spec.ts': SPEC,\n\t\t'tsconfig.json': TSCONFIG,\n\t\t'.gitignore': GITIGNORE,\n\t\t'README.md': readme(name),\n\t};\n}\n",
12
+ "/**\n * The `react-router` template: React Router's official one, as\n * `create-react-router` wrote it, committed under `templates/react-router/`\n * with the layer `examples/react-router` adds on top — `@alxia/core` and\n * `@alxia/react-router` as dependencies, `alxia()` in the Vite plugins,\n * `start` running the build on Bun, and a `bunfig.toml` that starts React\n * Router's CLI on Bun. The files are copied as they are; only `package.json`\n * is rewritten, with the project's name and alxia's versions.\n */\nimport { join } from 'node:path';\nimport type { Manifest } from '../registry';\nimport type { AlxiaPackage } from '../versions';\n\n/**\n * Files the template stores under another name, because a published tarball\n * would not hold them: `bun publish`, as `npm publish`, leaves every\n * `.gitignore` out, and Bun leaves `bunfig.toml` out too.\n */\nexport const RENAMED: Readonly<Record<string, string>> = {\n\tgitignore: '.gitignore',\n\t'_bunfig.toml': 'bunfig.toml',\n};\n\n/**\n * The template in `dir`: its manifest, named `name` with alxia's packages at\n * `alxia`'s ranges, and every other file, by the path it is written at.\n */\nexport async function reactRouterTemplate(\n\tdir: string,\n\tname: string,\n\talxia: Record<AlxiaPackage, string>,\n): Promise<{ manifest: Manifest; files: Record<string, Blob> }> {\n\tconst stored: Manifest = await Bun.file(join(dir, 'package.json')).json();\n\tconst dependencies = { ...stored.dependencies };\n\tfor (const pkg of Object.keys(dependencies)) {\n\t\tif (pkg in alxia) dependencies[pkg] = alxia[pkg as AlxiaPackage];\n\t}\n\tconst manifest: Manifest = { ...stored, name, dependencies };\n\tconst files: Record<string, Blob> = {};\n\tfor await (const path of new Bun.Glob('**').scan({ cwd: dir, dot: true })) {\n\t\t// A Finder file in a local checkout is not the template's.\n\t\tif (path === 'package.json' || path.endsWith('.DS_Store')) continue;\n\t\tfiles[RENAMED[path] ?? path] = Bun.file(join(dir, path));\n\t}\n\treturn { manifest, files };\n}\n",
13
13
  "/** Where `create-alxia` prints, asks and runs: the process's own, or a spec's. */\n\nexport interface Io {\n\treadonly out: (line: string) => void;\n\treadonly err: (line: string) => void;\n\t/**\n\t * An answer to `question`, `fallback` when empty; undefined when there is\n\t * no terminal to ask in, null when the input ended (Ctrl-D) unanswered.\n\t */\n\treadonly ask: (\n\t\tquestion: string,\n\t\tfallback: string,\n\t) => string | null | undefined;\n\t/** Runs a command in `cwd` with the terminal's streams; its exit code. */\n\treadonly run: (command: readonly string[], cwd: string) => Promise<number>;\n\treadonly env: Record<string, string | undefined>;\n\t/** The registry's `fetch`, for a spec's fake one. */\n\treadonly fetch?: (request: Request) => Promise<Response>;\n}\n\n/** The process's own `Io`: its streams, `prompt()`, `Bun.spawn`. */\nexport function processIo(): Io {\n\treturn {\n\t\tout: (line) => console.log(line),\n\t\terr: (line) => console.error(line),\n\t\task: (question, fallback) => {\n\t\t\tif (!process.stdin.isTTY) return undefined;\n\t\t\t// Bun's prompt() prints the default as `[fallback]`, gives it for an\n\t\t\t// empty line, and null at the end of the input.\n\t\t\tconst answer = prompt(question, fallback);\n\t\t\treturn answer === null ? null : answer.trim() || fallback;\n\t\t},\n\t\trun: async (command, cwd) =>\n\t\t\tBun.spawn([...command], { cwd, stdio: ['inherit', 'inherit', 'inherit'] })\n\t\t\t\t.exited,\n\t\tenv: process.env,\n\t};\n}\n",
14
14
  "#!/usr/bin/env bun\n/**\n * `create-alxia`, the package's bin: `bun create @alxia` runs it, as do\n * `bunx @alxia/create` and `npm create @alxia`.\n */\nimport { main, processIo } from './main';\n\nprocess.exitCode = await main(\n\tprocess.argv.slice(2),\n\tprocess.cwd(),\n\tprocessIo(),\n);\n"
15
15
  ],
16
- "mappings": ";;;;AAKA,iBAAS;AACT;;;ACHO,IAAM,OAAO;AAGb,IAAM,YAAY,CAAC,OAAO,cAAc;AAGxC,SAAS,UAAU,CAAC,OAAkC;AAAA,EAC5D,OAAQ,UAAgC,SAAS,KAAK;AAAA;AAYhD,SAAS,SAAS,CACxB,MACuC;AAAA,EACvC,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI,UAAU;AAAA,EACd,IAAI,OAAO;AAAA,EACX,SAAS,IAAI,EAAG,IAAI,KAAK,QAAQ,KAAK;AAAA,IACrC,MAAM,MAAM,KAAK;AAAA,IACjB,IAAI,QAAQ,YAAY,QAAQ;AAAA,MAAM,OAAO;AAAA,IACxC,SAAI,QAAQ;AAAA,MAAgB,UAAU;AAAA,IACtC,SACJ,QAAQ,gBACR,QAAQ,QACR,IAAI,WAAW,aAAa,GAC3B;AAAA,MACD,MAAM,QAAQ,IAAI,SAAS,GAAG,IAC3B,IAAI,MAAM,IAAI,QAAQ,GAAG,IAAI,CAAC,IAC9B,KAAK,EAAE;AAAA,MACV,IAAI,UAAU,aAAa,UAAU,IAAI;AAAA,QACxC,OAAO,EAAE,OAAO,GAAG,yBAAyB,UAAU,K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,KAAK,MAAM,KAAK;AAAA;;;ASlH1E,QAAQ,WAAW,MAAM,KACxB,QAAQ,KAAK,MAAM,CAAC,GACpB,QAAQ,IAAI,GACZ,UAAU,CACX;",
17
+ "debugId": "793DE037BCA1C3D464756E2164756E21",
18
18
  "names": []
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAM/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,KAAK,wbASsB,CAAC;AAEzC,sEAAsE;AACtE,wBAAsB,IAAI,CACzB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,EAAE,GACJ,OAAO,CAAC,MAAM,CAAC,CAgEjB"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAK/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,KAAK,wbASsB,CAAC;AAEzC,sEAAsE;AACtE,wBAAsB,IAAI,CACzB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,EAAE,GACJ,OAAO,CAAC,MAAM,CAAC,CAgEjB"}
@@ -21,6 +21,12 @@ export interface Bumped {
21
21
  readonly failed: string[];
22
22
  /** A package with no release within its range: its version is unchanged. */
23
23
  readonly unmatched: string[];
24
+ /**
25
+ * An `@alxia/*` package whose version the range starts at is not on the
26
+ * registry yet, as just after a release: the newest of the same minor
27
+ * was written instead.
28
+ */
29
+ readonly behind: string[];
24
30
  }
25
31
  /** The registry to resolve against: the one Bun or npm was given, or npm's. */
26
32
  export declare function registryUrl(env: Record<string, string | undefined>): string;
@@ -33,12 +39,27 @@ export declare function allowedRange(name: string): string | undefined;
33
39
  /** The newest release (not a prerelease) of `versions` within `range`. */
34
40
  export declare function newestWithin(versions: readonly string[], range: string): string | undefined;
35
41
  /**
36
- * Rewrites every dependency of `manifest` but those in `keep` to `^` its
37
- * newest version: within the range alxia's peers hold it to, or npm's
38
- * `latest` when none does. React Router's own packages take the
39
- * version `react-router` resolved to, when they have it: `@react-router/node`
40
- * pins `react-router` exactly. A package whose metadata fails to arrive keeps
41
- * its version, and is named in `failed`.
42
+ * `range`'s own minor, from its first version: `~0.3.0` for `^0.3.1`, or
43
+ * undefined for a range that names no version.
42
44
  */
43
- export declare function bumpDependencies(manifest: Manifest, registry: Registry, keep?: ReadonlySet<string>): Promise<Bumped>;
45
+ export declare function sameMinor(range: string): string | undefined;
46
+ /**
47
+ * For a `built` range with no release on the registry: the newest of its
48
+ * own minor whose `^` still takes the version the range starts at, or
49
+ * undefined. Below 0.1, `^0.0.2` does not take 0.0.3: no fallback there.
50
+ */
51
+ export declare function newestOfMinor(versions: readonly string[], range: string): string | undefined;
52
+ /**
53
+ * Rewrites every dependency of `manifest` to `^` its newest version: within
54
+ * `built[name]` for a package it names — alxia's, at the ranges this
55
+ * `@alxia/create` was published with — else within the range alxia's peers
56
+ * hold it to, else npm's `latest`. A package of `built` with no release in
57
+ * its range, as when npm has not yet propagated a version published minutes
58
+ * ago, takes the newest of the range's own minor, named in `behind`: `^` it
59
+ * is still within the range. React Router's own packages take the version
60
+ * `react-router` resolved to, when they have it: `@react-router/node` pins
61
+ * `react-router` exactly. A package whose metadata fails to arrive keeps its
62
+ * version, and is named in `failed`.
63
+ */
64
+ export declare function bumpDependencies(manifest: Manifest, registry: Registry, built?: Readonly<Record<string, string>>): Promise<Bumped>;
44
65
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAOA,sEAAsE;AACtE,MAAM,WAAW,QAAQ;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzD,iEAAiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,WAAW,MAAM;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAM3E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IA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