@alxia/create 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -5
- package/dist/index.js +57 -102
- package/dist/index.js.map +8 -8
- package/dist/main.d.ts.map +1 -1
- package/dist/registry.d.ts +28 -7
- package/dist/registry.d.ts.map +1 -1
- package/dist/templates/react-router.d.ts +9 -18
- package/dist/templates/react-router.d.ts.map +1 -1
- package/dist/versions.d.ts +0 -2
- package/dist/versions.d.ts.map +1 -1
- package/dist/write.d.ts +2 -1
- package/dist/write.d.ts.map +1 -1
- package/docs/README.md +2 -2
- package/docs/guide.md +57 -26
- package/docs/roadmap.md +26 -9
- package/docs/troubleshooting.md +44 -63
- package/package.json +3 -2
- package/templates/react-router/.dockerignore +4 -0
- package/templates/react-router/Dockerfile +29 -0
- package/templates/react-router/README.md +87 -0
- package/templates/react-router/_bunfig.toml +4 -0
- package/templates/react-router/app/app.css +15 -0
- package/templates/react-router/app/root.tsx +75 -0
- package/templates/react-router/app/routes/home.tsx +13 -0
- package/templates/react-router/app/routes.ts +3 -0
- package/templates/react-router/app/welcome/logo-dark.svg +23 -0
- package/templates/react-router/app/welcome/logo-light.svg +23 -0
- package/templates/react-router/app/welcome/welcome.tsx +89 -0
- package/templates/react-router/gitignore +7 -0
- package/templates/react-router/package.json +31 -0
- package/templates/react-router/public/favicon.ico +0 -0
- package/templates/react-router/react-router.config.ts +7 -0
- package/templates/react-router/tsconfig.json +26 -0
- package/templates/react-router/vite.config.ts +11 -0
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import type { Manifest } from '../registry';
|
|
2
|
-
import {
|
|
2
|
+
import type { AlxiaPackage } from '../versions';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Files the template stores under another name, because a published tarball
|
|
5
|
+
* would not hold them: `bun publish`, as `npm publish`, leaves every
|
|
6
|
+
* `.gitignore` out, and Bun leaves `bunfig.toml` out too.
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
/** The scaffold is not what the edits expect: nothing more is written, and `main` removes it. */
|
|
10
|
-
export declare class ScaffoldChanged extends Error {
|
|
11
|
-
constructor(file: string, expected: string);
|
|
12
|
-
}
|
|
13
|
-
export declare const BUNFIG = "[run]\n# The React Router CLI is a node script: this starts it on Bun, which\n# alxia's server needs, even where a node is installed.\nbun = true\n";
|
|
14
|
-
/** `vite.config.ts` with `alxia()` after `reactRouter()`. */
|
|
15
|
-
export declare function addPlugin(config: string): string;
|
|
16
|
-
/** The manifest with alxia's dependencies and `start` on Bun. */
|
|
17
|
-
export declare function addAlxia(manifest: Manifest, alxia: Record<AlxiaPackage, string>): Manifest;
|
|
8
|
+
export declare const RENAMED: Readonly<Record<string, string>>;
|
|
18
9
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
10
|
+
* The template in `dir`: its manifest, named `name` with alxia's packages at
|
|
11
|
+
* `alxia`'s ranges, and every other file, by the path it is written at.
|
|
21
12
|
*/
|
|
22
|
-
export declare function
|
|
13
|
+
export declare function reactRouterTemplate(dir: string, name: string, alxia: Record<AlxiaPackage, string>): Promise<{
|
|
23
14
|
manifest: Manifest;
|
|
24
|
-
files: Record<string,
|
|
15
|
+
files: Record<string, Blob>;
|
|
25
16
|
}>;
|
|
26
17
|
//# sourceMappingURL=react-router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-router.d.ts","sourceRoot":"","sources":["../../src/templates/react-router.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"react-router.d.ts","sourceRoot":"","sources":["../../src/templates/react-router.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGpD,CAAC;AAEF;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;CAAE,CAAC,CAc9D"}
|
package/dist/versions.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export declare const PEER_RANGES: {
|
|
|
14
14
|
readonly 'react-router': "^8.0.0";
|
|
15
15
|
readonly vite: "^7.0.0 || ^8.0.0";
|
|
16
16
|
};
|
|
17
|
-
/** The highest major a range such as `^7.0.0 || ^8.0.0` names. */
|
|
18
|
-
export declare function highestMajor(range: string): number;
|
|
19
17
|
/**
|
|
20
18
|
* The range a generated project declares for each `@alxia/*` package: what
|
|
21
19
|
* this package's own `package.json` says. Published, that is `^<version>`,
|
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,eAAe,GACf,aAAa,GACb,qBAAqB,CAAC;AAQzB;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":"AAQA,qDAAqD;AACrD,MAAM,MAAM,YAAY,GACrB,eAAe,GACf,aAAa,GACb,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/dist/write.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/** Writes a template's project, its dependencies moved to the registry's newest. */
|
|
1
2
|
import { type Template } from './args';
|
|
2
3
|
import type { Io } from './io';
|
|
3
4
|
import type { AlxiaPackage } from './versions';
|
|
4
|
-
/** Writes the project into `target
|
|
5
|
+
/** Writes the project into `target`. */
|
|
5
6
|
export declare function write(target: string, template: Template, alxia: Record<AlxiaPackage, string>, io: Io): Promise<true>;
|
|
6
7
|
//# sourceMappingURL=write.d.ts.map
|
package/dist/write.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAIpF,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAK/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAW/C,wCAAwC;AACxC,wBAAsB,KAAK,CAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,EACnC,EAAE,EAAE,EAAE,GACJ,OAAO,CAAC,IAAI,CAAC,CAoCf"}
|
package/docs/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
The [package README](../README.md) is the short version. This folder is the
|
|
4
4
|
long one: what each template writes, what the `react-router` template
|
|
5
|
-
|
|
5
|
+
adds to React Router's own, how the versions are chosen, and the errors
|
|
6
6
|
the command prints.
|
|
7
7
|
|
|
8
8
|
| Page | Read it when |
|
|
9
9
|
| --- | --- |
|
|
10
10
|
| [Guide](guide.md) | choosing a template, reading what it wrote, 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,
|
|
11
|
+
| [Troubleshooting](troubleshooting.md) | the command refused a directory, a template or an option, the registry did not answer or lacked a version, or `bun install` failed |
|
|
12
12
|
| [Roadmap](roadmap.md) | wondering what is coming, and what is not planned |
|
package/docs/guide.md
CHANGED
|
@@ -138,16 +138,12 @@ compile under each one, and under none.
|
|
|
138
138
|
|
|
139
139
|
## The `react-router` template
|
|
140
140
|
|
|
141
|
-
It is React Router's template,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
bunx create-react-router@8 my-site --yes --no-install --no-git-init --no-agent-skills --no-motion
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
— the newest `create-react-router` of the React Router major
|
|
148
|
-
`@alxia/react-router` accepts — and then makes the same small change
|
|
141
|
+
It is React Router's official template, shipped inside this package and
|
|
142
|
+
copied: what `create-react-router` wrote, committed as it wrote it, with the
|
|
143
|
+
same small change
|
|
149
144
|
[`examples/react-router`](https://github.com/softistx/alxia/tree/develop/examples/react-router)
|
|
150
|
-
made to it,
|
|
145
|
+
made to it. Nothing is downloaded but the dependencies, and nothing runs
|
|
146
|
+
before `bun install`. The change, against React Router's files:
|
|
151
147
|
|
|
152
148
|
```diff
|
|
153
149
|
// package.json
|
|
@@ -156,7 +152,7 @@ made to it, in code:
|
|
|
156
152
|
+ "start": "bun build/server/index.js",
|
|
157
153
|
},
|
|
158
154
|
"dependencies": {
|
|
159
|
-
+ "@alxia/core": "^0.3.
|
|
155
|
+
+ "@alxia/core": "^0.3.1",
|
|
160
156
|
+ "@alxia/react-router": "^0.2.0",
|
|
161
157
|
```
|
|
162
158
|
|
|
@@ -177,12 +173,19 @@ made to it, in code:
|
|
|
177
173
|
bun = true
|
|
178
174
|
```
|
|
179
175
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
([
|
|
176
|
+
The `Dockerfile` is alxia's, in place of React Router's, which builds and
|
|
177
|
+
runs on Node ([Docker](#docker)). Every other file is React Router's:
|
|
178
|
+
`app/`, `public/`, `tsconfig.json`, `react-router.config.ts`, its
|
|
179
|
+
`README.md` (with Bun's commands where it wrote npm's: `bun install`,
|
|
180
|
+
`bun dev`, `bun run build`), `.gitignore` and `.dockerignore`. `package.json` takes the directory's name, and its
|
|
181
|
+
versions are moved to the newest the registry has ([Versions](#versions)):
|
|
182
|
+
the template's own are where they start.
|
|
183
|
+
|
|
184
|
+
The template follows React Router's majors, not its every release: it is
|
|
185
|
+
written again from `create-react-router` when React Router ships one that
|
|
186
|
+
`@alxia/react-router` accepts, in a new `@alxia/create`. Between two, the
|
|
187
|
+
files are what `create-react-router` wrote when the template was last
|
|
188
|
+
generated (React Router 8.4.0 in this release), and the versions are the newest of that major.
|
|
186
189
|
|
|
187
190
|
There is no `app/server.ts`: the plugin's default server serves the pages
|
|
188
191
|
in `bun dev` and from the build. To put alxia's hooks or `/api` routes in
|
|
@@ -193,21 +196,39 @@ bunx alxia-react-router reveal
|
|
|
193
196
|
```
|
|
194
197
|
|
|
195
198
|
The [`@alxia/react-router` guide](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide.md)
|
|
196
|
-
goes from there.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
goes from there.
|
|
200
|
+
|
|
201
|
+
### Docker
|
|
202
|
+
|
|
203
|
+
The project's `Dockerfile` builds the app and runs it on Bun, on the
|
|
204
|
+
official `oven/bun:1` image, in three stages: the production dependencies,
|
|
205
|
+
then every dependency and `bun run build`, then an image with `build/`
|
|
206
|
+
and the production `node_modules` alone, running
|
|
207
|
+
`bun build/server/index.js`, `start`'s command, as the image's non-root
|
|
208
|
+
`bun` user. `.dockerignore` keeps `node_modules`, `build` and
|
|
209
|
+
`.react-router` out of the context.
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
cd my-site
|
|
213
|
+
docker build -t my-site .
|
|
214
|
+
docker run -p 3000:3000 my-site
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The installs are `--frozen-lockfile`, from the `bun.lock` the command's
|
|
218
|
+
`bun install` wrote: commit it. The commented file, and what to change to
|
|
219
|
+
write files from the container, are in
|
|
220
|
+
[`@alxia/react-router`'s guide](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide.md#docker).
|
|
200
221
|
|
|
201
222
|
## Versions
|
|
202
223
|
|
|
203
|
-
A template
|
|
204
|
-
|
|
224
|
+
A template ships the versions it was generated with, and React Router's
|
|
225
|
+
lags behind its own releases. So before installing, the command
|
|
205
226
|
asks the registry for every dependency's versions, and writes `^` the
|
|
206
227
|
newest one alxia accepts:
|
|
207
228
|
|
|
208
229
|
| dependency | moved to the newest within |
|
|
209
230
|
| --- | --- |
|
|
210
|
-
| `@alxia/core`, `@alxia/client`, `@alxia/react-router` |
|
|
231
|
+
| `@alxia/core`, `@alxia/client`, `@alxia/react-router` | the ranges this `@alxia/create` was published with, such as `^0.3.1`; while the registry does not serve that version yet, the newest of its minor, `~0.3.0` |
|
|
211
232
|
| `typescript` | `^6.0.3 \|\| ^7.0.0`, every alxia package's peer range |
|
|
212
233
|
| `zod` | `^4.2.0`, `@alxia/zod`'s |
|
|
213
234
|
| `vite` | `^7.0.0 \|\| ^8.0.0`, `@alxia/react-router`'s |
|
|
@@ -235,9 +256,19 @@ The registry is the one `BUN_CONFIG_REGISTRY` names, else
|
|
|
235
256
|
that does not arrive keeps the template's version, and the command warns
|
|
236
257
|
and goes on.
|
|
237
258
|
|
|
238
|
-
alxia's own packages
|
|
239
|
-
set released together
|
|
240
|
-
`
|
|
259
|
+
alxia's own packages stay within the ranges they were published with, so
|
|
260
|
+
a project is always written with a set released together, and its patches
|
|
261
|
+
since. `bunx @alxia/create@latest` takes the newest set; `bun update` moves
|
|
262
|
+
an existing project's within its ranges.
|
|
263
|
+
|
|
264
|
+
Right after a release, npm can take a few minutes to serve a version
|
|
265
|
+
while the `@alxia/create` published beside it is already there. The
|
|
266
|
+
command then writes the newest release of the same minor, whose `^` range
|
|
267
|
+
takes the new version once it arrives, and says so:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
@alxia/core: the registry has no release within ^0.3.1 yet; wrote ^0.3.0, the newest of ~0.3.0
|
|
271
|
+
```
|
|
241
272
|
|
|
242
273
|
## In a script or CI
|
|
243
274
|
|
package/docs/roadmap.md
CHANGED
|
@@ -15,23 +15,40 @@ Nothing scheduled yet.
|
|
|
15
15
|
|
|
16
16
|
## Later
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
template ships one based on Node, which no longer runs the app once
|
|
20
|
-
`start` runs Bun; the
|
|
21
|
-
[`@alxia/react-router` guide](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide.md#deploying)
|
|
22
|
-
says what to change. The template keeps React Router's files as they are
|
|
23
|
-
written today, so this waits for a decision to edit more of them.
|
|
18
|
+
Nothing scheduled yet.
|
|
24
19
|
|
|
25
20
|
## Not planned
|
|
26
21
|
|
|
27
|
-
- **
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
- **Running `create-react-router` at creation.** The template is its
|
|
23
|
+
output, committed and copied: a new project needs nothing but the
|
|
24
|
+
registry, and no change upstream can stop the command. It is generated
|
|
25
|
+
again from the scaffold when React Router ships a new major.
|
|
30
26
|
- **A runtime dependency.** The prompts are Bun's `prompt()`, the registry
|
|
31
27
|
is read with `fetch`, versions are compared with `Bun.semver`.
|
|
32
28
|
|
|
33
29
|
## Shipped
|
|
34
30
|
|
|
31
|
+
### Next release
|
|
32
|
+
|
|
33
|
+
- **The `react-router` template's `Dockerfile` runs on Bun.** It replaces
|
|
34
|
+
React Router's Node one: multi-stage on `oven/bun:1`, the production
|
|
35
|
+
dependencies apart, `bun run build`, then `bun build/server/index.js` as
|
|
36
|
+
the image's non-root `bun` user. `docker build` works in a new project
|
|
37
|
+
as it is.
|
|
38
|
+
- **The `react-router` project's README runs Bun.** React Router's own
|
|
39
|
+
README, with `bun install`, `bun dev` and `bun run build` where it wrote
|
|
40
|
+
npm's commands.
|
|
41
|
+
- **The `react-router` template is files, copied.** React Router's official
|
|
42
|
+
template ships inside `@alxia/create`, with alxia's layer, and is copied
|
|
43
|
+
as it is: no `create-react-router` runs, and no change in it can make the
|
|
44
|
+
command refuse.
|
|
45
|
+
- **alxia's packages resolve at creation too.** `@alxia/core`,
|
|
46
|
+
`@alxia/client` and `@alxia/react-router` move to the newest version
|
|
47
|
+
within the ranges `@alxia/create` was published with. Right after a
|
|
48
|
+
release, while the registry does not serve that version yet, the newest
|
|
49
|
+
of the same minor is written, so `bun install` no longer fails with
|
|
50
|
+
`No version matching "^0.3.1"`.
|
|
51
|
+
|
|
35
52
|
### 0.1.0
|
|
36
53
|
|
|
37
54
|
- `bun create @alxia [dir] [--template api|react-router] [--no-install]`,
|
package/docs/troubleshooting.md
CHANGED
|
@@ -26,17 +26,16 @@ nothing — the symptom.
|
|
|
26
26
|
|
|
27
27
|
**Writing the project**
|
|
28
28
|
|
|
29
|
-
- [`create-alxia: create-react-router's … is not what this @alxia/create expects: …`](#create-alxia-create-react-routers--is-not-what-this-alxiacreate-expects-)
|
|
30
|
-
- [`create-alxia: failed: create-react-router exited with 1.`](#create-alxia-failed-create-react-router-exited-with-1)
|
|
31
29
|
- [`create-alxia: failed: …`](#create-alxia-failed-)
|
|
32
30
|
- [`create-alxia: warning: the registry did not answer for …; kept the versions the template ships.`](#create-alxia-warning-the-registry-did-not-answer-for--kept-the-versions-the-template-ships)
|
|
33
31
|
- [`typescript: kept to ^6.0.3 || ^7.0.0, where the newest is 7.0.2; npm's latest, 8.0.0, is outside it`](#typescript-kept-to-603--700-where-the-newest-is-702-npms-latest-800-is-outside-it)
|
|
34
32
|
- [`zod: no release within ^4.2.0; kept ^4.2.0`](#zod-no-release-within-420-kept-420)
|
|
33
|
+
- [`@alxia/core: the registry has no release within ^0.3.1 yet; wrote ^0.3.0, the newest of ~0.3.0`](#alxiacore-the-registry-has-no-release-within-031-yet-wrote-030-the-newest-of-030)
|
|
35
34
|
- [`create-alxia: bun install failed; the files are written.`](#create-alxia-bun-install-failed-the-files-are-written)
|
|
36
35
|
|
|
37
36
|
**After**
|
|
38
37
|
|
|
39
|
-
- [
|
|
38
|
+
- [`error: lockfile had changes, but lockfile is frozen`](#error-lockfile-had-changes-but-lockfile-is-frozen)
|
|
40
39
|
- [The project's `@alxia/*` are older than npm's latest](#the-projects-alxia-are-older-than-npms-latest)
|
|
41
40
|
|
|
42
41
|
## Before it runs
|
|
@@ -148,47 +147,6 @@ project beside it and move the files in.
|
|
|
148
147
|
|
|
149
148
|
## Writing the project
|
|
150
149
|
|
|
151
|
-
### `create-alxia: create-react-router's … is not what this @alxia/create expects: …`
|
|
152
|
-
|
|
153
|
-
**When:** the `react-router` template, after `create-react-router` ran.
|
|
154
|
-
The message names the file — `package.json`, `vite.config.ts` or
|
|
155
|
-
`bunfig.toml` — and what was expected of it:
|
|
156
|
-
|
|
157
|
-
- `it is missing`: no `package.json` or `vite.config.ts`;
|
|
158
|
-
- `react-router in its dependencies, and the scripts dev: react-router dev, build: react-router build and a start`;
|
|
159
|
-
- `reactRouter() from "@react-router/dev/vite", called once in plugins: [...]`;
|
|
160
|
-
- `it already imports @alxia/react-router/vite`;
|
|
161
|
-
- `none, and there is one`: a `bunfig.toml` already.
|
|
162
|
-
|
|
163
|
-
**Why:** React Router's template changed since this `@alxia/create` was
|
|
164
|
-
released, and the edits that add alxia check each file before changing it
|
|
165
|
-
rather than write a project that does not start. What was written is
|
|
166
|
-
removed: the target directory is emptied when it was there, removed when
|
|
167
|
-
it was not. A parent directory the command created for it, as `a/b` for
|
|
168
|
-
`a/b/my-site`, stays.
|
|
169
|
-
|
|
170
|
-
**Fix:** run the newest `@alxia/create`, whose edits follow the newest
|
|
171
|
-
template:
|
|
172
|
-
|
|
173
|
-
```sh
|
|
174
|
-
bunx @alxia/create@latest my-site --template react-router
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
If that one refuses too, add alxia to React Router's template by hand, as
|
|
178
|
-
[`@alxia/react-router`'s README](https://www.npmjs.com/package/@alxia/react-router)
|
|
179
|
-
shows (`bun add`, `alxia()` in `vite.config.ts`, `start`), and open an
|
|
180
|
-
issue.
|
|
181
|
-
|
|
182
|
-
### `create-alxia: failed: create-react-router exited with 1.`
|
|
183
|
-
|
|
184
|
-
**When:** the `react-router` template, when `create-react-router` itself
|
|
185
|
-
failed; its own output, just above, says why. Most often the network:
|
|
186
|
-
`bunx` could not fetch it, or it could not fetch React Router's template
|
|
187
|
-
from GitHub.
|
|
188
|
-
|
|
189
|
-
**Fix:** what its output says, then run the command again: what was
|
|
190
|
-
written is removed.
|
|
191
|
-
|
|
192
150
|
### `create-alxia: failed: …`
|
|
193
151
|
|
|
194
152
|
**When:** any other error while writing the project, with the error's own
|
|
@@ -196,7 +154,9 @@ message after `failed:` — most often the file system: `EACCES` writing
|
|
|
196
154
|
into a directory the user cannot write to, `ENOSPC` with the disk full.
|
|
197
155
|
|
|
198
156
|
**Fix:** what the message names, then run the command again: what was
|
|
199
|
-
written is removed
|
|
157
|
+
written is removed — the target directory is emptied when it was there,
|
|
158
|
+
removed when it was not. A parent directory the command created for it, as
|
|
159
|
+
`a/b` for `a/b/my-site`, stays.
|
|
200
160
|
|
|
201
161
|
### `create-alxia: warning: the registry did not answer for …; kept the versions the template ships.`
|
|
202
162
|
|
|
@@ -211,7 +171,10 @@ that is React Router's, whose TypeScript may be older than alxia accepts.
|
|
|
211
171
|
|
|
212
172
|
**Fix:** once the registry answers, run the command again in an empty
|
|
213
173
|
directory, or move the packages named within alxia's ranges by hand:
|
|
214
|
-
`bun add -d typescript@^7 vite@^8`.
|
|
174
|
+
`bun add -d typescript@^7 vite@^8`. The message can name an `@alxia/*`
|
|
175
|
+
package too, on a mirror that does not hold alxia's: the range kept is the
|
|
176
|
+
one this `@alxia/create` was published with, which that mirror cannot
|
|
177
|
+
install either, so let it proxy npmjs.org. Behind a proxy, check `BUN_CONFIG_REGISTRY` or
|
|
215
178
|
`npm_config_registry`, which the command reads.
|
|
216
179
|
|
|
217
180
|
### `typescript: kept to ^6.0.3 || ^7.0.0, where the newest is 7.0.2; npm's latest, 8.0.0, is outside it`
|
|
@@ -231,11 +194,27 @@ once the major is tested, and the next `@alxia/create` takes it.
|
|
|
231
194
|
**When:** a notice: the registry answered for the package, but none of its
|
|
232
195
|
releases is in the range alxia's packages accept — a registry mirror that
|
|
233
196
|
holds only some versions, most often. The template's own version is kept.
|
|
197
|
+
An `@alxia/*` package prints it too when the registry holds none of the
|
|
198
|
+
range's minor, not even an older patch.
|
|
234
199
|
|
|
235
200
|
**Fix:** check what the registry holds (`bun pm view zod versions`), let
|
|
236
201
|
the mirror fetch the missing ones, or write a version within the range by
|
|
237
202
|
hand after the project is created.
|
|
238
203
|
|
|
204
|
+
### `@alxia/core: the registry has no release within ^0.3.1 yet; wrote ^0.3.0, the newest of ~0.3.0`
|
|
205
|
+
|
|
206
|
+
**When:** a notice, not an error, right after an alxia release: the
|
|
207
|
+
registry lists `@alxia/create`'s new version but not yet the
|
|
208
|
+
`@alxia/core` (or `@alxia/client`, `@alxia/react-router`) published beside
|
|
209
|
+
it. npm can take a few minutes to serve a version everywhere.
|
|
210
|
+
|
|
211
|
+
**Why:** a project written with `^0.3.1` would fail its `bun install` with
|
|
212
|
+
`No version matching "^0.3.1" found`. The command writes the newest release
|
|
213
|
+
of the same minor instead; `^0.3.0` still takes 0.3.1.
|
|
214
|
+
|
|
215
|
+
**Fix:** nothing to do. Once the registry serves the new version,
|
|
216
|
+
`bun update @alxia/core` moves the project to it.
|
|
217
|
+
|
|
239
218
|
### `create-alxia: bun install failed; the files are written.`
|
|
240
219
|
|
|
241
220
|
**When:** `bun install` exited non-zero in the new project; its output,
|
|
@@ -247,32 +226,34 @@ project is complete; only `node_modules` is missing.
|
|
|
247
226
|
|
|
248
227
|
## After
|
|
249
228
|
|
|
250
|
-
###
|
|
229
|
+
### `error: lockfile had changes, but lockfile is frozen`
|
|
251
230
|
|
|
252
|
-
**
|
|
253
|
-
`
|
|
231
|
+
**When:** `docker build` in a `react-router` project stops at
|
|
232
|
+
`RUN bun install --frozen-lockfile`.
|
|
254
233
|
|
|
255
|
-
**Why:**
|
|
256
|
-
|
|
257
|
-
|
|
234
|
+
**Why:** the project's `Dockerfile` installs exactly what `bun.lock`
|
|
235
|
+
records, and `package.json` now asks for something it does not: a
|
|
236
|
+
dependency added or changed by hand, without `bun install`, or a `bun.lock` left
|
|
237
|
+
behind in a clone where `package.json` moved on without it.
|
|
258
238
|
|
|
259
|
-
**Fix:**
|
|
260
|
-
`bun
|
|
261
|
-
`
|
|
262
|
-
[`@alxia/react-router`'s guide](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide.md#deploying)
|
|
263
|
-
says.
|
|
239
|
+
**Fix:** run `bun install`, commit `bun.lock`, and build again. The other
|
|
240
|
+
traps of the image, a write refused to the `bun` user among them, are in
|
|
241
|
+
[`@alxia/react-router`'s troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/troubleshooting.md#eacces-permission-denied-open-app).
|
|
264
242
|
|
|
265
243
|
### The project's `@alxia/*` are older than npm's latest
|
|
266
244
|
|
|
267
|
-
**Symptom:** a fresh project declares `@alxia/core` at `^0.3.
|
|
268
|
-
has `0.4.0
|
|
245
|
+
**Symptom:** a fresh project declares `@alxia/core` at `^0.3.4` while npm
|
|
246
|
+
has `0.4.0`, and the output said `@alxia/core: kept to ^0.3.1, where the
|
|
247
|
+
newest is 0.3.4; npm's latest, 0.4.0, is outside it`.
|
|
269
248
|
|
|
270
|
-
**Why:** alxia's packages
|
|
271
|
-
that ran was published with ([Versions](guide.md#versions))
|
|
272
|
-
of `@alxia/core` alone does not release a
|
|
249
|
+
**Why:** alxia's packages move only within the ranges the `@alxia/create`
|
|
250
|
+
that ran was published with ([Versions](guide.md#versions)): a new minor
|
|
251
|
+
is outside them, and a release of `@alxia/core` alone does not release a
|
|
252
|
+
new `@alxia/create`.
|
|
273
253
|
|
|
274
254
|
**Fix:** `bunx @alxia/create@latest` for the newest `@alxia/create`, and in
|
|
275
255
|
an existing project
|
|
276
|
-
`bun add @alxia/core@latest @alxia/client@latest
|
|
256
|
+
`bun add @alxia/core@latest @alxia/client@latest` (`api`) or
|
|
257
|
+
`bun add @alxia/core@latest @alxia/react-router@latest` (`react-router`), reading
|
|
277
258
|
[`@alxia/core`'s upgrading page](https://github.com/softistx/alxia/blob/develop/packages/core/docs/upgrading.md)
|
|
278
259
|
for what a minor changed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alxia/create",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Start an alxia app: `bun create @alxia` writes an API with Zod, or React Router's official template served by alxia",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"docs",
|
|
13
|
+
"templates/react-router",
|
|
13
14
|
"README.md",
|
|
14
15
|
"package.json",
|
|
15
16
|
"LICENSE"
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@alxia/client": "^0.2.1",
|
|
41
42
|
"@alxia/core": "^0.3.1",
|
|
42
|
-
"@alxia/react-router": "^0.
|
|
43
|
+
"@alxia/react-router": "^0.3.0",
|
|
43
44
|
"@types/bun": "^1.4.2",
|
|
44
45
|
"zod": "^4.6.5"
|
|
45
46
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Bun builds the app and runs it: build/server/index.js is alxia's server,
|
|
2
|
+
# which runs on Bun. Pinned to Bun 1, the major alxia supports.
|
|
3
|
+
|
|
4
|
+
# The production dependencies alone, for the final image.
|
|
5
|
+
FROM oven/bun:1 AS production-dependencies
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
COPY package.json bun.lock* bunfig.toml* ./
|
|
8
|
+
RUN bun install --frozen-lockfile --production
|
|
9
|
+
|
|
10
|
+
# Every dependency, then react-router build: build/client and
|
|
11
|
+
# build/server/index.js.
|
|
12
|
+
FROM oven/bun:1 AS build
|
|
13
|
+
WORKDIR /app
|
|
14
|
+
COPY package.json bun.lock* bunfig.toml* ./
|
|
15
|
+
RUN bun install --frozen-lockfile
|
|
16
|
+
COPY . .
|
|
17
|
+
RUN bun run build
|
|
18
|
+
|
|
19
|
+
# The build and the production dependencies, run as Bun's own non-root
|
|
20
|
+
# user. The server listens on PORT (3000) and HOST (0.0.0.0).
|
|
21
|
+
FROM oven/bun:1
|
|
22
|
+
WORKDIR /app
|
|
23
|
+
ENV NODE_ENV=production
|
|
24
|
+
COPY package.json ./
|
|
25
|
+
COPY --from=production-dependencies /app/node_modules ./node_modules
|
|
26
|
+
COPY --from=build /app/build ./build
|
|
27
|
+
USER bun
|
|
28
|
+
EXPOSE 3000
|
|
29
|
+
CMD ["bun", "build/server/index.js"]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Welcome to React Router!
|
|
2
|
+
|
|
3
|
+
A modern, production-ready template for building full-stack React applications using React Router.
|
|
4
|
+
|
|
5
|
+
[](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/default)
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🚀 Server-side rendering
|
|
10
|
+
- ⚡️ Hot Module Replacement (HMR)
|
|
11
|
+
- 📦 Asset bundling and optimization
|
|
12
|
+
- 🔄 Data loading and mutations
|
|
13
|
+
- 🔒 TypeScript by default
|
|
14
|
+
- 🎉 TailwindCSS for styling
|
|
15
|
+
- 📖 [React Router docs](https://reactrouter.com/)
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
|
|
21
|
+
Install the dependencies:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bun install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Development
|
|
28
|
+
|
|
29
|
+
Start the development server with HMR:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Your application will be available at `http://localhost:5173`.
|
|
36
|
+
|
|
37
|
+
## Building for Production
|
|
38
|
+
|
|
39
|
+
Create a production build:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bun run build
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Deployment
|
|
46
|
+
|
|
47
|
+
### Docker Deployment
|
|
48
|
+
|
|
49
|
+
To build and run using Docker:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
docker build -t my-app .
|
|
53
|
+
|
|
54
|
+
# Run the container
|
|
55
|
+
docker run -p 3000:3000 my-app
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The containerized application can be deployed to any platform that supports Docker, including:
|
|
59
|
+
|
|
60
|
+
- AWS ECS
|
|
61
|
+
- Google Cloud Run
|
|
62
|
+
- Azure Container Apps
|
|
63
|
+
- Digital Ocean App Platform
|
|
64
|
+
- Fly.io
|
|
65
|
+
- Railway
|
|
66
|
+
|
|
67
|
+
### DIY Deployment
|
|
68
|
+
|
|
69
|
+
The build is production-ready: `bun run start` runs `build/server/index.js` on Bun.
|
|
70
|
+
|
|
71
|
+
Make sure to deploy the output of `bun run build`
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
├── package.json
|
|
75
|
+
├── bun.lock
|
|
76
|
+
├── build/
|
|
77
|
+
│ ├── client/ # Static assets
|
|
78
|
+
│ └── server/ # Server-side code
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Styling
|
|
82
|
+
|
|
83
|
+
This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
Built with ❤️ using React Router.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
@theme {
|
|
4
|
+
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif,
|
|
5
|
+
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
html,
|
|
9
|
+
body {
|
|
10
|
+
@apply bg-white dark:bg-gray-950;
|
|
11
|
+
|
|
12
|
+
@media (prefers-color-scheme: dark) {
|
|
13
|
+
color-scheme: dark;
|
|
14
|
+
}
|
|
15
|
+
}
|