@openelement/create 1.0.0-alpha.6 → 1.0.0-alpha.8

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 CHANGED
@@ -10,47 +10,49 @@ 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, Deno configuration, Vite setup, and starter pages.
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
- deno run -A npm:@openelement/create@alpha my-app
19
+ npm exec @openelement/create@alpha -- my-app
19
20
  cd my-app
20
- deno task dev
21
+ pnpm install
22
+ pnpm dev
21
23
  ```
22
24
 
23
25
  The version `@alpha` resolves to is registered in
24
- `the tracked release-state manifest` (currently `1.0.0-alpha.5`, a new baseline —
26
+ `the tracked release-state manifest` (currently `1.0.0-alpha.7`, a new baseline —
25
27
  not a 0.x upgrade, with no migration path from 0.x). Pin that exact version
26
28
  when reproducibility matters (verify against the live registry with
27
29
  `npm view @openelement/create dist-tags.alpha`):
28
30
 
29
31
  ```bash
30
- deno run -A npm:@openelement/create@1.0.0-alpha.5 my-app
32
+ npm exec @openelement/create@1.0.0-alpha.7 -- my-app
31
33
  ```
32
34
 
33
- `--minimum-dependency-age 0` is needed because Deno's default
34
- minimumDependencyAge (~24h) refuses packages published within the last day.
35
-
36
35
  The generated starter pins the exact `@openelement/*` versions it was built
37
- from in its `deno.json` import map.
36
+ from in its `package.json` dependencies.
38
37
 
39
38
  The canonical install command is exported from `@openelement/create/install-command` (one builder, every documented copy derives from it).
40
39
 
41
- ## Do not run the bin under Node (`npx`)
40
+ ## The bootstrap is a plain npm invocation; the generated project is Node
41
+
42
+ The documented bootstrap runs the generator through `npm exec` (or the `npx`
43
+ short form, or `pnpm dlx`) — plain Node tooling, no second runtime. Node.js
44
+ 24.2+ is the only host requirement for both the bootstrap and the generated
45
+ project. The packed package ships two equivalent npm bins
46
+ (`openelement-create`, `create-openelement`, both the same entry), so the pnpm
47
+ form must name one explicitly:
48
+
49
+ ```bash
50
+ npx @openelement/create@alpha my-app
51
+ pnpm dlx --package=@openelement/create@alpha openelement-create my-app
52
+ ```
42
53
 
43
- > **Use the bare-flag create command documented above. Do not use
44
- > `npx @openelement/create` / `npx create-openelement`.** The CLI is a Deno
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.
54
+ The scaffolded project itself is Node-native: Node.js 24.2+ and
55
+ pnpm run its scripts.
54
56
 
55
57
  ## Stable 0.43 (maintenance line)
56
58
 
@@ -59,20 +61,23 @@ A versionless install resolves the npm `latest` dist-tag to it; pin the line
59
61
  explicitly instead:
60
62
 
61
63
  ```bash
62
- deno run -A npm:@openelement/create@0.43 my-app
64
+ npm exec @openelement/create@0.43 -- my-app
63
65
  ```
64
66
 
65
67
  ## Requirements
66
68
 
67
- **Deno 2.9+.** The generated starter writes the `minimumDependencyAge` config
68
- key into its `deno.json` (a key introduced in Deno 2.5.5); the 2.9 floor is the
69
- toolchain this repository pins in `.dvmrc`, exercises in CI, and verifies in
70
- its native-pack, scaffold, package, and consumer proof. No earlier version is
71
- claimed or tested.
69
+ - **Bootstrap:** Node.js 24.2+ with npm (or pnpm for the `pnpm dlx` variant) —
70
+ the verified floor this repository exercises in CI.
71
+ - **Generated project:** Node.js 24.2+ (the floor the packed `@openelement/*`
72
+ engines declare and CI exercises; `.node-version` pins the development
73
+ line) and pnpm for the lifecycle scripts.
72
74
 
73
75
  ## What It Creates
74
76
 
75
- - `deno.json` - starter authoring imports and build tasks
77
+ - `package.json` - starter dependencies (exact `@openelement/*` release pins)
78
+ and the lifecycle scripts (`dev`/`check`/`test`/`build`/`start`/`preview`)
79
+ - `tsconfig.json` - the type-check surface for `pnpm check`: JSX authoring
80
+ through the element import source, whole-`app/` coverage
76
81
  - `vite.config.ts` - Vite build configuration; the plugin call is plain
77
82
  `openElement()`, because framework options have exactly one home:
78
83
  - `openelement.config.ts` - the framework options. It is OPTIONAL and nearly
@@ -88,9 +93,9 @@ claimed or tested.
88
93
  - `public/` - static assets
89
94
  - `README.md` and `.gitignore` - starter docs and ignore rules
90
95
 
91
- The generated import map intentionally keeps protocol and build internals out of
92
- the starter surface. Advanced contracts remain available through the published
93
- workspace packages when a project needs them.
96
+ The generated dependency set intentionally keeps protocol and build internals
97
+ out of the starter surface. Advanced contracts remain available through the
98
+ published workspace packages when a project needs them.
94
99
 
95
100
  ## License
96
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openelement/create",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.8",
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
- "deno": ">=2.9"
35
+ "node": ">=24.2"
36
36
  },
37
37
  "sideEffects": [
38
38
  "./src/cli.js"
package/src/cli.d.ts CHANGED
@@ -1 +1 @@
1
- #!/usr/bin/env -S deno run --allow-read --allow-write
1
+ export {}
package/src/cli.js CHANGED
@@ -1,82 +1,88 @@
1
- #!/usr/bin/env -S deno run --allow-read --allow-write
1
+ #!/usr/bin/env node
2
+ import { buildTemplates, resolveVersions, validateProjectName } from "./template-builder.js";
3
+ import { createInstallCommand } from "./install-command.js";
4
+ import { mkdir, stat, writeFile } from "node:fs/promises";
5
+ import process from "node:process";
6
+ //#region src/cli.ts
2
7
  /**
3
- * @openelement/create - Minimal project scaffold for openElement framework.
4
- *
5
- * The install command this CLI documents is built by ./install-command.ts
6
- * (#1414): usage output, the guides and the homepage all render that one
7
- * string, so the documented command cannot drift from the shipped flags.
8
- *
9
- * openElement Architecture: Keep It Simple, Stupid.
10
- * One template, zero prompts, instant start.
11
- *
12
- * L9: every failure mode exits 1 with one actionable message — never a
13
- * runtime stack trace.
14
- */ import { buildTemplates, resolveVersions, validateProjectName } from './template-builder.js';
15
- import { createInstallCommand } from './install-command.js';
8
+ * @openelement/create - Minimal project scaffold for openElement framework.
9
+ *
10
+ * The install command this CLI documents is built by ./install-command.ts
11
+ * (#1414): usage output, the guides and the homepage all render that one
12
+ * string, so the documented command cannot drift from the shipped flags.
13
+ *
14
+ * openElement Architecture: Keep It Simple, Stupid.
15
+ * One template, zero prompts, instant start.
16
+ *
17
+ * L9: every failure mode exits 1 with one actionable message — never a
18
+ * runtime stack trace.
19
+ */
16
20
  function errorMessage(error) {
17
- return error instanceof Error ? error.message : String(error);
21
+ return error instanceof Error ? error.message : String(error);
22
+ }
23
+ /** node:fs error shape for "path does not exist". */
24
+ function isNotFound(error) {
25
+ return error.code === "ENOENT";
26
+ }
27
+ /** node:fs error shapes for "not permitted". */
28
+ function isPermissionDenied(error) {
29
+ const code = error.code;
30
+ return code === "EACCES" || code === "EPERM";
18
31
  }
19
32
  function fail(message) {
20
- console.error(`error: ${message}`);
21
- Deno.exit(1);
33
+ console.error(`error: ${message}`);
34
+ process.exit(1);
22
35
  }
23
36
  function joinPosix(...parts) {
24
- return parts.join('/').replace(/\/{2,}/g, '/');
37
+ return parts.join("/").replace(/\/{2,}/g, "/");
25
38
  }
26
39
  function dirnameOf(path) {
27
- const normalized = path.replace(/\\+/g, '/');
28
- const idx = normalized.lastIndexOf('/');
29
- if (idx <= 0) return '.';
30
- return path.slice(0, idx);
40
+ const idx = path.replace(/\\+/g, "/").lastIndexOf("/");
41
+ if (idx <= 0) return ".";
42
+ return path.slice(0, idx);
31
43
  }
32
44
  async function main() {
33
- const name = Deno.args[0];
34
- if (!name || name === '--help' || name === '-h') {
35
- console.log(`Usage (Alpha): ${createInstallCommand()}`);
36
- console.log('(a versionless install resolves the stable 0.43 line)');
37
- Deno.exit(name ? 0 : 1);
38
- }
39
- const invalid = validateProjectName(name);
40
- if (invalid) fail(`Invalid project name "${name}". ${invalid}`);
41
- const cwd = Deno.cwd().replace(/\/+$/, '');
42
- const targetDir = `${cwd}/${name}`;
43
- const relativeTarget = name;
44
- if (!relativeTarget || relativeTarget.includes('..') || relativeTarget.includes('/') || relativeTarget.includes('\\') || /^[a-zA-Z]:/.test(relativeTarget) || relativeTarget.startsWith('/')) {
45
- fail(`Refusing to create project outside the current directory: ${name}`);
46
- }
47
- try {
48
- await Deno.stat(targetDir);
49
- fail(`Directory "${name}" already exists. Choose a different name or remove the existing directory.`);
50
- } catch (error) {
51
- if (!(error instanceof Deno.errors.NotFound)) {
52
- throw new Error(`Could not inspect target directory "${name}": ${errorMessage(error)}`);
53
- }
54
- }
55
- const v = resolveVersions();
56
- try {
57
- await Deno.mkdir(targetDir, {
58
- recursive: true
59
- });
60
- const TPL = await buildTemplates(v, name);
61
- for (const [path, content] of Object.entries(TPL)){
62
- const fullPath = joinPosix(targetDir, path);
63
- await Deno.mkdir(dirnameOf(fullPath), {
64
- recursive: true
65
- });
66
- await Deno.writeTextFile(fullPath, content);
67
- console.info(` created ${path}`);
68
- }
69
- } catch (error) {
70
- const detail = error instanceof Deno.errors.PermissionDenied ? `Permission denied. Check write permissions for ${targetDir}.` : errorMessage(error);
71
- throw new Error(`Failed to write project files in "${name}": ${detail} ` + 'Remove the partially created directory before retrying.');
72
- }
73
- console.info(`\nopenElement project created at ./${relativeTarget}/`);
74
- console.info(`\n cd ${relativeTarget}`);
75
- console.info(' deno task dev');
76
- console.info(' See README.md for all tasks (check/build/start/preview)');
45
+ const name = process.argv[2];
46
+ if (!name || name === "--help" || name === "-h") {
47
+ console.log(`Usage (Alpha): ${createInstallCommand()}`);
48
+ console.log("(a versionless install resolves the stable 0.43 line)");
49
+ process.exit(name ? 0 : 1);
50
+ }
51
+ const invalid = validateProjectName(name);
52
+ if (invalid) fail(`Invalid project name "${name}". ${invalid}`);
53
+ const targetDir = `${process.cwd().replace(/\/+$/, "")}/${name}`;
54
+ const relativeTarget = name;
55
+ 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}`);
56
+ try {
57
+ await stat(targetDir);
58
+ fail(`Directory "${name}" already exists. Choose a different name or remove the existing directory.`);
59
+ } catch (error) {
60
+ if (!isNotFound(error)) throw new Error(`Could not inspect target directory "${name}": ${errorMessage(error)}`);
61
+ }
62
+ const v = resolveVersions();
63
+ try {
64
+ await mkdir(targetDir, { recursive: true });
65
+ const TPL = await buildTemplates(v, name);
66
+ for (const [path, content] of Object.entries(TPL)) {
67
+ const fullPath = joinPosix(targetDir, path);
68
+ await mkdir(dirnameOf(fullPath), { recursive: true });
69
+ await writeFile(fullPath, content, "utf8");
70
+ console.info(` created ${path}`);
71
+ }
72
+ } catch (error) {
73
+ const detail = isPermissionDenied(error) ? `Permission denied. Check write permissions for ${targetDir}.` : errorMessage(error);
74
+ throw new Error(`Failed to write project files in "${name}": ${detail} Remove the partially created directory before retrying.`);
75
+ }
76
+ console.info(`\nopenElement project created at ./${relativeTarget}/`);
77
+ console.info(`\n cd ${relativeTarget}`);
78
+ console.info(" pnpm install");
79
+ console.info(" pnpm dev");
80
+ console.info(" See README.md for all scripts (check/test/build/start/preview)");
77
81
  }
78
82
  try {
79
- await main();
83
+ await main();
80
84
  } catch (error) {
81
- fail(errorMessage(error));
85
+ fail(errorMessage(error));
82
86
  }
87
+ //#endregion
88
+ export {};
@@ -1,3 +1,4 @@
1
+ //#region src/install-command.d.ts
1
2
  /**
2
3
  * The canonical install command — the ONE source every documented copy of it
3
4
  * derives from (#1414 item 5).
@@ -9,25 +10,31 @@
9
10
  * in the repository differs from this string. There is no second spelling to
10
11
  * drift.
11
12
  *
12
- * This module is deliberately side-effect free (no top-level CLI execution, no
13
- * Deno APIs): it is imported by the site build as well as by the CLI itself.
14
- */ /** The npm specifier the generator is published under. */ export declare const CREATE_PACKAGE_SPECIFIER: 'npm:@openelement/create';
15
- /** The dist-tag the documented install resolves; the exact version is registry truth. */ export declare const CREATE_INSTALL_TAG: 'alpha';
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
+ */
16
+ /** The npm specifier the generator is published under. */
17
+ export declare const CREATE_PACKAGE_SPECIFIER = "@openelement/create";
18
+ /** The dist-tag the documented install resolves; the exact version is registry truth. */
19
+ export declare const CREATE_INSTALL_TAG = "alpha";
20
+ /** Placeholder the usage text and the docs use in place of a project name. */
21
+ export declare const CREATE_PROJECT_PLACEHOLDER = "<project-name>";
16
22
  /**
17
- * Deno permissions the bootstrap needs. Owner ruling 2026-09-21: the
18
- * documented command uses bare `-A` — the consumer scaffolds their own
19
- * project, and the scoped-permission form reads as noise (the same ruling
20
- * narrowed the `check-no-allow-all` tripwire to an exact-line exemption for
21
- * this command). `--minimum-dependency-age 0` is a functional footnote kept
22
- * in prose where needed, not part of the documented shape.
23
- */ export declare const CREATE_INSTALL_PERMISSIONS: readonly string[];
24
- /** Placeholder the usage text and the docs use in place of a project name. */ export declare const CREATE_PROJECT_PLACEHOLDER: '<project-name>';
25
- /**
26
- * Build the canonical install command for `projectName`.
23
+ * The documented install command shapes, all verified against the published
24
+ * two-bin artifact (bins `openelement-create` and `create-openelement`, both
25
+ * `src/cli.js`; npm 11 / pnpm 12):
26
+ * - canonical: `npm exec <pkg>@<tag> -- <name>`
27
+ * - short form: `npx <pkg>@<tag> <name>`
28
+ * - pnpm: `pnpm dlx --package=<pkg>@<tag> openelement-create <name>` — the
29
+ * explicit `--package` plus bin is required because the packed package
30
+ * ships two bins, so a bare `pnpm dlx <pkg>` cannot resolve one (and no
31
+ * package named `create-openelement` exists on the registry).
27
32
  *
28
- * `projectName` defaults to the placeholder so callers that document the
29
- * command shape (usage output) and callers that show a concrete example share
30
- * one builder and therefore one flag list.
31
- */ export declare function createInstallCommand(projectName?: string, options?: {
33
+ * Owner ruling 2026-10-03: the former Deno bootstrap (`deno run` of the npm
34
+ * specifier) is retired with the Deno consumer surface; the generator is
35
+ * invoked through plain Node tooling.
36
+ */
37
+ export declare function createInstallCommand(projectName?: string, options?: {
32
38
  tag?: string;
33
39
  }): string;
40
+ //#endregion
@@ -1,36 +1,42 @@
1
+ //#region src/install-command.ts
1
2
  /**
2
- * The canonical install command — the ONE source every documented copy of it
3
- * derives from (#1414 item 5).
4
- *
5
- * The command is data about this CLI, so it lives beside the CLI: `cli.ts`
6
- * prints it in its usage output, the site's documentation generator inlines it
7
- * into the guides and the homepage, and the install-command gate
8
- * (the site's install-command generator --check) fails when any curated copy
9
- * in the repository differs from this string. There is no second spelling to
10
- * drift.
11
- *
12
- * This module is deliberately side-effect free (no top-level CLI execution, no
13
- * Deno APIs): it is imported by the site build as well as by the CLI itself.
14
- */ /** The npm specifier the generator is published under. */ export const CREATE_PACKAGE_SPECIFIER = 'npm:@openelement/create';
15
- /** The dist-tag the documented install resolves; the exact version is registry truth. */ export const CREATE_INSTALL_TAG = 'alpha';
3
+ * The canonical install command — the ONE source every documented copy of it
4
+ * derives from (#1414 item 5).
5
+ *
6
+ * The command is data about this CLI, so it lives beside the CLI: `cli.ts`
7
+ * prints it in its usage output, the site's documentation generator inlines it
8
+ * into the guides and the homepage, and the install-command gate
9
+ * (the site's install-command generator --check) fails when any curated copy
10
+ * in the repository differs from this string. There is no second spelling to
11
+ * drift.
12
+ *
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
+ */
16
+ /** The npm specifier the generator is published under. */
17
+ const CREATE_PACKAGE_SPECIFIER = "@openelement/create";
18
+ /** The dist-tag the documented install resolves; the exact version is registry truth. */
19
+ const CREATE_INSTALL_TAG = "alpha";
20
+ /** Placeholder the usage text and the docs use in place of a project name. */
21
+ const CREATE_PROJECT_PLACEHOLDER = "<project-name>";
16
22
  /**
17
- * Deno permissions the bootstrap needs. Owner ruling 2026-09-21: the
18
- * documented command uses bare `-A` — the consumer scaffolds their own
19
- * project, and the scoped-permission form reads as noise (the same ruling
20
- * narrowed the `check-no-allow-all` tripwire to an exact-line exemption for
21
- * this command). `--minimum-dependency-age 0` is a functional footnote kept
22
- * in prose where needed, not part of the documented shape.
23
- */ export const CREATE_INSTALL_PERMISSIONS = [
24
- String.fromCharCode(45, 65)
25
- ];
26
- /** Placeholder the usage text and the docs use in place of a project name. */ export const CREATE_PROJECT_PLACEHOLDER = '<project-name>';
27
- /**
28
- * Build the canonical install command for `projectName`.
29
- *
30
- * `projectName` defaults to the placeholder so callers that document the
31
- * command shape (usage output) and callers that show a concrete example share
32
- * one builder and therefore one flag list.
33
- */ export function createInstallCommand(projectName = CREATE_PROJECT_PLACEHOLDER, options = {}) {
34
- const tag = options.tag ?? CREATE_INSTALL_TAG;
35
- return `deno run ${CREATE_INSTALL_PERMISSIONS.join(' ')} ${CREATE_PACKAGE_SPECIFIER}@${tag} ${projectName}`;
23
+ * The documented install command shapes, all verified against the published
24
+ * two-bin artifact (bins `openelement-create` and `create-openelement`, both
25
+ * `src/cli.js`; npm 11 / pnpm 12):
26
+ * - canonical: `npm exec <pkg>@<tag> -- <name>`
27
+ * - short form: `npx <pkg>@<tag> <name>`
28
+ * - pnpm: `pnpm dlx --package=<pkg>@<tag> openelement-create <name>` — the
29
+ * explicit `--package` plus bin is required because the packed package
30
+ * ships two bins, so a bare `pnpm dlx <pkg>` cannot resolve one (and no
31
+ * package named `create-openelement` exists on the registry).
32
+ *
33
+ * Owner ruling 2026-10-03: the former Deno bootstrap (`deno run` of the npm
34
+ * specifier) is retired with the Deno consumer surface; the generator is
35
+ * invoked through plain Node tooling.
36
+ */
37
+ function createInstallCommand(projectName = CREATE_PROJECT_PLACEHOLDER, options = {}) {
38
+ const tag = options.tag ?? "alpha";
39
+ return `npm exec ${CREATE_PACKAGE_SPECIFIER}@${tag} -- ${projectName}`;
36
40
  }
41
+ //#endregion
42
+ export { CREATE_INSTALL_TAG, CREATE_PACKAGE_SPECIFIER, CREATE_PROJECT_PLACEHOLDER, createInstallCommand };
@@ -1,204 +1,90 @@
1
- import { CREATE_VERSION, VITE_STARTER_PIN } from './version.js';
2
- // npm package-name ceiling (validate-npm-package-name); a generated project
3
- // directory must stay a legal package name so `npm init`-style flows and
4
- // registry publication are never blocked by the scaffold itself (L11).
1
+ import { CREATE_VERSION, VITE_STARTER_PIN } from "./version.js";
2
+ import { readFile } from "node:fs/promises";
3
+ //#region src/template-builder.ts
5
4
  const MAX_PROJECT_NAME_LENGTH = 214;
6
5
  const PROJECT_NAME_PATTERN = /^[a-z0-9][a-z0-9._-]*$/;
7
6
  /**
8
- * L11: validate the scaffold target name before any filesystem work. Returns
9
- * an actionable message when the name is unsafe, `null` when it is a legal
10
- * npm-style package name that cannot escape the current directory.
11
- */ export function validateProjectName(name) {
12
- if (name.length === 0) return 'Project name must not be empty.';
13
- if (name.length > MAX_PROJECT_NAME_LENGTH) {
14
- return `Project name must be at most ${MAX_PROJECT_NAME_LENGTH} characters (npm package-name limit).`;
15
- }
16
- if (name.includes('..')) {
17
- return 'Project name must not contain ".." (path traversal is not allowed).';
18
- }
19
- if (name !== name.toLowerCase()) {
20
- return 'Project name must be lowercase (npm package names cannot contain uppercase letters).';
21
- }
22
- if (!PROJECT_NAME_PATTERN.test(name)) {
23
- return 'Project name must start with a lowercase letter or number and may only contain ' + 'lowercase letters, numbers, dots, underscores, and hyphens.';
24
- }
25
- 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;
26
18
  }
27
19
  /**
28
- * The published starter relies on the support-package same-version release
29
- * invariant. Package-graph and release-prepare gates verify that invariant;
30
- * Create deliberately has no runtime registry fallback or mixed-version mode.
31
- * Caller-supplied versions are validated by `buildTemplates` below.
32
- */ export function resolveVersions() {
33
- return {
34
- router: CREATE_VERSION,
35
- element: CREATE_VERSION
36
- };
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
+ };
37
30
  }
38
- export function assertUnifiedProductVersions(versions) {
39
- const observed = [
40
- ...new Set(Object.values(versions))
41
- ];
42
- if (observed.length !== 1) {
43
- throw new Error(`Create requires the support-package same-version release invariant; observed ${observed.join(', ')}`);
44
- }
45
- 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;
46
35
  }
47
- // [sourceTemplate, targetRelativePath] pairs. The starter manifest is stored
48
- // as deno.json.tmpl so deno does not treat the templates/ directory as a
49
- // nested workspace config; it is renamed to deno.json when written.
50
36
  const TEMPLATE_FILES = [
51
- // npm tarballs omit dotfiles even when a directory is included. Keep the
52
- // template non-hidden and write the expected dotfile into generated apps.
53
- [
54
- 'gitignore.tmpl',
55
- '.gitignore'
56
- ],
57
- [
58
- 'README.tmpl',
59
- 'README.md'
60
- ],
61
- [
62
- 'public/openelement-mark.svg',
63
- 'public/openelement-mark.svg'
64
- ],
65
- [
66
- 'deno.json.tmpl',
67
- 'deno.json'
68
- ],
69
- // package.json carries no runtime npm dependencies: framework consumption
70
- // resolves through the deno.json import map, and packed first-party
71
- // modules carry no bare @std/* specifiers, so no @jsr registry bridge is
72
- // generated. npm is the only public registry.
73
- [
74
- 'package.json.tmpl',
75
- 'package.json'
76
- ],
77
- [
78
- 'vite.config.ts.tmpl',
79
- 'vite.config.ts'
80
- ],
81
- // #1411: framework options live in openelement.config.ts; the starter ships
82
- // it near-empty, so every option comes from a file convention until the user
83
- // overrides one.
84
- [
85
- 'openelement.config.ts.tmpl',
86
- 'openelement.config.ts'
87
- ],
88
- [
89
- 'app/styles/tokens.css',
90
- 'app/styles/tokens.css'
91
- ],
92
- // alpha.4: the structural document-head convention. The config file carries
93
- // the structured `head` channel (title/description/favicon/scripts); this
94
- // module carries what a URL list cannot express (meta tags, preloads).
95
- [
96
- 'app/head.tsx.tmpl',
97
- 'app/head.tsx'
98
- ],
99
- [
100
- 'app/islands/app-shell.tsx.tmpl',
101
- 'app/islands/app-shell.tsx'
102
- ],
103
- [
104
- 'app/components/page-styles.ts.tmpl',
105
- 'app/components/page-styles.ts'
106
- ],
107
- [
108
- 'app/components/page-home.tsx.tmpl',
109
- 'app/components/page-home.tsx'
110
- ],
111
- [
112
- 'app/components/page-freshness.tsx.tmpl',
113
- 'app/components/page-freshness.tsx'
114
- ],
115
- [
116
- 'app/components/page-404.tsx.tmpl',
117
- 'app/components/page-404.tsx'
118
- ],
119
- [
120
- 'app/components/page-contact.tsx.tmpl',
121
- 'app/components/page-contact.tsx'
122
- ],
123
- [
124
- 'app/components/page-blog-index.tsx.tmpl',
125
- 'app/components/page-blog-index.tsx'
126
- ],
127
- [
128
- 'app/components/page-blog-welcome.tsx.tmpl',
129
- 'app/components/page-blog-welcome.tsx'
130
- ],
131
- [
132
- 'app/routes/404.tsx.tmpl',
133
- 'app/routes/404.tsx'
134
- ],
135
- [
136
- 'app/routes/index.tsx.tmpl',
137
- 'app/routes/index.tsx'
138
- ],
139
- [
140
- 'app/routes/freshness.tsx.tmpl',
141
- 'app/routes/freshness.tsx'
142
- ],
143
- [
144
- 'app/routes/contact.tsx.tmpl',
145
- 'app/routes/contact.tsx'
146
- ],
147
- [
148
- 'app/routes/blog/index.tsx.tmpl',
149
- 'app/routes/blog/index.tsx'
150
- ],
151
- [
152
- 'app/routes/blog/welcome.tsx.tmpl',
153
- 'app/routes/blog/welcome.tsx'
154
- ],
155
- [
156
- 'app/routes/api/health.ts.tmpl',
157
- 'app/routes/api/health.ts'
158
- ],
159
- [
160
- 'app/islands/my-counter.tsx.tmpl',
161
- 'app/islands/my-counter.tsx'
162
- ],
163
- [
164
- 'app/islands/only-ticker.tsx.tmpl',
165
- 'app/islands/only-ticker.tsx'
166
- ]
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"]
167
63
  ];
168
64
  function versionTokens(v) {
169
- return {
170
- ['$' + '{v.router}']: v.router,
171
- ['$' + '{v.element}']: v.element
172
- };
65
+ return {
66
+ ["${v.router}"]: v.router,
67
+ ["${v.element}"]: v.element
68
+ };
173
69
  }
174
- export async function buildTemplates(v, projectName) {
175
- assertUnifiedProductVersions(v);
176
- const invalid = validateProjectName(projectName);
177
- if (invalid) throw new Error(`Invalid project name "${projectName}". ${invalid}`);
178
- const templatesBase = new URL('../templates/', import.meta.url);
179
- // The starter's Vite pin comes from the workspace-anchored VITE_STARTER_PIN
180
- // (deps:vite-check), not from the product release version.
181
- const tokens = {
182
- ...versionTokens(v),
183
- ['$' + '{v.vite}']: VITE_STARTER_PIN,
184
- ['$' + '{name}']: projectName
185
- };
186
- const entries = await Promise.all(TEMPLATE_FILES.map(async ([source, target])=>{
187
- let content = await Deno.readTextFile(new URL(source, templatesBase));
188
- for (const [token, value] of Object.entries(tokens)){
189
- if (content.includes(token)) content = content.split(token).join(value);
190
- }
191
- if (content.includes('${v.') || content.includes('${name}')) {
192
- throw new Error(`Unresolved scaffold token in starter template: ${source}`);
193
- }
194
- return [
195
- target,
196
- content
197
- ];
198
- }));
199
- // Code-unit comparison (not localeCompare): deterministic across host
200
- // locales and matches the test's toSorted() expectation, including
201
- // uppercase targets like README.md.
202
- entries.sort(([a], [b])=>a < b ? -1 : a > b ? 1 : 0);
203
- return Object.fromEntries(entries);
70
+ async function buildTemplates(v, projectName) {
71
+ assertUnifiedProductVersions(v);
72
+ const invalid = validateProjectName(projectName);
73
+ if (invalid) throw new Error(`Invalid project name "${projectName}". ${invalid}`);
74
+ const templatesBase = new URL("../templates/", import.meta.url);
75
+ const tokens = {
76
+ ...versionTokens(v),
77
+ ["${v.vite}"]: VITE_STARTER_PIN,
78
+ ["${name}"]: projectName
79
+ };
80
+ const entries = await Promise.all(TEMPLATE_FILES.map(async ([source, target]) => {
81
+ let content = await readFile(new URL(source, templatesBase), "utf8");
82
+ for (const [token, value] of Object.entries(tokens)) if (content.includes(token)) content = content.split(token).join(value);
83
+ if (content.includes("${v.") || content.includes("${name}")) throw new Error(`Unresolved scaffold token in starter template: ${source}`);
84
+ return [target, content];
85
+ }));
86
+ entries.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
87
+ return Object.fromEntries(entries);
204
88
  }
89
+ //#endregion
90
+ export { assertUnifiedProductVersions, buildTemplates, resolveVersions, validateProjectName };
package/src/version.js CHANGED
@@ -1,7 +1,12 @@
1
- /** The published CLI version, embedded so packed npm installs are self-contained. */ export const CREATE_VERSION = '1.0.0-alpha.6';
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.8";
2
4
  /**
3
- * The Vite dev release stamped into the generated starter's import map and
4
- * dev task. Embedded for the same reason as CREATE_VERSION (packed npm
5
- * installs are self-contained); the repository's Vite-pin check anchors this
6
- * copy to the canonical dev pin.
7
- */ export const VITE_STARTER_PIN = '8.0.16';
5
+ * The Vite dev release stamped into the generated starter's import map and
6
+ * dev task. Embedded for the same reason as CREATE_VERSION (packed npm
7
+ * installs are self-contained); the repository's Vite-pin check anchors this
8
+ * copy to the canonical dev pin.
9
+ */
10
+ const VITE_STARTER_PIN = "8.0.16";
11
+ //#endregion
12
+ export { CREATE_VERSION, VITE_STARTER_PIN };
@@ -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 `deno.json`; update both
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
@@ -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
- ## Tasks
40
+ ## Scripts
41
41
 
42
- - `deno task dev` — start the Vite dev server.
43
- - `deno task check` — type-check every route/component file. When you add a
44
- route file, add it to this task's file list in `deno.json`.
45
- - `deno task test` — run Deno tests (the starter ships none).
46
- - `deno task build` — production build (SSG + Nitro server) into `dist/`.
47
- - `deno task start` — serve the production build. Use this for production
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
- `deno task preview` (static-only preview, #601) is refused by design.
50
- - `deno task preview` — static-only preview; refused for this starter (see
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
- ## Import map notes
63
+ ## Dependency notes
63
64
 
64
- `deno.json` maps `@openelement/router/nitro-mount` and `hono` even
65
- though no source file imports them: the dev server and the production
66
- build resolve `hono` when loading the generated server entry (the
67
- bundled `dist/` output inlines it), and Nitro deployments bridge the
68
- built handler through `@openelement/router/nitro-mount`. Do not remove
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
- "dependencies": {}
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,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
+ }
@@ -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
- }