create-kide-app 0.1.8 → 0.1.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 +1 -1
- package/index.js +42 -42
- package/package.json +4 -1
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { execFileSync, execSync, spawn } from "node:child_process";
|
|
|
5
5
|
import {
|
|
6
6
|
cpSync,
|
|
7
7
|
existsSync,
|
|
8
|
-
mkdirSync,
|
|
9
8
|
readFileSync,
|
|
10
9
|
rmSync,
|
|
11
10
|
writeFileSync,
|
|
@@ -169,9 +168,13 @@ async function main() {
|
|
|
169
168
|
const branchArgs = templateRef ? ["--branch", templateRef] : [];
|
|
170
169
|
// execFileSync, not execSync: no shell, so projectDir is passed as one argv entry
|
|
171
170
|
// and can never be reinterpreted as a command regardless of what it contains.
|
|
172
|
-
execFileSync(
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
execFileSync(
|
|
172
|
+
"git",
|
|
173
|
+
["clone", "--depth", "1", ...branchArgs, REPO, projectDir],
|
|
174
|
+
{
|
|
175
|
+
stdio: "pipe",
|
|
176
|
+
},
|
|
177
|
+
);
|
|
175
178
|
try {
|
|
176
179
|
templateCommit = execSync("git rev-parse HEAD", {
|
|
177
180
|
cwd: projectDir,
|
|
@@ -208,31 +211,24 @@ async function main() {
|
|
|
208
211
|
const targetDir = path.join(adaptersDir, target);
|
|
209
212
|
|
|
210
213
|
if (target === "cloudflare") {
|
|
214
|
+
// The Cloudflare adapter/storage/env implementations live in the tree at
|
|
215
|
+
// src/cms/platform/cloudflare. We only copy the target's Astro/Drizzle/wrangler config and
|
|
216
|
+
// flip the two platform selectors to point at that profile — no source files are overwritten.
|
|
211
217
|
cpSync(
|
|
212
218
|
path.join(targetDir, "astro.config.mjs"),
|
|
213
219
|
path.join(projectDir, "astro.config.mjs"),
|
|
214
220
|
);
|
|
215
|
-
cpSync(
|
|
216
|
-
path.join(targetDir, "src/cms/adapters/db.ts"),
|
|
217
|
-
path.join(projectDir, "src/cms/adapters/db.ts"),
|
|
218
|
-
);
|
|
219
221
|
cpSync(
|
|
220
222
|
path.join(targetDir, "drizzle.config.ts"),
|
|
221
223
|
path.join(projectDir, "drizzle.config.ts"),
|
|
222
224
|
);
|
|
223
|
-
|
|
224
|
-
path.join(
|
|
225
|
-
|
|
226
|
-
);
|
|
227
|
-
cpSync(
|
|
228
|
-
path.join(targetDir, "src/cms/adapters/cf-env.ts"),
|
|
229
|
-
path.join(projectDir, "src/cms/adapters/cf-env.ts"),
|
|
225
|
+
writeFileSync(
|
|
226
|
+
path.join(projectDir, "src/cms/adapters/db.ts"),
|
|
227
|
+
'export * from "../platform/cloudflare/database";\n',
|
|
230
228
|
);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
path.join(targetDir, "src/pages/uploads/[...path].ts"),
|
|
235
|
-
path.join(uploadsRouteDir, "[...path].ts"),
|
|
229
|
+
writeFileSync(
|
|
230
|
+
path.join(projectDir, "src/cms/adapters/storage.ts"),
|
|
231
|
+
'export * from "../platform/cloudflare/storage";\n',
|
|
236
232
|
);
|
|
237
233
|
}
|
|
238
234
|
|
|
@@ -243,7 +239,7 @@ async function main() {
|
|
|
243
239
|
|
|
244
240
|
if (target === "cloudflare") {
|
|
245
241
|
delete pkg.dependencies["@astrojs/node"];
|
|
246
|
-
pkg.dependencies["@astrojs/cloudflare"] = "
|
|
242
|
+
pkg.dependencies["@astrojs/cloudflare"] = "~14.1.7";
|
|
247
243
|
|
|
248
244
|
// Move better-sqlite3 to devDependencies — drizzle-kit needs it to push schema to local D1
|
|
249
245
|
if (pkg.dependencies["better-sqlite3"]) {
|
|
@@ -272,7 +268,7 @@ async function main() {
|
|
|
272
268
|
);
|
|
273
269
|
writeFileSync(path.join(projectDir, "wrangler.toml"), wranglerContent);
|
|
274
270
|
|
|
275
|
-
pkg.devDependencies.wrangler = "^4.
|
|
271
|
+
pkg.devDependencies.wrangler = "^4.83.0";
|
|
276
272
|
|
|
277
273
|
pkg.scripts.dev = "astro dev";
|
|
278
274
|
pkg.scripts.build = "astro build";
|
|
@@ -483,22 +479,13 @@ async function main() {
|
|
|
483
479
|
|
|
484
480
|
if (seedDemo && target === "local") {
|
|
485
481
|
s.start("Pushing schema to database");
|
|
486
|
-
//
|
|
487
|
-
|
|
488
|
-
let pushOk = false;
|
|
482
|
+
// The guarded sync script (exits non-zero on failure, creates data/ itself) —
|
|
483
|
+
// same path the dev server and deploys use.
|
|
489
484
|
try {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
stdio: "pipe",
|
|
493
|
-
}).toString();
|
|
494
|
-
pushOk = !out.includes("Error:") && out.includes("Changes applied");
|
|
495
|
-
s.stop(
|
|
496
|
-
pushOk
|
|
497
|
-
? "Schema pushed"
|
|
498
|
-
: "Schema push failed — run `pnpm exec drizzle-kit push` manually",
|
|
499
|
-
);
|
|
485
|
+
execSync(`${pm.run} cms:push`, { cwd: projectDir, stdio: "pipe" });
|
|
486
|
+
s.stop("Schema pushed");
|
|
500
487
|
} catch {
|
|
501
|
-
s.stop("Schema
|
|
488
|
+
s.stop("Schema push failed — run `pnpm cms:push` manually");
|
|
502
489
|
}
|
|
503
490
|
s.start("Seeding demo content");
|
|
504
491
|
try {
|
|
@@ -713,12 +700,25 @@ async function main() {
|
|
|
713
700
|
// --- Done ---
|
|
714
701
|
|
|
715
702
|
if (target === "local") {
|
|
716
|
-
p.
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
|
|
703
|
+
const startDev = await p.confirm({
|
|
704
|
+
message: "Start the dev server now?",
|
|
705
|
+
initialValue: true,
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
if (!p.isCancel(startDev) && startDev) {
|
|
709
|
+
p.outro("Starting dev server...");
|
|
710
|
+
try {
|
|
711
|
+
execSync(`${pm.run} dev`, { cwd: projectDir, stdio: "inherit" });
|
|
712
|
+
} catch {
|
|
713
|
+
console.log(`\n Project directory: ${projectDir}`);
|
|
714
|
+
console.log(` To start again: cd ${projectName} && pnpm dev\n`);
|
|
715
|
+
}
|
|
716
|
+
} else {
|
|
717
|
+
p.note(
|
|
718
|
+
[`cd ${projectName}`, "", `${pm.run} dev`].join("\n"),
|
|
719
|
+
"Next steps",
|
|
720
|
+
);
|
|
721
|
+
p.outro("Project created!");
|
|
722
722
|
}
|
|
723
723
|
} else {
|
|
724
724
|
if (cf.deployed && cf.url) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-kide-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Scaffold a new Kide CMS project",
|
|
5
5
|
"author": "Matti Hernesniemi",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,6 +8,9 @@
|
|
|
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
|
+
},
|
|
11
14
|
"files": [
|
|
12
15
|
"index.js"
|
|
13
16
|
],
|