@jxsuite/create 0.29.0 → 0.30.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/index.ts +27 -17
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -20,13 +20,19 @@ if (!dest) {
|
|
|
20
20
|
const destPath = resolve(dest);
|
|
21
21
|
const dirName = basename(destPath);
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
// The interactive flow runs inside an async function rather than via top-level await: when a test
|
|
24
|
+
// Pulls this entry in with a dynamic import(), Bun's test runtime drops the continuation after a
|
|
25
|
+
// Top-level await (it never resumes on Windows), leaving the prompts and generate step unexecuted.
|
|
26
|
+
// `ready` lets the test await the same sequence. The no-arg usage guard stays at module scope so a
|
|
27
|
+
// Bare invocation still exits during evaluation.
|
|
28
|
+
async function main() {
|
|
29
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
24
30
|
|
|
25
|
-
const name = (await rl.question(`Project name (${dirName}): `)) || dirName;
|
|
26
|
-
const description = await rl.question("Description: ");
|
|
27
|
-
const url = await rl.question("Production URL (https://example.com): ");
|
|
31
|
+
const name = (await rl.question(`Project name (${dirName}): `)) || dirName;
|
|
32
|
+
const description = await rl.question("Description: ");
|
|
33
|
+
const url = await rl.question("Production URL (https://example.com): ");
|
|
28
34
|
|
|
29
|
-
console.log(`
|
|
35
|
+
console.log(`
|
|
30
36
|
Deployment adapter:
|
|
31
37
|
1) static (default)
|
|
32
38
|
2) cloudflare-pages
|
|
@@ -34,21 +40,21 @@ Deployment adapter:
|
|
|
34
40
|
4) bun
|
|
35
41
|
5) cloudflare-workers
|
|
36
42
|
`);
|
|
37
|
-
const adapterChoice = await rl.question("Adapter [1]: ");
|
|
38
|
-
rl.close();
|
|
43
|
+
const adapterChoice = await rl.question("Adapter [1]: ");
|
|
44
|
+
rl.close();
|
|
39
45
|
|
|
40
|
-
const adapterMap: Record<string, ProjectOptions["adapter"]> = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
const adapter = adapterMap[adapterChoice] || "static";
|
|
46
|
+
const adapterMap: Record<string, ProjectOptions["adapter"]> = {
|
|
47
|
+
1: "static",
|
|
48
|
+
2: "cloudflare-pages",
|
|
49
|
+
3: "node",
|
|
50
|
+
4: "bun",
|
|
51
|
+
5: "cloudflare-workers",
|
|
52
|
+
};
|
|
53
|
+
const adapter = adapterMap[adapterChoice] || "static";
|
|
48
54
|
|
|
49
|
-
await generateProject(destPath, { adapter, description, name, url });
|
|
55
|
+
await generateProject(destPath, { adapter, description, name, url });
|
|
50
56
|
|
|
51
|
-
console.log(`
|
|
57
|
+
console.log(`
|
|
52
58
|
Project created at ${destPath}
|
|
53
59
|
|
|
54
60
|
Next steps:
|
|
@@ -56,3 +62,7 @@ Next steps:
|
|
|
56
62
|
bun install
|
|
57
63
|
bun run dev
|
|
58
64
|
`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// oxlint-disable-next-line unicorn/prefer-top-level-await
|
|
68
|
+
export const ready = main();
|