@openelement/create 1.0.0-alpha.12 → 1.0.0-alpha.13
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 +16 -13
- package/package.json +1 -1
- package/src/cli.js +10 -1
- package/src/version.js +1 -1
- package/templates/README.tmpl +24 -9
- package/templates/app/components/page-404.tsx.tmpl +3 -2
- package/templates/app/routes/404.tsx.tmpl +6 -2
- package/templates/openelement.config.ts.tmpl +4 -4
- package/templates/package.json.tmpl +6 -8
package/README.md
CHANGED
|
@@ -12,9 +12,9 @@ Docs and guides: <https://openelement.org>.
|
|
|
12
12
|
|
|
13
13
|
`@openelement/create` generates a new openElement project from ONE template —
|
|
14
14
|
the showcase starter: a static-first landing page with two islands, a fully
|
|
15
|
-
static About page, an `/api/ping` server route, and a
|
|
16
|
-
sheet (
|
|
17
|
-
Node/pnpm project.
|
|
15
|
+
static About page, an `/api/ping` server route, and a Tailwind-ON design-token
|
|
16
|
+
sheet (the `@theme` role table; one template, no variants). The generated
|
|
17
|
+
project is a plain Node/pnpm project.
|
|
18
18
|
|
|
19
19
|
## Usage (1.0 Alpha)
|
|
20
20
|
|
|
@@ -45,18 +45,19 @@ npx @openelement/create my-app --no-install --no-git -t showcase
|
|
|
45
45
|
resolves to `@scope/create` at the scope's default dist-tag — with no tag in
|
|
46
46
|
the command, that is `latest`, which the 1.0 line rides — so the canonical
|
|
47
47
|
spelling names no tag, and npm runs this package's generator. The version a
|
|
48
|
-
versionless install resolves is
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
versionless install resolves is registry truth: read it from the live registry
|
|
49
|
+
(`npm view @openelement/create dist-tags`), and from the framework's tracked
|
|
50
|
+
release-state manifest, which records the version each dist-tag was last
|
|
51
|
+
verified to serve. The 1.0 line is a new baseline — not a 0.x upgrade, with no
|
|
52
|
+
migration path from 0.x. Pin an exact version when reproducibility matters:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
npm create @openelement
|
|
55
|
+
npm create @openelement@<version> my-app
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
The generated starter
|
|
59
|
-
from
|
|
58
|
+
The generated starter depends on `@openelement/*` through caret ranges over
|
|
59
|
+
the release it was generated from, so `pnpm update` picks up later `1.0.0`
|
|
60
|
+
prereleases without a manifest edit.
|
|
60
61
|
|
|
61
62
|
The canonical install command is exported from `@openelement/create/install-command` (one builder, every documented copy derives from it).
|
|
62
63
|
|
|
@@ -99,8 +100,10 @@ npm create @openelement@0.43 my-app
|
|
|
99
100
|
|
|
100
101
|
## What It Creates
|
|
101
102
|
|
|
102
|
-
- `package.json` - starter dependencies (
|
|
103
|
-
|
|
103
|
+
- `package.json` - starter dependencies (`@openelement/*` with caret ranges
|
|
104
|
+
over the generated-from release)
|
|
105
|
+
and the lifecycle scripts (`dev`/`check`/`test`/`build`/`start`; `build` and
|
|
106
|
+
`start` run the `openelement` bin from `@openelement/router`)
|
|
104
107
|
- `tsconfig.json` - the type-check surface for `pnpm check`: JSX authoring
|
|
105
108
|
through the element import source, whole-`app/` coverage
|
|
106
109
|
- `vite.config.ts` - Vite build configuration only; framework options still
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { CREATE_VERSION } from "./version.js";
|
|
2
3
|
import { buildTemplates, resolveVersions, validateProjectName } from "./template-builder.js";
|
|
3
4
|
import { createInstallCommand } from "./install-command.js";
|
|
4
5
|
import { detectPackageManager } from "./pm.js";
|
|
@@ -173,11 +174,19 @@ function initGitRepository(targetDir, relativeTarget) {
|
|
|
173
174
|
}
|
|
174
175
|
console.info(" initialized git repository (with .gitignore)");
|
|
175
176
|
}
|
|
176
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* The boxed end-of-run handoff: where to go, what to run, where to read, and
|
|
179
|
+
* which generator version produced the scaffold. The version line is load
|
|
180
|
+
* bearing: a cached `npm exec` / `npx` run resolves whatever copy it first
|
|
181
|
+
* downloaded, so the box is the one place a stale generator announces itself
|
|
182
|
+
* (#1634). The framework's packed-starter qualification asserts the line on
|
|
183
|
+
* the packed artifact.
|
|
184
|
+
*/
|
|
177
185
|
function printHandoff(relativeTarget, pm, startRequested) {
|
|
178
186
|
const devCommand = pm ? `${pm} run dev` : "pnpm run dev";
|
|
179
187
|
const lines = [
|
|
180
188
|
"openElement project ready",
|
|
189
|
+
`(@openelement/create ${CREATE_VERSION})`,
|
|
181
190
|
"",
|
|
182
191
|
`cd ${relativeTarget}`,
|
|
183
192
|
`${devCommand} # start the dev server`,
|
package/src/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/version.ts
|
|
2
2
|
/** The published CLI version, embedded so packed npm installs are self-contained. */
|
|
3
|
-
const CREATE_VERSION = "1.0.0-alpha.
|
|
3
|
+
const CREATE_VERSION = "1.0.0-alpha.13";
|
|
4
4
|
/**
|
|
5
5
|
* The Vite release pinned into the generated starter's package.json (the
|
|
6
6
|
* `${v.vite}` scaffold token in the npm/pnpm starter). Embedded for the same
|
package/templates/README.tmpl
CHANGED
|
@@ -15,9 +15,10 @@ root holds the build's internal state (head-convention bookkeeping and build
|
|
|
15
15
|
plans). `pnpm dev` and `pnpm build` write it as needed; the `.gitignore`
|
|
16
16
|
excludes it and deleting it is safe — the next run recreates it.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
The `@openelement/element` and `@openelement/router` dependencies carry caret
|
|
19
|
+
ranges over the `1.0.0` release this starter was generated from, so
|
|
20
|
+
`pnpm update` picks up later `1.0.0` prereleases (and the final `1.0.0`)
|
|
21
|
+
without editing this file.
|
|
21
22
|
|
|
22
23
|
## The JS cost map
|
|
23
24
|
|
|
@@ -83,9 +84,14 @@ accepted-key list. `vite.config.ts` stays Vite-only: `plugins: [...openElement()
|
|
|
83
84
|
whole `app/` directory (`tsconfig.json`), so new files are picked up
|
|
84
85
|
automatically.
|
|
85
86
|
- `pnpm test` — run Node's built-in test runner (the starter ships none).
|
|
86
|
-
- `pnpm build` — production build
|
|
87
|
+
- `pnpm build` — production build into `dist/`: prerendered HTML for every
|
|
88
|
+
static route, plus the request-time server when the app has one.
|
|
87
89
|
- `pnpm start` — serve the production build.
|
|
88
|
-
|
|
90
|
+
|
|
91
|
+
`build` and `start` run the `openelement` bin from the `@openelement/router`
|
|
92
|
+
dependency (`openelement build` / `openelement start`); the router's CLI also
|
|
93
|
+
carries a static-only `openelement start --mode=preview`, which refuses a
|
|
94
|
+
build that has a request-time server.
|
|
89
95
|
|
|
90
96
|
## Styling ownership
|
|
91
97
|
|
|
@@ -105,13 +111,22 @@ unused.
|
|
|
105
111
|
|
|
106
112
|
## Dependency notes
|
|
107
113
|
|
|
108
|
-
`@
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
`@openelement/element` and `@openelement/router` are the runtime dependencies
|
|
115
|
+
your app imports. `@hono/vite-dev-server` and `hono` ride devDependencies:
|
|
116
|
+
the Vite dev server needs the former (and the latter as its own node-adapter
|
|
117
|
+
peer), it is loaded lazily, and `build`/`start` never resolve either — so
|
|
118
|
+
`npm install --omit=dev` in a production image installs only the runtime pair.
|
|
119
|
+
The generated server entry itself imports no
|
|
112
120
|
HTTP framework — it composes on the internal WinterCG layer (#1560); `hono`
|
|
113
121
|
is an optional peer of `@openelement/router`, and `@openelement/router/hono`
|
|
114
122
|
(`createHonoAdapter`) is the one opt-in if you ever want to mount the built
|
|
115
123
|
handler inside your own Hono app. For Nitro deployments, the built handler
|
|
116
124
|
bridges through the `@openelement/router/nitro-mount` subpath of the one
|
|
117
125
|
`@openelement/router` dependency. Do not remove them.
|
|
126
|
+
|
|
127
|
+
pnpm manages a `pnpm-workspace.yaml` for this project. That file is pnpm's own
|
|
128
|
+
bookkeeping, not starter output: it carries workspace membership and the
|
|
129
|
+
package-manager settings that apply here — including `minimumReleaseAge`, the
|
|
130
|
+
supply-chain window that withholds freshly published versions, and any
|
|
131
|
+
exemptions pnpm records when you approve a package inside that window. Keep
|
|
132
|
+
the file (pnpm rewrites it), and review the exemptions it lists.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Styled 404 page element (#923): the request-time server renders this page
|
|
3
|
-
* with a 404 status for unmatched paths;
|
|
4
|
-
*
|
|
3
|
+
* with a 404 status for unmatched paths; a build with no request-time route
|
|
4
|
+
* prerenders the route (see ./../routes/404.tsx) to dist/404.html instead.
|
|
5
|
+
* The path-derived tag is 'el-404'. Light root: the page owns its
|
|
5
6
|
* rules via `static styles` (the imported .css sheets), inlined into SSR as
|
|
6
7
|
* @scope(el-404). The site chrome sheet (./site-chrome.css) is shared
|
|
7
8
|
*/
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Styled 404 (#923):
|
|
3
|
-
*
|
|
2
|
+
* Styled 404 (#923). `renderIntent: { mode: 'dynamic' }` keeps this page on
|
|
3
|
+
* the request-time path, and it is the reason this starter's build emits
|
|
4
|
+
* `dist/server/`: the request-time server renders it with a 404 status for
|
|
5
|
+
* every unmatched path, so the build writes no static 404.html. Drop the
|
|
6
|
+
* renderIntent line and the route becomes prerenderable — a build with no
|
|
7
|
+
* other request-time route then writes the page to dist/404.html.
|
|
4
8
|
*/
|
|
5
9
|
import { definePage } from '@openelement/router';
|
|
6
10
|
import NotFoundPage from '../components/page-404.tsx';
|
|
@@ -27,10 +27,10 @@ export default defineConfig({
|
|
|
27
27
|
// app/styles/theme.css compile into the preset's deliverable both ways: dev
|
|
28
28
|
// serves the compile from /.openElement/tailwind-preset/entry.css and links
|
|
29
29
|
// it in the document head, the build emits the same compile as the
|
|
30
|
-
// layer-ordered /assets/open-tailwind.css after the SSG render. The path
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
tailwind: { theme: ['
|
|
30
|
+
// layer-ordered /assets/open-tailwind.css after the SSG render. The path is
|
|
31
|
+
// app-relative (resolved against the app root); package CSS specifiers such
|
|
32
|
+
// as '@openelement/ui/theme.css' also work here.
|
|
33
|
+
tailwind: { theme: ['app/styles/theme.css'] },
|
|
34
34
|
head: {
|
|
35
35
|
// Titles default to the package.json "name"; this overrides the document
|
|
36
36
|
// title fallback while page routes keep their own `head: { title }`.
|
|
@@ -11,19 +11,17 @@
|
|
|
11
11
|
"dev": "vite",
|
|
12
12
|
"check": "tsc --noEmit",
|
|
13
13
|
"test": "node --test",
|
|
14
|
-
"build": "
|
|
15
|
-
"start": "
|
|
16
|
-
"preview": "node node_modules/@openelement/router/src/cli/start.js --mode=preview"
|
|
14
|
+
"build": "openelement build",
|
|
15
|
+
"start": "openelement start"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"@openelement/
|
|
21
|
-
"@openelement/router": "${v.router}",
|
|
22
|
-
"hono": "^4.12"
|
|
18
|
+
"@openelement/element": "^${v.element}",
|
|
19
|
+
"@openelement/router": "^${v.router}"
|
|
23
20
|
},
|
|
24
21
|
"devDependencies": {
|
|
25
|
-
"@
|
|
22
|
+
"@hono/vite-dev-server": "^0.25.3",
|
|
26
23
|
"@tailwindcss/vite": "4.3.3",
|
|
24
|
+
"hono": "^4.12",
|
|
27
25
|
"tailwindcss": "4.3.3",
|
|
28
26
|
"typescript": "6.0.3",
|
|
29
27
|
"vite": "${v.vite}"
|