@openelement/create 1.0.0-alpha.7 → 1.0.0-alpha.9
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 +68 -35
- package/package.json +2 -2
- package/src/cli.js +75 -15
- package/src/install-command.d.ts +25 -16
- package/src/install-command.js +27 -18
- package/src/template-builder.js +61 -10
- package/src/version.js +17 -6
- package/templates/README.tmpl +18 -18
- package/templates/package.json.tmpl +24 -1
- 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/deno.json.tmpl +0 -25
package/README.md
CHANGED
|
@@ -10,47 +10,72 @@ Docs and guides: <https://openelement.org>.
|
|
|
10
10
|
> line until a separately admitted stable release.
|
|
11
11
|
|
|
12
12
|
`@openelement/create` generates a new openElement project with the recommended
|
|
13
|
-
directory structure,
|
|
13
|
+
directory structure, a pnpm-scripted package manifest, Vite setup, and starter
|
|
14
|
+
pages. The generated project is a plain Node/pnpm project.
|
|
14
15
|
|
|
15
16
|
## Usage (1.0 Alpha)
|
|
16
17
|
|
|
17
18
|
```bash
|
|
18
|
-
|
|
19
|
+
npm create @openelement@alpha my-app
|
|
19
20
|
cd my-app
|
|
20
|
-
|
|
21
|
+
pnpm install
|
|
22
|
+
pnpm dev
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
`
|
|
25
|
+
`npm create @openelement@alpha` rides npm's initializer alias: a bare `@scope`
|
|
26
|
+
resolves to `@scope/create` at the same tag, so the canonical spelling names
|
|
27
|
+
the scope, and npm runs this package's generator. The version `@alpha` resolves
|
|
28
|
+
to is registered in
|
|
29
|
+
`the tracked release-state manifest` (currently `1.0.0-alpha.8`, a new baseline —
|
|
25
30
|
not a 0.x upgrade, with no migration path from 0.x). Pin that exact version
|
|
26
31
|
when reproducibility matters (verify against the live registry with
|
|
27
32
|
`npm view @openelement/create dist-tags.alpha`):
|
|
28
33
|
|
|
29
34
|
```bash
|
|
30
|
-
|
|
35
|
+
npm create @openelement@1.0.0-alpha.8 my-app
|
|
31
36
|
```
|
|
32
37
|
|
|
33
|
-
`--minimum-dependency-age 0` is needed because Deno's default
|
|
34
|
-
minimumDependencyAge (~24h) refuses packages published within the last day.
|
|
35
|
-
|
|
36
38
|
The generated starter pins the exact `@openelement/*` versions it was built
|
|
37
|
-
from in its `
|
|
39
|
+
from in its `package.json` dependencies.
|
|
38
40
|
|
|
39
41
|
The canonical install command is exported from `@openelement/create/install-command` (one builder, every documented copy derives from it).
|
|
40
42
|
|
|
41
|
-
##
|
|
43
|
+
## Tailwind form (the one scaffold question)
|
|
44
|
+
|
|
45
|
+
The scaffold ships the **Tailwind-ON starter by default**: a preset-wired
|
|
46
|
+
`vite.config.ts` (the `@openelement/router` Tailwind preset), the
|
|
47
|
+
`app/styles/theme.css` `@theme` role sheet (semantic roles over the Tailwind
|
|
48
|
+
default scale), and exact `tailwindcss` / `@tailwindcss/vite` pins in
|
|
49
|
+
`devDependencies`. Interactively the CLI asks exactly one question —
|
|
50
|
+
`Enable Tailwind CSS + @theme role sheet? (Y/n)` — and every non-interactive
|
|
51
|
+
run (CI, packed consumers) takes the same `Y` default. Pass a flag to skip the
|
|
52
|
+
question; the flags reach the generator through the spellings that forward
|
|
53
|
+
trailing arguments (`npx`, `pnpm dlx`, or a directly invoked bin):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx @openelement/create@alpha my-app --no-tailwind # the minimal starter
|
|
57
|
+
npx @openelement/create@alpha my-app --tailwind # explicit ON (the default)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`--no-tailwind` generates the pre-#1524 minimal starter: no Tailwind
|
|
61
|
+
dependency surface, no preset wiring, no role sheet.
|
|
62
|
+
|
|
63
|
+
## The bootstrap is a plain npm invocation; the generated project is Node
|
|
64
|
+
|
|
65
|
+
The documented bootstrap runs the generator through `npm create` (or the
|
|
66
|
+
`npx` short form, or `pnpm dlx`) — plain Node tooling, no second runtime.
|
|
67
|
+
Node.js 24.2+ is the only host requirement for both the bootstrap and the
|
|
68
|
+
generated project. The packed package ships two equivalent npm bins
|
|
69
|
+
(`openelement-create`, `create-openelement`, both the same entry), so the pnpm
|
|
70
|
+
form must name one explicitly:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx @openelement/create@alpha my-app
|
|
74
|
+
pnpm dlx --package=@openelement/create@alpha openelement-create my-app
|
|
75
|
+
```
|
|
42
76
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
> program: it is written against the Deno API, and its `bin` entries and
|
|
46
|
-
> shebang (`#!/usr/bin/env -S deno run --allow-read --allow-write`) both assume
|
|
47
|
-
> a Deno host. Under a plain Node host the bin dies at startup with
|
|
48
|
-
> `ReferenceError: Deno is not defined`.
|
|
49
|
-
>
|
|
50
|
-
> A Node-executable entry point is a deferred roadmap item (portable-host
|
|
51
|
-
> tooling, [#1387](https://github.com/open-element/openelement/issues/1387)).
|
|
52
|
-
> Until it lands, the bare-flag create form is the
|
|
53
|
-
> supported install path.
|
|
77
|
+
The scaffolded project itself is Node-native: Node.js 24.2+ and
|
|
78
|
+
pnpm run its scripts.
|
|
54
79
|
|
|
55
80
|
## Stable 0.43 (maintenance line)
|
|
56
81
|
|
|
@@ -59,22 +84,29 @@ A versionless install resolves the npm `latest` dist-tag to it; pin the line
|
|
|
59
84
|
explicitly instead:
|
|
60
85
|
|
|
61
86
|
```bash
|
|
62
|
-
|
|
87
|
+
npm create @openelement@0.43 my-app
|
|
63
88
|
```
|
|
64
89
|
|
|
65
90
|
## Requirements
|
|
66
91
|
|
|
67
|
-
**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
92
|
+
- **Bootstrap:** Node.js 24.2+ with npm (or pnpm for the `pnpm dlx` variant) —
|
|
93
|
+
the verified floor this repository exercises in CI.
|
|
94
|
+
- **Generated project:** Node.js 24.2+ (the floor the packed `@openelement/*`
|
|
95
|
+
engines declare and CI exercises; `.node-version` pins the development
|
|
96
|
+
line) and pnpm for the lifecycle scripts.
|
|
72
97
|
|
|
73
98
|
## What It Creates
|
|
74
99
|
|
|
75
|
-
- `
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
- `package.json` - starter dependencies (exact `@openelement/*` release pins)
|
|
101
|
+
and the lifecycle scripts (`dev`/`check`/`test`/`build`/`start`/`preview`);
|
|
102
|
+
the default (Tailwind-ON) form adds the exact `tailwindcss` and
|
|
103
|
+
`@tailwindcss/vite` dev pins
|
|
104
|
+
- `tsconfig.json` - the type-check surface for `pnpm check`: JSX authoring
|
|
105
|
+
through the element import source, whole-`app/` coverage
|
|
106
|
+
- `vite.config.ts` - Vite build configuration. On the default (Tailwind-ON)
|
|
107
|
+
form it also applies the router's public Tailwind preset so the role sheet
|
|
108
|
+
compiles into the linked bundle; framework options still have exactly one
|
|
109
|
+
home:
|
|
78
110
|
- `openelement.config.ts` - the framework options. It is OPTIONAL and nearly
|
|
79
111
|
empty by default; every option it omits comes from a file convention —
|
|
80
112
|
design tokens from `app/styles/tokens.css`, the app shell from
|
|
@@ -82,15 +114,16 @@ claimed or tested.
|
|
|
82
114
|
`app/head.tsx`, the site title from `package.json`. Passing framework
|
|
83
115
|
options inline to `openElement()` while this file carries options is a hard
|
|
84
116
|
error, and an unknown key fails the build with the accepted-key list.
|
|
85
|
-
- `app/` - application directory with starter pages and islands
|
|
117
|
+
- `app/` - application directory with starter pages and islands; the
|
|
118
|
+
Tailwind-ON form adds `app/styles/theme.css`, the `@theme` role sheet
|
|
86
119
|
- `app/routes/blog/` - the sample blog as compiled page routes (`index` list
|
|
87
120
|
and `welcome` post), prerendered at build time
|
|
88
121
|
- `public/` - static assets
|
|
89
122
|
- `README.md` and `.gitignore` - starter docs and ignore rules
|
|
90
123
|
|
|
91
|
-
The generated
|
|
92
|
-
the starter surface. Advanced contracts remain available through the
|
|
93
|
-
workspace packages when a project needs them.
|
|
124
|
+
The generated dependency set intentionally keeps protocol and build internals
|
|
125
|
+
out of the starter surface. Advanced contracts remain available through the
|
|
126
|
+
published workspace packages when a project needs them.
|
|
94
127
|
|
|
95
128
|
## License
|
|
96
129
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openelement/create",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/cli.js",
|
|
6
6
|
"types": "./src/cli.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"starter"
|
|
33
33
|
],
|
|
34
34
|
"engines": {
|
|
35
|
-
"
|
|
35
|
+
"node": ">=24.2"
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": [
|
|
38
38
|
"./src/cli.js"
|
package/src/cli.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
import { buildTemplates, resolveVersions, validateProjectName } from "./template-builder.js";
|
|
3
3
|
import { createInstallCommand } from "./install-command.js";
|
|
4
|
+
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import readline from "node:readline/promises";
|
|
4
7
|
//#region src/cli.ts
|
|
5
8
|
/**
|
|
6
9
|
* @openelement/create - Minimal project scaffold for openElement framework.
|
|
@@ -10,7 +13,11 @@ import { createInstallCommand } from "./install-command.js";
|
|
|
10
13
|
* string, so the documented command cannot drift from the shipped flags.
|
|
11
14
|
*
|
|
12
15
|
* openElement Architecture: Keep It Simple, Stupid.
|
|
13
|
-
* One template,
|
|
16
|
+
* One template, one question, instant start. The single question is the
|
|
17
|
+
* Tailwind form (#1524): the default (and every non-interactive run) ships
|
|
18
|
+
* the Tailwind-ON starter — preset-wired vite config, @theme role sheet, and
|
|
19
|
+
* the exact tailwindcss/@tailwindcss/vite pins; `--no-tailwind` keeps the
|
|
20
|
+
* pre-#1524 minimal template.
|
|
14
21
|
*
|
|
15
22
|
* L9: every failure mode exits 1 with one actionable message — never a
|
|
16
23
|
* runtime stack trace.
|
|
@@ -18,9 +25,18 @@ import { createInstallCommand } from "./install-command.js";
|
|
|
18
25
|
function errorMessage(error) {
|
|
19
26
|
return error instanceof Error ? error.message : String(error);
|
|
20
27
|
}
|
|
28
|
+
/** node:fs error shape for "path does not exist". */
|
|
29
|
+
function isNotFound(error) {
|
|
30
|
+
return error.code === "ENOENT";
|
|
31
|
+
}
|
|
32
|
+
/** node:fs error shapes for "not permitted". */
|
|
33
|
+
function isPermissionDenied(error) {
|
|
34
|
+
const code = error.code;
|
|
35
|
+
return code === "EACCES" || code === "EPERM";
|
|
36
|
+
}
|
|
21
37
|
function fail(message) {
|
|
22
38
|
console.error(`error: ${message}`);
|
|
23
|
-
|
|
39
|
+
process.exit(1);
|
|
24
40
|
}
|
|
25
41
|
function joinPosix(...parts) {
|
|
26
42
|
return parts.join("/").replace(/\/{2,}/g, "/");
|
|
@@ -30,42 +46,86 @@ function dirnameOf(path) {
|
|
|
30
46
|
if (idx <= 0) return ".";
|
|
31
47
|
return path.slice(0, idx);
|
|
32
48
|
}
|
|
49
|
+
/** The CLI flags and the project-name positional, parsed without a library. */
|
|
50
|
+
function parseArgs(argv) {
|
|
51
|
+
let name;
|
|
52
|
+
let tailwind;
|
|
53
|
+
for (const arg of argv) if (arg === "--tailwind") tailwind = true;
|
|
54
|
+
else if (arg === "--no-tailwind") tailwind = false;
|
|
55
|
+
else if (arg.startsWith("-")) continue;
|
|
56
|
+
else if (name === void 0) name = arg;
|
|
57
|
+
return {
|
|
58
|
+
name,
|
|
59
|
+
tailwind
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the Tailwind form: a flag wins without prompting; otherwise a TTY
|
|
64
|
+
* asks the one scaffold question (default Y), and a non-TTY run (CI, packed
|
|
65
|
+
* consumers) takes the same default without prompting.
|
|
66
|
+
*/
|
|
67
|
+
async function resolveTailwindForm(flag) {
|
|
68
|
+
if (flag !== void 0) return flag;
|
|
69
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) return true;
|
|
70
|
+
const rl = readline.createInterface({
|
|
71
|
+
input: process.stdin,
|
|
72
|
+
output: process.stdout
|
|
73
|
+
});
|
|
74
|
+
try {
|
|
75
|
+
for (;;) {
|
|
76
|
+
const answer = (await rl.question("Enable Tailwind CSS + @theme role sheet? (Y/n) ")).trim().toLowerCase();
|
|
77
|
+
if (answer === "" || answer === "y" || answer === "yes") return true;
|
|
78
|
+
if (answer === "n" || answer === "no") return false;
|
|
79
|
+
console.info(" please answer y (default) or n");
|
|
80
|
+
}
|
|
81
|
+
} finally {
|
|
82
|
+
rl.close();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
33
85
|
async function main() {
|
|
34
|
-
const
|
|
86
|
+
const argv = process.argv.slice(2);
|
|
87
|
+
const { name: positionalName, tailwind: tailwindFlag } = parseArgs(argv);
|
|
88
|
+
const name = positionalName;
|
|
35
89
|
if (!name || name === "--help" || name === "-h") {
|
|
36
90
|
console.log(`Usage (Alpha): ${createInstallCommand()}`);
|
|
37
91
|
console.log("(a versionless install resolves the stable 0.43 line)");
|
|
38
|
-
|
|
92
|
+
console.log(" --tailwind ship the Tailwind-ON starter (default)");
|
|
93
|
+
console.log(" --no-tailwind ship the minimal starter without Tailwind");
|
|
94
|
+
process.exit(name ? 0 : 1);
|
|
39
95
|
}
|
|
96
|
+
if (argv.includes("--tailwind") && argv.includes("--no-tailwind")) fail("--tailwind and --no-tailwind are mutually exclusive.");
|
|
40
97
|
const invalid = validateProjectName(name);
|
|
41
98
|
if (invalid) fail(`Invalid project name "${name}". ${invalid}`);
|
|
42
|
-
const targetDir = `${
|
|
99
|
+
const targetDir = `${process.cwd().replace(/\/+$/, "")}/${name}`;
|
|
43
100
|
const relativeTarget = name;
|
|
44
101
|
if (!relativeTarget || relativeTarget.includes("..") || relativeTarget.includes("/") || relativeTarget.includes("\\") || /^[a-zA-Z]:/.test(relativeTarget) || relativeTarget.startsWith("/")) fail(`Refusing to create project outside the current directory: ${name}`);
|
|
45
102
|
try {
|
|
46
|
-
await
|
|
103
|
+
await stat(targetDir);
|
|
47
104
|
fail(`Directory "${name}" already exists. Choose a different name or remove the existing directory.`);
|
|
48
105
|
} catch (error) {
|
|
49
|
-
if (!(error
|
|
106
|
+
if (!isNotFound(error)) throw new Error(`Could not inspect target directory "${name}": ${errorMessage(error)}`);
|
|
50
107
|
}
|
|
108
|
+
const tailwind = await resolveTailwindForm(tailwindFlag);
|
|
51
109
|
const v = resolveVersions();
|
|
52
110
|
try {
|
|
53
|
-
await
|
|
54
|
-
const TPL = await buildTemplates(v, name);
|
|
111
|
+
await mkdir(targetDir, { recursive: true });
|
|
112
|
+
const TPL = await buildTemplates(v, name, { tailwind });
|
|
55
113
|
for (const [path, content] of Object.entries(TPL)) {
|
|
56
114
|
const fullPath = joinPosix(targetDir, path);
|
|
57
|
-
await
|
|
58
|
-
await
|
|
115
|
+
await mkdir(dirnameOf(fullPath), { recursive: true });
|
|
116
|
+
await writeFile(fullPath, content, "utf8");
|
|
59
117
|
console.info(` created ${path}`);
|
|
60
118
|
}
|
|
61
119
|
} catch (error) {
|
|
62
|
-
const detail = error
|
|
120
|
+
const detail = isPermissionDenied(error) ? `Permission denied. Check write permissions for ${targetDir}.` : errorMessage(error);
|
|
63
121
|
throw new Error(`Failed to write project files in "${name}": ${detail} Remove the partially created directory before retrying.`);
|
|
64
122
|
}
|
|
65
123
|
console.info(`\nopenElement project created at ./${relativeTarget}/`);
|
|
124
|
+
console.info(tailwind ? " Tailwind: ON — app/styles/theme.css carries the @theme role sheet." : " Tailwind: OFF — minimal starter, no Tailwind dependency surface.");
|
|
66
125
|
console.info(`\n cd ${relativeTarget}`);
|
|
67
|
-
console.info("
|
|
68
|
-
console.info("
|
|
126
|
+
console.info(" pnpm install");
|
|
127
|
+
console.info(" pnpm dev");
|
|
128
|
+
console.info(" See README.md for all scripts (check/test/build/start/preview)");
|
|
69
129
|
}
|
|
70
130
|
try {
|
|
71
131
|
await main();
|
package/src/install-command.d.ts
CHANGED
|
@@ -10,30 +10,39 @@
|
|
|
10
10
|
* in the repository differs from this string. There is no second spelling to
|
|
11
11
|
* drift.
|
|
12
12
|
*
|
|
13
|
-
* This module is deliberately side-effect free (no top-level CLI execution
|
|
14
|
-
*
|
|
13
|
+
* This module is deliberately side-effect free (no top-level CLI execution):
|
|
14
|
+
* it is imported by the site build as well as by the CLI itself.
|
|
15
15
|
*/
|
|
16
16
|
/** The npm specifier the generator is published under. */
|
|
17
|
-
export declare const CREATE_PACKAGE_SPECIFIER = "
|
|
18
|
-
/** The dist-tag the documented install resolves; the exact version is registry truth. */
|
|
19
|
-
export declare const CREATE_INSTALL_TAG = "alpha";
|
|
17
|
+
export declare const CREATE_PACKAGE_SPECIFIER = "@openelement/create";
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* this command). `--minimum-dependency-age 0` is a functional footnote kept
|
|
26
|
-
* in prose where needed, not part of the documented shape.
|
|
19
|
+
* The scope `npm create` resolves to {@linkcode CREATE_PACKAGE_SPECIFIER}:
|
|
20
|
+
* npm's initializer alias maps a bare `@scope` (optionally `@scope@<tag>`) to
|
|
21
|
+
* `@scope/create` at the same tag, so the canonical spelling never repeats the
|
|
22
|
+
* `/create` suffix (owner-verified against npm's init alias rules).
|
|
27
23
|
*/
|
|
28
|
-
export declare const
|
|
24
|
+
export declare const CREATE_NPM_CREATE_SCOPE = "@openelement";
|
|
25
|
+
/** The dist-tag the documented install resolves; the exact version is registry truth. */
|
|
26
|
+
export declare const CREATE_INSTALL_TAG = "alpha";
|
|
29
27
|
/** Placeholder the usage text and the docs use in place of a project name. */
|
|
30
28
|
export declare const CREATE_PROJECT_PLACEHOLDER = "<project-name>";
|
|
31
29
|
/**
|
|
32
|
-
*
|
|
30
|
+
* The documented install command shapes, all verified against the published
|
|
31
|
+
* two-bin artifact (bins `openelement-create` and `create-openelement`, both
|
|
32
|
+
* `src/cli.js`; npm 11 / pnpm 12):
|
|
33
|
+
* - canonical: `npm create @openelement@<tag> <name>` — npm's `@scope`
|
|
34
|
+
* initializer alias resolves it to `@openelement/create@<tag>` (#1507
|
|
35
|
+
* revision, 2026-10-05; the former canonical `npm exec <pkg>@<tag> -- <name>`
|
|
36
|
+
* remains a verified spelling through the same artifact)
|
|
37
|
+
* - short form: `npx <pkg>@<tag> <name>`
|
|
38
|
+
* - pnpm: `pnpm dlx --package=<pkg>@<tag> openelement-create <name>` — the
|
|
39
|
+
* explicit `--package` plus bin is required because the packed package
|
|
40
|
+
* ships two bins, so a bare `pnpm dlx <pkg>` cannot resolve one (and no
|
|
41
|
+
* package named `create-openelement` exists on the registry).
|
|
33
42
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
43
|
+
* Owner ruling 2026-10-03: the former Deno bootstrap (`deno run` of the npm
|
|
44
|
+
* specifier) is retired with the Deno consumer surface; the generator is
|
|
45
|
+
* invoked through plain Node tooling.
|
|
37
46
|
*/
|
|
38
47
|
export declare function createInstallCommand(projectName?: string, options?: {
|
|
39
48
|
tag?: string;
|
package/src/install-command.js
CHANGED
|
@@ -10,34 +10,43 @@
|
|
|
10
10
|
* in the repository differs from this string. There is no second spelling to
|
|
11
11
|
* drift.
|
|
12
12
|
*
|
|
13
|
-
* This module is deliberately side-effect free (no top-level CLI execution
|
|
14
|
-
*
|
|
13
|
+
* This module is deliberately side-effect free (no top-level CLI execution):
|
|
14
|
+
* it is imported by the site build as well as by the CLI itself.
|
|
15
15
|
*/
|
|
16
16
|
/** The npm specifier the generator is published under. */
|
|
17
|
-
const CREATE_PACKAGE_SPECIFIER = "
|
|
18
|
-
/** The dist-tag the documented install resolves; the exact version is registry truth. */
|
|
19
|
-
const CREATE_INSTALL_TAG = "alpha";
|
|
17
|
+
const CREATE_PACKAGE_SPECIFIER = "@openelement/create";
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* this command). `--minimum-dependency-age 0` is a functional footnote kept
|
|
26
|
-
* in prose where needed, not part of the documented shape.
|
|
19
|
+
* The scope `npm create` resolves to {@linkcode CREATE_PACKAGE_SPECIFIER}:
|
|
20
|
+
* npm's initializer alias maps a bare `@scope` (optionally `@scope@<tag>`) to
|
|
21
|
+
* `@scope/create` at the same tag, so the canonical spelling never repeats the
|
|
22
|
+
* `/create` suffix (owner-verified against npm's init alias rules).
|
|
27
23
|
*/
|
|
28
|
-
const
|
|
24
|
+
const CREATE_NPM_CREATE_SCOPE = "@openelement";
|
|
25
|
+
/** The dist-tag the documented install resolves; the exact version is registry truth. */
|
|
26
|
+
const CREATE_INSTALL_TAG = "alpha";
|
|
29
27
|
/** Placeholder the usage text and the docs use in place of a project name. */
|
|
30
28
|
const CREATE_PROJECT_PLACEHOLDER = "<project-name>";
|
|
31
29
|
/**
|
|
32
|
-
*
|
|
30
|
+
* The documented install command shapes, all verified against the published
|
|
31
|
+
* two-bin artifact (bins `openelement-create` and `create-openelement`, both
|
|
32
|
+
* `src/cli.js`; npm 11 / pnpm 12):
|
|
33
|
+
* - canonical: `npm create @openelement@<tag> <name>` — npm's `@scope`
|
|
34
|
+
* initializer alias resolves it to `@openelement/create@<tag>` (#1507
|
|
35
|
+
* revision, 2026-10-05; the former canonical `npm exec <pkg>@<tag> -- <name>`
|
|
36
|
+
* remains a verified spelling through the same artifact)
|
|
37
|
+
* - short form: `npx <pkg>@<tag> <name>`
|
|
38
|
+
* - pnpm: `pnpm dlx --package=<pkg>@<tag> openelement-create <name>` — the
|
|
39
|
+
* explicit `--package` plus bin is required because the packed package
|
|
40
|
+
* ships two bins, so a bare `pnpm dlx <pkg>` cannot resolve one (and no
|
|
41
|
+
* package named `create-openelement` exists on the registry).
|
|
33
42
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
43
|
+
* Owner ruling 2026-10-03: the former Deno bootstrap (`deno run` of the npm
|
|
44
|
+
* specifier) is retired with the Deno consumer surface; the generator is
|
|
45
|
+
* invoked through plain Node tooling.
|
|
37
46
|
*/
|
|
38
47
|
function createInstallCommand(projectName = CREATE_PROJECT_PLACEHOLDER, options = {}) {
|
|
39
48
|
const tag = options.tag ?? "alpha";
|
|
40
|
-
return `
|
|
49
|
+
return `npm create ${CREATE_NPM_CREATE_SCOPE}@${tag} ${projectName}`;
|
|
41
50
|
}
|
|
42
51
|
//#endregion
|
|
43
|
-
export {
|
|
52
|
+
export { CREATE_INSTALL_TAG, CREATE_NPM_CREATE_SCOPE, CREATE_PACKAGE_SPECIFIER, CREATE_PROJECT_PLACEHOLDER, createInstallCommand };
|
package/src/template-builder.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CREATE_VERSION, VITE_STARTER_PIN } from "./version.js";
|
|
1
|
+
import { CREATE_VERSION, TAILWIND_STARTER_PIN, VITE_STARTER_PIN } from "./version.js";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
2
3
|
//#region src/template-builder.ts
|
|
3
4
|
const MAX_PROJECT_NAME_LENGTH = 214;
|
|
4
5
|
const PROJECT_NAME_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
|
|
@@ -36,8 +37,8 @@ const TEMPLATE_FILES = [
|
|
|
36
37
|
["gitignore.tmpl", ".gitignore"],
|
|
37
38
|
["README.tmpl", "README.md"],
|
|
38
39
|
["public/openelement-mark.svg", "public/openelement-mark.svg"],
|
|
39
|
-
["deno.json.tmpl", "deno.json"],
|
|
40
40
|
["package.json.tmpl", "package.json"],
|
|
41
|
+
["tsconfig.json.tmpl", "tsconfig.json"],
|
|
41
42
|
["vite.config.ts.tmpl", "vite.config.ts"],
|
|
42
43
|
["openelement.config.ts.tmpl", "openelement.config.ts"],
|
|
43
44
|
["app/styles/tokens.css", "app/styles/tokens.css"],
|
|
@@ -60,30 +61,80 @@ const TEMPLATE_FILES = [
|
|
|
60
61
|
["app/islands/my-counter.tsx.tmpl", "app/islands/my-counter.tsx"],
|
|
61
62
|
["app/islands/only-ticker.tsx.tmpl", "app/islands/only-ticker.tsx"]
|
|
62
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
|
+
};
|
|
63
79
|
function versionTokens(v) {
|
|
64
80
|
return {
|
|
65
81
|
["${v.router}"]: v.router,
|
|
66
82
|
["${v.element}"]: v.element
|
|
67
83
|
};
|
|
68
84
|
}
|
|
69
|
-
async function buildTemplates(v, projectName) {
|
|
85
|
+
async function buildTemplates(v, projectName, options = {}) {
|
|
70
86
|
assertUnifiedProductVersions(v);
|
|
71
87
|
const invalid = validateProjectName(projectName);
|
|
72
88
|
if (invalid) throw new Error(`Invalid project name "${projectName}". ${invalid}`);
|
|
89
|
+
const tailwind = options.tailwind ?? true;
|
|
73
90
|
const templatesBase = new URL("../templates/", import.meta.url);
|
|
74
91
|
const tokens = {
|
|
75
92
|
...versionTokens(v),
|
|
76
93
|
["${v.vite}"]: VITE_STARTER_PIN,
|
|
77
|
-
["${name}"]: projectName
|
|
94
|
+
["${name}"]: projectName,
|
|
95
|
+
[TAILWIND_README_TOKEN]: tailwind ? tailwindReadmeSection() : ""
|
|
78
96
|
};
|
|
79
|
-
const
|
|
80
|
-
|
|
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");
|
|
81
100
|
for (const [token, value] of Object.entries(tokens)) if (content.includes(token)) content = content.split(token).join(value);
|
|
82
|
-
if (content.includes("${v.") || content.includes("${name}")) throw new Error(`Unresolved scaffold token in starter template: ${source}`);
|
|
101
|
+
if (content.includes("${v.") || content.includes("${name}") || content.includes("${tailwind.")) throw new Error(`Unresolved scaffold token in starter template: ${source}`);
|
|
83
102
|
return [target, content];
|
|
84
103
|
}));
|
|
85
|
-
|
|
86
|
-
|
|
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));
|
|
116
|
+
}
|
|
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
|
+
`;
|
|
87
138
|
}
|
|
88
139
|
//#endregion
|
|
89
|
-
export { assertUnifiedProductVersions, buildTemplates, resolveVersions, validateProjectName };
|
|
140
|
+
export { TAILWIND_DEV_DEPENDENCIES, TAILWIND_README_TOKEN, assertUnifiedProductVersions, buildTemplates, resolveVersions, validateProjectName };
|
package/src/version.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
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.9";
|
|
4
4
|
/**
|
|
5
|
-
* The Vite
|
|
6
|
-
*
|
|
7
|
-
* installs are self-contained); the
|
|
8
|
-
*
|
|
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.
|
|
9
10
|
*/
|
|
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";
|
|
11
22
|
//#endregion
|
|
12
|
-
export { CREATE_VERSION, VITE_STARTER_PIN };
|
|
23
|
+
export { CREATE_VERSION, TAILWIND_STARTER_PIN, VITE_STARTER_PIN };
|
package/templates/README.tmpl
CHANGED
|
@@ -6,7 +6,7 @@ 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
8
|
This starter pins the exact `@openelement/element` and `@openelement/router`
|
|
9
|
-
versions it was generated from (`${v.element}`) in `
|
|
9
|
+
versions it was generated from (`${v.element}`) in `package.json`; update both
|
|
10
10
|
there when moving to a new release.
|
|
11
11
|
|
|
12
12
|
Styling ownership is split three ways. Global design tokens and the document
|
|
@@ -17,7 +17,7 @@ roots and own their rules in `static styles`
|
|
|
17
17
|
the SSR output as a `@scope(<page-tag>)` style block, so pages are fully styled
|
|
18
18
|
with zero client JavaScript. The shell and the islands hydrate in the browser
|
|
19
19
|
and carry their own `static styles`.
|
|
20
|
-
|
|
20
|
+
${tailwind.section}
|
|
21
21
|
## Where options live
|
|
22
22
|
|
|
23
23
|
Framework options have exactly one home: `openelement.config.ts`. It is
|
|
@@ -37,17 +37,18 @@ accepted-key list. `vite.config.ts` stays Vite-only: `plugins: [...openElement()
|
|
|
37
37
|
The conventions follow the `dirs` block, so moving the three roots under
|
|
38
38
|
`src/` moves the token, shell and head files with them.
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Scripts
|
|
41
41
|
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- `
|
|
47
|
-
- `
|
|
42
|
+
- `pnpm dev` — start the Vite dev server.
|
|
43
|
+
- `pnpm check` — type-check every route/component file. The check covers the
|
|
44
|
+
whole `app/` directory (`tsconfig.json`), so new files are picked up
|
|
45
|
+
automatically.
|
|
46
|
+
- `pnpm test` — run Node's built-in test runner (the starter ships none).
|
|
47
|
+
- `pnpm build` — production build (SSG + Nitro server) into `dist/`.
|
|
48
|
+
- `pnpm start` — serve the production build. Use this for production
|
|
48
49
|
preview: the starter ships a request-time route (`/contact`), so
|
|
49
|
-
`
|
|
50
|
-
- `
|
|
50
|
+
`pnpm preview` (static-only preview, #601) is refused by design.
|
|
51
|
+
- `pnpm preview` — static-only preview; refused for this starter (see
|
|
51
52
|
above).
|
|
52
53
|
|
|
53
54
|
## Blog
|
|
@@ -59,14 +60,13 @@ then link it from `app/routes/blog/index.tsx` (the index list is static
|
|
|
59
60
|
authoring). Interactive content belongs in a compiled island composed from
|
|
60
61
|
the page.
|
|
61
62
|
|
|
62
|
-
##
|
|
63
|
+
## Dependency notes
|
|
63
64
|
|
|
64
|
-
`
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
them.
|
|
65
|
+
`hono` and `@hono/vite-dev-server` are installed even though no source file
|
|
66
|
+
imports them: the dev server resolves `hono` when loading the generated
|
|
67
|
+
server entry (the bundled `dist/` output inlines it). For Nitro deployments,
|
|
68
|
+
the built handler bridges through the `@openelement/router/nitro-mount`
|
|
69
|
+
subpath of the one `@openelement/router` dependency. Do not remove them.
|
|
70
70
|
|
|
71
71
|
## Brand assets
|
|
72
72
|
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "${name}",
|
|
3
3
|
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
4
5
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
+
"packageManager": "pnpm@12.8.1",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=24.2"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"check": "tsc --noEmit",
|
|
13
|
+
"test": "node --test",
|
|
14
|
+
"build": "node node_modules/@openelement/router/src/cli/build.js",
|
|
15
|
+
"start": "node node_modules/@openelement/router/src/cli/start.js",
|
|
16
|
+
"preview": "node node_modules/@openelement/router/src/cli/start.js --mode=preview"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@hono/vite-dev-server": "^0.25.3",
|
|
20
|
+
"@openelement/element": "${v.element}",
|
|
21
|
+
"@openelement/router": "${v.router}",
|
|
22
|
+
"hono": "^4.12"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@playwright/test": "1.59.1",
|
|
26
|
+
"typescript": "6.0.3",
|
|
27
|
+
"vite": "${v.vite}"
|
|
28
|
+
}
|
|
6
29
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* ═══════════════════════════════════════════════════════════════════════
|
|
2
|
+
The starter's @theme role sheet (scaffolded with Tailwind enabled).
|
|
3
|
+
|
|
4
|
+
Same contract as @openelement/ui's theme.css (the reference table): every
|
|
5
|
+
role is a shadcn-style semantic name expressed with Tailwind default theme
|
|
6
|
+
variables (var(--color-<ramp>-<step>)) — no role carries a handwritten
|
|
7
|
+
scale value. The installed tailwindcss build provides the scale variables
|
|
8
|
+
through the preset's compile (the router's Tailwind preset), the compiled
|
|
9
|
+
bundle links into every rendered page, and the custom properties inherit
|
|
10
|
+
into every shadow root, so compiled elements and islands read the roles
|
|
11
|
+
directly. Extend this table with new roles the same way — name on the
|
|
12
|
+
left, an existing Tailwind variable on the right — or override a role per
|
|
13
|
+
theme with the dark pairs below.
|
|
14
|
+
═══════════════════════════════════════════════════════════════════════ */
|
|
15
|
+
|
|
16
|
+
@theme {
|
|
17
|
+
/* ── semantic roles (light), over the TW4 default scale.
|
|
18
|
+
Violet-anchored roles (the starter brand reads violet); neutral
|
|
19
|
+
surfaces stay zinc so the page base keeps its near-neutral paper
|
|
20
|
+
feel. ── */
|
|
21
|
+
|
|
22
|
+
--color-background: var(--color-white);
|
|
23
|
+
--color-foreground: var(--color-zinc-950);
|
|
24
|
+
|
|
25
|
+
--color-card: var(--color-white);
|
|
26
|
+
--color-card-foreground: var(--color-zinc-950);
|
|
27
|
+
|
|
28
|
+
--color-popover: var(--color-white);
|
|
29
|
+
--color-popover-foreground: var(--color-zinc-950);
|
|
30
|
+
|
|
31
|
+
--color-primary: var(--color-violet-700);
|
|
32
|
+
--color-primary-foreground: var(--color-violet-50);
|
|
33
|
+
|
|
34
|
+
--color-secondary: var(--color-violet-100);
|
|
35
|
+
--color-secondary-foreground: var(--color-violet-900);
|
|
36
|
+
|
|
37
|
+
--color-muted: var(--color-zinc-100);
|
|
38
|
+
--color-muted-foreground: var(--color-zinc-600);
|
|
39
|
+
|
|
40
|
+
--color-accent: var(--color-violet-100);
|
|
41
|
+
--color-accent-foreground: var(--color-violet-900);
|
|
42
|
+
|
|
43
|
+
--color-destructive: var(--color-red-700);
|
|
44
|
+
--color-destructive-foreground: var(--color-white);
|
|
45
|
+
|
|
46
|
+
--color-border: var(--color-violet-200);
|
|
47
|
+
--color-input: var(--color-violet-200);
|
|
48
|
+
--color-ring: var(--color-violet-500);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Dark pairs (shadcn v4 convention; the selector matches the runtime theme
|
|
52
|
+
attribute the ui package documents). */
|
|
53
|
+
:root[data-theme='dark'],
|
|
54
|
+
:host([data-theme='dark']) {
|
|
55
|
+
--color-background: var(--color-zinc-950);
|
|
56
|
+
--color-foreground: var(--color-zinc-50);
|
|
57
|
+
|
|
58
|
+
--color-card: var(--color-zinc-900);
|
|
59
|
+
--color-card-foreground: var(--color-zinc-50);
|
|
60
|
+
|
|
61
|
+
--color-popover: var(--color-zinc-900);
|
|
62
|
+
--color-popover-foreground: var(--color-zinc-50);
|
|
63
|
+
|
|
64
|
+
--color-primary: var(--color-violet-400);
|
|
65
|
+
--color-primary-foreground: var(--color-violet-950);
|
|
66
|
+
|
|
67
|
+
--color-secondary: var(--color-zinc-800);
|
|
68
|
+
--color-secondary-foreground: var(--color-zinc-100);
|
|
69
|
+
|
|
70
|
+
--color-muted: var(--color-zinc-800);
|
|
71
|
+
--color-muted-foreground: var(--color-zinc-400);
|
|
72
|
+
|
|
73
|
+
--color-accent: var(--color-zinc-800);
|
|
74
|
+
--color-accent-foreground: var(--color-zinc-100);
|
|
75
|
+
|
|
76
|
+
--color-destructive: var(--color-red-400);
|
|
77
|
+
--color-destructive-foreground: var(--color-red-950);
|
|
78
|
+
|
|
79
|
+
--color-border: var(--color-zinc-800);
|
|
80
|
+
--color-input: var(--color-zinc-800);
|
|
81
|
+
--color-ring: var(--color-violet-400);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Forced-colors layer: every role re-seats on a system color. Values are
|
|
85
|
+
system keywords — no author color survives the forcing. */
|
|
86
|
+
@media (forced-colors: active) {
|
|
87
|
+
:root {
|
|
88
|
+
--color-background: Canvas;
|
|
89
|
+
--color-foreground: CanvasText;
|
|
90
|
+
--color-card: Canvas;
|
|
91
|
+
--color-card-foreground: CanvasText;
|
|
92
|
+
--color-popover: Canvas;
|
|
93
|
+
--color-popover-foreground: CanvasText;
|
|
94
|
+
--color-primary: ButtonText;
|
|
95
|
+
--color-primary-foreground: Canvas;
|
|
96
|
+
--color-secondary: ButtonFace;
|
|
97
|
+
--color-secondary-foreground: ButtonText;
|
|
98
|
+
--color-muted: Canvas;
|
|
99
|
+
--color-muted-foreground: GrayText;
|
|
100
|
+
--color-accent: ButtonFace;
|
|
101
|
+
--color-accent-foreground: ButtonText;
|
|
102
|
+
--color-destructive: CanvasText;
|
|
103
|
+
--color-destructive-foreground: Canvas;
|
|
104
|
+
--color-border: CanvasText;
|
|
105
|
+
--color-input: CanvasText;
|
|
106
|
+
--color-ring: Highlight;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { applyTailwindPreset, openElement } from '@openelement/router/vite';
|
|
2
|
+
import { defineConfig, type Plugin, type ResolvedConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
// Vite configuration only. Framework options live in openelement.config.ts —
|
|
5
|
+
// the plugin reads that file itself, so the plugin call stays
|
|
6
|
+
// `openElement()`. The JSX transform is owned by the plugin's compiler pass
|
|
7
|
+
// (TSX → Part Program); nothing JSX-related needs configuring here.
|
|
8
|
+
//
|
|
9
|
+
// Tailwind role sheet (scaffolded ON): the roles in app/styles/theme.css are
|
|
10
|
+
// compiled into the preset's linked, layer-ordered bundle at build time and
|
|
11
|
+
// referenced from every rendered page with <link rel="stylesheet">. The role
|
|
12
|
+
// file is declared relative to the preset's build-time staging entry (it is
|
|
13
|
+
// @import-ed from .openElement/tailwind-preset/), which is why the path
|
|
14
|
+
// climbs out of that directory. `pnpm dev` serves the tokens convention
|
|
15
|
+
// (app/styles/tokens.css); the compiled bundle exists in the build output.
|
|
16
|
+
// No node: imports here on purpose — the starter's `check` surface has no
|
|
17
|
+
// @types/node, and vite resolves `root` to an absolute path already.
|
|
18
|
+
|
|
19
|
+
function tailwindPreset(): Plugin {
|
|
20
|
+
let config: ResolvedConfig | undefined;
|
|
21
|
+
return {
|
|
22
|
+
name: 'starter:tailwind-preset',
|
|
23
|
+
apply: 'build',
|
|
24
|
+
configResolved(resolved) {
|
|
25
|
+
config = resolved;
|
|
26
|
+
},
|
|
27
|
+
async closeBundle() {
|
|
28
|
+
if (!config || config.command !== 'build') return;
|
|
29
|
+
const outDir = `${config.root}/${config.build.outDir || 'dist'}`;
|
|
30
|
+
await applyTailwindPreset({ theme: ['../../app/styles/theme.css'] }, config, outDir);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
base: '/',
|
|
37
|
+
plugins: [...openElement(), tailwindPreset()],
|
|
38
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"jsxImportSource": "@openelement/element",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"allowImportingTsExtensions": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["app", "vite.config.ts", "openelement.config.ts"]
|
|
15
|
+
}
|
package/templates/deno.json.tmpl
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"imports": {
|
|
3
|
-
"@hono/vite-dev-server": "npm:@hono/vite-dev-server@^0.25.3",
|
|
4
|
-
"@openelement/router": "npm:@openelement/router@${v.router}",
|
|
5
|
-
"@openelement/router/vite": "npm:@openelement/router@${v.router}/vite",
|
|
6
|
-
"@openelement/router/nitro-mount": "npm:@openelement/router@${v.router}/nitro-mount",
|
|
7
|
-
"@openelement/element": "npm:@openelement/element@${v.element}",
|
|
8
|
-
"@openelement/element/build-utils": "npm:@openelement/element@${v.element}/build-utils",
|
|
9
|
-
"@openelement/element/jsx-dev-runtime": "npm:@openelement/element@${v.element}/jsx-dev-runtime",
|
|
10
|
-
"@openelement/element/jsx-runtime": "npm:@openelement/element@${v.element}/jsx-runtime",
|
|
11
|
-
"hono": "npm:hono@^4.12",
|
|
12
|
-
"vite": "npm:vite@${v.vite}"
|
|
13
|
-
},
|
|
14
|
-
"nodeModulesDir": "auto",
|
|
15
|
-
"minimumDependencyAge": 0,
|
|
16
|
-
"tasks": {
|
|
17
|
-
"dev": "deno run --config deno.json --allow-read --allow-write --allow-env --allow-net --allow-run --allow-sys --allow-ffi npm:vite@${v.vite}",
|
|
18
|
-
"check": "deno check --config deno.json app/ vite.config.ts openelement.config.ts",
|
|
19
|
-
"test": "deno test --config deno.json --permit-no-files",
|
|
20
|
-
"build": "deno run --config deno.json --allow-read --allow-write --allow-net --allow-env --allow-ffi --allow-sys --allow-run npm:@openelement/router@${v.router}/cli/build",
|
|
21
|
-
"start": "deno run --config deno.json --allow-read --allow-write --allow-net --allow-env --allow-ffi --allow-sys --allow-run npm:@openelement/router@${v.router}/cli/start",
|
|
22
|
-
"preview": "deno run --config deno.json --allow-read --allow-write --allow-net --allow-env --allow-ffi --allow-sys --allow-run npm:@openelement/router@${v.router}/cli/start --mode=preview"
|
|
23
|
-
},
|
|
24
|
-
"compilerOptions": { "lib": ["ES2022", "DOM", "DOM.Iterable"], "jsx": "react-jsx", "jsxImportSource": "@openelement/element" }
|
|
25
|
-
}
|