@alxia/create 0.1.5 → 0.1.7
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/README.md +43 -18
- package/dist/index.js +29 -19
- package/dist/index.js.map +7 -6
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/packument.d.ts +18 -0
- package/dist/packument.d.ts.map +1 -0
- package/dist/registry.d.ts +19 -10
- package/dist/registry.d.ts.map +1 -1
- package/dist/versions.d.ts +1 -1
- package/dist/versions.d.ts.map +1 -1
- package/docs/README.md +6 -5
- package/docs/guide.md +372 -53
- package/docs/roadmap.md +36 -4
- package/docs/troubleshooting.md +135 -4
- package/package.json +5 -4
- package/templates/api/README.md +53 -8
- package/templates/api/_biome.json +1 -1
- package/templates/api/openapi-codegen.config.ts +11 -0
- package/templates/api/openapi.yaml +116 -0
- package/templates/api/package.json +5 -3
- package/templates/api/src/app.spec.ts +33 -14
- package/templates/api/src/app.ts +5 -30
- package/templates/api/src/context.ts +19 -0
- package/templates/api/src/generated/alxia.ts +71 -0
- package/templates/api/src/generated/operations.ts +133 -0
- package/templates/api/src/generated/paths.ts +170 -0
- package/templates/api/src/generated/types.ts +170 -0
- package/templates/api/src/generated/zod.ts +31 -0
- package/templates/api/src/routes/todos.ts +31 -0
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @alxia/create
|
|
2
2
|
|
|
3
3
|
Start an [alxia](https://github.com/softistx/alxia) app in one command: an
|
|
4
|
-
API with Zod, or React Router's official
|
|
4
|
+
API with Zod, written OpenAPI spec first, or React Router's official
|
|
5
|
+
template served by alxia.
|
|
5
6
|
|
|
6
7
|
```sh
|
|
7
8
|
bun create @alxia my-app
|
|
@@ -28,29 +29,47 @@ bun create @alxia my-site --template react-router
|
|
|
28
29
|
|
|
29
30
|
| template | what it writes |
|
|
30
31
|
| --- | --- |
|
|
31
|
-
| `api` | an `@alxia/core` app with Zod: `POST /todos`
|
|
32
|
+
| `api` | an `@alxia/core` app with Zod, OpenAPI spec first: `openapi.yaml` declares `GET /todos`, `POST /todos` and `GET /todos/{id}`; `bun run generate` writes `src/generated/` from it with [`@nxgt/openapi-codegen`](https://www.npmjs.com/package/@nxgt/openapi-codegen) (`openapi-codegen.config.ts`), committed, so nothing is generated at install or build; `src/context.ts` holds the base the routes read and registers it with `@alxia/core`'s `Register`; `src/routes/todos.ts`, made with `defineRoutes()`, reads that context with no import of the app and binds each operation with `route(operation, …middlewares, handler)`, as `route(operations.createTodo, requireKey, handler)`, where `requireKey`, made with `defineMiddleware`, answers 401 without an API key, and the operation's schemas validate the request and check the handler's reply; `src/app.ts` mounts the routes on the base, `base.plugin(todoRoutes)`; a `bun test` spec calling the app with `app.request()` and asserting `matchesSpec` from [`@alxia/openapi`](https://www.npmjs.com/package/@alxia/openapi): every operation has its route, and no route is outside the spec; `bun dev` restarting on change, `typecheck`, `build`, a strict `tsconfig.json`, Biome (`biome.json`, `lint`, `format`, `check`, `check:ci`), `verify`, starting with `generate --check`, a `Dockerfile` running on `oven/bun:1-alpine`, `.dockerignore`, `.gitignore`, `.env.example`, `.vscode/` and a README. `@alxia/openapi` and `@nxgt/openapi-codegen` are devDependencies |
|
|
32
33
|
| `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, a `Dockerfile` running on `oven/bun:1-alpine` in place of React Router's Node one, and Biome as the `api` project has it, the scaffold formatted by it once. No server file: the default one serves the pages; `bunx alxia-react-router reveal` writes it out to customise |
|
|
33
34
|
|
|
34
|
-
The heart of the `api` project, its
|
|
35
|
-
|
|
35
|
+
The heart of the `api` project, its middleware and a route bound to an
|
|
36
|
+
operation of `openapi.yaml` (the whole file, and how to add an operation,
|
|
37
|
+
are in the [guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md#the-api-template)):
|
|
36
38
|
|
|
37
39
|
```ts
|
|
38
|
-
// src/
|
|
39
|
-
const
|
|
40
|
+
// src/context.ts, in part: the base, registered
|
|
41
|
+
export const base = alxia().decorate({ todos });
|
|
42
|
+
|
|
43
|
+
declare module "@alxia/core" {
|
|
44
|
+
interface Register {
|
|
45
|
+
context: typeof base;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/routes/todos.ts, in part: no import of the app
|
|
50
|
+
const requireKey = defineMiddleware(({ request, reply }, next) =>
|
|
40
51
|
request.headers.get("x-api-key") === apiKey
|
|
41
|
-
?
|
|
52
|
+
? next()
|
|
42
53
|
: reply(401, { error: "unauthorized" as const }),
|
|
43
54
|
);
|
|
44
55
|
|
|
45
|
-
export const
|
|
46
|
-
.
|
|
47
|
-
.post("/todos", [requireKey], { body: NewTodo, response: { 201: Todo } }, ({ body, todos, reply }) => {
|
|
56
|
+
export const todoRoutes = defineRoutes()
|
|
57
|
+
.route(operations.createTodo, requireKey, ({ body, todos, reply }) => {
|
|
48
58
|
const todo = { id: todos.length + 1, title: body.title, done: false };
|
|
49
59
|
todos.push(todo);
|
|
50
60
|
return reply.created(todo);
|
|
51
61
|
});
|
|
62
|
+
|
|
63
|
+
// src/app.ts
|
|
64
|
+
export const app = base.plugin(todoRoutes);
|
|
52
65
|
```
|
|
53
66
|
|
|
67
|
+
`operations.createTodo` is `POST /todos` as `openapi.yaml` declares it:
|
|
68
|
+
the body is validated just before the handler, which reads it typed, and
|
|
69
|
+
the handler's reply is checked against the spec's responses; `requireKey`'s
|
|
70
|
+
401 is its own, sent as it is. To change the API, edit `openapi.yaml` and run
|
|
71
|
+
`bun run generate`; never edit `src/generated/`.
|
|
72
|
+
|
|
54
73
|
## Lint and format
|
|
55
74
|
|
|
56
75
|
Both projects ship [Biome](https://biomejs.dev), set up the same way: a
|
|
@@ -66,7 +85,8 @@ passes `bun run check:ci` with no finding.
|
|
|
66
85
|
| `bun run lint` | `biome lint` |
|
|
67
86
|
| `bun run format` | `biome format --write` |
|
|
68
87
|
| `bun run check:ci` | `biome ci`: what CI runs, read-only |
|
|
69
|
-
| `bun run verify` | `check:ci`, `typecheck`, then `test`
|
|
88
|
+
| `bun run verify` | `api`: `generate --check`, `check:ci`, `typecheck`, then `test`; `react-router`: `check:ci`, `typecheck`, then `build` |
|
|
89
|
+
| `bun run generate` | `api` only: `nxgt-openapi generate`, `src/generated/` from `openapi.yaml`; with `--check`, writes nothing and exits 1 when a file is stale |
|
|
70
90
|
|
|
71
91
|
```sh
|
|
72
92
|
cd my-api
|
|
@@ -87,7 +107,8 @@ builds in a stage of its own, and the image holds the build output alone,
|
|
|
87
107
|
no `node_modules`:
|
|
88
108
|
|
|
89
109
|
- `api`: `bun run build` bundles `src/server.ts` and its dependencies into
|
|
90
|
-
`dist/server.js
|
|
110
|
+
`dist/server.js`, `src/generated/` included as it is committed, so the
|
|
111
|
+
build generates nothing; the image holds `dist/` and runs `bun --no-install dist/server.js`.
|
|
91
112
|
- `react-router`: `bun run build`, every dependency bundled into
|
|
92
113
|
`build/server/index.js` by `@alxia/react-router`'s plugin; the image
|
|
93
114
|
holds `build/` and runs `bun --no-install build/server/index.js`.
|
|
@@ -127,8 +148,8 @@ or CI.
|
|
|
127
148
|
|
|
128
149
|
## Versions
|
|
129
150
|
|
|
130
|
-
- **alxia's packages** — `@alxia/core`, `@alxia/
|
|
131
|
-
`@alxia/react-router` — are moved to the newest version on the registry
|
|
151
|
+
- **alxia's packages** — `@alxia/core`, `@alxia/openapi` (`api`) and
|
|
152
|
+
`@alxia/react-router` (`react-router`) — are moved to the newest version on the registry
|
|
132
153
|
within the ranges this release of `@alxia/create` was published with:
|
|
133
154
|
`^0.3.1` writes `^0.3.4` once 0.3.4 is out, never `^0.4.0`. Just after a
|
|
134
155
|
release, while the registry does not serve that version yet, the newest of
|
|
@@ -141,9 +162,13 @@ or CI.
|
|
|
141
162
|
packages within `^8.0.0`, Zod within `^4.2.0`; what no alxia package
|
|
142
163
|
constrains goes to npm's `latest`. A newer major outside alxia's range is
|
|
143
164
|
left out, and the output says so.
|
|
144
|
-
- **Biome** is pinned exactly, and written exactly: the newest patch of
|
|
145
|
-
|
|
146
|
-
|
|
165
|
+
- **Biome** is pinned exactly, and written exactly: the newest patch of the
|
|
166
|
+
template's minor, `2.5.15` writing `2.5.16` but never `2.6.0`, whose new
|
|
167
|
+
rules the template was not checked against.
|
|
168
|
+
- **`@nxgt/openapi-codegen`** is pinned exactly and kept at the template's
|
|
169
|
+
version, `0.7.0`, never moved to a newer patch: `bun run verify` runs
|
|
170
|
+
`generate --check` over the committed `src/generated/`, which a release
|
|
171
|
+
that writes the files differently would fail in a fresh project.
|
|
147
172
|
|
|
148
173
|
The registry is the one `BUN_CONFIG_REGISTRY` or `npm_config_registry`
|
|
149
174
|
names, else npmjs.org; when it does not answer, the template's own
|
|
@@ -167,6 +192,6 @@ the project it writes installs with `bun install`.
|
|
|
167
192
|
|
|
168
193
|
## Documentation
|
|
169
194
|
|
|
170
|
-
- [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, Biome's settings, each `Dockerfile`, how versions are chosen, and running it in CI.
|
|
195
|
+
- [Guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md): each template file by file, adding an operation to the `api` project, what the `react-router` template adds to React Router's, Biome's settings, each `Dockerfile`, how versions are chosen, and running it in CI.
|
|
171
196
|
- [Troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/create/docs/troubleshooting.md): each message the command prints, and what to do about it.
|
|
172
197
|
- [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
|
@@ -81,8 +81,8 @@ async function clean(target, existed) {
|
|
|
81
81
|
// src/versions.ts
|
|
82
82
|
import { dirname } from "node:path";
|
|
83
83
|
var ALXIA_PACKAGES = [
|
|
84
|
-
"@alxia/client",
|
|
85
84
|
"@alxia/core",
|
|
85
|
+
"@alxia/openapi",
|
|
86
86
|
"@alxia/react-router"
|
|
87
87
|
];
|
|
88
88
|
var PEER_RANGES = {
|
|
@@ -162,20 +162,11 @@ async function copyTemplate(template, name, alxia, root = TEMPLATES2) {
|
|
|
162
162
|
return { manifest, files };
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
// src/
|
|
165
|
+
// src/packument.ts
|
|
166
166
|
function registryUrl(env) {
|
|
167
167
|
const url = env["BUN_CONFIG_REGISTRY"] || env["npm_config_registry"] || "https://registry.npmjs.org";
|
|
168
168
|
return url.replace(/\/+$/, "");
|
|
169
169
|
}
|
|
170
|
-
function allowedRange(name) {
|
|
171
|
-
if (name === "react-router" || name.startsWith("@react-router/")) {
|
|
172
|
-
return PEER_RANGES["react-router"];
|
|
173
|
-
}
|
|
174
|
-
return name in PEER_RANGES ? PEER_RANGES[name] : undefined;
|
|
175
|
-
}
|
|
176
|
-
function newestWithin(versions, range) {
|
|
177
|
-
return versions.filter((v) => !v.includes("-") && Bun.semver.satisfies(v, range)).sort(Bun.semver.order).at(-1);
|
|
178
|
-
}
|
|
179
170
|
async function packument(name, registry) {
|
|
180
171
|
const call = registry.fetch ?? ((request) => fetch(request));
|
|
181
172
|
const response = await call(new Request(`${registry.url}/${name.replace("/", "%2f")}`, {
|
|
@@ -186,6 +177,25 @@ async function packument(name, registry) {
|
|
|
186
177
|
throw new Error(`${response.status}`);
|
|
187
178
|
return await response.json();
|
|
188
179
|
}
|
|
180
|
+
async function packuments(names, registry) {
|
|
181
|
+
return new Map(await Promise.all(names.map(async (name) => [
|
|
182
|
+
name,
|
|
183
|
+
await packument(name, registry).catch(() => {
|
|
184
|
+
return;
|
|
185
|
+
})
|
|
186
|
+
])));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/registry.ts
|
|
190
|
+
function allowedRange(name) {
|
|
191
|
+
if (name === "react-router" || name.startsWith("@react-router/")) {
|
|
192
|
+
return PEER_RANGES["react-router"];
|
|
193
|
+
}
|
|
194
|
+
return name in PEER_RANGES ? PEER_RANGES[name] : undefined;
|
|
195
|
+
}
|
|
196
|
+
function newestWithin(versions, range) {
|
|
197
|
+
return versions.filter((v) => !v.includes("-") && Bun.semver.satisfies(v, range)).sort(Bun.semver.order).at(-1);
|
|
198
|
+
}
|
|
189
199
|
function choose(versions, range, latest) {
|
|
190
200
|
if (range !== undefined)
|
|
191
201
|
return newestWithin(versions, range);
|
|
@@ -194,6 +204,9 @@ function choose(versions, range, latest) {
|
|
|
194
204
|
function isExact(range) {
|
|
195
205
|
return /^\d+\.\d+\.\d+$/.test(range);
|
|
196
206
|
}
|
|
207
|
+
var KEPT_EXACT = new Set([
|
|
208
|
+
"@nxgt/openapi-codegen"
|
|
209
|
+
]);
|
|
197
210
|
function sameMinor(range) {
|
|
198
211
|
const match = /(\d+)\.(\d+)\.\d+/.exec(range);
|
|
199
212
|
return match ? `~${match[1]}.${match[2]}.0` : undefined;
|
|
@@ -207,12 +220,7 @@ function newestOfMinor(versions, range) {
|
|
|
207
220
|
async function bumpDependencies(manifest, registry, built = {}) {
|
|
208
221
|
const fields = ["dependencies", "devDependencies"];
|
|
209
222
|
const names = fields.flatMap((field) => Object.keys(manifest[field] ?? {}));
|
|
210
|
-
const fetched =
|
|
211
|
-
name,
|
|
212
|
-
await packument(name, registry).catch(() => {
|
|
213
|
-
return;
|
|
214
|
-
})
|
|
215
|
-
])));
|
|
223
|
+
const fetched = await packuments(names, registry);
|
|
216
224
|
const moved = [];
|
|
217
225
|
const held = [];
|
|
218
226
|
const failed = [];
|
|
@@ -226,6 +234,8 @@ async function bumpDependencies(manifest, registry, built = {}) {
|
|
|
226
234
|
const current = deps?.[name];
|
|
227
235
|
if (!deps || current === undefined)
|
|
228
236
|
continue;
|
|
237
|
+
if (KEPT_EXACT.has(name) && isExact(current))
|
|
238
|
+
continue;
|
|
229
239
|
const meta = fetched.get(name);
|
|
230
240
|
if (!meta?.versions) {
|
|
231
241
|
failed.push(name);
|
|
@@ -302,7 +312,7 @@ Writes a new alxia app in dir, which must be empty or not exist yet. Asks
|
|
|
302
312
|
for what is not given.
|
|
303
313
|
|
|
304
314
|
Options:
|
|
305
|
-
-t, --template <name> api an alxia app with Zod, a
|
|
315
|
+
-t, --template <name> api an alxia app with Zod, a middleware and a spec
|
|
306
316
|
react-router React Router's official template, served by alxia
|
|
307
317
|
--no-install write the files, skip bun install
|
|
308
318
|
-h, --help show this help`;
|
|
@@ -393,5 +403,5 @@ function askTemplate(io) {
|
|
|
393
403
|
// src/index.ts
|
|
394
404
|
process.exitCode = await main(process.argv.slice(2), process.cwd(), processIo());
|
|
395
405
|
|
|
396
|
-
//# debugId=
|
|
406
|
+
//# debugId=E23F8EA87FA867D064756E2164756E21
|
|
397
407
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/main.ts", "../src/args.ts", "../src/target.ts", "../src/versions.ts", "../src/write.ts", "../src/copy.ts", "../src/registry.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/copy.ts", "../src/packument.ts", "../src/registry.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 { 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
|
|
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 middleware and a spec\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 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/
|
|
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/core'\n\t| '@alxia/openapi'\n\t| '@alxia/react-router';\n\nconst ALXIA_PACKAGES: readonly AlxiaPackage[] = [\n\t'@alxia/core',\n\t'@alxia/openapi',\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
9
|
"/** Writes a template's project, its dependencies moved to the registry's newest. */\n\nimport { join } from 'node:path';\nimport { NAME, type Template } from './args';\nimport { copyTemplate } from './copy';\nimport type { Io } from './io';\nimport { bumpDependencies, registryUrl } from './registry';\nimport { packageName } from './target';\nimport type { AlxiaPackage } from './versions';\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 { manifest, files } = await copyTemplate(\n\t\ttemplate,\n\t\tpackageName(target),\n\t\talxia,\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\tfor (const [file, content] of Object.entries(files)) {\n\t\tawait Bun.write(join(target, file), content);\n\t}\n\tawait Bun.write(\n\t\tjoin(target, 'package.json'),\n\t\t`${JSON.stringify(manifest, null, 2)}\\n`,\n\t);\n\treturn true;\n}\n",
|
|
10
10
|
"/**\n * Copies a template stored under `templates/<template>/`: the `api` one,\n * alxia's own, and the `react-router` one, React Router's official scaffold\n * with the layer `examples/react-router` adds on top. The files are copied\n * as they are, but for the project's name in place of the template's own\n * (`my-api`, `my-app`) wherever a text file names it, as the README's\n * `docker build -t` does; `package.json` is rewritten, with that name and\n * alxia's versions in place of `workspace:^`.\n */\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Template } from './args';\nimport type { Manifest } from './registry';\nimport type { AlxiaPackage } from './versions';\n\n/**\n * Where the templates are, beside `src/` here and beside `dist/` published:\n * this module is bundled into `dist/index.js`, as `versions.ts` reads\n * `../package.json`.\n */\nexport const TEMPLATES = fileURLToPath(\n\tnew URL('../templates', import.meta.url),\n);\n\n/**\n * Files a template stores under another name: a published tarball would not\n * hold them — `bun publish`, as `npm publish`, leaves every `.gitignore`\n * out, and Bun leaves `bunfig.toml` out too — or this repository's Biome\n * would refuse them: a `biome.json` with no `\"root\": false` inside the\n * workspace is a nested root configuration, an error, and the project's\n * own must be a root.\n */\nexport const RENAMED: Readonly<Record<string, string>> = {\n\tgitignore: '.gitignore',\n\t'_bunfig.toml': 'bunfig.toml',\n\t'_biome.json': 'biome.json',\n};\n\n/**\n * `file` with `name` for every whole-word `placeholder` in it, or `file`\n * itself when it names none or is not UTF-8 text, as an icon.\n */\nexport async function withName(\n\tfile: Blob,\n\tplaceholder: string,\n\tname: string,\n): Promise<Blob> {\n\tlet text: string;\n\ttry {\n\t\ttext = new TextDecoder('utf-8', { fatal: true }).decode(await file.bytes());\n\t} catch {\n\t\treturn file;\n\t}\n\tconst escaped = placeholder.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\tconst word = new RegExp(`(?<![\\\\w-])${escaped}(?![\\\\w-])`, 'g');\n\tconst named = text.replace(word, () => name);\n\treturn named === text ? file : new Blob([named]);\n}\n\n/**\n * `template`, from `root`: its manifest, named `name` with alxia's packages\n * at `alxia`'s ranges, and every other file, by the path it is written at.\n */\nexport async function copyTemplate(\n\ttemplate: Template,\n\tname: string,\n\talxia: Record<AlxiaPackage, string>,\n\troot: string = TEMPLATES,\n): Promise<{ manifest: Manifest; files: Record<string, Blob> }> {\n\tconst dir = join(root, template);\n\tconst stored: Manifest = await Bun.file(join(dir, 'package.json')).json();\n\tconst manifest: Manifest = { ...stored, name };\n\tfor (const field of ['dependencies', 'devDependencies'] as const) {\n\t\tconst deps = stored[field];\n\t\tif (deps === undefined) continue;\n\t\tmanifest[field] = Object.fromEntries(\n\t\t\tObject.entries(deps).map(([pkg, range]) => [\n\t\t\t\tpkg,\n\t\t\t\tObject.hasOwn(alxia, pkg) ? alxia[pkg as AlxiaPackage] : range,\n\t\t\t]),\n\t\t);\n\t}\n\t// A range only the workspace resolves would make the project uninstallable.\n\tconst left = JSON.stringify(manifest).match(/\"([^\"]+)\":\"workspace:/);\n\tif (left) {\n\t\tthrow new Error(\n\t\t\t`the ${template} template names ${left[1]} at workspace:, which this @alxia/create has no version for`,\n\t\t);\n\t}\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\tconst file = Bun.file(join(dir, path));\n\t\tfiles[RENAMED[path] ?? path] =\n\t\t\ttypeof stored['name'] === 'string'\n\t\t\t\t? await withName(file, stored['name'], name)\n\t\t\t\t: file;\n\t}\n\treturn { manifest, files };\n}\n",
|
|
11
|
-
"
|
|
11
|
+
"/** Reading packages' metadata from the registry, as `bun install` asks for it. */\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/** 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/** What the registry says of a package: its tags and its versions. */\nexport interface Packument {\n\treadonly 'dist-tags'?: Record<string, string>;\n\treadonly versions?: Record<string, unknown>;\n}\n\n/** One package's metadata, or a rejection: a status other than 2xx, a timeout. */\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/** Each package's metadata, fetched together: `undefined` for one that did not arrive. */\nexport async function packuments(\n\tnames: readonly string[],\n\tregistry: Registry,\n): Promise<Map<string, Packument | undefined>> {\n\treturn 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}\n",
|
|
12
|
+
"/**\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 { packuments, type Registry } from './packument';\nimport { PEER_RANGES } from './versions';\n\nexport { type Registry, registryUrl } from './packument';\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/** 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/**\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\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\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 * Whether `range` is one exact version, as `2.5.15`: how a template pins a\n * tool whose patch releases may change its output, as Biome asks to be\n * pinned. Such a dependency stays exact, and within its own minor: a\n * minor of Biome may add a recommended rule the template was not checked\n * against.\n */\nexport function isExact(range: string): boolean {\n\treturn /^\\d+\\.\\d+\\.\\d+$/.test(range);\n}\n\n/**\n * Tools whose exact pin the template keeps as it is, even from the newest\n * patch of its minor: a project's `bun run verify` runs `generate --check`\n * over the committed `src/generated/`, so a generator patch that writes the\n * files differently would fail a fresh project on files it never touched.\n */\nexport const KEPT_EXACT: ReadonlySet<string> = new Set([\n\t'@nxgt/openapi-codegen',\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 dependency the template pins exactly\n * (`isExact`) is rewritten exactly, to the newest of its own minor, except\n * a `KEPT_EXACT` one, which keeps the template's version. A\n * 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 = await packuments(names, registry);\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\tif (KEPT_EXACT.has(name) && isExact(current)) 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 exact = isExact(current);\n\t\tconst range =\n\t\t\tpinned ?? allowedRange(name) ?? (exact ? `~${current}` : undefined);\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 = exact ? version : `^${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
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",
|
|
13
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"
|
|
14
15
|
],
|
|
15
|
-
"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;AA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A,EAC5E,MAAM,QAAQ;AAAA,IACb,UAAU,MAAM,YAAY,MAAM;AAAA,IAClC,YAAY,YAAY;AAAA,IACxB;AAAA,EACD,EAAE,OAAO,CAAC,SAAS,SAAS,SAAS;AAAA,EACrC,OAAO;AAAA,QAAW,UAAU,MAAM,mBAAmB,mBAAmB;AAAA;AAAA,EAA+B,MACrG,IAAI,CAAC,SAAS,KAAK,MAAM,EACzB,KAAK;AAAA,CAAI;AAAA;AAAA;AAIZ,SAAS,WAAW,CAAC,IAA6C;AAAA,EACjE,MAAM,SAAS,GAAG,IAAI,mBAAmB,UAAU,KAAK,MAAM,KAAK,KAAK;AAAA,EACxE,IAAI,WAAW;AAAA,IAAM,OAAO;AAAA,EAC5B,IAAI,WAAW,WAAW;AAAA,IACzB,OAAO,EAAE,OAAO,kDAAkD;AAAA,EACnE;AAAA,EACA,OAAO,WAAW,MAAM,IACrB,SACA,EAAE,OAAO,oBAAoB,eAAe,UAAU,KAAK,MAAM,KAAK;AAAA;;;ASlH1E,QAAQ,WAAW,MAAM,KACxB,QAAQ,KAAK,MAAM,CAAC,GACpB,QAAQ,IAAI,GACZ,UAAU,CACX;",
|
|
17
|
+
"debugId": "E23F8EA87FA867D064756E2164756E21",
|
|
17
18
|
"names": []
|
|
18
19
|
}
|
package/dist/main.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { NAME } from './args';
|
|
|
3
3
|
export type { Io } from './io';
|
|
4
4
|
export { processIo } from './io';
|
|
5
5
|
export { packageName, refusal } from './target';
|
|
6
|
-
export declare 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
|
|
6
|
+
export declare 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 middleware and a spec\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";
|
|
7
7
|
/** Runs the command in `cwd`; resolves to the process's exit code. */
|
|
8
8
|
export declare function main(args: readonly string[], cwd: string, io: Io): Promise<number>;
|
|
9
9
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -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;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,
|
|
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,obASsB,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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Reading packages' metadata from the registry, as `bun install` asks for it. */
|
|
2
|
+
/** How to reach the registry: its URL, and the `fetch` to call it with. */
|
|
3
|
+
export interface Registry {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly fetch?: (request: Request) => Promise<Response>;
|
|
6
|
+
/** How long one package's metadata may take, in milliseconds. */
|
|
7
|
+
readonly timeout?: number;
|
|
8
|
+
}
|
|
9
|
+
/** The registry to resolve against: the one Bun or npm was given, or npm's. */
|
|
10
|
+
export declare function registryUrl(env: Record<string, string | undefined>): string;
|
|
11
|
+
/** What the registry says of a package: its tags and its versions. */
|
|
12
|
+
export interface Packument {
|
|
13
|
+
readonly 'dist-tags'?: Record<string, string>;
|
|
14
|
+
readonly versions?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
/** Each package's metadata, fetched together: `undefined` for one that did not arrive. */
|
|
17
|
+
export declare function packuments(names: readonly string[], registry: Registry): Promise<Map<string, Packument | undefined>>;
|
|
18
|
+
//# sourceMappingURL=packument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packument.d.ts","sourceRoot":"","sources":["../src/packument.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,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,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAM3E;AAED,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAeD,0FAA0F;AAC1F,wBAAsB,UAAU,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,CAY7C"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moves a generated project's dependencies to their newest versions on the
|
|
3
|
+
* registry, within what alxia accepts: a template ships the versions it was
|
|
4
|
+
* written with, and React Router's lags behind its own releases. alxia's own
|
|
5
|
+
* packages move within the ranges this `@alxia/create` was published with,
|
|
6
|
+
* and fall back on the same minor when the registry does not have the
|
|
7
|
+
* version those ranges start at yet.
|
|
8
|
+
*/
|
|
9
|
+
import { type Registry } from './packument';
|
|
10
|
+
export { type Registry, registryUrl } from './packument';
|
|
1
11
|
/** The dependency fields of a manifest, as a template writes them. */
|
|
2
12
|
export interface Manifest {
|
|
3
13
|
dependencies?: Record<string, string>;
|
|
4
14
|
devDependencies?: Record<string, string>;
|
|
5
15
|
[key: string]: unknown;
|
|
6
16
|
}
|
|
7
|
-
/** How to reach the registry: its URL, and the `fetch` to call it with. */
|
|
8
|
-
export interface Registry {
|
|
9
|
-
readonly url: string;
|
|
10
|
-
readonly fetch?: (request: Request) => Promise<Response>;
|
|
11
|
-
/** How long one package's metadata may take, in milliseconds. */
|
|
12
|
-
readonly timeout?: number;
|
|
13
|
-
}
|
|
14
17
|
/** What a bump changed, and what it could not. */
|
|
15
18
|
export interface Bumped {
|
|
16
19
|
/** One line per dependency moved: `vite ^8.0.3 -> ^8.3.2`. */
|
|
@@ -28,8 +31,6 @@ export interface Bumped {
|
|
|
28
31
|
*/
|
|
29
32
|
readonly behind: string[];
|
|
30
33
|
}
|
|
31
|
-
/** The registry to resolve against: the one Bun or npm was given, or npm's. */
|
|
32
|
-
export declare function registryUrl(env: Record<string, string | undefined>): string;
|
|
33
34
|
/**
|
|
34
35
|
* The range alxia's peers hold `name` to — React Router's packages follow
|
|
35
36
|
* `react-router`'s — or undefined when none does, and npm's `latest` is
|
|
@@ -46,6 +47,13 @@ export declare function newestWithin(versions: readonly string[], range: string)
|
|
|
46
47
|
* against.
|
|
47
48
|
*/
|
|
48
49
|
export declare function isExact(range: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Tools whose exact pin the template keeps as it is, even from the newest
|
|
52
|
+
* patch of its minor: a project's `bun run verify` runs `generate --check`
|
|
53
|
+
* over the committed `src/generated/`, so a generator patch that writes the
|
|
54
|
+
* files differently would fail a fresh project on files it never touched.
|
|
55
|
+
*/
|
|
56
|
+
export declare const KEPT_EXACT: ReadonlySet<string>;
|
|
49
57
|
/**
|
|
50
58
|
* `range`'s own minor, from its first version: `~0.3.0` for `^0.3.1`, or
|
|
51
59
|
* undefined for a range that names no version.
|
|
@@ -62,7 +70,8 @@ export declare function newestOfMinor(versions: readonly string[], range: string
|
|
|
62
70
|
* `built[name]` for a package it names — alxia's, at the ranges this
|
|
63
71
|
* `@alxia/create` was published with — else within the range alxia's peers
|
|
64
72
|
* hold it to, else npm's `latest`. A dependency the template pins exactly
|
|
65
|
-
* (`isExact`) is rewritten exactly, to the newest of its own minor
|
|
73
|
+
* (`isExact`) is rewritten exactly, to the newest of its own minor, except
|
|
74
|
+
* a `KEPT_EXACT` one, which keeps the template's version. A
|
|
66
75
|
* package of `built` with no release in
|
|
67
76
|
* its range, as when npm has not yet propagated a version published minutes
|
|
68
77
|
* ago, takes the newest of the range's own minor, named in `behind`: `^` it
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,aAAa,C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X,MAAM,GAAG,SAAS,CAOpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAC1C,OAAO,CAAC,MAAM,CAAC,CAkEjB"}
|
package/dist/versions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The `@alxia/*` packages a template depends on. */
|
|
2
|
-
export type AlxiaPackage = '@alxia/
|
|
2
|
+
export type AlxiaPackage = '@alxia/core' | '@alxia/openapi' | '@alxia/react-router';
|
|
3
3
|
/**
|
|
4
4
|
* The peer ranges of alxia's packages that a template's other dependencies
|
|
5
5
|
* must stay within, by the package they constrain: `typescript` is every
|
package/dist/versions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":"AAQA,qDAAqD;AACrD,MAAM,MAAM,YAAY,GACrB,
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":"AAQA,qDAAqD;AACrD,MAAM,MAAM,YAAY,GACrB,aAAa,GACb,gBAAgB,GAChB,qBAAqB,CAAC;AAQzB;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX;;;;;;GAMG;AACH,wBAAsB,WAAW,CAChC,WAAW,GAAE,GAAiD,GAC5D,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAcvC"}
|
package/docs/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# @alxia/create documentation
|
|
2
2
|
|
|
3
3
|
The [package README](../README.md) is the short version. This folder is the
|
|
4
|
-
long one: what each template writes,
|
|
5
|
-
|
|
6
|
-
the command
|
|
4
|
+
long one: what each template writes, how the `api` project grows from
|
|
5
|
+
its OpenAPI document, what the `react-router` template adds to React
|
|
6
|
+
Router's own, how the versions are chosen, and the errors the command and
|
|
7
|
+
a new project print.
|
|
7
8
|
|
|
8
9
|
| Page | Read it when |
|
|
9
10
|
| --- | --- |
|
|
10
|
-
| [Guide](guide.md) | choosing a template, reading what it wrote, linting and formatting it with Biome, building its Docker image, pinning or moving versions, or running the command in a script or CI |
|
|
11
|
-
| [Troubleshooting](troubleshooting.md) | the command refused a directory, a template or an option, the registry did not answer or lacked a version, `bun install` failed,
|
|
11
|
+
| [Guide](guide.md) | choosing a template, reading what it wrote, adding an operation to the `api` project's `openapi.yaml`, linting and formatting it with Biome, building its Docker image, pinning or moving versions, or running the command in a script or CI |
|
|
12
|
+
| [Troubleshooting](troubleshooting.md) | the command refused a directory, a template or an option, the registry did not answer or lacked a version, `bun install` failed, Biome refused to run in a project, or the `api` project's `generate --check`, `matchesSpec` or a reply check failed |
|
|
12
13
|
| [Roadmap](roadmap.md) | wondering what is coming, and what is not planned |
|