@alxia/create 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +81 -24
  2. package/dist/copy.d.ts +11 -3
  3. package/dist/copy.d.ts.map +1 -1
  4. package/dist/index.js +51 -23
  5. package/dist/index.js.map +8 -7
  6. package/dist/main.d.ts +1 -1
  7. package/dist/main.d.ts.map +1 -1
  8. package/dist/packument.d.ts +18 -0
  9. package/dist/packument.d.ts.map +1 -0
  10. package/dist/registry.d.ts +29 -10
  11. package/dist/registry.d.ts.map +1 -1
  12. package/dist/versions.d.ts +1 -1
  13. package/dist/versions.d.ts.map +1 -1
  14. package/docs/README.md +6 -5
  15. package/docs/guide.md +503 -59
  16. package/docs/roadmap.md +49 -4
  17. package/docs/troubleshooting.md +249 -4
  18. package/package.json +5 -4
  19. package/templates/api/.vscode/extensions.json +3 -0
  20. package/templates/api/.vscode/settings.json +8 -0
  21. package/templates/api/README.md +78 -6
  22. package/templates/api/_biome.json +32 -0
  23. package/templates/api/openapi-codegen.config.ts +11 -0
  24. package/templates/api/openapi.yaml +116 -0
  25. package/templates/api/package.json +27 -19
  26. package/templates/api/src/app.spec.ts +57 -38
  27. package/templates/api/src/app.ts +5 -30
  28. package/templates/api/src/context.ts +19 -0
  29. package/templates/api/src/generated/alxia.ts +61 -0
  30. package/templates/api/src/generated/operations.ts +133 -0
  31. package/templates/api/src/generated/paths.ts +170 -0
  32. package/templates/api/src/generated/types.ts +170 -0
  33. package/templates/api/src/generated/zod.ts +31 -0
  34. package/templates/api/src/routes/todos.ts +31 -0
  35. package/templates/api/src/server.ts +12 -12
  36. package/templates/api/tsconfig.json +23 -23
  37. package/templates/react-router/.vscode/extensions.json +3 -0
  38. package/templates/react-router/.vscode/settings.json +8 -0
  39. package/templates/react-router/README.md +27 -0
  40. package/templates/react-router/_biome.json +49 -0
  41. package/templates/react-router/app/app.css +3 -2
  42. package/templates/react-router/app/routes/home.tsx +1 -1
  43. package/templates/react-router/app/routes.ts +1 -1
  44. package/templates/react-router/package.json +7 -1
@@ -1,16 +1,19 @@
1
+ /**
2
+ * Moves a generated project's dependencies to their newest versions on the
3
+ * registry, within what alxia accepts: a template ships the versions it was
4
+ * written with, and React Router's lags behind its own releases. alxia's own
5
+ * packages move within the ranges this `@alxia/create` was published with,
6
+ * and fall back on the same minor when the registry does not have the
7
+ * version those ranges start at yet.
8
+ */
9
+ import { type Registry } from './packument';
10
+ export { type Registry, registryUrl } from './packument';
1
11
  /** The dependency fields of a manifest, as a template writes them. */
2
12
  export interface Manifest {
3
13
  dependencies?: Record<string, string>;
4
14
  devDependencies?: Record<string, string>;
5
15
  [key: string]: unknown;
6
16
  }
7
- /** How to reach the registry: its URL, and the `fetch` to call it with. */
8
- export interface Registry {
9
- readonly url: string;
10
- readonly fetch?: (request: Request) => Promise<Response>;
11
- /** How long one package's metadata may take, in milliseconds. */
12
- readonly timeout?: number;
13
- }
14
17
  /** What a bump changed, and what it could not. */
