create-smoodly-app 0.0.55 → 0.0.56
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/dist/index.js +31 -13
- package/package.json +2 -2
- package/templates/astro-blank/package.json +4 -1
- package/templates/astro-blank-intl/package.json +4 -1
- package/templates/astro-lorem/package.json +4 -1
- package/templates/astro-lorem-intl/package.json +4 -1
- package/templates/blank/package.json +4 -1
- package/templates/blank-intl/package.json +4 -1
- package/templates/lorem/package.json +4 -1
- package/templates/lorem-intl/package.json +4 -1
- package/templates/astro-lorem/src/messages/fi.json +0 -7
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as p2 from "@clack/prompts";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { readdir as readdir2, rm, writeFile as writeFile2 } from "node:fs/promises";
|
|
7
|
-
import { join as
|
|
7
|
+
import { join as join4, relative } from "node:path";
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
9
|
|
|
10
10
|
// src/args.ts
|
|
@@ -95,9 +95,19 @@ var exec = (cmd, args, opts) => new Promise((resolve3, reject) => {
|
|
|
95
95
|
);
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
+
// src/node-floor.ts
|
|
99
|
+
var NODE_FLOOR = "22.12";
|
|
100
|
+
function nodeProblem(version) {
|
|
101
|
+
const [major = 0, minor = 0] = version.replace(/^v/, "").split(".").map(Number);
|
|
102
|
+
const [floorMajor, floorMinor] = NODE_FLOOR.split(".").map(Number);
|
|
103
|
+
if (major > floorMajor || major === floorMajor && minor >= floorMinor) return null;
|
|
104
|
+
return `smoodly: Node ${version.replace(/^v/, "")} is too old \u2014 the site needs Node ${NODE_FLOOR} or newer (Astro 7's floor). Upgrade Node and run the installer again.`;
|
|
105
|
+
}
|
|
106
|
+
|
|
98
107
|
// src/prompts.ts
|
|
99
108
|
import * as p from "@clack/prompts";
|
|
100
|
-
import {
|
|
109
|
+
import { homedir } from "node:os";
|
|
110
|
+
import { join as join2, resolve as resolve2 } from "node:path";
|
|
101
111
|
|
|
102
112
|
// src/env.ts
|
|
103
113
|
var SPACE = "sp_(?:eu_)?[a-z2-7]{20}";
|
|
@@ -136,7 +146,7 @@ function validName(name) {
|
|
|
136
146
|
}
|
|
137
147
|
async function isEmptyOrMissing(dir) {
|
|
138
148
|
try {
|
|
139
|
-
return (await readdir(dir)).length === 0;
|
|
149
|
+
return (await readdir(dir)).filter((name) => name !== ".git").length === 0;
|
|
140
150
|
} catch (e) {
|
|
141
151
|
const code = e.code;
|
|
142
152
|
if (code === "ENOENT") return true;
|
|
@@ -255,16 +265,19 @@ async function spaceValues(flags2, typed) {
|
|
|
255
265
|
const publishableKey = typed.publishableKey ?? await ask(p.text({ message: "Publishable key", placeholder: "pk_\u2026", validate: (v) => checkPublishableKey((v ?? "").trim()) }));
|
|
256
266
|
return { spaceId, secretKey, publishableKey, ...hidden };
|
|
257
267
|
}
|
|
268
|
+
var expandHome = (typed) => typed === "~" ? homedir() : typed.startsWith("~/") ? join2(homedir(), typed.slice(2)) : typed;
|
|
258
269
|
async function resolveAnswers(flags2, ctx) {
|
|
259
270
|
const typedFlags = typedValues(flags2);
|
|
260
|
-
const
|
|
271
|
+
const quiet = flags2.yes || !process.stdin.isTTY;
|
|
272
|
+
const folderName = (typed2) => nameFromDir(resolve2(ctx.cwd, expandHome(typed2)));
|
|
273
|
+
if (flags2.name === void 0 && !process.stdin.isTTY) throw new Error("smoodly: name the folder to create \u2014 npx create-smoodly-app my-site.");
|
|
261
274
|
const typed = flags2.name ?? await answer(p.text({ message: "Project folder", placeholder: "my-site", validate: (v) => v ? validName(folderName(v)) ?? void 0 : "A folder name or path." }));
|
|
262
|
-
const dir = resolve2(ctx.cwd, typed);
|
|
275
|
+
const dir = resolve2(ctx.cwd, expandHome(typed));
|
|
263
276
|
const name = nameFromDir(dir);
|
|
264
277
|
const invalid = validName(name);
|
|
265
278
|
if (invalid) bail(invalid);
|
|
266
279
|
if (!await isEmptyOrMissing(dir)) bail(`${dir} exists and is not empty.`);
|
|
267
|
-
const framework = flags2.framework ?? (
|
|
280
|
+
const framework = flags2.framework ?? (quiet ? "astro" : await answer(
|
|
268
281
|
p.select({
|
|
269
282
|
message: "Framework?",
|
|
270
283
|
options: [
|
|
@@ -273,7 +286,7 @@ async function resolveAnswers(flags2, ctx) {
|
|
|
273
286
|
]
|
|
274
287
|
})
|
|
275
288
|
));
|
|
276
|
-
const locales = flags2.locales ?? (
|
|
289
|
+
const locales = flags2.locales ?? (quiet ? void 0 : await answer(p.confirm({ message: `Multilingual site? (${framework === "astro" ? "Astro i18n" : "next-intl"}, translated URLs)`, initialValue: false })) ? await answer(
|
|
277
290
|
p.text({
|
|
278
291
|
message: "Locales, comma-separated, the first is the default",
|
|
279
292
|
placeholder: "en, fr",
|
|
@@ -286,7 +299,7 @@ async function resolveAnswers(flags2, ctx) {
|
|
|
286
299
|
}
|
|
287
300
|
})
|
|
288
301
|
).then(parseLocales) : void 0);
|
|
289
|
-
const starter = flags2.starter ?? (
|
|
302
|
+
const starter = flags2.starter ?? (quiet ? "lorem" : await answer(
|
|
290
303
|
p.select({
|
|
291
304
|
message: "Starter?",
|
|
292
305
|
options: [
|
|
@@ -300,7 +313,7 @@ async function resolveAnswers(flags2, ctx) {
|
|
|
300
313
|
}
|
|
301
314
|
|
|
302
315
|
// src/run.ts
|
|
303
|
-
import { join as
|
|
316
|
+
import { join as join3 } from "node:path";
|
|
304
317
|
|
|
305
318
|
// src/plan.ts
|
|
306
319
|
function templateName(framework, starter, locales) {
|
|
@@ -308,7 +321,7 @@ function templateName(framework, starter, locales) {
|
|
|
308
321
|
return framework === "astro" ? `astro-${base}` : base;
|
|
309
322
|
}
|
|
310
323
|
function plan(_a) {
|
|
311
|
-
return ["copyTemplate", "install", "writeEnv", "
|
|
324
|
+
return ["copyTemplate", "install", "writeEnv", "gitInit", "push", "seed", "finish"];
|
|
312
325
|
}
|
|
313
326
|
|
|
314
327
|
// src/run.ts
|
|
@@ -337,7 +350,7 @@ async function run(answers2, deps) {
|
|
|
337
350
|
await sh("npm", ["install"]);
|
|
338
351
|
break;
|
|
339
352
|
case "writeEnv":
|
|
340
|
-
await deps.fs.writeFile(
|
|
353
|
+
await deps.fs.writeFile(join3(cwd, envFile(answers2)), renderEnv(answers2.space, siteUrl(answers2)));
|
|
341
354
|
break;
|
|
342
355
|
case "push":
|
|
343
356
|
deps.log("Pushing the site's schema to the space\u2026");
|
|
@@ -414,6 +427,11 @@ if (flags.help) {
|
|
|
414
427
|
console.log(HELP);
|
|
415
428
|
process.exit(0);
|
|
416
429
|
}
|
|
430
|
+
var tooOld = nodeProblem(process.version);
|
|
431
|
+
if (tooOld) {
|
|
432
|
+
console.error(tooOld);
|
|
433
|
+
process.exit(1);
|
|
434
|
+
}
|
|
417
435
|
p2.intro("create-smoodly-app");
|
|
418
436
|
var answers;
|
|
419
437
|
var outcome;
|
|
@@ -430,11 +448,11 @@ try {
|
|
|
430
448
|
writeFile: (path, text2) => writeFile2(path, text2),
|
|
431
449
|
rm: async (dir) => {
|
|
432
450
|
if (!existed) return rm(dir, { recursive: true, force: true });
|
|
433
|
-
for (const name of await readdir2(dir)) await rm(
|
|
451
|
+
for (const name of await readdir2(dir)) await rm(join4(dir, name), { recursive: true, force: true });
|
|
434
452
|
}
|
|
435
453
|
},
|
|
436
454
|
agentFiles: async (dir) => {
|
|
437
|
-
const gen = await import(pathToFileURL(
|
|
455
|
+
const gen = await import(pathToFileURL(join4(dir, "node_modules/next/dist/server/lib/generate-agent-files.js")).href);
|
|
438
456
|
(gen.writeAgentFiles ?? gen.default?.writeAgentFiles)(dir);
|
|
439
457
|
}
|
|
440
458
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-smoodly-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"description": "Create a Smoodly site: a fresh Astro or Next.js app with the admin mounted, its env file on a space's three values, its schema pushed and its starter content seeded.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"templates"
|
|
18
18
|
],
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">=22.12"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "npm run build:template && npm run build:cli",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "astro dev",
|
|
7
10
|
"build": "astro build",
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@astrojs/node": "^11.1.6",
|
|
14
17
|
"astro": "^7.3.5",
|
|
15
|
-
"smoodly": "0.0.
|
|
18
|
+
"smoodly": "0.0.56"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"@astrojs/check": "^0.9.10",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "astro dev",
|
|
7
10
|
"build": "astro build",
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@astrojs/node": "^11.1.6",
|
|
14
17
|
"astro": "^7.3.5",
|
|
15
|
-
"smoodly": "0.0.
|
|
18
|
+
"smoodly": "0.0.56"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"@astrojs/check": "^0.9.10",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "astro dev",
|
|
7
10
|
"build": "astro build",
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@astrojs/node": "^11.1.6",
|
|
14
17
|
"astro": "^7.3.5",
|
|
15
|
-
"smoodly": "0.0.
|
|
18
|
+
"smoodly": "0.0.56"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"@astrojs/check": "^0.9.10",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "astro dev",
|
|
7
10
|
"build": "astro build",
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@astrojs/node": "^11.1.6",
|
|
14
17
|
"astro": "^7.3.5",
|
|
15
|
-
"smoodly": "0.0.
|
|
18
|
+
"smoodly": "0.0.56"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"@astrojs/check": "^0.9.10",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "next dev",
|
|
7
10
|
"build": "next build",
|
|
@@ -14,7 +17,7 @@
|
|
|
14
17
|
"next": "^16.3.4",
|
|
15
18
|
"react": "^19",
|
|
16
19
|
"react-dom": "^19",
|
|
17
|
-
"smoodly": "0.0.
|
|
20
|
+
"smoodly": "0.0.56"
|
|
18
21
|
},
|
|
19
22
|
"devDependencies": {
|
|
20
23
|
"@next/env": "^16.3.4",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "next dev",
|
|
7
10
|
"build": "next build",
|
|
@@ -14,7 +17,7 @@
|
|
|
14
17
|
"next": "^16.3.4",
|
|
15
18
|
"react": "^19",
|
|
16
19
|
"react-dom": "^19",
|
|
17
|
-
"smoodly": "0.0.
|
|
20
|
+
"smoodly": "0.0.56",
|
|
18
21
|
"next-intl": "^4.14.2"
|
|
19
22
|
},
|
|
20
23
|
"devDependencies": {
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "next dev",
|
|
7
10
|
"build": "next build",
|
|
@@ -14,7 +17,7 @@
|
|
|
14
17
|
"next": "^16.3.4",
|
|
15
18
|
"react": "^19",
|
|
16
19
|
"react-dom": "^19",
|
|
17
|
-
"smoodly": "0.0.
|
|
20
|
+
"smoodly": "0.0.56"
|
|
18
21
|
},
|
|
19
22
|
"devDependencies": {
|
|
20
23
|
"@next/env": "^16.3.4",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"name": "smoodly-site",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=22.12"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "next dev",
|
|
7
10
|
"build": "next build",
|
|
@@ -14,7 +17,7 @@
|
|
|
14
17
|
"next": "^16.3.4",
|
|
15
18
|
"react": "^19",
|
|
16
19
|
"react-dom": "^19",
|
|
17
|
-
"smoodly": "0.0.
|
|
20
|
+
"smoodly": "0.0.56",
|
|
18
21
|
"next-intl": "^4.14.2"
|
|
19
22
|
},
|
|
20
23
|
"devDependencies": {
|