@openelement/create 0.44.0-beta.2.2 → 1.0.0-alpha.10
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 +105 -24
- package/package.json +16 -4
- package/src/cli.d.ts +1 -1
- package/src/cli.js +126 -66
- package/src/install-command.d.ts +50 -0
- package/src/install-command.js +52 -0
- package/src/template-builder.js +128 -166
- package/src/version.js +23 -2
- package/templates/README.tmpl +56 -23
- package/templates/app/components/{page-404.tsx → page-404.tsx.tmpl} +6 -2
- package/templates/app/components/{page-blog-index.tsx → page-blog-index.tsx.tmpl} +6 -2
- package/templates/app/components/{page-blog-welcome.tsx → page-blog-welcome.tsx.tmpl} +9 -6
- package/templates/app/components/{page-contact.tsx → page-contact.tsx.tmpl} +5 -2
- package/templates/app/components/{page-freshness.tsx → page-freshness.tsx.tmpl} +6 -2
- package/templates/app/components/{page-home.tsx → page-home.tsx.tmpl} +10 -7
- package/templates/app/components/page-styles.ts.tmpl +123 -0
- package/templates/app/head.tsx.tmpl +42 -0
- package/templates/app/islands/app-shell.tsx.tmpl +83 -0
- package/templates/app/islands/my-counter.tsx.tmpl +55 -0
- package/templates/app/islands/only-ticker.tsx.tmpl +51 -0
- package/templates/app/routes/{404.tsx → 404.tsx.tmpl} +1 -1
- package/templates/app/routes/blog/{index.tsx → index.tsx.tmpl} +1 -1
- package/templates/app/routes/blog/{welcome.tsx → welcome.tsx.tmpl} +1 -1
- package/templates/app/routes/{contact.tsx → contact.tsx.tmpl} +1 -1
- package/templates/app/routes/{freshness.tsx → freshness.tsx.tmpl} +1 -1
- package/templates/app/routes/{index.tsx → index.tsx.tmpl} +1 -1
- package/templates/app/styles/tokens.css +57 -0
- package/templates/gitignore.tmpl +1 -0
- package/templates/openelement.config.ts.tmpl +31 -0
- package/templates/package.json.tmpl +29 -0
- package/templates/tailwind/theme.css +108 -0
- package/templates/tailwind/vite.config.ts.tmpl +38 -0
- package/templates/tsconfig.json.tmpl +15 -0
- package/templates/vite.config.ts.tmpl +11 -0
- package/templates/app/components/page-styles.ts +0 -64
- package/templates/app/data/_generated-blog-data.d.ts +0 -21
- package/templates/app/islands/app-shell.tsx +0 -58
- package/templates/app/islands/my-counter.tsx +0 -38
- package/templates/app/islands/only-ticker.tsx +0 -34
- package/templates/deno.json.tmpl +0 -26
- package/templates/vite.config.ts +0 -100
- /package/templates/app/routes/api/{health.ts → health.ts.tmpl} +0 -0
package/src/template-builder.js
CHANGED
|
@@ -1,178 +1,140 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
// directory must stay a legal package name so `npm init`-style flows and
|
|
5
|
-
// registry publication are never blocked by the scaffold itself (L11).
|
|
1
|
+
import { CREATE_VERSION, TAILWIND_STARTER_PIN, VITE_STARTER_PIN } from "./version.js";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
//#region src/template-builder.ts
|
|
6
4
|
const MAX_PROJECT_NAME_LENGTH = 214;
|
|
7
5
|
const PROJECT_NAME_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
|
|
8
6
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (name !== name.toLowerCase()) {
|
|
21
|
-
return 'Project name must be lowercase (npm package names cannot contain uppercase letters).';
|
|
22
|
-
}
|
|
23
|
-
if (!PROJECT_NAME_PATTERN.test(name)) {
|
|
24
|
-
return 'Project name must start with a lowercase letter or number and may only contain ' + 'lowercase letters, numbers, dots, underscores, and hyphens.';
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
7
|
+
* L11: validate the scaffold target name before any filesystem work. Returns
|
|
8
|
+
* an actionable message when the name is unsafe, `null` when it is a legal
|
|
9
|
+
* npm-style package name that cannot escape the current directory.
|
|
10
|
+
*/
|
|
11
|
+
function validateProjectName(name) {
|
|
12
|
+
if (name.length === 0) return "Project name must not be empty.";
|
|
13
|
+
if (name.length > MAX_PROJECT_NAME_LENGTH) return `Project name must be at most ${MAX_PROJECT_NAME_LENGTH} characters (npm package-name limit).`;
|
|
14
|
+
if (name.includes("..")) return "Project name must not contain \"..\" (path traversal is not allowed).";
|
|
15
|
+
if (name !== name.toLowerCase()) return "Project name must be lowercase (npm package names cannot contain uppercase letters).";
|
|
16
|
+
if (!PROJECT_NAME_PATTERN.test(name)) return "Project name must start with a lowercase letter or number and may only contain lowercase letters, numbers, dots, underscores, and hyphens.";
|
|
17
|
+
return null;
|
|
27
18
|
}
|
|
28
19
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
* The published starter relies on the support-package same-version release
|
|
21
|
+
* invariant. Package-graph and release-prepare gates verify that invariant;
|
|
22
|
+
* Create deliberately has no runtime registry fallback or mixed-version mode.
|
|
23
|
+
* Caller-supplied versions are validated by `buildTemplates` below.
|
|
24
|
+
*/
|
|
25
|
+
function resolveVersions() {
|
|
26
|
+
return {
|
|
27
|
+
router: CREATE_VERSION,
|
|
28
|
+
element: CREATE_VERSION
|
|
29
|
+
};
|
|
39
30
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (observed.length !== 1) {
|
|
45
|
-
throw new Error(`Create requires the five-package same-version release invariant; observed ${observed.join(', ')}`);
|
|
46
|
-
}
|
|
47
|
-
return versions;
|
|
31
|
+
function assertUnifiedProductVersions(versions) {
|
|
32
|
+
const observed = [...new Set(Object.values(versions))];
|
|
33
|
+
if (observed.length !== 1) throw new Error(`Create requires the support-package same-version release invariant; observed ${observed.join(", ")}`);
|
|
34
|
+
return versions;
|
|
48
35
|
}
|
|
49
|
-
// [sourceTemplate, targetRelativePath] pairs. The starter manifest is stored
|
|
50
|
-
// as deno.json.tmpl so deno does not treat the templates/ directory as a
|
|
51
|
-
// nested workspace config; it is renamed to deno.json when written.
|
|
52
36
|
const TEMPLATE_FILES = [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
[
|
|
80
|
-
'app/components/page-styles.ts',
|
|
81
|
-
'app/components/page-styles.ts'
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
'app/components/page-home.tsx',
|
|
85
|
-
'app/components/page-home.tsx'
|
|
86
|
-
],
|
|
87
|
-
[
|
|
88
|
-
'app/components/page-freshness.tsx',
|
|
89
|
-
'app/components/page-freshness.tsx'
|
|
90
|
-
],
|
|
91
|
-
[
|
|
92
|
-
'app/components/page-404.tsx',
|
|
93
|
-
'app/components/page-404.tsx'
|
|
94
|
-
],
|
|
95
|
-
[
|
|
96
|
-
'app/components/page-contact.tsx',
|
|
97
|
-
'app/components/page-contact.tsx'
|
|
98
|
-
],
|
|
99
|
-
[
|
|
100
|
-
'app/components/page-blog-index.tsx',
|
|
101
|
-
'app/components/page-blog-index.tsx'
|
|
102
|
-
],
|
|
103
|
-
[
|
|
104
|
-
'app/components/page-blog-welcome.tsx',
|
|
105
|
-
'app/components/page-blog-welcome.tsx'
|
|
106
|
-
],
|
|
107
|
-
[
|
|
108
|
-
'app/data/_generated-blog-data.d.ts',
|
|
109
|
-
'app/data/_generated-blog-data.d.ts'
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
'app/routes/404.tsx',
|
|
113
|
-
'app/routes/404.tsx'
|
|
114
|
-
],
|
|
115
|
-
[
|
|
116
|
-
'app/routes/index.tsx',
|
|
117
|
-
'app/routes/index.tsx'
|
|
118
|
-
],
|
|
119
|
-
[
|
|
120
|
-
'app/routes/freshness.tsx',
|
|
121
|
-
'app/routes/freshness.tsx'
|
|
122
|
-
],
|
|
123
|
-
[
|
|
124
|
-
'app/routes/contact.tsx',
|
|
125
|
-
'app/routes/contact.tsx'
|
|
126
|
-
],
|
|
127
|
-
[
|
|
128
|
-
'app/routes/blog/index.tsx',
|
|
129
|
-
'app/routes/blog/index.tsx'
|
|
130
|
-
],
|
|
131
|
-
[
|
|
132
|
-
'app/routes/blog/welcome.tsx',
|
|
133
|
-
'app/routes/blog/welcome.tsx'
|
|
134
|
-
],
|
|
135
|
-
[
|
|
136
|
-
'app/routes/api/health.ts',
|
|
137
|
-
'app/routes/api/health.ts'
|
|
138
|
-
],
|
|
139
|
-
[
|
|
140
|
-
'app/islands/my-counter.tsx',
|
|
141
|
-
'app/islands/my-counter.tsx'
|
|
142
|
-
],
|
|
143
|
-
[
|
|
144
|
-
'app/islands/only-ticker.tsx',
|
|
145
|
-
'app/islands/only-ticker.tsx'
|
|
146
|
-
]
|
|
37
|
+
["gitignore.tmpl", ".gitignore"],
|
|
38
|
+
["README.tmpl", "README.md"],
|
|
39
|
+
["public/openelement-mark.svg", "public/openelement-mark.svg"],
|
|
40
|
+
["package.json.tmpl", "package.json"],
|
|
41
|
+
["tsconfig.json.tmpl", "tsconfig.json"],
|
|
42
|
+
["vite.config.ts.tmpl", "vite.config.ts"],
|
|
43
|
+
["openelement.config.ts.tmpl", "openelement.config.ts"],
|
|
44
|
+
["app/styles/tokens.css", "app/styles/tokens.css"],
|
|
45
|
+
["app/head.tsx.tmpl", "app/head.tsx"],
|
|
46
|
+
["app/islands/app-shell.tsx.tmpl", "app/islands/app-shell.tsx"],
|
|
47
|
+
["app/components/page-styles.ts.tmpl", "app/components/page-styles.ts"],
|
|
48
|
+
["app/components/page-home.tsx.tmpl", "app/components/page-home.tsx"],
|
|
49
|
+
["app/components/page-freshness.tsx.tmpl", "app/components/page-freshness.tsx"],
|
|
50
|
+
["app/components/page-404.tsx.tmpl", "app/components/page-404.tsx"],
|
|
51
|
+
["app/components/page-contact.tsx.tmpl", "app/components/page-contact.tsx"],
|
|
52
|
+
["app/components/page-blog-index.tsx.tmpl", "app/components/page-blog-index.tsx"],
|
|
53
|
+
["app/components/page-blog-welcome.tsx.tmpl", "app/components/page-blog-welcome.tsx"],
|
|
54
|
+
["app/routes/404.tsx.tmpl", "app/routes/404.tsx"],
|
|
55
|
+
["app/routes/index.tsx.tmpl", "app/routes/index.tsx"],
|
|
56
|
+
["app/routes/freshness.tsx.tmpl", "app/routes/freshness.tsx"],
|
|
57
|
+
["app/routes/contact.tsx.tmpl", "app/routes/contact.tsx"],
|
|
58
|
+
["app/routes/blog/index.tsx.tmpl", "app/routes/blog/index.tsx"],
|
|
59
|
+
["app/routes/blog/welcome.tsx.tmpl", "app/routes/blog/welcome.tsx"],
|
|
60
|
+
["app/routes/api/health.ts.tmpl", "app/routes/api/health.ts"],
|
|
61
|
+
["app/islands/my-counter.tsx.tmpl", "app/islands/my-counter.tsx"],
|
|
62
|
+
["app/islands/only-ticker.tsx.tmpl", "app/islands/only-ticker.tsx"]
|
|
147
63
|
];
|
|
64
|
+
/**
|
|
65
|
+
* The Tailwind-ON overlay (#1524): the default scaffold replaces the plain
|
|
66
|
+
* vite config with the preset-wired one and adds the @theme role sheet. The
|
|
67
|
+
* overlay lives in templates/tailwind/ so the OFF form stays exactly the
|
|
68
|
+
* pre-#1524 minimal starter. theme.css carries no scaffold tokens (like
|
|
69
|
+
* tokens.css), so it ships as a plain payload file.
|
|
70
|
+
*/
|
|
71
|
+
const TAILWIND_TEMPLATE_FILES = [["tailwind/vite.config.ts.tmpl", "vite.config.ts"], ["tailwind/theme.css", "app/styles/theme.css"]];
|
|
72
|
+
/** The README section token the Tailwind-ON prose replaces (OFF removes it). */
|
|
73
|
+
const TAILWIND_README_TOKEN = "${tailwind.section}";
|
|
74
|
+
/** The devDependencies the Tailwind-ON scaffold adds (exact pins, no ranges). */
|
|
75
|
+
const TAILWIND_DEV_DEPENDENCIES = {
|
|
76
|
+
"@tailwindcss/vite": TAILWIND_STARTER_PIN,
|
|
77
|
+
tailwindcss: TAILWIND_STARTER_PIN
|
|
78
|
+
};
|
|
148
79
|
function versionTokens(v) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
80
|
+
return {
|
|
81
|
+
["${v.router}"]: v.router,
|
|
82
|
+
["${v.element}"]: v.element
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async function buildTemplates(v, projectName, options = {}) {
|
|
86
|
+
assertUnifiedProductVersions(v);
|
|
87
|
+
const invalid = validateProjectName(projectName);
|
|
88
|
+
if (invalid) throw new Error(`Invalid project name "${projectName}". ${invalid}`);
|
|
89
|
+
const tailwind = options.tailwind ?? true;
|
|
90
|
+
const templatesBase = new URL("../templates/", import.meta.url);
|
|
91
|
+
const tokens = {
|
|
92
|
+
...versionTokens(v),
|
|
93
|
+
["${v.vite}"]: VITE_STARTER_PIN,
|
|
94
|
+
["${name}"]: projectName,
|
|
95
|
+
[TAILWIND_README_TOKEN]: tailwind ? tailwindReadmeSection() : ""
|
|
96
|
+
};
|
|
97
|
+
const files = tailwind ? [...TEMPLATE_FILES, ...TAILWIND_TEMPLATE_FILES] : TEMPLATE_FILES;
|
|
98
|
+
const entries = await Promise.all(files.map(async ([source, target]) => {
|
|
99
|
+
let content = await readFile(new URL(source, templatesBase), "utf8");
|
|
100
|
+
for (const [token, value] of Object.entries(tokens)) if (content.includes(token)) content = content.split(token).join(value);
|
|
101
|
+
if (content.includes("${v.") || content.includes("${name}") || content.includes("${tailwind.")) throw new Error(`Unresolved scaffold token in starter template: ${source}`);
|
|
102
|
+
return [target, content];
|
|
103
|
+
}));
|
|
104
|
+
const byTarget = new Map(entries);
|
|
105
|
+
if (tailwind) {
|
|
106
|
+
const manifestPath = "package.json";
|
|
107
|
+
const manifest = JSON.parse(byTarget.get(manifestPath));
|
|
108
|
+
manifest.devDependencies = Object.fromEntries(Object.entries({
|
|
109
|
+
...manifest.devDependencies,
|
|
110
|
+
...TAILWIND_DEV_DEPENDENCIES
|
|
111
|
+
}).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
112
|
+
byTarget.set(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
113
|
+
}
|
|
114
|
+
const out = Object.fromEntries(byTarget);
|
|
115
|
+
return Object.fromEntries(Object.entries(out).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
154
116
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return Object.fromEntries(entries);
|
|
117
|
+
/**
|
|
118
|
+
* The README prose the Tailwind-ON scaffold injects (the OFF form removes the
|
|
119
|
+
* token line). One source here, so the generated README and the tests cannot
|
|
120
|
+
* drift apart. The leading/trailing newline keeps the injected heading
|
|
121
|
+
* blank-line separated in both replacements.
|
|
122
|
+
*/
|
|
123
|
+
function tailwindReadmeSection() {
|
|
124
|
+
return `
|
|
125
|
+
## Tailwind and the @theme role sheet
|
|
126
|
+
|
|
127
|
+
This project was scaffolded with Tailwind enabled (pass \`--no-tailwind\` to
|
|
128
|
+
\`@openelement/create\` for a starter without it). \`app/styles/theme.css\` is
|
|
129
|
+
the @theme role sheet: semantic roles (background, primary, muted, ...) over
|
|
130
|
+
the Tailwind default scale, with dark pairs and a forced-colors layer. The
|
|
131
|
+
router's Tailwind preset compiles the sheet into one linked bundle during
|
|
132
|
+
\`pnpm build\` and references it from every rendered page; the custom
|
|
133
|
+
properties inherit into every shadow root, so pages and islands can consume
|
|
134
|
+
the roles directly. \`pnpm dev\` serves the tokens convention instead — the
|
|
135
|
+
compiled bundle exists in the build output. Extend the sheet by adding role
|
|
136
|
+
lines; \`@openelement/ui\`'s theme.css documents the same contract.
|
|
137
|
+
`;
|
|
177
138
|
}
|
|
178
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vaG9tZS9ydW5uZXIvd29yay9vcGVuZWxlbWVudC9vcGVuZWxlbWVudC9wYWNrYWdlcy9jcmVhdGUvc3JjL3RlbXBsYXRlLWJ1aWxkZXIudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgam9pbiwgcmVzb2x2ZSB9IGZyb20gJ25vZGU6cGF0aCc7XG5pbXBvcnQgeyBDUkVBVEVfVkVSU0lPTiB9IGZyb20gJy4vdmVyc2lvbi5qcyc7XG5cbi8vIG5wbSBwYWNrYWdlLW5hbWUgY2VpbGluZyAodmFsaWRhdGUtbnBtLXBhY2thZ2UtbmFtZSk7IGEgZ2VuZXJhdGVkIHByb2plY3Rcbi8vIGRpcmVjdG9yeSBtdXN0IHN0YXkgYSBsZWdhbCBwYWNrYWdlIG5hbWUgc28gYG5wbSBpbml0YC1zdHlsZSBmbG93cyBhbmRcbi8vIHJlZ2lzdHJ5IHB1YmxpY2F0aW9uIGFyZSBuZXZlciBibG9ja2VkIGJ5IHRoZSBzY2FmZm9sZCBpdHNlbGYgKEwxMSkuXG5jb25zdCBNQVhfUFJPSkVDVF9OQU1FX0xFTkdUSCA9IDIxNDtcbmNvbnN0IFBST0pFQ1RfTkFNRV9QQVRURVJOID0gL15bYS16MC05XVthLXowLTkuXy1dKiQvO1xuXG4vKipcbiAqIEwxMTogdmFsaWRhdGUgdGhlIHNjYWZmb2xkIHRhcmdldCBuYW1lIGJlZm9yZSBhbnkgZmlsZXN5c3RlbSB3b3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nifiedProductVersions, buildTemplates, resolveVersions, validateProjectName };
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/version.ts
|
|
2
|
+
/** The published CLI version, embedded so packed npm installs are self-contained. */
|
|
3
|
+
const CREATE_VERSION = "1.0.0-alpha.10";
|
|
4
|
+
/**
|
|
5
|
+
* The Vite release pinned into the generated starter's package.json (the
|
|
6
|
+
* `${v.vite}` scaffold token in the npm/pnpm starter). Embedded for the same
|
|
7
|
+
* reason as CREATE_VERSION (packed npm installs are self-contained); the
|
|
8
|
+
* repository's Vite-pin check (deps:vite-check in the repo tooling package) anchors this copy
|
|
9
|
+
* to the canonical dev pin.
|
|
10
|
+
*/
|
|
11
|
+
const VITE_STARTER_PIN = "8.0.16";
|
|
12
|
+
/**
|
|
13
|
+
* The Tailwind line pinned into the generated starter's devDependencies (the
|
|
14
|
+
* Tailwind-ON scaffold, #1524): both `tailwindcss` and `@tailwindcss/vite`,
|
|
15
|
+
* exactly, aligned with the router's own dev pins. The 4.3.x line is the
|
|
16
|
+
* preset's supported line (the v3-lts line is forbidden — see the router's
|
|
17
|
+
* preset-tailwind module). Embedded like the other pins so packed npm
|
|
18
|
+
* installs stay self-contained; the create tests anchor this copy to the
|
|
19
|
+
* router manifest the way deps:vite-check anchors VITE_STARTER_PIN.
|
|
20
|
+
*/
|
|
21
|
+
const TAILWIND_STARTER_PIN = "4.3.3";
|
|
22
|
+
//#endregion
|
|
23
|
+
export { CREATE_VERSION, TAILWIND_STARTER_PIN, VITE_STARTER_PIN };
|
package/templates/README.tmpl
CHANGED
|
@@ -5,23 +5,57 @@ A file-based openElement app: page routes live in `app/routes/`, compiled page
|
|
|
5
5
|
elements and shared style sheets in `app/components/`, and client islands
|
|
6
6
|
(including the `app-shell` layout island) in `app/islands/`.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
One directory is generated rather than source: `.openElement/` at the project
|
|
9
|
+
root holds the build's internal state. The router compiles the `app/head.tsx`
|
|
10
|
+
head convention there (build-plan bookkeeping and Tailwind preset staging land
|
|
11
|
+
alongside); `pnpm dev` and `pnpm build` write it as needed. The starter's
|
|
12
|
+
`.gitignore` excludes it, and deleting it is safe — the next dev run or build
|
|
13
|
+
recreates it.
|
|
14
|
+
|
|
15
|
+
This starter pins the exact `@openelement/element` and `@openelement/router`
|
|
16
|
+
versions it was generated from (`${v.element}`) in `package.json`; update both
|
|
17
|
+
there when moving to a new release.
|
|
18
|
+
|
|
19
|
+
Styling ownership is split three ways. Global design tokens and the document
|
|
20
|
+
baseline (`body`, `::selection`) live in `app/styles/tokens.css` — the file
|
|
21
|
+
convention the build inlines into every document `<head>`. Pages use light
|
|
22
|
+
roots and own their rules in `static styles`
|
|
23
|
+
(`app/components/page-styles.ts`): the server inlines each page's sheets into
|
|
24
|
+
the SSR output as a `@scope(<page-tag>)` style block, so pages are fully styled
|
|
25
|
+
with zero client JavaScript. The shell and the islands hydrate in the browser
|
|
26
|
+
and carry their own `static styles`.
|
|
27
|
+
${tailwind.section}
|
|
28
|
+
## Where options live
|
|
29
|
+
|
|
30
|
+
Framework options have exactly one home: `openelement.config.ts`. It is
|
|
31
|
+
optional and nearly empty — every option it omits comes from a file
|
|
32
|
+
convention:
|
|
33
|
+
|
|
34
|
+
| Option | Convention |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| design tokens | `app/styles/tokens.css` |
|
|
37
|
+
| app shell | `app/islands/app-shell.tsx` (deletable) |
|
|
38
|
+
| document head content | `app/head.tsx` (meta tags, preloads, inline CSS) |
|
|
39
|
+
| site title | the `name` field of `package.json` |
|
|
40
|
+
|
|
41
|
+
Passing framework options inline to `openElement()` while the config file
|
|
42
|
+
carries options is a hard error, and an unknown key fails the build with the
|
|
43
|
+
accepted-key list. `vite.config.ts` stays Vite-only: `plugins: [...openElement()]`.
|
|
44
|
+
The conventions follow the `dirs` block, so moving the three roots under
|
|
45
|
+
`src/` moves the token, shell and head files with them.
|
|
46
|
+
|
|
47
|
+
## Scripts
|
|
48
|
+
|
|
49
|
+
- `pnpm dev` — start the Vite dev server.
|
|
50
|
+
- `pnpm check` — type-check every route/component file. The check covers the
|
|
51
|
+
whole `app/` directory (`tsconfig.json`), so new files are picked up
|
|
52
|
+
automatically.
|
|
53
|
+
- `pnpm test` — run Node's built-in test runner (the starter ships none).
|
|
54
|
+
- `pnpm build` — production build (SSG + Nitro server) into `dist/`.
|
|
55
|
+
- `pnpm start` — serve the production build. Use this for production
|
|
22
56
|
preview: the starter ships a request-time route (`/contact`), so
|
|
23
|
-
`
|
|
24
|
-
- `
|
|
57
|
+
`pnpm preview` (static-only preview, #601) is refused by design.
|
|
58
|
+
- `pnpm preview` — static-only preview; refused for this starter (see
|
|
25
59
|
above).
|
|
26
60
|
|
|
27
61
|
## Blog
|
|
@@ -33,14 +67,13 @@ then link it from `app/routes/blog/index.tsx` (the index list is static
|
|
|
33
67
|
authoring). Interactive content belongs in a compiled island composed from
|
|
34
68
|
the page.
|
|
35
69
|
|
|
36
|
-
##
|
|
70
|
+
## Dependency notes
|
|
37
71
|
|
|
38
|
-
`
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
content collection plugin.
|
|
72
|
+
`hono` and `@hono/vite-dev-server` are installed even though no source file
|
|
73
|
+
imports them: the dev server resolves `hono` when loading the generated
|
|
74
|
+
server entry (the bundled `dist/` output inlines it). For Nitro deployments,
|
|
75
|
+
the built handler bridges through the `@openelement/router/nitro-mount`
|
|
76
|
+
subpath of the one `@openelement/router` dependency. Do not remove them.
|
|
44
77
|
|
|
45
78
|
## Brand assets
|
|
46
79
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Styled 404 page element (#923): the request-time server renders this page
|
|
3
3
|
* with a 404 status for unmatched paths; SSG builds also emit it as static
|
|
4
|
-
* 404.html. The path-derived tag is 'el-404'. Light root: the page
|
|
5
|
-
*
|
|
4
|
+
* 404.html. The path-derived tag is 'el-404'. Light root: the page owns its
|
|
5
|
+
* rules via `static styles` (./page-styles.ts), inlined into SSR as
|
|
6
|
+
* @scope(el-404).
|
|
6
7
|
*/
|
|
7
8
|
import { element, OpenElement } from '@openelement/element';
|
|
9
|
+
import { notFoundPageStyles } from './page-styles.ts';
|
|
8
10
|
|
|
9
11
|
@element('el-404', { root: 'light' })
|
|
10
12
|
export default class NotFoundPage extends OpenElement {
|
|
13
|
+
static override styles = notFoundPageStyles;
|
|
14
|
+
|
|
11
15
|
render() {
|
|
12
16
|
return (
|
|
13
17
|
<main>
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
* under app/routes/blog/ (compiled to static pages at build time); the list
|
|
4
4
|
* below is authored statically — add a link per post. (Compiler grammar v1
|
|
5
5
|
* list Regions carry one value slot per item and no per-item attributes, so
|
|
6
|
-
* a data-driven link list is a known v1 boundary.) Light root: the page
|
|
7
|
-
*
|
|
6
|
+
* a data-driven link list is a known v1 boundary.) Light root: the page owns
|
|
7
|
+
* its rules via `static styles` (./page-styles.ts), inlined into SSR as
|
|
8
|
+
* @scope(blog-index).
|
|
8
9
|
*/
|
|
9
10
|
import { element, OpenElement } from '@openelement/element';
|
|
11
|
+
import { blogIndexStyles } from './page-styles.ts';
|
|
10
12
|
|
|
11
13
|
@element('blog-index', { root: 'light' })
|
|
12
14
|
export default class BlogIndexPage extends OpenElement {
|
|
15
|
+
static override styles = blogIndexStyles;
|
|
16
|
+
|
|
13
17
|
render() {
|
|
14
18
|
return (
|
|
15
19
|
<main>
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* /blog/welcome post page element — static prerendered. A post is a compiled
|
|
3
|
-
* page route in 0
|
|
4
|
-
*
|
|
5
|
-
* derives the tag ('blog-welcome'); there is
|
|
6
|
-
* grammar v1 (no raw-HTML sink
|
|
3
|
+
* page route in the 1.0 Alpha baseline: static markup in the render() below,
|
|
4
|
+
* page rules in `static styles` (./page-styles.ts, inlined into SSR as
|
|
5
|
+
* @scope(blog-welcome)). The path derives the tag ('blog-welcome'); there is
|
|
6
|
+
* no dynamic [slug] route in grammar v1 (with no raw-HTML sink), so unknown
|
|
7
7
|
* slugs fall through to the styled 404 (#922).
|
|
8
8
|
*/
|
|
9
9
|
import { element, OpenElement } from '@openelement/element';
|
|
10
|
+
import { blogWelcomeStyles } from './page-styles.ts';
|
|
10
11
|
|
|
11
12
|
@element('blog-welcome', { root: 'light' })
|
|
12
13
|
export default class BlogWelcomePage extends OpenElement {
|
|
14
|
+
static override styles = blogWelcomeStyles;
|
|
15
|
+
|
|
13
16
|
render() {
|
|
14
17
|
return (
|
|
15
18
|
<main>
|
|
@@ -23,7 +26,7 @@ export default class BlogWelcomePage extends OpenElement {
|
|
|
23
26
|
<article class='post-body'>
|
|
24
27
|
<p>
|
|
25
28
|
This starter keeps one post route present so the blog is wired up from the first build.
|
|
26
|
-
In 0
|
|
29
|
+
In the 1.0 Alpha baseline a post is a compiled page: edit{' '}
|
|
27
30
|
<code>app/components/page-blog-welcome.tsx</code> and the route module{' '}
|
|
28
31
|
<code>app/routes/blog/welcome.tsx</code> next to it.
|
|
29
32
|
</p>
|
|
@@ -35,7 +38,7 @@ export default class BlogWelcomePage extends OpenElement {
|
|
|
35
38
|
</li>
|
|
36
39
|
<li>a request-time route with a plain HTML form loop (/contact)</li>
|
|
37
40
|
<li>client islands hydrated on demand (the counter on the home page)</li>
|
|
38
|
-
<li>an app shell composed around every page
|
|
41
|
+
<li>an app shell composed around every page by the app-shell convention</li>
|
|
39
42
|
</ul>
|
|
40
43
|
<h2>Write your own posts</h2>
|
|
41
44
|
<p>
|
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
* and morphs in place with it (data-open-enhance). The route module's props
|
|
5
5
|
* projector maps request/action state onto the compiled properties below;
|
|
6
6
|
* the feedback paragraphs render empty (zero-height, invisible) until the
|
|
7
|
-
* action supplies text. Light root: the page
|
|
8
|
-
*
|
|
7
|
+
* action supplies text. Light root: the page owns its rules via
|
|
8
|
+
* `static styles` (./page-styles.ts), inlined into SSR as @scope(contact-page).
|
|
9
9
|
*/
|
|
10
10
|
import { element, OpenElement, property } from '@openelement/element';
|
|
11
|
+
import { contactPageStyles } from './page-styles.ts';
|
|
11
12
|
|
|
12
13
|
@element('contact-page', { root: 'light' })
|
|
13
14
|
export default class ContactPage extends OpenElement {
|
|
15
|
+
static override styles = contactPageStyles;
|
|
16
|
+
|
|
14
17
|
@property({ reflect: false, attribute: false })
|
|
15
18
|
email = '';
|
|
16
19
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* /freshness page element — prerendered statically at build time like any
|
|
3
3
|
* other static route. v0.44 ships no route-level cache revalidation
|
|
4
|
-
* semantics (ISR was removed, see issue #1217). Light root: the page
|
|
5
|
-
*
|
|
4
|
+
* semantics (ISR was removed, see issue #1217). Light root: the page owns its
|
|
5
|
+
* rules via `static styles` (./page-styles.ts), inlined into SSR as
|
|
6
|
+
* @scope(freshness-page).
|
|
6
7
|
*/
|
|
7
8
|
import { element, OpenElement } from '@openelement/element';
|
|
9
|
+
import { freshnessPageStyles } from './page-styles.ts';
|
|
8
10
|
|
|
9
11
|
@element('freshness-page', { root: 'light' })
|
|
10
12
|
export default class FreshnessPage extends OpenElement {
|
|
13
|
+
static override styles = freshnessPageStyles;
|
|
14
|
+
|
|
11
15
|
render() {
|
|
12
16
|
return (
|
|
13
17
|
<main>
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Home page element — static prerendered (default renderIntent mode).
|
|
3
3
|
*
|
|
4
|
-
* Compiled
|
|
5
|
-
* at build time. The page uses a light root
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The two island hosts (<my-counter>,
|
|
9
|
-
* custom-element hosts that the generated server
|
|
10
|
-
* islands' own compiled classes.
|
|
4
|
+
* Compiled page: the render() below is lowered to a Part Program
|
|
5
|
+
* at build time. The page uses a light root and owns its rules via
|
|
6
|
+
* `static styles` (./page-styles.ts): the server inlines them into the SSR
|
|
7
|
+
* output as a @scope(index-page) <style data-oe-static-styles> block, so the
|
|
8
|
+
* page is styled with zero client JS. The two island hosts (<my-counter>,
|
|
9
|
+
* <only-ticker>) are static custom-element hosts that the generated server
|
|
10
|
+
* entry expands through the islands' own compiled classes.
|
|
11
11
|
*/
|
|
12
12
|
import { element, OpenElement } from '@openelement/element';
|
|
13
|
+
import { homePageStyles } from './page-styles.ts';
|
|
13
14
|
|
|
14
15
|
@element('index-page', { root: 'light' })
|
|
15
16
|
export default class HomePage extends OpenElement {
|
|
17
|
+
static override styles = homePageStyles;
|
|
18
|
+
|
|
16
19
|
render() {
|
|
17
20
|
return (
|
|
18
21
|
<main>
|