@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/README.md
CHANGED
|
@@ -2,47 +2,128 @@
|
|
|
2
2
|
|
|
3
3
|
Project scaffolding CLI for openElement applications.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
>
|
|
8
|
-
>
|
|
5
|
+
Docs and guides: <https://openelement.org>.
|
|
6
|
+
|
|
7
|
+
> 1.0 Alpha line: the supported creation entry for Element and Router. The
|
|
8
|
+
> published npm versions and dist-tags are registry truth (query them with
|
|
9
|
+
> `npm view @openelement/create dist-tags`); `latest` stays on the stable 0.43
|
|
10
|
+
> line until a separately admitted stable release.
|
|
9
11
|
|
|
10
12
|
`@openelement/create` generates a new openElement project with the recommended
|
|
11
|
-
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.
|
|
12
15
|
|
|
13
|
-
## Usage
|
|
16
|
+
## Usage (1.0 Alpha)
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
|
-
|
|
19
|
+
npm create @openelement@alpha my-app
|
|
17
20
|
cd my-app
|
|
18
|
-
|
|
21
|
+
pnpm install
|
|
22
|
+
pnpm dev
|
|
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.9`, a new baseline —
|
|
30
|
+
not a 0.x upgrade, with no migration path from 0.x). Pin that exact version
|
|
31
|
+
when reproducibility matters (verify against the live registry with
|
|
32
|
+
`npm view @openelement/create dist-tags.alpha`):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm create @openelement@1.0.0-alpha.9 my-app
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The generated starter pins the exact `@openelement/*` versions it was built
|
|
39
|
+
from in its `package.json` dependencies.
|
|
40
|
+
|
|
41
|
+
The canonical install command is exported from `@openelement/create/install-command` (one builder, every documented copy derives from it).
|
|
42
|
+
|
|
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)
|
|
19
58
|
```
|
|
20
59
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
```
|
|
76
|
+
|
|
77
|
+
The scaffolded project itself is Node-native: Node.js 24.2+ and
|
|
78
|
+
pnpm run its scripts.
|
|
79
|
+
|
|
80
|
+
## Stable 0.43 (maintenance line)
|
|
81
|
+
|
|
82
|
+
The stable 0.43 line is still published, but it is not the Alpha install path.
|
|
83
|
+
A versionless install resolves the npm `latest` dist-tag to it; pin the line
|
|
84
|
+
explicitly instead:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm create @openelement@0.43 my-app
|
|
88
|
+
```
|
|
24
89
|
|
|
25
90
|
## Requirements
|
|
26
91
|
|
|
27
|
-
**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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.
|
|
32
97
|
|
|
33
98
|
## What It Creates
|
|
34
99
|
|
|
35
|
-
- `
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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:
|
|
110
|
+
- `openelement.config.ts` - the framework options. It is OPTIONAL and nearly
|
|
111
|
+
empty by default; every option it omits comes from a file convention —
|
|
112
|
+
design tokens from `app/styles/tokens.css`, the app shell from
|
|
113
|
+
`app/islands/app-shell.tsx`, structural document-head content from
|
|
114
|
+
`app/head.tsx`, the site title from `package.json`. Passing framework
|
|
115
|
+
options inline to `openElement()` while this file carries options is a hard
|
|
116
|
+
error, and an unknown key fails the build with the accepted-key list.
|
|
117
|
+
- `app/` - application directory with starter pages and islands; the
|
|
118
|
+
Tailwind-ON form adds `app/styles/theme.css`, the `@theme` role sheet
|
|
119
|
+
- `app/routes/blog/` - the sample blog as compiled page routes (`index` list
|
|
120
|
+
and `welcome` post), prerendered at build time
|
|
40
121
|
- `public/` - static assets
|
|
41
122
|
- `README.md` and `.gitignore` - starter docs and ignore rules
|
|
42
123
|
|
|
43
|
-
The generated
|
|
44
|
-
the starter surface. Advanced contracts remain available through the
|
|
45
|
-
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.
|
|
46
127
|
|
|
47
128
|
## License
|
|
48
129
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openelement/create",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/cli.js",
|
|
6
6
|
"types": "./src/cli.d.ts",
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"types": "./src/cli.d.ts",
|
|
10
10
|
"import": "./src/cli.js",
|
|
11
11
|
"default": "./src/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"./install-command": {
|
|
14
|
+
"types": "./src/install-command.d.ts",
|
|
15
|
+
"import": "./src/install-command.js",
|
|
16
|
+
"default": "./src/install-command.js"
|
|
12
17
|
}
|
|
13
18
|
},
|
|
14
19
|
"repository": {
|
|
@@ -22,13 +27,20 @@
|
|
|
22
27
|
"keywords": [
|
|
23
28
|
"openelement",
|
|
24
29
|
"web-components",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
30
|
+
"scaffolding",
|
|
31
|
+
"generator",
|
|
32
|
+
"starter"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=24.2"
|
|
36
|
+
},
|
|
37
|
+
"sideEffects": [
|
|
38
|
+
"./src/cli.js"
|
|
28
39
|
],
|
|
29
40
|
"bin": {
|
|
30
41
|
"openelement-create": "./src/cli.js",
|
|
31
42
|
"create-openelement": "./src/cli.js"
|
|
32
43
|
},
|
|
44
|
+
"peerDependenciesMeta": {},
|
|
33
45
|
"dependencies": {}
|
|
34
46
|
}
|
package/src/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {}
|
package/src/cli.js
CHANGED
|
@@ -1,76 +1,136 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
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
|
+
import readline from "node:readline/promises";
|
|
7
|
+
//#region src/cli.ts
|
|
2
8
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
* @openelement/create - Minimal project scaffold for openElement framework.
|
|
10
|
+
*
|
|
11
|
+
* The install command this CLI documents is built by ./install-command.ts
|
|
12
|
+
* (#1414): usage output, the guides and the homepage all render that one
|
|
13
|
+
* string, so the documented command cannot drift from the shipped flags.
|
|
14
|
+
*
|
|
15
|
+
* openElement Architecture: Keep It Simple, Stupid.
|
|
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.
|
|
21
|
+
*
|
|
22
|
+
* L9: every failure mode exits 1 with one actionable message — never a
|
|
23
|
+
* runtime stack trace.
|
|
24
|
+
*/
|
|
15
25
|
function errorMessage(error) {
|
|
16
|
-
|
|
26
|
+
return error instanceof Error ? error.message : String(error);
|
|
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";
|
|
17
36
|
}
|
|
18
37
|
function fail(message) {
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
console.error(`error: ${message}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
function joinPosix(...parts) {
|
|
42
|
+
return parts.join("/").replace(/\/{2,}/g, "/");
|
|
43
|
+
}
|
|
44
|
+
function dirnameOf(path) {
|
|
45
|
+
const idx = path.replace(/\\+/g, "/").lastIndexOf("/");
|
|
46
|
+
if (idx <= 0) return ".";
|
|
47
|
+
return path.slice(0, idx);
|
|
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
|
+
}
|
|
21
84
|
}
|
|
22
85
|
async function main() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.info(`\nopenElement project created at ./${relativeTarget}/`);
|
|
67
|
-
console.info(`\n cd ${relativeTarget}`);
|
|
68
|
-
console.info(' deno task dev');
|
|
69
|
-
console.info(' See README.md for all tasks (check/build/start/preview)');
|
|
86
|
+
const argv = process.argv.slice(2);
|
|
87
|
+
const { name: positionalName, tailwind: tailwindFlag } = parseArgs(argv);
|
|
88
|
+
const name = positionalName;
|
|
89
|
+
if (!name || name === "--help" || name === "-h") {
|
|
90
|
+
console.log(`Usage (Alpha): ${createInstallCommand()}`);
|
|
91
|
+
console.log("(a versionless install resolves the stable 0.43 line)");
|
|
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);
|
|
95
|
+
}
|
|
96
|
+
if (argv.includes("--tailwind") && argv.includes("--no-tailwind")) fail("--tailwind and --no-tailwind are mutually exclusive.");
|
|
97
|
+
const invalid = validateProjectName(name);
|
|
98
|
+
if (invalid) fail(`Invalid project name "${name}". ${invalid}`);
|
|
99
|
+
const targetDir = `${process.cwd().replace(/\/+$/, "")}/${name}`;
|
|
100
|
+
const relativeTarget = name;
|
|
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}`);
|
|
102
|
+
try {
|
|
103
|
+
await stat(targetDir);
|
|
104
|
+
fail(`Directory "${name}" already exists. Choose a different name or remove the existing directory.`);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
if (!isNotFound(error)) throw new Error(`Could not inspect target directory "${name}": ${errorMessage(error)}`);
|
|
107
|
+
}
|
|
108
|
+
const tailwind = await resolveTailwindForm(tailwindFlag);
|
|
109
|
+
const v = resolveVersions();
|
|
110
|
+
try {
|
|
111
|
+
await mkdir(targetDir, { recursive: true });
|
|
112
|
+
const TPL = await buildTemplates(v, name, { tailwind });
|
|
113
|
+
for (const [path, content] of Object.entries(TPL)) {
|
|
114
|
+
const fullPath = joinPosix(targetDir, path);
|
|
115
|
+
await mkdir(dirnameOf(fullPath), { recursive: true });
|
|
116
|
+
await writeFile(fullPath, content, "utf8");
|
|
117
|
+
console.info(` created ${path}`);
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
const detail = isPermissionDenied(error) ? `Permission denied. Check write permissions for ${targetDir}.` : errorMessage(error);
|
|
121
|
+
throw new Error(`Failed to write project files in "${name}": ${detail} Remove the partially created directory before retrying.`);
|
|
122
|
+
}
|
|
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.");
|
|
125
|
+
console.info(`\n cd ${relativeTarget}`);
|
|
126
|
+
console.info(" pnpm install");
|
|
127
|
+
console.info(" pnpm dev");
|
|
128
|
+
console.info(" See README.md for all scripts (check/test/build/start/preview)");
|
|
70
129
|
}
|
|
71
130
|
try {
|
|
72
|
-
|
|
131
|
+
await main();
|
|
73
132
|
} catch (error) {
|
|
74
|
-
|
|
133
|
+
fail(errorMessage(error));
|
|
75
134
|
}
|
|
76
|
-
//#
|
|
135
|
+
//#endregion
|
|
136
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/install-command.d.ts
|
|
2
|
+
/**
|
|
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
|
+
export declare const CREATE_PACKAGE_SPECIFIER = "@openelement/create";
|
|
18
|
+
/**
|
|
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).
|
|
23
|
+
*/
|
|
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";
|
|
27
|
+
/** Placeholder the usage text and the docs use in place of a project name. */
|
|
28
|
+
export declare const CREATE_PROJECT_PLACEHOLDER = "<project-name>";
|
|
29
|
+
/**
|
|
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).
|
|
42
|
+
*
|
|
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.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createInstallCommand(projectName?: string, options?: {
|
|
48
|
+
tag?: string;
|
|
49
|
+
}): string;
|
|
50
|
+
//#endregion
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/install-command.ts
|
|
2
|
+
/**
|
|
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
|
+
/**
|
|
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).
|
|
23
|
+
*/
|
|
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";
|
|
27
|
+
/** Placeholder the usage text and the docs use in place of a project name. */
|
|
28
|
+
const CREATE_PROJECT_PLACEHOLDER = "<project-name>";
|
|
29
|
+
/**
|
|
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).
|
|
42
|
+
*
|
|
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.
|
|
46
|
+
*/
|
|
47
|
+
function createInstallCommand(projectName = CREATE_PROJECT_PLACEHOLDER, options = {}) {
|
|
48
|
+
const tag = options.tag ?? "alpha";
|
|
49
|
+
return `npm create ${CREATE_NPM_CREATE_SCOPE}@${tag} ${projectName}`;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { CREATE_INSTALL_TAG, CREATE_NPM_CREATE_SCOPE, CREATE_PACKAGE_SPECIFIER, CREATE_PROJECT_PLACEHOLDER, createInstallCommand };
|