15
18
  export interface Bumped {
16
19
  /** One line per dependency moved: `vite ^8.0.3 -> ^8.3.2`. */
@@ -28,8 +31,6 @@ export interface Bumped {
28
31
  */
29
32
  readonly behind: string[];
30
33
  }
31
- /** The registry to resolve against: the one Bun or npm was given, or npm's. */
32
- export declare function registryUrl(env: Record<string, string | undefined>): string;
33
34
  /**
34
35
  * The range alxia's peers hold `name` to — React Router's packages follow
35
36
  * `react-router`'s — or undefined when none does, and npm's `latest` is
@@ -38,6 +39,21 @@ export declare function registryUrl(env: Record<string, string | undefined>): st
38
39
  export declare function allowedRange(name: string): string | undefined;
39
40
  /** The newest release (not a prerelease) of `versions` within `range`. */
40
41
  export declare function newestWithin(versions: readonly string[], range: string): string | undefined;
42
+ /**
43
+ * Whether `range` is one exact version, as `2.5.15`: how a template pins a
44
+ * tool whose patch releases may change its output, as Biome asks to be
45
+ * pinned. Such a dependency stays exact, and within its own minor: a
46
+ * minor of Biome may add a recommended rule the template was not checked
47
+ * against.
48
+ */
49
+ export declare function isExact(range: string): boolean;
50
+ /**
51
+ * Tools whose exact pin the template keeps as it is, even from the newest
52
+ * patch of its minor: a project's `bun run verify` runs `generate --check`
53
+ * over the committed `src/generated/`, so a generator patch that writes the
54
+ * files differently would fail a fresh project on files it never touched.
55
+ */
56
+ export declare const KEPT_EXACT: ReadonlySet<string>;
41
57
  /**
42
58
  * `range`'s own minor, from its first version: `~0.3.0` for `^0.3.1`, or
43
59
  * undefined for a range that names no version.
@@ -53,7 +69,10 @@ export declare function newestOfMinor(versions: readonly string[], range: string
53
69
  * Rewrites every dependency of `manifest` to `^` its newest version: within
54
70
  * `built[name]` for a package it names — alxia's, at the ranges this
55
71
  * `@alxia/create` was published with — else within the range alxia's peers
56
- * hold it to, else npm's `latest`. A package of `built` with no release in
72
+ * hold it to, else npm's `latest`. A dependency the template pins exactly
73
+ * (`isExact`) is rewritten exactly, to the newest of its own minor, except
74
+ * a `KEPT_EXACT` one, which keeps the template's version. A
75
+ * package of `built` with no release in
57
76
  * its range, as when npm has not yet propagated a version published minutes
58
77
  * ago, takes the newest of the range's own minor, named in `behind`: `^` it
59
78
  * is still within the range. React Router's own packages take the version
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAUA,sEAAsE;AACtE,MAAM,WAAW,QAAQ;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzD,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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"}
@@ -1,5 +1,5 @@
1
1
  /** The `@alxia/*` packages a template depends on. */
2
- export type AlxiaPackage = '@alxia/client' | '@alxia/core' | '@alxia/react-router';
2
+ export type AlxiaPackage = '@alxia/core' | '@alxia/openapi' | '@alxia/react-router';
3
3
  /**
4
4
  * The peer ranges of alxia's packages that a template's other dependencies
5
5
  * must stay within, by the package they constrain: `typescript` is every
@@ -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;;;;;;GAMG;AACH,wBAAsB,WAAW,CAChC,WAAW,GAAE,GAAiD,GAC5D,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAcvC"}
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":"AAQA,qDAAqD;AACrD,MAAM,MAAM,YAAY,GACrB,aAAa,GACb,gBAAgB,GAChB,qBAAqB,CAAC;AAQzB;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX;;;;;;GAMG;AACH,wBAAsB,WAAW,CAChC,WAAW,GAAE,GAAiD,GAC5D,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAcvC"}
package/docs/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # @alxia/create documentation
2
2
 
3
3
  The [package README](../README.md) is the short version. This folder is the
4
- long one: what each template writes, what the `react-router` template
5
- adds to React Router's own, how the versions are chosen, and the errors
6
- the command prints.
4
+ long one: what each template writes, how the `api` project grows from
5
+ its OpenAPI document, what the `react-router` template adds to React
6
+ Router's own, how the versions are chosen, and the errors the command and
7
+ a new project print.
7
8
 
8
9
  | Page | Read it when |
9
10
  | --- | --- |
10
- | [Guide](guide.md) | choosing a template, reading what it wrote, building its Docker image, pinning or moving versions, or running the command in a script or CI |
11
- | [Troubleshooting](troubleshooting.md) | the command refused a directory, a template or an option, the registry did not answer or lacked a version, or `bun install` failed |
11
+ | [Guide](guide.md) | choosing a template, reading what it wrote, adding an operation to the `api` project's `openapi.yaml`, linting and formatting it with Biome, building its Docker image, pinning or moving versions, or running the command in a script or CI |
12
+ | [Troubleshooting](troubleshooting.md) | the command refused a directory, a template or an option, the registry did not answer or lacked a version, `bun install` failed, Biome refused to run in a project, or the `api` project's `generate --check`, `matchesSpec` or a reply check failed |
12
13
  | [Roadmap](roadmap.md) | wondering what is coming, and what is not planned |