@alxia/create 0.1.7 → 0.2.0
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 +80 -25
- package/dist/args.d.ts +3 -1
- package/dist/args.d.ts.map +1 -1
- package/dist/index.js +19 -9
- package/dist/index.js.map +7 -7
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/registry.d.ts +2 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/versions.d.ts +5 -2
- package/dist/versions.d.ts.map +1 -1
- package/docs/README.md +16 -6
- package/docs/guide.md +428 -47
- package/docs/roadmap.md +24 -0
- package/docs/troubleshooting.md +152 -9
- package/package.json +15 -5
- package/templates/api/.env.example +9 -1
- package/templates/api/README.md +40 -12
- package/templates/api/openapi.yaml +13 -9
- package/templates/api/package.json +5 -3
- package/templates/api/src/app.spec.ts +42 -28
- package/templates/api/src/app.ts +13 -3
- package/templates/api/src/context.ts +3 -4
- package/templates/api/src/env.ts +20 -0
- package/templates/api/src/generated/alxia.ts +3 -3
- package/templates/api/src/generated/operations.ts +3 -3
- package/templates/api/src/generated/paths.ts +6 -6
- package/templates/api/src/generated/types.ts +14 -10
- package/templates/api/src/generated/zod.ts +6 -2
- package/templates/api/src/routes/todos.ts +2 -2
- package/templates/api/src/server.ts +8 -16
- package/templates/graphql/.dockerignore +6 -0
- package/templates/graphql/.env.example +3 -0
- package/templates/graphql/.vscode/extensions.json +3 -0
- package/templates/graphql/.vscode/settings.json +8 -0
- package/templates/graphql/Dockerfile +26 -0
- package/templates/graphql/README.md +171 -0
- package/templates/graphql/_biome.json +32 -0
- package/templates/graphql/codegen.ts +22 -0
- package/templates/graphql/gitignore +6 -0
- package/templates/graphql/package.json +34 -0
- package/templates/graphql/schema.graphql +26 -0
- package/templates/graphql/src/app.spec.ts +119 -0
- package/templates/graphql/src/app.ts +14 -0
- package/templates/graphql/src/context.ts +24 -0
- package/templates/graphql/src/env.ts +8 -0
- package/templates/graphql/src/generated/resolvers.ts +180 -0
- package/templates/graphql/src/graphql.d.ts +6 -0
- package/templates/graphql/src/resolvers.ts +42 -0
- package/templates/graphql/src/schema.ts +6 -0
- package/templates/graphql/src/server.ts +10 -0
- package/templates/graphql/src/store.ts +25 -0
- package/templates/graphql/tsconfig.json +25 -0
- package/templates/minimal/.dockerignore +6 -0
- package/templates/minimal/.vscode/extensions.json +3 -0
- package/templates/minimal/.vscode/settings.json +8 -0
- package/templates/minimal/Dockerfile +26 -0
- package/templates/minimal/README.md +107 -0
- package/templates/minimal/_biome.json +32 -0
- package/templates/minimal/gitignore +6 -0
- package/templates/minimal/package.json +25 -0
- package/templates/minimal/src/index.spec.ts +12 -0
- package/templates/minimal/src/index.ts +17 -0
- package/templates/minimal/tsconfig.json +25 -0
- package/templates/react-router/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @alxia/create
|
|
2
2
|
|
|
3
|
-
Start an [alxia](https://github.com/softistx/alxia) app in one command:
|
|
4
|
-
API with Zod
|
|
5
|
-
|
|
3
|
+
Start an [alxia](https://github.com/softistx/alxia) app in one command: a
|
|
4
|
+
minimal one to try alxia with, an API with Zod written OpenAPI spec first, a
|
|
5
|
+
GraphQL API written schema first, or React Router's official template
|
|
6
|
+
served by alxia.
|
|
6
7
|
|
|
7
8
|
```sh
|
|
8
9
|
bun create @alxia my-app
|
|
@@ -23,14 +24,21 @@ It needs Bun 1.4.2 or later, which the projects it writes run on.
|
|
|
23
24
|
## Templates
|
|
24
25
|
|
|
25
26
|
```sh
|
|
27
|
+
bun create @alxia my-app --template minimal # the template to try alxia with
|
|
26
28
|
bun create @alxia my-api --template api
|
|
29
|
+
bun create @alxia my-graph --template graphql
|
|
27
30
|
bun create @alxia my-site --template react-router
|
|
28
31
|
```
|
|
29
32
|
|
|
33
|
+
`minimal` is the one to start with: one file, one dependency, a test, and
|
|
34
|
+
`bun dev` answering in 30 seconds.
|
|
35
|
+
|
|
30
36
|
| template | what it writes |
|
|
31
37
|
| --- | --- |
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
38
|
+
| `minimal` | the smallest alxia app: `src/index.ts` exports `app = alxia().get("/", …)` and listens on `PORT` only when it is the entry file, `src/index.spec.ts` calls it with `app.request()`; `bun dev` (`NODE_ENV=development bun --hot`), `build`, `start`, `typecheck`, a strict `tsconfig.json`, Biome and `verify` (`check:ci`, `typecheck`, then `test`), a `Dockerfile` running on `oven/bun:1-alpine`, `.dockerignore`, `.gitignore`, `.vscode/` and a README. One dependency, `@alxia/core`: no OpenAPI, no code generation, no validator, no env file |
|
|
39
|
+
| `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/env.ts` reads `PORT`, `API_KEY` and `API_DOCS` with `defineEnv` from [`@alxia/env`](https://www.npmjs.com/package/@alxia/env), `API_KEY` a secret defaulting to `dev-key` under `NODE_ENV` `development` and `test` alone, required anywhere else; `src/context.ts` holds the base the routes read, `alxia({ errors: "problem" })` so alxia's own errors are RFC 9457 problems as `openapi.yaml` declares them, 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 `health()` (`GET /health`, `GET /ready`), `apiDocs` from `@alxia/openapi` (the API reference at `/docs`, from `openapi.yaml` imported into the bundle; on in development, else with `API_DOCS=true`) and the routes on the base; a `bun test` spec calling the app through the typed [openapi-fetch](https://openapi-ts.dev/openapi-fetch/) client over the generated `paths.ts`, its `fetch` being `app.fetch` (in process, no server), keeping one `app.request()` test, 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` (`NODE_ENV=development`) 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` is a dependency; `openapi-fetch` and `@nxgt/openapi-codegen` are devDependencies |
|
|
40
|
+
| `graphql` | a GraphQL API with [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server) through [`@alxia/graphql`](https://www.npmjs.com/package/@alxia/graphql), schema first: `schema.graphql` is the contract (`Query`, `Mutation`, `Subscription`); `bun run generate` writes `src/generated/resolvers.ts` from it with [GraphQL Code Generator](https://the-guild.dev/graphql/codegen) (`codegen.ts`), committed, typing `Resolvers` with the app's context; `src/context.ts` holds the base and `viewerOf`, a middleware reading `Authorization: Bearer <token>` so every resolver reads a typed `viewer`; `src/resolvers.ts`; `src/schema.ts` and `src/app.ts` mounting `health()` and `graphql(app, { schema })`, GraphiQL on in dev alone; `src/env.ts` (`PORT`) with `defineEnv`; `src/store.ts`, in memory, with the pub/sub of the `noteAdded` subscription (server-sent events); a `bun test` spec posting to `/graphql` through `app.request()`; the same scripts, `Dockerfile`, Biome and `.vscode/` as `api`, `verify` starting with `generate --check`, and a `.env.example`. `@alxia/graphql`, `@alxia/env`, `graphql` and `graphql-yoga` are dependencies; the code generator is a devDependency |
|
|
41
|
+
| `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, `dev` under `NODE_ENV=development`, `start` running `NODE_ENV=production 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 |
|
|
34
42
|
|
|
35
43
|
The heart of the `api` project, its middleware and a route bound to an
|
|
36
44
|
operation of `openapi.yaml` (the whole file, and how to add an operation,
|
|
@@ -48,7 +56,7 @@ declare module "@alxia/core" {
|
|
|
48
56
|
|
|
49
57
|
// src/routes/todos.ts, in part: no import of the app
|
|
50
58
|
const requireKey = defineMiddleware(({ request, reply }, next) =>
|
|
51
|
-
request.headers.get("x-api-key") ===
|
|
59
|
+
request.headers.get("x-api-key") === env.API_KEY
|
|
52
60
|
? next()
|
|
53
61
|
: reply(401, { error: "unauthorized" as const }),
|
|
54
62
|
);
|
|
@@ -70,12 +78,47 @@ the handler's reply is checked against the spec's responses; `requireKey`'s
|
|
|
70
78
|
401 is its own, sent as it is. To change the API, edit `openapi.yaml` and run
|
|
71
79
|
`bun run generate`; never edit `src/generated/`.
|
|
72
80
|
|
|
81
|
+
The `graphql` project's heart, a schema and a resolver reading the typed
|
|
82
|
+
`viewer` (the walk-through, with subscriptions and how to add a field, is in the
|
|
83
|
+
[guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md#the-graphql-template)):
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
// schema.graphql, in part
|
|
87
|
+
// type Mutation { addNote(text: String!): Note! }
|
|
88
|
+
|
|
89
|
+
// src/context.ts, in part: a middleware, then the resolvers' context
|
|
90
|
+
const viewerOf = defineMiddleware(({ request }, next) => {
|
|
91
|
+
const token = request.headers.get("authorization")?.match(/^Bearer (.+)$/i)?.[1];
|
|
92
|
+
const id = token === undefined ? undefined : db.tokens.get(token);
|
|
93
|
+
return next({ viewer: (id === undefined ? undefined : db.users.get(id)) ?? null });
|
|
94
|
+
});
|
|
95
|
+
export const base = alxia().decorate({ env, db }).use(viewerOf);
|
|
96
|
+
export type Context = GraphQLContext<typeof base>;
|
|
97
|
+
|
|
98
|
+
// src/resolvers.ts, in part: `Resolvers` is generated from the schema
|
|
99
|
+
export const resolvers: Resolvers = {
|
|
100
|
+
Mutation: {
|
|
101
|
+
addNote: (_, { text }, { viewer, db }) => {
|
|
102
|
+
if (viewer === null) {
|
|
103
|
+
throw new GraphQLError("Sign in to add a note", {
|
|
104
|
+
extensions: { code: "UNAUTHENTICATED" },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// …
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
To change the API, edit `schema.graphql` and run `bun run generate`; never
|
|
114
|
+
edit `src/generated/`.
|
|
115
|
+
|
|
73
116
|
## Lint and format
|
|
74
117
|
|
|
75
|
-
|
|
76
|
-
`biome.json` of
|
|
77
|
-
double quotes, imports sorted, the build output and `.react-router/`
|
|
78
|
-
skipped; `@biomejs/biome` pinned exactly, as Biome asks; and
|
|
118
|
+
Every project ships [Biome](https://biomejs.dev), set up the same way: a
|
|
119
|
+
`biome.json` of its own with Biome's recommended rules, spaces and
|
|
120
|
+
double quotes, imports sorted, the build output (and `.react-router/`
|
|
121
|
+
or `src/generated/`, where the project has them) skipped; `@biomejs/biome` pinned exactly, as Biome asks; and
|
|
79
122
|
`.vscode/` recommending its extension, formatting on save. A new project
|
|
80
123
|
passes `bun run check:ci` with no finding.
|
|
81
124
|
|
|
@@ -85,8 +128,8 @@ passes `bun run check:ci` with no finding.
|
|
|
85
128
|
| `bun run lint` | `biome lint` |
|
|
86
129
|
| `bun run format` | `biome format --write` |
|
|
87
130
|
| `bun run check:ci` | `biome ci`: what CI runs, read-only |
|
|
88
|
-
| `bun run verify` | `
|
|
89
|
-
| `bun run generate` | `api
|
|
131
|
+
| `bun run verify` | `minimal`: `check:ci`, `typecheck`, then `test`; `api` and `graphql`: `generate --check`, then those; `react-router`: `check:ci`, `typecheck`, then `build` |
|
|
132
|
+
| `bun run generate` | `api`: `nxgt-openapi generate`, `src/generated/` from `openapi.yaml`; `graphql`: `graphql-codegen`, `src/generated/resolvers.ts` from `schema.graphql`; with `--check`, writes nothing and exits 1 when a file is stale |
|
|
90
133
|
|
|
91
134
|
```sh
|
|
92
135
|
cd my-api
|
|
@@ -100,15 +143,21 @@ has the settings and why.
|
|
|
100
143
|
|
|
101
144
|
## Docker
|
|
102
145
|
|
|
103
|
-
|
|
146
|
+
Every project builds into an image as it is written: built on
|
|
104
147
|
`oven/bun:1`, run on `oven/bun:1-alpine` as the non-root `bun` user, an
|
|
105
148
|
image of about 130 MB. Each `Dockerfile`
|
|
106
149
|
builds in a stage of its own, and the image holds the build output alone,
|
|
107
150
|
no `node_modules`:
|
|
108
151
|
|
|
152
|
+
- `minimal`: `bun run build` bundles `src/index.ts` into `dist/index.js`; the
|
|
153
|
+
image holds `dist/` and runs `bun --no-install dist/index.js`.
|
|
109
154
|
- `api`: `bun run build` bundles `src/server.ts` and its dependencies into
|
|
110
155
|
`dist/server.js`, `src/generated/` included as it is committed, so the
|
|
111
156
|
build generates nothing; the image holds `dist/` and runs `bun --no-install dist/server.js`.
|
|
157
|
+
- `graphql`: `bun run build` bundles `src/server.ts`, its dependencies and
|
|
158
|
+
`schema.graphql` (imported as text) into `dist/server.js`, `src/generated/`
|
|
159
|
+
included as it is committed; the image holds `dist/` and runs
|
|
160
|
+
`bun --no-install dist/server.js`, with GraphiQL off (`NODE_ENV=production`, so alxia's dev switch is off).
|
|
112
161
|
- `react-router`: `bun run build`, every dependency bundled into
|
|
113
162
|
`build/server/index.js` by `@alxia/react-router`'s plugin; the image
|
|
114
163
|
holds `build/` and runs `bun --no-install build/server/index.js`.
|
|
@@ -116,9 +165,11 @@ no `node_modules`:
|
|
|
116
165
|
```sh
|
|
117
166
|
cd my-api
|
|
118
167
|
docker build -t my-api .
|
|
119
|
-
docker run -p 3000:3000 -e API_KEY=change-me my-api
|
|
168
|
+
docker run -p 3000:3000 -e API_KEY=change-me my-api # API_KEY is required: the app does not start without it
|
|
120
169
|
```
|
|
121
170
|
|
|
171
|
+
`minimal` and `graphql` run the same way, with no `-e`: `docker run -p 3000:3000 my-app`.
|
|
172
|
+
|
|
122
173
|
```sh
|
|
123
174
|
cd my-site
|
|
124
175
|
docker build -t my-site .
|
|
@@ -139,7 +190,7 @@ which does not load on Alpine.
|
|
|
139
190
|
| option | |
|
|
140
191
|
| --- | --- |
|
|
141
192
|
| `[dir]` | where to write the project: a directory that is empty or does not exist yet. Asked when not given |
|
|
142
|
-
| `--template <name>`, `-t` | `api` or `react-router`. Asked when not given |
|
|
193
|
+
| `--template <name>`, `-t` | `minimal`, `api`, `graphql` or `react-router`. Asked when not given, `minimal` by default |
|
|
143
194
|
| `--no-install` | write the files, skip `bun install` |
|
|
144
195
|
| `--help`, `-h` | the usage |
|
|
145
196
|
|
|
@@ -148,25 +199,28 @@ or CI.
|
|
|
148
199
|
|
|
149
200
|
## Versions
|
|
150
201
|
|
|
151
|
-
- **alxia's packages** — `@alxia/core`, `@alxia/openapi` (`api`)
|
|
152
|
-
`@alxia/react-router` (`react-router`) — are moved to the newest version on the registry
|
|
202
|
+
- **alxia's packages** — `@alxia/core`, `@alxia/env` (`api`, `graphql`), `@alxia/openapi` (`api`),
|
|
203
|
+
`@alxia/graphql` (`graphql`) and `@alxia/react-router` (`react-router`) — are moved to the newest version on the registry
|
|
153
204
|
within the ranges this release of `@alxia/create` was published with:
|
|
154
205
|
`^0.3.1` writes `^0.3.4` once 0.3.4 is out, never `^0.4.0`. Just after a
|
|
155
206
|
release, while the registry does not serve that version yet, the newest of
|
|
156
207
|
the same minor is written (`^0.3.0`, which takes 0.3.1 once it arrives),
|
|
157
208
|
and the output says so. `bunx @alxia/create@<version>` picks an older set.
|
|
158
|
-
- **Everything else** — Zod, TypeScript, Vite, React, React Router,
|
|
159
|
-
— is moved to the newest version on the registry when the project is
|
|
209
|
+
- **Everything else** — Zod, TypeScript, Vite, React, React Router, GraphQL,
|
|
210
|
+
Tailwind — is moved to the newest version on the registry when the project is
|
|
160
211
|
written, within the range alxia's packages accept: TypeScript within
|
|
161
212
|
`^6.0.3 || ^7.0.0`, Vite within `^7.0.0 || ^8.0.0`, React Router and its
|
|
162
|
-
packages within `^8.0.0`, Zod within `^4.2.0
|
|
213
|
+
packages within `^8.0.0`, Zod within `^4.2.0`, `graphql` within `^16.11.0 || ^17.0.0` and `graphql-yoga`
|
|
214
|
+
within `^5.16.0`; what no alxia package
|
|
163
215
|
constrains goes to npm's `latest`. A newer major outside alxia's range is
|
|
164
216
|
left out, and the output says so.
|
|
165
217
|
- **Biome** is pinned exactly, and written exactly: the newest patch of the
|
|
166
218
|
template's minor, `2.5.15` writing `2.5.16` but never `2.6.0`, whose new
|
|
167
219
|
rules the template was not checked against.
|
|
168
|
-
-
|
|
169
|
-
|
|
220
|
+
- **The code generators** are pinned exactly and kept at the template's
|
|
221
|
+
versions, never moved to a newer patch: `@nxgt/openapi-codegen` (`api`,
|
|
222
|
+
`0.7.0`) and GraphQL Code Generator's `@graphql-codegen/cli`,
|
|
223
|
+
`typescript` and `typescript-resolvers` (`graphql`). `bun run verify` runs
|
|
170
224
|
`generate --check` over the committed `src/generated/`, which a release
|
|
171
225
|
that writes the files differently would fail in a fresh project.
|
|
172
226
|
|
|
@@ -177,8 +231,8 @@ versions stay, with a warning.
|
|
|
177
231
|
## Other package managers
|
|
178
232
|
|
|
179
233
|
```sh
|
|
180
|
-
bunx @alxia/create my-app --template
|
|
181
|
-
npm create @alxia my-app -- --template
|
|
234
|
+
bunx @alxia/create my-app --template minimal
|
|
235
|
+
npm create @alxia my-app -- --template minimal
|
|
182
236
|
```
|
|
183
237
|
|
|
184
238
|
The bin runs on Bun (`#!/usr/bin/env bun`) whichever runner starts it, and
|
|
@@ -192,6 +246,7 @@ the project it writes installs with `bun install`.
|
|
|
192
246
|
|
|
193
247
|
## Documentation
|
|
194
248
|
|
|
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.
|
|
249
|
+
- [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 and a field to the `graphql` one, what the `react-router` template adds to React Router's, Biome's settings, each `Dockerfile`, how versions are chosen, and running it in CI.
|
|
196
250
|
- [Troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/create/docs/troubleshooting.md): each message the command prints, and what to do about it.
|
|
197
251
|
- [Roadmap](https://github.com/softistx/alxia/blob/develop/packages/create/docs/roadmap.md): what is coming, and what is not planned.
|
|
252
|
+
- [Recipes](https://github.com/softistx/alxia/blob/develop/docs/recipes/README.md): [Start in 5 minutes](https://github.com/softistx/alxia/blob/develop/docs/start.md), [A spec-first CRUD API](https://github.com/softistx/alxia/blob/develop/docs/recipes/spec-first-crud.md), [A GraphQL API](https://github.com/softistx/alxia/blob/develop/docs/recipes/graphql-api.md), [Deploy with Docker](https://github.com/softistx/alxia/blob/develop/docs/recipes/deploying.md).
|
package/dist/args.d.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
/** The command's name, which starts every line it prints to stderr. */
|
|
3
3
|
export declare const NAME = "create-alxia";
|
|
4
4
|
/** The templates, in the order the prompt lists them. */
|
|
5
|
-
export declare const TEMPLATES: readonly ["api", "react-router"];
|
|
5
|
+
export declare const TEMPLATES: readonly ["minimal", "api", "graphql", "react-router"];
|
|
6
6
|
export type Template = (typeof TEMPLATES)[number];
|
|
7
|
+
/** The templates as a sentence: `minimal, api, graphql or react-router`. */
|
|
8
|
+
export declare const TEMPLATE_LIST: string;
|
|
7
9
|
export declare function isTemplate(value: string): value is Template;
|
|
8
10
|
/** What the arguments asked for. A missing `dir` or `template` is prompted. */
|
|
9
11
|
export interface Options {
|
package/dist/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,uEAAuE;AACvE,eAAO,MAAM,IAAI,iBAAiB,CAAC;AAEnC,yDAAyD;AACzD,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,uEAAuE;AACvE,eAAO,MAAM,IAAI,iBAAiB,CAAC;AAEnC,yDAAyD;AACzD,eAAO,MAAM,SAAS,wDAAyD,CAAC;AAChF,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,4EAA4E;AAC5E,eAAO,MAAM,aAAa,QAAgE,CAAC;AAE3F,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAE3D;AAED,+EAA+E;AAC/E,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACvB;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CACxB,IAAI,EAAE,SAAS,MAAM,EAAE,GACrB,OAAO,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAoCtC"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import { relative, resolve } from "node:path";
|
|
|
7
7
|
|
|
8
8
|
// src/args.ts
|
|
9
9
|
var NAME = "create-alxia";
|
|
10
|
-
var TEMPLATES = ["api", "react-router"];
|
|
10
|
+
var TEMPLATES = ["minimal", "api", "graphql", "react-router"];
|
|
11
|
+
var TEMPLATE_LIST = `${TEMPLATES.slice(0, -1).join(", ")} or ${TEMPLATES.at(-1)}`;
|
|
11
12
|
function isTemplate(value) {
|
|
12
13
|
return TEMPLATES.includes(value);
|
|
13
14
|
}
|
|
@@ -25,11 +26,11 @@ function parseArgs(args) {
|
|
|
25
26
|
else if (arg === "--template" || arg === "-t" || arg.startsWith("--template=")) {
|
|
26
27
|
const value = arg.includes("=") ? arg.slice(arg.indexOf("=") + 1) : args[++i];
|
|
27
28
|
if (value === undefined || value === "") {
|
|
28
|
-
return { error: `${arg} needs a template: ${
|
|
29
|
+
return { error: `${arg} needs a template: ${TEMPLATE_LIST}.` };
|
|
29
30
|
}
|
|
30
31
|
if (!isTemplate(value)) {
|
|
31
32
|
return {
|
|
32
|
-
error: `unknown template ${value}: use ${
|
|
33
|
+
error: `unknown template ${value}: use ${TEMPLATE_LIST}.`
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
template = value;
|
|
@@ -82,6 +83,8 @@ async function clean(target, existed) {
|
|
|
82
83
|
import { dirname } from "node:path";
|
|
83
84
|
var ALXIA_PACKAGES = [
|
|
84
85
|
"@alxia/core",
|
|
86
|
+
"@alxia/env",
|
|
87
|
+
"@alxia/graphql",
|
|
85
88
|
"@alxia/openapi",
|
|
86
89
|
"@alxia/react-router"
|
|
87
90
|
];
|
|
@@ -89,7 +92,9 @@ var PEER_RANGES = {
|
|
|
89
92
|
typescript: "^6.0.3 || ^7.0.0",
|
|
90
93
|
zod: "^4.2.0",
|
|
91
94
|
"react-router": "^8.0.0",
|
|
92
|
-
vite: "^7.0.0 || ^8.0.0"
|
|
95
|
+
vite: "^7.0.0 || ^8.0.0",
|
|
96
|
+
graphql: "^16.11.0 || ^17.0.0",
|
|
97
|
+
"graphql-yoga": "^5.16.0"
|
|
93
98
|
};
|
|
94
99
|
async function alxiaRanges(manifestUrl = new URL("../package.json", import.meta.url)) {
|
|
95
100
|
const manifest = await Bun.file(manifestUrl).json();
|
|
@@ -205,7 +210,10 @@ function isExact(range) {
|
|
|
205
210
|
return /^\d+\.\d+\.\d+$/.test(range);
|
|
206
211
|
}
|
|
207
212
|
var KEPT_EXACT = new Set([
|
|
208
|
-
"@nxgt/openapi-codegen"
|
|
213
|
+
"@nxgt/openapi-codegen",
|
|
214
|
+
"@graphql-codegen/cli",
|
|
215
|
+
"@graphql-codegen/typescript",
|
|
216
|
+
"@graphql-codegen/typescript-resolvers"
|
|
209
217
|
]);
|
|
210
218
|
function sameMinor(range) {
|
|
211
219
|
const match = /(\d+)\.(\d+)\.\d+/.exec(range);
|
|
@@ -312,7 +320,9 @@ Writes a new alxia app in dir, which must be empty or not exist yet. Asks
|
|
|
312
320
|
for what is not given.
|
|
313
321
|
|
|
314
322
|
Options:
|
|
315
|
-
-t, --template <name>
|
|
323
|
+
-t, --template <name> minimal one route and its test: try alxia in 30 seconds
|
|
324
|
+
api spec first: openapi.yaml, generated operations, Zod
|
|
325
|
+
graphql a GraphQL API, schema first, on GraphQL Yoga
|
|
316
326
|
react-router React Router's official template, served by alxia
|
|
317
327
|
--no-install write the files, skip bun install
|
|
318
328
|
-h, --help show this help`;
|
|
@@ -391,17 +401,17 @@ ${steps.map((step) => ` ${step}`).join(`
|
|
|
391
401
|
`;
|
|
392
402
|
}
|
|
393
403
|
function askTemplate(io) {
|
|
394
|
-
const answer = io.ask(`Which template? ${
|
|
404
|
+
const answer = io.ask(`Which template? ${TEMPLATE_LIST}`, "minimal");
|
|
395
405
|
if (answer === null)
|
|
396
406
|
return null;
|
|
397
407
|
if (answer === undefined) {
|
|
398
408
|
return { error: "no --template given, and no terminal to ask in." };
|
|
399
409
|
}
|
|
400
|
-
return isTemplate(answer) ? answer : { error: `unknown template ${answer}: use ${
|
|
410
|
+
return isTemplate(answer) ? answer : { error: `unknown template ${answer}: use ${TEMPLATE_LIST}.` };
|
|
401
411
|
}
|
|
402
412
|
|
|
403
413
|
// src/index.ts
|
|
404
414
|
process.exitCode = await main(process.argv.slice(2), process.cwd(), processIo());
|
|
405
415
|
|
|
406
|
-
//# debugId=
|
|
416
|
+
//# debugId=695D881182698E9064756E2164756E21
|
|
407
417
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
"version": 3,
|
|
3
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 {
|
|
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: ${
|
|
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 {\n\tisTemplate,\n\tNAME,\n\tparseArgs,\n\tTEMPLATE_LIST,\n\ttype Template,\n} 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> minimal one route and its test: try alxia in 30 seconds\n api spec first: openapi.yaml, generated operations, Zod\n graphql a GraphQL API, schema first, on GraphQL Yoga\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? ${TEMPLATE_LIST}`, 'minimal');\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 ${TEMPLATE_LIST}.` };\n}\n",
|
|
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 = ['minimal', 'api', 'graphql', 'react-router'] as const;\nexport type Template = (typeof TEMPLATES)[number];\n\n/** The templates as a sentence: `minimal, api, graphql or react-router`. */\nexport const TEMPLATE_LIST = `${TEMPLATES.slice(0, -1).join(', ')} or ${TEMPLATES.at(-1)}`;\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: ${TEMPLATE_LIST}.` };\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 ${TEMPLATE_LIST}.`,\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/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",
|
|
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/env'\n\t| '@alxia/graphql'\n\t| '@alxia/openapi'\n\t| '@alxia/react-router';\n\nconst ALXIA_PACKAGES: readonly AlxiaPackage[] = [\n\t'@alxia/core',\n\t'@alxia/env',\n\t'@alxia/graphql',\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, `graphql` and `graphql-yoga` are\n * `@alxia/graphql`'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\tgraphql: '^16.11.0 || ^17.0.0',\n\t'graphql-yoga': '^5.16.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
|
-
"/**\n * Copies a template stored under `templates/<template>/`:
|
|
10
|
+
"/**\n * Copies a template stored under `templates/<template>/`: `minimal`, `api`\n * and `graphql`, 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
|
+
"/**\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 * The `api` template's is `@nxgt/openapi-codegen`; the `graphql` one's are\n * GraphQL Code Generator's CLI and the two plugins that write its types.\n */\nexport const KEPT_EXACT: ReadonlySet<string> = new Set([\n\t'@nxgt/openapi-codegen',\n\t'@graphql-codegen/cli',\n\t'@graphql-codegen/typescript',\n\t'@graphql-codegen/typescript-resolvers',\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",
|
|
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,I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EACA,OAAO,YAAY,IAAI;AAAA;AAIxB,SAAS,IAAI,CAAC,OAAe,UAAoB,WAA4B;AAAA,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,iBAAiB,SAAS;AAAA,EACnE,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,iBAAiB;AAAA;;;AS1HjE,QAAQ,WAAW,MAAM,KACxB,QAAQ,KAAK,MAAM,CAAC,GACpB,QAAQ,IAAI,GACZ,UAAU,CACX;",
|
|
17
|
+
"debugId": "695D881182698E9064756E2164756E21",
|
|
18
18
|
"names": []
|
|
19
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
|
|
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> minimal one route and its test: try alxia in 30 seconds\n api spec first: openapi.yaml, generated operations, Zod\n graphql a GraphQL API, schema first, on GraphQL Yoga\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":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAcA,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,smBAWsB,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"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export declare function isExact(range: string): boolean;
|
|
|
52
52
|
* patch of its minor: a project's `bun run verify` runs `generate --check`
|
|
53
53
|
* over the committed `src/generated/`, so a generator patch that writes the
|
|
54
54
|
* files differently would fail a fresh project on files it never touched.
|
|
55
|
+
* The `api` template's is `@nxgt/openapi-codegen`; the `graphql` one's are
|
|
56
|
+
* GraphQL Code Generator's CLI and the two plugins that write its types.
|
|
55
57
|
*/
|
|
56
58
|
export declare const KEPT_EXACT: ReadonlySet<string>;
|
|
57
59
|
/**
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAE,KAAK,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEzD,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,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;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO7D;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,KAAK,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAKpB;AAcD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED
|
|
1
|
+
{"version":3,"file":"registry.d.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,SAAS,CAG3D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,KAAK,EAAE,MAAM,GACX,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,10 +1,11 @@
|
|
|
1
1
|
/** The `@alxia/*` packages a template depends on. */
|
|
2
|
-
export type AlxiaPackage = '@alxia/core' | '@alxia/openapi' | '@alxia/react-router';
|
|
2
|
+
export type AlxiaPackage = '@alxia/core' | '@alxia/env' | '@alxia/graphql' | '@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
|
|
6
6
|
* package's, `zod` is `@alxia/zod`'s, `react-router` and `vite` are
|
|
7
|
-
* `@alxia/react-router`'s
|
|
7
|
+
* `@alxia/react-router`'s, `graphql` and `graphql-yoga` are
|
|
8
|
+
* `@alxia/graphql`'s. `versions.spec.ts` checks each against the
|
|
8
9
|
* package that declares it, so a widened peer fails there until it is
|
|
9
10
|
* widened here too.
|
|
10
11
|
*/
|
|
@@ -13,6 +14,8 @@ export declare const PEER_RANGES: {
|
|
|
13
14
|
readonly zod: "^4.2.0";
|
|
14
15
|
readonly 'react-router': "^8.0.0";
|
|
15
16
|
readonly vite: "^7.0.0 || ^8.0.0";
|
|
17
|
+
readonly graphql: "^16.11.0 || ^17.0.0";
|
|
18
|
+
readonly 'graphql-yoga': "^5.16.0";
|
|
16
19
|
};
|
|
17
20
|
/**
|
|
18
21
|
* The range a generated project declares for each `@alxia/*` package: what
|
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,aAAa,GACb,gBAAgB,GAChB,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":"AAQA,qDAAqD;AACrD,MAAM,MAAM,YAAY,GACrB,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,qBAAqB,CAAC;AAUzB;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAC;AAEX;;;;;;GAMG;AACH,wBAAsB,WAAW,CAChC,WAAW,GAAE,GAAiD,GAC5D,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAcvC"}
|