@alxia/create 0.1.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/LICENSE +21 -0
- package/README.md +101 -0
- package/dist/args.d.ts +19 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +599 -0
- package/dist/index.js.map +19 -0
- package/dist/io.d.ts +18 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/main.d.ts +9 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/registry.d.ts +44 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/target.d.ts +7 -0
- package/dist/target.d.ts.map +1 -0
- package/dist/templates/api.d.ts +16 -0
- package/dist/templates/api.d.ts.map +1 -0
- package/dist/templates/react-router.d.ts +26 -0
- package/dist/templates/react-router.d.ts.map +1 -0
- package/dist/versions.d.ts +27 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/write.d.ts +6 -0
- package/dist/write.d.ts.map +1 -0
- package/docs/README.md +12 -0
- package/docs/guide.md +253 -0
- package/docs/roadmap.md +39 -0
- package/docs/troubleshooting.md +278 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Steve Tsala
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @alxia/create
|
|
2
|
+
|
|
3
|
+
Start an [alxia](https://github.com/softistx/alxia) app in one command: an
|
|
4
|
+
API with Zod, or React Router's official template served by alxia.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
bun create @alxia my-app
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
`bun create @alxia` runs this package's bin, as `bun create <name>` runs
|
|
11
|
+
`create-<name>` and `bun create @scope` runs `@scope/create`. It asks for
|
|
12
|
+
what it is not given, writes the project, installs it and prints the next
|
|
13
|
+
steps:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
cd my-app
|
|
17
|
+
bun dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
It needs Bun 1.4.2 or later, which the projects it writes run on.
|
|
21
|
+
|
|
22
|
+
## Templates
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
bun create @alxia my-api --template api
|
|
26
|
+
bun create @alxia my-site --template react-router
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| template | what it writes |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| `api` | an `@alxia/core` app with Zod: `POST /todos` validates its body, behind `requireKey`, a hook made with `defineHook` that answers 401 without an API key; a `bun test` spec calling it with `app.request()` and through `@alxia/client`, typed; `bun dev` restarting on change, `typecheck`, `build`, a strict `tsconfig.json`, `.gitignore` and a README |
|
|
32
|
+
| `react-router` | React Router's own template, written by its `create-react-router`, then [`@alxia/react-router`](https://www.npmjs.com/package/@alxia/react-router) added as its README says: `alxia()` in `vite.config.ts`'s plugins, `start` running `bun build/server/index.js`, a `bunfig.toml` starting React Router's CLI on Bun. No server file: the default one serves the pages; `bunx alxia-react-router reveal` writes it out to customise |
|
|
33
|
+
|
|
34
|
+
The heart of the `api` project, its route and hook (the whole file, with
|
|
35
|
+
its imports and schemas, is in the [guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md#the-api-template)):
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// src/app.ts, in part
|
|
39
|
+
const requireKey = defineHook(({ request, reply }) =>
|
|
40
|
+
request.headers.get('x-api-key') === apiKey
|
|
41
|
+
? undefined
|
|
42
|
+
: reply(401, { error: 'unauthorized' as const }),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export const app = alxia()
|
|
46
|
+
.decorate({ todos })
|
|
47
|
+
.post('/todos', [requireKey], { body: NewTodo, response: { 201: Todo } }, ({ body, todos, reply }) => {
|
|
48
|
+
const todo = { id: todos.length + 1, title: body.title, done: false };
|
|
49
|
+
todos.push(todo);
|
|
50
|
+
return reply.created(todo);
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Options
|
|
55
|
+
|
|
56
|
+
| option | |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `[dir]` | where to write the project: a directory that is empty or does not exist yet. Asked when not given |
|
|
59
|
+
| `--template <name>`, `-t` | `api` or `react-router`. Asked when not given |
|
|
60
|
+
| `--no-install` | write the files, skip `bun install` |
|
|
61
|
+
| `--help`, `-h` | the usage |
|
|
62
|
+
|
|
63
|
+
Given both `dir` and `--template`, it asks nothing, so it runs in a script
|
|
64
|
+
or CI.
|
|
65
|
+
|
|
66
|
+
## Versions
|
|
67
|
+
|
|
68
|
+
- **alxia's packages** are at the versions this release of `@alxia/create`
|
|
69
|
+
was published with, as `^` ranges: `@alxia/core`, `@alxia/client`,
|
|
70
|
+
`@alxia/react-router`. `bunx @alxia/create@<version>` picks an older set.
|
|
71
|
+
- **Everything else** — Zod, TypeScript, Vite, React, React Router, Tailwind
|
|
72
|
+
— is moved to the newest version on the registry when the project is
|
|
73
|
+
written, within the range alxia's packages accept: TypeScript within
|
|
74
|
+
`^6.0.3 || ^7.0.0`, Vite within `^7.0.0 || ^8.0.0`, React Router and its
|
|
75
|
+
packages within `^8.0.0`, Zod within `^4.2.0`; what no alxia package
|
|
76
|
+
constrains goes to npm's `latest`. A newer major outside alxia's range is
|
|
77
|
+
left out, and the output says so. The registry is the one
|
|
78
|
+
`BUN_CONFIG_REGISTRY` or `npm_config_registry` names, else npmjs.org;
|
|
79
|
+
when it does not answer, the template's own versions stay, with a warning.
|
|
80
|
+
|
|
81
|
+
## Other package managers
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
bunx @alxia/create my-app --template api
|
|
85
|
+
npm create @alxia my-app -- --template api
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The bin runs on Bun (`#!/usr/bin/env bun`) whichever runner starts it, and
|
|
89
|
+
the project it writes installs with `bun install`.
|
|
90
|
+
|
|
91
|
+
## API
|
|
92
|
+
|
|
93
|
+
| export | |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `create-alxia` | the bin `bun create @alxia`, `bunx @alxia/create` and `npm create @alxia` run. The package exports no module |
|
|
96
|
+
|
|
97
|
+
## Documentation
|
|
98
|
+
|
|
99
|
+
- [Guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md): each template file by file, what the `react-router` template changes in React Router's, how versions are chosen, and running it in CI.
|
|
100
|
+
- [Troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/create/docs/troubleshooting.md): each message the command prints, and what to do about it.
|
|
101
|
+
- [Roadmap](https://github.com/softistx/alxia/blob/develop/packages/create/docs/roadmap.md): what is coming, and what is not planned.
|
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The command line of `create-alxia`, read into what to create. */
|
|
2
|
+
/** The command's name, which starts every line it prints to stderr. */
|
|
3
|
+
export declare const NAME = "create-alxia";
|
|
4
|
+
/** The templates, in the order the prompt lists them. */
|
|
5
|
+
export declare const TEMPLATES: readonly ["api", "react-router"];
|
|
6
|
+
export type Template = (typeof TEMPLATES)[number];
|
|
7
|
+
export declare function isTemplate(value: string): value is Template;
|
|
8
|
+
/** What the arguments asked for. A missing `dir` or `template` is prompted. */
|
|
9
|
+
export interface Options {
|
|
10
|
+
readonly dir?: string;
|
|
11
|
+
readonly template?: Template;
|
|
12
|
+
readonly install: boolean;
|
|
13
|
+
readonly help: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** The arguments as options, or the message that refuses them. */
|
|
16
|
+
export declare function parseArgs(args: readonly string[]): Options | {
|
|
17
|
+
readonly error: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +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,kCAAmC,CAAC;AAC1D,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,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.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|