create-kide-app 0.7.0 → 0.8.1
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 +1 -1
- package/index.js +22 -12
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ The template repo can be overridden with the `KIDE_TEMPLATE_REPO` env var (forks
|
|
|
49
49
|
|
|
50
50
|
## Requirements
|
|
51
51
|
|
|
52
|
-
- Node.js >= 22.
|
|
52
|
+
- Node.js >= 22.23.4
|
|
53
53
|
- `pnpm` installed
|
|
54
54
|
- `git` on PATH
|
|
55
55
|
- Optional: [`gh` CLI](https://cli.github.com) authenticated (`gh auth login`) for GitHub repo creation
|
package/index.js
CHANGED
|
@@ -477,7 +477,7 @@ async function main() {
|
|
|
477
477
|
if (target === "cloudflare") {
|
|
478
478
|
// `pnpm preview` runs a production build in wrangler, which reads local secrets
|
|
479
479
|
// from .dev.vars — keep it out of git.
|
|
480
|
-
writeFileSync(path.join(projectDir, ".dev.vars"), `
|
|
480
|
+
writeFileSync(path.join(projectDir, ".dev.vars"), `KIDE_SECRET=${authSecret}\n`);
|
|
481
481
|
const gitignorePath = path.join(projectDir, ".gitignore");
|
|
482
482
|
const gitignore = existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf-8") : "";
|
|
483
483
|
if (!/^\.dev\.vars$/m.test(gitignore)) {
|
|
@@ -509,6 +509,16 @@ async function main() {
|
|
|
509
509
|
recursive: true,
|
|
510
510
|
force: true,
|
|
511
511
|
});
|
|
512
|
+
} else {
|
|
513
|
+
const envPath = path.join(projectDir, ".env");
|
|
514
|
+
if (!existsSync(envPath)) {
|
|
515
|
+
const examplePath = path.join(projectDir, ".env.example");
|
|
516
|
+
const example = existsSync(examplePath) ? readFileSync(examplePath, "utf-8") : "";
|
|
517
|
+
const env = /^KIDE_SECRET=.*$/m.test(example)
|
|
518
|
+
? example.replace(/^KIDE_SECRET=.*$/m, `KIDE_SECRET=${authSecret}`)
|
|
519
|
+
: `${example}${example && !example.endsWith("\n") ? "\n" : ""}KIDE_SECRET=${authSecret}\n`;
|
|
520
|
+
writeFileSync(envPath, env);
|
|
521
|
+
}
|
|
512
522
|
}
|
|
513
523
|
|
|
514
524
|
const pkgPath = path.join(projectDir, "package.json");
|
|
@@ -578,7 +588,7 @@ async function main() {
|
|
|
578
588
|
);
|
|
579
589
|
writeFileSync(path.join(projectDir, "wrangler.toml"), wranglerContent);
|
|
580
590
|
|
|
581
|
-
pkg.devDependencies.wrangler = "^4.
|
|
591
|
+
pkg.devDependencies.wrangler = "^4.149.0";
|
|
582
592
|
|
|
583
593
|
pkg.scripts.dev = "astro dev";
|
|
584
594
|
pkg.scripts.build = "astro build";
|
|
@@ -588,14 +598,14 @@ async function main() {
|
|
|
588
598
|
"astro build && wrangler deploy --config dist/server/wrangler.json";
|
|
589
599
|
|
|
590
600
|
// @cloudflare/vite-plugin statically imports module.registerHooks (Node
|
|
591
|
-
// >=22.15), and Node >=23 changes the native ABI (breaking
|
|
592
|
-
// better-sqlite3 used for local D1). So pin Node 22.
|
|
593
|
-
// with a friendly check instead of a cryptic
|
|
594
|
-
pkg.engines = { ...(pkg.engines ?? {}), node: ">=22.
|
|
601
|
+
// >=22.15), Astro needs >=22.23.4, and Node >=23 changes the native ABI (breaking
|
|
602
|
+
// the prebuilt better-sqlite3 used for local D1). So pin Node 22.23.4–22.x and guard
|
|
603
|
+
// `dev` with a friendly check instead of a cryptic crash.
|
|
604
|
+
pkg.engines = { ...(pkg.engines ?? {}), node: ">=22.23.4" };
|
|
595
605
|
pkg.scripts.predev =
|
|
596
606
|
`node -e "const v=process.versions.node.split('.').map(Number);` +
|
|
597
|
-
`if(v[0]<22||(v[0]===22&&v[1]<
|
|
598
|
-
`console.error('\\n[kide] Cloudflare dev needs Node 22.
|
|
607
|
+
`if(v[0]<22||(v[0]===22&&(v[1]<23||(v[1]===23&&v[2]<4)))||v[0]>=23){` +
|
|
608
|
+
`console.error('\\n[kide] Cloudflare dev needs Node 22.23.4+ (22.x). You have '+process.version+'.\\n` +
|
|
599
609
|
` Run: nvm install 22 && nvm use (or use fnm/volta)\\n');` +
|
|
600
610
|
`process.exit(1)}"`;
|
|
601
611
|
writeFileSync(path.join(projectDir, ".nvmrc"), "22\n");
|
|
@@ -1037,13 +1047,13 @@ async function main() {
|
|
|
1037
1047
|
s.start("Setting the admin sign-in secret");
|
|
1038
1048
|
try {
|
|
1039
1049
|
execSync(
|
|
1040
|
-
`${pm.exec} wrangler secret put
|
|
1050
|
+
`${pm.exec} wrangler secret put KIDE_SECRET --config dist/server/wrangler.json`,
|
|
1041
1051
|
{ cwd: projectDir, input: authSecret, stdio: ["pipe", "pipe", "pipe"] },
|
|
1042
1052
|
);
|
|
1043
1053
|
cf.secretSet = true;
|
|
1044
1054
|
s.stop("Admin sign-in secret set");
|
|
1045
1055
|
} catch (err) {
|
|
1046
|
-
s.stop("Could not set
|
|
1056
|
+
s.stop("Could not set KIDE_SECRET — set it manually (see below)");
|
|
1047
1057
|
if (err.stderr) console.error(err.stderr.toString().slice(-800));
|
|
1048
1058
|
}
|
|
1049
1059
|
}
|
|
@@ -1057,7 +1067,7 @@ async function main() {
|
|
|
1057
1067
|
|
|
1058
1068
|
if (target === "local") {
|
|
1059
1069
|
p.log.info(
|
|
1060
|
-
"
|
|
1070
|
+
"A KIDE_SECRET was generated in .env — set the same value in your production environment.",
|
|
1061
1071
|
);
|
|
1062
1072
|
// Without a terminal the dev server would never return control; skip it.
|
|
1063
1073
|
const startDev = flags.noDev || !interactive
|
|
@@ -1122,7 +1132,7 @@ async function main() {
|
|
|
1122
1132
|
}
|
|
1123
1133
|
if (!cf.secretSet) {
|
|
1124
1134
|
remaining.push(
|
|
1125
|
-
` ${pm.dlx} wrangler secret put
|
|
1135
|
+
` ${pm.dlx} wrangler secret put KIDE_SECRET`,
|
|
1126
1136
|
" # paste the value from .dev.vars — admin sign-in needs it",
|
|
1127
1137
|
);
|
|
1128
1138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-kide-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Scaffold a new Kide CMS project",
|
|
5
5
|
"author": "Matti Hernesniemi",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
"bin": {
|
|
9
9
|
"create-kide-app": "./index.js"
|
|
10
10
|
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"release": "npm version patch && git push --follow-tags && npm publish",
|
|
13
|
-
"release:minor": "npm version minor && git push --follow-tags && npm publish"
|
|
14
|
-
},
|
|
15
11
|
"files": [
|
|
16
12
|
"index.js"
|
|
17
13
|
],
|
|
@@ -28,9 +24,13 @@
|
|
|
28
24
|
"scaffold"
|
|
29
25
|
],
|
|
30
26
|
"engines": {
|
|
31
|
-
"node": ">=22.
|
|
27
|
+
"node": ">=22.23.4"
|
|
32
28
|
},
|
|
33
29
|
"dependencies": {
|
|
34
30
|
"@clack/prompts": "^1.1.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"release": "npm version patch && git push --follow-tags && npm publish",
|
|
34
|
+
"release:minor": "npm version minor && git push --follow-tags && npm publish"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|