@jxsuite/create 1.3.9 → 1.3.11
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 +23 -88
- package/package.json +2 -2
- package/template-versions.json +4 -4
- package/templates/mobile-app/pages/index.md +1 -2
package/README.md
CHANGED
|
@@ -4,15 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
`@jxsuite/create` turns an empty directory into a working Jx project. It is two things at once: an
|
|
8
|
-
interactive CLI, and the library whose `generateProject()` is the single generation engine shared by
|
|
9
|
-
every creation surface in the monorepo. The CLI imports it directly, and the dev server's Studio
|
|
10
|
-
API and the packaged desktop backend dynamic-import it (`packages/server/src/studio-api.ts`,
|
|
11
|
-
`packages/desktop/src/project-session.ts`).
|
|
7
|
+
`@jxsuite/create` turns an empty directory into a working Jx project. It is two things at once: an interactive CLI, and the library whose `generateProject()` is the single generation engine shared by every creation surface in the monorepo. The CLI imports it directly, and the dev server's Studio API and the packaged desktop backend dynamic-import it (`packages/server/src/studio-api.ts`, `packages/desktop/src/project-session.ts`).
|
|
12
8
|
|
|
13
|
-
The package publishes **raw TypeScript**: there is no build step, the `create-jxsuite` bin points at
|
|
14
|
-
`./index.ts`, and every `exports` target is a `.ts` or `.json` source file. Its only runtime
|
|
15
|
-
dependency is `@jxsuite/starters`.
|
|
9
|
+
The package publishes **raw TypeScript**: there is no build step, the `create-jxsuite` bin points at `./index.ts`, and every `exports` target is a `.ts` or `.json` source file. Its only runtime dependency is `@jxsuite/starters`.
|
|
16
10
|
|
|
17
11
|
## CLI
|
|
18
12
|
|
|
@@ -20,9 +14,7 @@ dependency is `@jxsuite/starters`.
|
|
|
20
14
|
bun create @jxsuite <directory> [--template <id>]
|
|
21
15
|
```
|
|
22
16
|
|
|
23
|
-
The first argument that is not part of `--template` is the destination directory; it is required (a
|
|
24
|
-
bare invocation prints usage and exits 1). `--template <id>` and `--template=<id>` are both accepted,
|
|
25
|
-
and no other flag is recognized. An unrecognized one is taken as the destination.
|
|
17
|
+
The first argument that is not part of `--template` is the destination directory; it is required (a bare invocation prints usage and exits 1). `--template <id>` and `--template=<id>` are both accepted, and no other flag is recognized. An unrecognized one is taken as the destination.
|
|
26
18
|
|
|
27
19
|
Everything except the destination is asked interactively. The prompts, in order:
|
|
28
20
|
|
|
@@ -34,15 +26,11 @@ Everything except the destination is asked interactively. The prompts, in order:
|
|
|
34
26
|
| `Template [1]: ` | Blank (skipped entirely when `--template` is given) |
|
|
35
27
|
| `Adapter [1]: ` | `static` |
|
|
36
28
|
|
|
37
|
-
The template menu numbers the four built-in templates 1-4, then the starters from
|
|
38
|
-
`@jxsuite/starters` 5 and up. The adapter menu is `1) static`, `2) cloudflare-pages`, `3) node`,
|
|
39
|
-
`4) bun`, `5) cloudflare-workers`; any unrecognized answer to either prompt falls back to the
|
|
40
|
-
default.
|
|
29
|
+
The template menu numbers the four built-in templates 1-4, then the starters from `@jxsuite/starters` 5 and up. The adapter menu is `1) static`, `2) cloudflare-pages`, `3) node`, `4) bun`, `5) cloudflare-workers`; any unrecognized answer to either prompt falls back to the default.
|
|
41
30
|
|
|
42
31
|
## Templates and starters
|
|
43
32
|
|
|
44
|
-
Two disjoint id namespaces feed `--template`. A **built-in template id wins**; otherwise a starter id
|
|
45
|
-
is matched; an id in neither namespace **silently falls back to blank** instead of erroring.
|
|
33
|
+
Two disjoint id namespaces feed `--template`. A **built-in template id wins**; otherwise a starter id is matched; an id in neither namespace **silently falls back to blank** instead of erroring.
|
|
46
34
|
|
|
47
35
|
| Built-in id | What it produces |
|
|
48
36
|
| --------------- | ------------------------------------------------------------------------------------- |
|
|
@@ -51,35 +39,15 @@ is matched; an id in neither namespace **silently falls back to blank** instead
|
|
|
51
39
|
| `mobile-first` | Same files, mobile-first `$media` (min-width queries, 375px base) |
|
|
52
40
|
| `mobile-app` | Mobile-first `$media`, `viewport-fit=cover`, a `theme-color` meta, and a file overlay |
|
|
53
41
|
|
|
54
|
-
`template/` (singular) is the shared skeleton copied on every non-starter scaffold: `gitignore` →
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
replaces `layouts/base.json` with an app shell (bottom nav bar, safe-area insets) and
|
|
58
|
-
`pages/index.md` with an app-flavored home page, and adds `pages/explore.md` and
|
|
59
|
-
`pages/profile.md`. So `blank`, `desktop-first` and `mobile-first` differ only in the generated
|
|
60
|
-
`project.json` (zero file differences). Breakpoint maps live in `templates.ts`
|
|
61
|
-
(`mediaForTemplate`).
|
|
62
|
-
|
|
63
|
-
Starter ids come from [`@jxsuite/starters`](../starters/README.md). Its `registry.json` is the
|
|
64
|
-
current list. A starter clone copies the starter tree verbatim except `node_modules`, `dist`,
|
|
65
|
-
`.cache`, `.jx-cache`, `.git`, and `images.json`, then re-stamps `project.json` in place: `name`
|
|
66
|
-
always, `url` only when non-empty, `build.adapter` only when the adapter is not `static`, and the
|
|
67
|
-
`<meta name="description">` content only when a description was given. The starter's design tokens,
|
|
68
|
-
content collections, image pipeline, and the rest of `$head` survive; its `package.json` does not,
|
|
69
|
-
because it is rebuilt from scratch (see below).
|
|
42
|
+
`template/` (singular) is the shared skeleton copied on every non-starter scaffold: `gitignore` → `.gitignore`, `layouts/`, `pages/`. `templates/` (plural) holds per-template overlay trees copied **after** the skeleton with `force: true`, and today contains exactly one: `mobile-app/`, which replaces `layouts/base.json` with an app shell (bottom nav bar, safe-area insets) and `pages/index.md` with an app-flavored home page, and adds `pages/explore.md` and `pages/profile.md`. So `blank`, `desktop-first` and `mobile-first` differ only in the generated `project.json` (zero file differences). Breakpoint maps live in `templates.ts` (`mediaForTemplate`).
|
|
43
|
+
|
|
44
|
+
Starter ids come from [`@jxsuite/starters`](../starters/README.md). Its `registry.json` is the current list. A starter clone copies the starter tree verbatim except `node_modules`, `dist`, `.cache`, `.jx-cache`, `.git`, and `images.json`, then re-stamps `project.json` in place: `name` always, `url` only when non-empty, `build.adapter` only when the adapter is not `static`, and the `<meta name="description">` content only when a description was given. The starter's design tokens, content collections, image pipeline, and the rest of `$head` survive; its `package.json` does not, because it is rebuilt from scratch (see below).
|
|
70
45
|
|
|
71
46
|
## What gets generated
|
|
72
47
|
|
|
73
|
-
`project.json` leads with `$schema: "./project.schema.json"` and carries `$head`, `$media`, `build`
|
|
74
|
-
(`{ outDir: "./dist", trailingSlash: "always" }`, plus `adapter` when it is not `static`),
|
|
75
|
-
`content: {}`, `defaults: { lang: "en", layout: "./layouts/base.json" }`,
|
|
76
|
-
`extensions: ["@jxsuite/parser"]`, `name`, `style`, and `url`.
|
|
48
|
+
`project.json` leads with `$schema: "./project.schema.json"` and carries `$head`, `$media`, `build` (`{ outDir: "./dist", trailingSlash: "always" }`, plus `adapter` when it is not `static`), `content: {}`, `defaults: { lang: "en", layout: "./layouts/base.json" }`, `extensions: ["@jxsuite/parser"]`, `name`, `style`, and `url`.
|
|
77
49
|
|
|
78
|
-
`package.json` is `private: true`, MIT, with `build`/`dev`/`preview` scripts calling the `jx` CLI. Its
|
|
79
|
-
name is the project name lowercased with non-alphanumerics collapsed to hyphens. `@jxsuite/parser` is
|
|
80
|
-
a dependency; `@jxsuite/compiler`, `@jxsuite/runtime` and `@jxsuite/server` are devDependencies. Any
|
|
81
|
-
non-static adapter adds `hono: "^4"`; the two Cloudflare adapters additionally add `wrangler: "^4"`, a
|
|
82
|
-
`deploy` script (`wrangler deploy` or `wrangler pages deploy dist`), and a generated `wrangler.jsonc`.
|
|
50
|
+
`package.json` is `private: true`, MIT, with `build`/`dev`/`preview` scripts calling the `jx` CLI. Its name is the project name lowercased with non-alphanumerics collapsed to hyphens. `@jxsuite/parser` is a dependency; `@jxsuite/compiler`, `@jxsuite/runtime` and `@jxsuite/server` are devDependencies. Any non-static adapter adds `hono: "^4"`; the two Cloudflare adapters additionally add `wrangler: "^4"`, a `deploy` script (`wrangler deploy` or `wrangler pages deploy dist`), and a generated `wrangler.jsonc`.
|
|
83
51
|
|
|
84
52
|
A blank scaffold also creates empty `components/`, `public/`, and `content/` directories.
|
|
85
53
|
|
|
@@ -98,8 +66,7 @@ await generateProject("/abs/path/to/my-site", {
|
|
|
98
66
|
});
|
|
99
67
|
```
|
|
100
68
|
|
|
101
|
-
`design` (optional) applies a colors/fonts/logo/breakpoints quickstart on top of the scaffold. See
|
|
102
|
-
`DesignOptions` in `generate.ts`.
|
|
69
|
+
`design` (optional) applies a colors/fonts/logo/breakpoints quickstart on top of the scaffold. See `DesignOptions` in `generate.ts`.
|
|
103
70
|
|
|
104
71
|
| Export | Description |
|
|
105
72
|
| ---------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
@@ -108,54 +75,24 @@ await generateProject("/abs/path/to/my-site", {
|
|
|
108
75
|
| `@jxsuite/create/scaffold` | `adapterNeedsWrangler`, `buildWranglerJsonc`, `updateWranglerConfig`, `applyBindingFragments` |
|
|
109
76
|
| `@jxsuite/create/template-versions.json` | The `@jxsuite/*` semver ranges stamped into scaffolded projects |
|
|
110
77
|
|
|
111
|
-
`scaffold.ts` has **zero node imports** by design, so it runs in a browser and against a Git Data
|
|
112
|
-
API. `@jxsuite/studio` imports `updateWranglerConfig` for its Cloudflare Pages publish flow, and
|
|
113
|
-
`@jxsuite/compiler` imports `applyBindingFragments` for `jx db push`. Adding `node:fs` there breaks
|
|
114
|
-
both. `isTemplateId` is used server-side as request validation: the Studio API rejects an unknown
|
|
115
|
-
template with a 400 before generating.
|
|
78
|
+
`scaffold.ts` has **zero node imports** by design, so it runs in a browser and against a Git Data API. `@jxsuite/studio` imports `updateWranglerConfig` for its Cloudflare Pages publish flow, and `@jxsuite/compiler` imports `applyBindingFragments` for `jx db push`. Adding `node:fs` there breaks both. `isTemplateId` is used server-side as request validation: the Studio API rejects an unknown template with a 400 before generating.
|
|
116
79
|
|
|
117
80
|
## Dependency ranges
|
|
118
81
|
|
|
119
|
-
Every `@jxsuite/*` range a scaffold emits, including a starter clone's rebuilt `package.json`,
|
|
120
|
-
comes from `template-versions.json`, never from a literal in code. A test asserts exactly that, so a
|
|
121
|
-
future hardcoded range fails there.
|
|
82
|
+
Every `@jxsuite/*` range a scaffold emits, including a starter clone's rebuilt `package.json`, comes from `template-versions.json`, never from a literal in code. A test asserts exactly that, so a future hardcoded range fails there.
|
|
122
83
|
|
|
123
|
-
**Never hand-edit that file.** In the normal case release-please rewrites it inside the release
|
|
124
|
-
commit (each of the four owning packages declares a jsonpath into it via `extra-files` in
|
|
125
|
-
`release-please-config.json`). The gate is `bun run templates:check`, which requires every range to
|
|
126
|
-
be exactly `^<workspace version>` across both shipping surfaces (this file and
|
|
127
|
-
`packages/starters/sites/*/package.json`) and runs on every PR; `bun run templates:sync` is the fixer
|
|
128
|
-
for drift that predates release-please. The gate exists because these ranges once named versions
|
|
129
|
-
that were never published, so `bun install` in a fresh scaffold could not resolve them at all.
|
|
84
|
+
**Never hand-edit that file.** In the normal case release-please rewrites it inside the release commit (each of the four owning packages declares a jsonpath into it via `extra-files` in `release-please-config.json`). The gate is `bun run templates:check`, which requires every range to be exactly `^<workspace version>` across both shipping surfaces (this file and `packages/starters/sites/*/package.json`) and runs on every PR; `bun run templates:sync` is the fixer for drift that predates release-please. The gate exists because these ranges once named versions that were never published, so `bun install` in a fresh scaffold could not resolve them at all.
|
|
130
85
|
|
|
131
86
|
## Surprises worth knowing
|
|
132
87
|
|
|
133
|
-
- **Generation refuses a non-empty destination.** It throws `Directory "<path>" is not empty`. An
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
starter's style already declares, and `--color-primary-hover` is deliberately left alone. Two of
|
|
142
|
-
them fall back rather than give up: `text` and `bodyFont` try `--color-text-primary` and
|
|
143
|
-
`--font-body` first, then the plain `color` / `fontFamily` keys. On a blank scaffold values are
|
|
144
|
-
written directly. A non-empty `design.media` replaces `$media` wholesale;
|
|
145
|
-
an empty one is treated as absent.
|
|
146
|
-
- **`design.logo.name` is the only untrusted-input path to the filesystem.** It is flattened to its
|
|
147
|
-
basename and must match `/\.(svg|png|jpe?g|webp|gif|ico)$/i` or generation throws. That is a
|
|
148
|
-
security boundary, not a convenience check.
|
|
149
|
-
- **`index.ts` exports `ready`, not a top-level await.** Bun's test runtime drops a
|
|
150
|
-
dynamically-imported module's top-level-await continuation, so the interactive run is a promise
|
|
151
|
-
tests can await; the no-arg usage guard stays at module scope so a bare invocation still exits
|
|
152
|
-
during evaluation.
|
|
153
|
-
- **`template/` and `templates/` resolve from `import.meta.dirname`**, which is why the desktop build
|
|
154
|
-
stages them to exact paths and `packages/desktop/scripts/verify-bundle.ts` fails the packaged build
|
|
155
|
-
when they are missing.
|
|
156
|
-
- **`generate.ts` imports `@jxsuite/starters` lazily**, inside the starter path only, so a blank
|
|
157
|
-
scaffold never loads it; the CLI entry imports `listStarters` eagerly, because the menu needs it.
|
|
158
|
-
An unknown starter id passed programmatically throws `Unknown starter: "<id>"`.
|
|
88
|
+
- **Generation refuses a non-empty destination.** It throws `Directory "<path>" is not empty`. An existing but empty directory is fine.
|
|
89
|
+
- **`$schema` points at a file this package does not write.** `project.schema.json` comes from `jx schema` (specs/extensions.md §5.2), so a fresh scaffold has a dangling reference until that runs.
|
|
90
|
+
- **A starter's `package.json` is rebuilt, not copied.** Anything its manifest declared beyond name/scripts/deps is lost by design.
|
|
91
|
+
- **The design quickstart is best-effort on a starter**: an override only lands on a key the starter's style already declares, and `--color-primary-hover` is deliberately left alone. Two of them fall back rather than give up: `text` and `bodyFont` try `--color-text-primary` and `--font-body` first, then the plain `color` / `fontFamily` keys. On a blank scaffold values are written directly. A non-empty `design.media` replaces `$media` wholesale; an empty one is treated as absent.
|
|
92
|
+
- **`design.logo.name` is the only untrusted-input path to the filesystem.** It is flattened to its basename and must match `/\.(svg|png|jpe?g|webp|gif|ico)$/i` or generation throws. That is a security boundary, not a convenience check.
|
|
93
|
+
- **`index.ts` exports `ready`, not a top-level await.** Bun's test runtime drops a dynamically-imported module's top-level-await continuation, so the interactive run is a promise tests can await; the no-arg usage guard stays at module scope so a bare invocation still exits during evaluation.
|
|
94
|
+
- **`template/` and `templates/` resolve from `import.meta.dirname`**, which is why the desktop build stages them to exact paths and `packages/desktop/scripts/verify-bundle.ts` fails the packaged build when they are missing.
|
|
95
|
+
- **`generate.ts` imports `@jxsuite/starters` lazily**, inside the starter path only, so a blank scaffold never loads it; the CLI entry imports `listStarters` eagerly, because the menu needs it. An unknown starter id passed programmatically throws `Unknown starter: "<id>"`.
|
|
159
96
|
|
|
160
97
|
## Testing
|
|
161
98
|
|
|
@@ -168,9 +105,7 @@ Per-file coverage thresholds live in `packages/create/bunfig.toml`.
|
|
|
168
105
|
|
|
169
106
|
## Docs
|
|
170
107
|
|
|
171
|
-
User-facing documentation for this surface is `docs/framework/build/cli.md`, whose `code:`
|
|
172
|
-
frontmatter already lists `index.ts`, `cli-args.ts`, `templates.ts` and `generate.ts`. A behavior
|
|
173
|
-
change here trips `bun run docs:sync`.
|
|
108
|
+
User-facing documentation for this surface is `docs/framework/build/cli.md`, whose `code:` frontmatter already lists `index.ts`, `cli-args.ts`, `templates.ts` and `generate.ts`. A behavior change here trips `bun run docs:sync`.
|
|
174
109
|
|
|
175
110
|
## License
|
|
176
111
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/create",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "Scaffold a new Jx project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"test:coverage": "bun test --isolate --coverage"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@jxsuite/starters": "^1.
|
|
40
|
+
"@jxsuite/starters": "^1.8.1"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/template-versions.json
CHANGED
|
@@ -4,5 +4,4 @@ title: Home
|
|
|
4
4
|
|
|
5
5
|
# Welcome
|
|
6
6
|
|
|
7
|
-
Your new Jx app is ready. Edit this page at `pages/index.md`, and the app shell (header and bottom
|
|
8
|
-
navigation) at `layouts/base.json`.
|
|
7
|
+
Your new Jx app is ready. Edit this page at `pages/index.md`, and the app shell (header and bottom navigation) at `layouts/base.json`.
|