@fedify/init 2.4.0-pr.934.40 → 2.4.0

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.
Files changed (48) hide show
  1. package/README.md +9 -5
  2. package/dist/action/configs.js +5 -2
  3. package/dist/action/deps.js +4 -3
  4. package/dist/action/mod.d.ts +1 -1
  5. package/dist/action/patch.js +4 -2
  6. package/dist/action/templates.js +14 -2
  7. package/dist/action/utils.js +16 -1
  8. package/dist/ask/dir.js +51 -19
  9. package/dist/ask/kv.js +1 -1
  10. package/dist/ask/mq.js +1 -1
  11. package/dist/ask/pm.js +44 -26
  12. package/dist/command.d.ts +5 -5
  13. package/dist/const.js +6 -2
  14. package/dist/deno.js +1 -1
  15. package/dist/json/deps.js +14 -13
  16. package/dist/json/deps.json +16 -16
  17. package/dist/json/kv.js +1 -1
  18. package/dist/json/kv.json +1 -1
  19. package/dist/json/mq.js +1 -1
  20. package/dist/json/mq.json +1 -1
  21. package/dist/json/rt.js +7 -14
  22. package/dist/json/rt.json +7 -20
  23. package/dist/lib.js +92 -2
  24. package/dist/mod.d.ts +1 -1
  25. package/dist/templates/astro/astro.config.bun.ts.tpl +2 -2
  26. package/dist/templates/defaults/smoke.test.ts.tpl +170 -0
  27. package/dist/templates/next/middleware.ts.tpl +7 -2
  28. package/dist/templates/sveltekit/hooks.server.ts.tpl +7 -0
  29. package/dist/test/create.js +32 -7
  30. package/dist/test/db.js +1 -1
  31. package/dist/test/lookup.js +3 -2
  32. package/dist/test/port.js +4 -4
  33. package/dist/types.d.ts +3 -1
  34. package/dist/utils.js +9 -3
  35. package/dist/webframeworks/astro.js +39 -11
  36. package/dist/webframeworks/bare-bones.js +8 -4
  37. package/dist/webframeworks/const.js +1 -1
  38. package/dist/webframeworks/elysia.js +9 -5
  39. package/dist/webframeworks/express.js +8 -4
  40. package/dist/webframeworks/hono.js +8 -4
  41. package/dist/webframeworks/mod.js +3 -1
  42. package/dist/webframeworks/next.js +10 -5
  43. package/dist/webframeworks/nitro.js +11 -4
  44. package/dist/webframeworks/nuxt.js +10 -5
  45. package/dist/webframeworks/solidstart.js +10 -5
  46. package/dist/webframeworks/sveltekit.js +82 -0
  47. package/dist/webframeworks/utils.js +15 -1
  48. package/package.json +6 -5
@@ -1,8 +1,8 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
3
- import { npm__astrojs_node, npm__deno_astro_adapter, npm__dotenvx_dotenvx, npm__nurodev_astro_bun, npm__types_node_22, npm_oxlint, npm_prettier, npm_prettier_plugin_astro, npm_typescript } from "../json/deps.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
+ import { "@logtape/logtape" as _logtape_logtape, "npm:@astrojs/node" as npm__astrojs_node, "npm:@deno/astro-adapter" as npm__deno_astro_adapter, "npm:@dotenvx/dotenvx" as npm__dotenvx_dotenvx, "npm:@types/node@22" as npm__types_node_22, "npm:astro" as npm_astro, "npm:create-astro" as npm_create_astro, "npm:oxlint" as npm_oxlint, "npm:prettier" as npm_prettier, "npm:prettier-plugin-astro" as npm_prettier_plugin_astro, "npm:typescript" as npm_typescript } from "../json/deps.js";
4
4
  import { defaultDenoDependencies } from "./const.js";
5
- import { getInstruction, pmToRt } from "./utils.js";
5
+ import { getInstruction, getTestDependencies, getTestTask, pmToRt } from "./utils.js";
6
6
  //#region src/webframeworks/astro.ts
7
7
  const astroNodeBunDevDependencies = {
8
8
  "@fedify/lint": PACKAGE_VERSION,
@@ -15,22 +15,37 @@ const astroNodeBunDevToolTasks = {
15
15
  "format:check": "prettier --plugin prettier-plugin-astro --check .",
16
16
  lint: "oxlint ."
17
17
  };
18
+ const astroDenoCommand = `deno run -A npm:astro@${npm_astro}`;
19
+ const ASTRO_NODE_VERSION_CHECK = `
20
+ const [major, minor] = process.versions.node.split(".").map(Number);
21
+ if (major < 22 || (major === 22 && minor < 12)) {
22
+ console.error("Astro 7 requires Node.js 22.12 or later.");
23
+ process.exit(1);
24
+ }
25
+ `.trim();
18
26
  const astroDescription = {
19
27
  label: "Astro",
20
28
  packageManagers: PACKAGE_MANAGER,
21
29
  defaultPort: 4321,
30
+ minRuntimeVersions: { node: "22.12.0" },
22
31
  init: async ({ packageManager: pm }) => {
23
32
  const dependencies = pm === "deno" ? {
24
33
  ...defaultDenoDependencies,
34
+ "@fedify/fedify": `npm:@fedify/fedify@${PACKAGE_VERSION}`,
35
+ "@fedify/vocab": `npm:@fedify/vocab@${PACKAGE_VERSION}`,
36
+ "@logtape/logtape": `npm:@logtape/logtape@${_logtape_logtape}`,
37
+ astro: `npm:astro@${npm_astro}`,
25
38
  "@deno/astro-adapter": `npm:@deno/astro-adapter@${npm__deno_astro_adapter}`,
26
- "@fedify/astro": PACKAGE_VERSION
39
+ "@fedify/astro": `npm:@fedify/astro@${PACKAGE_VERSION}`
27
40
  } : pm === "bun" ? {
41
+ "@astrojs/node": npm__astrojs_node,
28
42
  "@fedify/astro": PACKAGE_VERSION,
29
- "@nurodev/astro-bun": npm__nurodev_astro_bun
43
+ astro: npm_astro
30
44
  } : {
31
45
  "@astrojs/node": npm__astrojs_node,
32
46
  "@fedify/astro": PACKAGE_VERSION,
33
- "@dotenvx/dotenvx": npm__dotenvx_dotenvx
47
+ "@dotenvx/dotenvx": npm__dotenvx_dotenvx,
48
+ astro: npm_astro
34
49
  };
35
50
  return {
36
51
  command: Array.from(getAstroInitCommand(pm)),
@@ -40,10 +55,12 @@ const astroDescription = {
40
55
  ...pm !== "deno" ? {
41
56
  typescript: npm_typescript,
42
57
  "@types/node": npm__types_node_22
43
- } : {}
58
+ } : {},
59
+ ...getTestDependencies(pm)
44
60
  },
45
61
  federationFile: "src/federation.ts",
46
62
  loggingFile: "src/logging.ts",
63
+ testFile: "scripts/smoke.test.ts",
47
64
  format: pm === "deno" ? void 0 : { tool: "prettier" },
48
65
  files: {
49
66
  "astro.config.ts": await readTemplate(`astro/astro.config.${pmToRt(pm)}.ts`),
@@ -61,13 +78,21 @@ const astroDescription = {
61
78
  * by a template.
62
79
  */
63
80
  function* getAstroInitCommand(pm) {
81
+ if (pm !== "deno" && pm !== "bun") {
82
+ yield "node";
83
+ yield "-e";
84
+ yield ASTRO_NODE_VERSION_CHECK;
85
+ yield "&&";
86
+ }
64
87
  yield* createAstroAppCommand(pm);
65
- yield "astro@latest";
88
+ yield `astro@${npm_create_astro}`;
66
89
  yield ".";
67
90
  yield "--";
68
91
  yield "--no-git";
69
92
  yield "--skip-houston";
70
93
  yield "-y";
94
+ yield "--ref";
95
+ yield `astro@${npm_astro.replace(/^\D+/, "")}`;
71
96
  if (pm !== "deno") yield "--no-install";
72
97
  yield "&&";
73
98
  yield "rm";
@@ -82,20 +107,23 @@ const createAstroAppCommand = (pm) => pm === "deno" ? [
82
107
  ] : [pm, "create"];
83
108
  const TASKS = {
84
109
  "deno": {
85
- dev: "deno run -A npm:astro dev",
86
- build: "deno run -A npm:astro build",
87
- preview: "deno run -A npm:astro preview"
110
+ dev: `${astroDenoCommand} dev`,
111
+ build: `${astroDenoCommand} build`,
112
+ preview: `${astroDenoCommand} preview`,
113
+ test: getTestTask("deno")
88
114
  },
89
115
  "bun": {
90
116
  dev: "bunx --bun astro dev",
91
117
  build: "bunx --bun astro build",
92
118
  preview: "bun ./dist/server/entry.mjs",
119
+ test: getTestTask("bun"),
93
120
  ...astroNodeBunDevToolTasks
94
121
  },
95
122
  "node": {
96
123
  dev: "dotenvx run -- astro dev",
97
124
  build: "dotenvx run -- astro build",
98
125
  preview: "dotenvx run -- astro preview",
126
+ test: getTestTask("npm"),
99
127
  ...astroNodeBunDevToolTasks
100
128
  }
101
129
  };
@@ -1,8 +1,8 @@
1
- import { readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
3
- import { _hongminhee_x_forwarded_fetch, npm__dotenvx_dotenvx, npm__hono_node_server, npm__types_bun, npm__types_node_25, npm_tsx, npm_x_forwarded_fetch } from "../json/deps.js";
2
+ import { readTemplate } from "../lib.js";
3
+ import { "@hongminhee/x-forwarded-fetch" as _hongminhee_x_forwarded_fetch, "npm:@dotenvx/dotenvx" as npm__dotenvx_dotenvx, "npm:@hono/node-server" as npm__hono_node_server, "npm:@types/bun" as npm__types_bun, "npm:@types/node@25" as npm__types_node_25, "npm:tsx" as npm_tsx, "npm:x-forwarded-fetch" as npm_x_forwarded_fetch } from "../json/deps.js";
4
4
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
- import { getInstruction, nodeBunDevToolTasks, pmToRt } from "./utils.js";
5
+ import { getInstruction, getTestTask, nodeBunDevToolTasks, pmToRt } from "./utils.js";
6
6
  //#region src/webframeworks/bare-bones.ts
7
7
  const bareBonesDescription = {
8
8
  label: "Bare-bones",
@@ -16,6 +16,7 @@ const bareBonesDescription = {
16
16
  },
17
17
  federationFile: "src/federation.ts",
18
18
  loggingFile: "src/logging.ts",
19
+ testFile: "scripts/smoke.test.ts",
19
20
  files: { "src/main.ts": await readTemplate(`bare-bones/main/${pmToRt(pm)}.ts`) },
20
21
  compilerOptions: pm === "deno" ? {
21
22
  "jsx": "precompile",
@@ -46,16 +47,19 @@ const getDependencies = (pm) => pm === "deno" ? {
46
47
  const TASKS = {
47
48
  deno: {
48
49
  dev: "deno run -A --watch ./src/main.ts",
49
- prod: "deno run -A ./src/main.ts"
50
+ prod: "deno run -A ./src/main.ts",
51
+ test: getTestTask("deno")
50
52
  },
51
53
  bun: {
52
54
  dev: "bun run --hot ./src/main.ts",
53
55
  prod: "bun run ./src/main.ts",
56
+ test: getTestTask("bun"),
54
57
  ...nodeBunDevToolTasks
55
58
  },
56
59
  node: {
57
60
  dev: "dotenvx run -- tsx watch ./src/main.ts",
58
61
  prod: "dotenvx run -- node --import tsx ./src/main.ts",
62
+ test: getTestTask("npm"),
59
63
  ...nodeBunDevToolTasks
60
64
  }
61
65
  };
@@ -1,5 +1,5 @@
1
1
  import { PACKAGE_VERSION } from "../lib.js";
2
- import { npm_oxfmt, npm_oxlint } from "../json/deps.js";
2
+ import { "npm:oxfmt" as npm_oxfmt, "npm:oxlint" as npm_oxlint } from "../json/deps.js";
3
3
  //#region src/webframeworks/const.ts
4
4
  const defaultDevDependencies = {
5
5
  "@fedify/lint": PACKAGE_VERSION,
@@ -1,11 +1,11 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
3
- import { npm__dotenvx_dotenvx, npm__elysiajs_node, npm__sinclair_typebox, npm__types_bun, npm__types_node_25, npm_elysia, npm_openapi_types, npm_tsx, npm_typescript } from "../json/deps.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
+ import { "npm:@dotenvx/dotenvx" as npm__dotenvx_dotenvx, "npm:@elysiajs/node" as npm__elysiajs_node, "npm:@sinclair/typebox" as npm__sinclair_typebox, "npm:@types/bun" as npm__types_bun, "npm:@types/node@25" as npm__types_node_25, "npm:elysia" as npm_elysia, "npm:openapi-types" as npm_openapi_types, "npm:tsx" as npm_tsx, "npm:typescript" as npm_typescript } from "../json/deps.js";
4
4
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
- import { getInstruction, nodeBunDevToolTasks, pmToRt } from "./utils.js";
5
+ import { getInstruction, getTestTask, nodeBunDevToolTasks, pmToRt } from "./utils.js";
6
6
  //#region src/webframeworks/elysia.ts
7
7
  const elysiaDescription = {
8
- label: "ElysiaJS",
8
+ label: "Elysia",
9
9
  packageManagers: PACKAGE_MANAGER,
10
10
  defaultPort: 3e3,
11
11
  init: async ({ projectName, packageManager: pm }) => ({
@@ -36,6 +36,7 @@ const elysiaDescription = {
36
36
  },
37
37
  federationFile: "src/federation.ts",
38
38
  loggingFile: "src/logging.ts",
39
+ testFile: "scripts/smoke.test.ts",
39
40
  files: { "src/index.ts": (await readTemplate(`elysia/index/${pmToRt(pm)}.ts`)).replace(/\/\* logger \*\//, projectName) },
40
41
  compilerOptions: pm === "deno" || pm === "bun" ? void 0 : {
41
42
  "lib": ["ESNext", "DOM"],
@@ -54,17 +55,20 @@ const elysiaDescription = {
54
55
  const TASKS = {
55
56
  deno: {
56
57
  dev: "deno serve --allow-read --allow-env --allow-net --watch ./src/index.ts",
57
- prod: "deno serve --allow-read --allow-env --allow-net ./src/index.ts"
58
+ prod: "deno serve --allow-read --allow-env --allow-net ./src/index.ts",
59
+ test: getTestTask("deno")
58
60
  },
59
61
  bun: {
60
62
  dev: "bun run --hot ./src/index.ts",
61
63
  prod: "bun run ./src/index.ts",
64
+ test: getTestTask("bun"),
62
65
  ...nodeBunDevToolTasks
63
66
  },
64
67
  node: {
65
68
  dev: "dotenvx run -- tsx watch src/index.ts",
66
69
  build: "tsc src/index.ts --outDir dist",
67
70
  start: "NODE_ENV=production dotenvx run -- node dist/index.js",
71
+ test: getTestTask("npm"),
68
72
  ...nodeBunDevToolTasks
69
73
  }
70
74
  };
@@ -1,8 +1,8 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
3
- import { npm__dotenvx_dotenvx, npm__types_bun, npm__types_express, npm_express, npm_tsx } from "../json/deps.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
+ import { "npm:@dotenvx/dotenvx" as npm__dotenvx_dotenvx, "npm:@types/bun" as npm__types_bun, "npm:@types/express" as npm__types_express, "npm:express" as npm_express, "npm:tsx" as npm_tsx } from "../json/deps.js";
4
4
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
- import { getInstruction, nodeBunDevToolTasks, pmToRt } from "./utils.js";
5
+ import { getInstruction, getTestTask, nodeBunDevToolTasks, pmToRt } from "./utils.js";
6
6
  //#region src/webframeworks/express.ts
7
7
  const expressDescription = {
8
8
  label: "Express",
@@ -25,6 +25,7 @@ const expressDescription = {
25
25
  },
26
26
  federationFile: "src/federation.ts",
27
27
  loggingFile: "src/logging.ts",
28
+ testFile: "scripts/smoke.test.ts",
28
29
  files: {
29
30
  "src/app.ts": (await readTemplate("express/app.ts")).replace(/\/\* logger \*\//, projectName),
30
31
  "src/index.ts": await readTemplate("express/index.ts")
@@ -46,16 +47,19 @@ const expressDescription = {
46
47
  const TASKS = {
47
48
  deno: {
48
49
  dev: "deno run --allow-read --allow-net --allow-env --allow-sys --watch ./src/index.ts",
49
- prod: "deno run --allow-read --allow-net --allow-env --allow-sys ./src/index.ts"
50
+ prod: "deno run --allow-read --allow-net --allow-env --allow-sys ./src/index.ts",
51
+ test: getTestTask("deno")
50
52
  },
51
53
  bun: {
52
54
  dev: "bun run --hot ./src/index.ts",
53
55
  prod: "bun run ./src/index.ts",
56
+ test: getTestTask("bun"),
54
57
  ...nodeBunDevToolTasks
55
58
  },
56
59
  node: {
57
60
  dev: "dotenvx run -- tsx watch ./src/index.ts",
58
61
  prod: "dotenvx run -- node --import tsx ./src/index.ts",
62
+ test: getTestTask("npm"),
59
63
  ...nodeBunDevToolTasks
60
64
  }
61
65
  };
@@ -1,9 +1,9 @@
1
+ import { PACKAGE_MANAGER } from "../const.js";
1
2
  import { replace } from "../utils.js";
2
3
  import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
- import { PACKAGE_MANAGER } from "../const.js";
4
- import { _hongminhee_x_forwarded_fetch, _hono_hono, npm__dotenvx_dotenvx, npm__hono_node_server, npm__types_bun, npm_hono, npm_tsx, npm_x_forwarded_fetch } from "../json/deps.js";
4
+ import { "@hongminhee/x-forwarded-fetch" as _hongminhee_x_forwarded_fetch, "@hono/hono" as _hono_hono, "npm:@dotenvx/dotenvx" as npm__dotenvx_dotenvx, "npm:@hono/node-server" as npm__hono_node_server, "npm:@types/bun" as npm__types_bun, "npm:hono" as npm_hono, "npm:tsx" as npm_tsx, "npm:x-forwarded-fetch" as npm_x_forwarded_fetch } from "../json/deps.js";
5
5
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
6
- import { getInstruction, nodeBunDevToolTasks, pmToRt } from "./utils.js";
6
+ import { getInstruction, getTestTask, nodeBunDevToolTasks, pmToRt } from "./utils.js";
7
7
  import { pipe } from "@fxts/core";
8
8
  //#region src/webframeworks/hono.ts
9
9
  const honoDescription = {
@@ -18,6 +18,7 @@ const honoDescription = {
18
18
  },
19
19
  federationFile: "src/federation.ts",
20
20
  loggingFile: "src/logging.ts",
21
+ testFile: "scripts/smoke.test.ts",
21
22
  files: {
22
23
  "src/app.tsx": pipe(await readTemplate("hono/app.tsx"), replace(/\/\* hono \*\//, pm === "deno" ? "@hono/hono" : "hono"), replace(/\/\* logger \*\//, projectName)),
23
24
  "src/index.ts": await readTemplate(`hono/index/${pmToRt(pm)}.ts`)
@@ -58,16 +59,19 @@ const getDependencies = (pm) => pm === "deno" ? {
58
59
  const TASKS = {
59
60
  deno: {
60
61
  dev: "deno run -A --watch ./src/index.ts",
61
- prod: "deno run -A ./src/index.ts"
62
+ prod: "deno run -A ./src/index.ts",
63
+ test: getTestTask("deno")
62
64
  },
63
65
  bun: {
64
66
  dev: "bun run --hot ./src/index.ts",
65
67
  prod: "bun run ./src/index.ts",
68
+ test: getTestTask("bun"),
66
69
  ...nodeBunDevToolTasks
67
70
  },
68
71
  node: {
69
72
  dev: "dotenvx run -- tsx watch ./src/index.ts",
70
73
  prod: "dotenvx run -- node --import tsx ./src/index.ts",
74
+ test: getTestTask("npm"),
71
75
  ...nodeBunDevToolTasks
72
76
  }
73
77
  };
@@ -7,6 +7,7 @@ import nextDescription from "./next.js";
7
7
  import nitroDescription from "./nitro.js";
8
8
  import nuxtDescription from "./nuxt.js";
9
9
  import solidstartDescription from "./solidstart.js";
10
+ import sveltekitDescription from "./sveltekit.js";
10
11
  //#region src/webframeworks/mod.ts
11
12
  /**
12
13
  * Registry of all supported web framework configurations.
@@ -24,7 +25,8 @@ const webFrameworks = {
24
25
  next: nextDescription,
25
26
  nitro: nitroDescription,
26
27
  nuxt: nuxtDescription,
27
- solidstart: solidstartDescription
28
+ solidstart: solidstartDescription,
29
+ sveltekit: sveltekitDescription
28
30
  };
29
31
  //#endregion
30
32
  export { webFrameworks as default };
@@ -1,8 +1,8 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
3
- import { npm__types_node_20 } from "../json/deps.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
+ import { "npm:@types/node@20" as npm__types_node_20 } from "../json/deps.js";
4
4
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
- import { getInstruction, getNodeBunDevToolTasks } from "./utils.js";
5
+ import { getInstruction, getNodeBunDevToolTasks, getTestDependencies, getTestTask } from "./utils.js";
6
6
  //#region src/webframeworks/next.ts
7
7
  const nextDescription = {
8
8
  label: "Next.js",
@@ -21,16 +21,21 @@ const nextDescription = {
21
21
  },
22
22
  devDependencies: {
23
23
  "@types/node": npm__types_node_20,
24
- ...defaultDevDependencies
24
+ ...defaultDevDependencies,
25
+ ...getTestDependencies(pm)
25
26
  },
26
27
  federationFile: "federation/index.ts",
27
28
  loggingFile: "logging.ts",
29
+ testFile: "scripts/smoke.test.ts",
28
30
  format: { ignorePatterns: [".next/**"] },
29
31
  files: {
30
32
  "instrumentation.ts": await readTemplate("next/instrumentation.ts"),
31
33
  "middleware.ts": await readTemplate("next/middleware.ts")
32
34
  },
33
- tasks: getNodeBunDevToolTasks(pm),
35
+ tasks: {
36
+ ...getNodeBunDevToolTasks(pm),
37
+ test: getTestTask(pm)
38
+ },
34
39
  instruction: getInstruction(pm, 3e3)
35
40
  })
36
41
  };
@@ -1,7 +1,7 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
3
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
4
- import { getInstruction, getNodeBunDevToolTasks } from "./utils.js";
4
+ import { getInstruction, getNodeBunDevToolTasks, getTestDependencies, getTestTask } from "./utils.js";
5
5
  //#region src/webframeworks/nitro.ts
6
6
  const nitroDescription = {
7
7
  label: "Nitro",
@@ -19,9 +19,13 @@ const nitroDescription = {
19
19
  "@fedify/h3": PACKAGE_VERSION,
20
20
  ...pm === "deno" && defaultDenoDependencies
21
21
  },
22
- devDependencies: defaultDevDependencies,
22
+ devDependencies: {
23
+ ...defaultDevDependencies,
24
+ ...getTestDependencies(pm)
25
+ },
23
26
  federationFile: "server/federation.ts",
24
27
  loggingFile: "server/logging.ts",
28
+ testFile: "scripts/smoke.test.ts",
25
29
  format: { ignorePatterns: [".output/**"] },
26
30
  env: testMode ? { HOST: "127.0.0.1" } : {},
27
31
  files: {
@@ -51,7 +55,10 @@ const nitroDescription = {
51
55
  lib: ["ESNext", "DOM"],
52
56
  baseUrl: "."
53
57
  },
54
- tasks: getNodeBunDevToolTasks(pm),
58
+ tasks: {
59
+ ...getNodeBunDevToolTasks(pm),
60
+ test: getTestTask(pm)
61
+ },
55
62
  instruction: getInstruction(pm, 3e3)
56
63
  })
57
64
  };
@@ -1,8 +1,8 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
3
- import { npm__types_node_25, npm_typescript } from "../json/deps.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
+ import { "npm:@types/node@25" as npm__types_node_25, "npm:typescript" as npm_typescript } from "../json/deps.js";
4
4
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
- import { getInstruction, getNodeBunDevToolTasks } from "./utils.js";
5
+ import { getInstruction, getNodeBunDevToolTasks, getTestDependencies, getTestTask } from "./utils.js";
6
6
  //#region src/webframeworks/nuxt.ts
7
7
  const nuxtDescription = {
8
8
  label: "Nuxt",
@@ -14,18 +14,23 @@ const nuxtDescription = {
14
14
  devDependencies: {
15
15
  ...defaultDevDependencies,
16
16
  "typescript": npm_typescript,
17
- "@types/node": npm__types_node_25
17
+ "@types/node": npm__types_node_25,
18
+ ...getTestDependencies(pm)
18
19
  },
19
20
  federationFile: "server/federation.ts",
20
21
  loggingFile: "server/logging.ts",
21
22
  loggingTemplate: "nuxt/server/logging.ts",
23
+ testFile: "scripts/smoke.test.ts",
22
24
  format: { ignorePatterns: [".output/**"] },
23
25
  env: testMode ? { HOST: "127.0.0.1" } : {},
24
26
  files: {
25
27
  "nuxt.config.ts": await readTemplate("nuxt/nuxt.config.ts"),
26
28
  "server/plugins/logging.ts": await readTemplate("nuxt/server/plugins/logging.ts")
27
29
  },
28
- tasks: getNodeBunDevToolTasks(pm),
30
+ tasks: {
31
+ ...getNodeBunDevToolTasks(pm),
32
+ test: getTestTask(pm)
33
+ },
29
34
  instruction: getInstruction(pm, 3e3)
30
35
  })
31
36
  };
@@ -1,8 +1,8 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
1
  import { PACKAGE_MANAGER } from "../const.js";
3
- import { npm__dotenvx_dotenvx, npm__solidjs_router, npm__solidjs_start, npm__types_node_22, npm_solid_js, npm_typescript, npm_vinxi } from "../json/deps.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
+ import { "npm:@dotenvx/dotenvx" as npm__dotenvx_dotenvx, "npm:@solidjs/router" as npm__solidjs_router, "npm:@solidjs/start" as npm__solidjs_start, "npm:@types/node@22" as npm__types_node_22, "npm:solid-js" as npm_solid_js, "npm:typescript" as npm_typescript, "npm:vinxi" as npm_vinxi } from "../json/deps.js";
4
4
  import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
- import { getInstruction, nodeBunDevToolTasks, pmToRt } from "./utils.js";
5
+ import { getInstruction, getTestDependencies, getTestTask, nodeBunDevToolTasks, pmToRt } from "./utils.js";
6
6
  //#region src/webframeworks/solidstart.ts
7
7
  const NPM_SOLIDSTART = `npm:@solidjs/start@${npm__solidjs_start}`;
8
8
  const solidstartDescription = {
@@ -14,10 +14,12 @@ const solidstartDescription = {
14
14
  devDependencies: {
15
15
  ...defaultDevDependencies,
16
16
  typescript: npm_typescript,
17
- "@types/node": npm__types_node_22
17
+ "@types/node": npm__types_node_22,
18
+ ...getTestDependencies(pm)
18
19
  },
19
20
  federationFile: "src/federation.ts",
20
21
  loggingFile: "src/logging.ts",
22
+ testFile: "scripts/smoke.test.ts",
21
23
  format: { ignorePatterns: [".solid/**", ".vinxi/**"] },
22
24
  files: {
23
25
  "app.config.ts": (await readTemplate("solidstart/app.config.ts")).replace(/\/\* preset \*\//, pm === "deno" ? "deno-server" : "node-server"),
@@ -70,18 +72,21 @@ const TASKS = {
70
72
  deno: {
71
73
  dev: "deno run -A npm:vinxi dev",
72
74
  build: "deno run -A npm:vinxi build",
73
- start: "deno run -A npm:vinxi start"
75
+ start: "deno run -A npm:vinxi start",
76
+ test: getTestTask("deno")
74
77
  },
75
78
  bun: {
76
79
  dev: "bunx vinxi dev",
77
80
  build: "bunx vinxi build",
78
81
  start: "bunx vinxi start",
82
+ test: getTestTask("bun"),
79
83
  ...nodeBunDevToolTasks
80
84
  },
81
85
  node: {
82
86
  dev: "vinxi dev",
83
87
  build: "vinxi build",
84
88
  start: "dotenvx run -- vinxi start",
89
+ test: getTestTask("npm"),
85
90
  ...nodeBunDevToolTasks
86
91
  }
87
92
  };
@@ -0,0 +1,82 @@
1
+ import { PACKAGE_MANAGER } from "../const.js";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
+ import { "npm:@dotenvx/dotenvx" as npm__dotenvx_dotenvx, "npm:@types/node@25" as npm__types_node_25, "npm:typescript" as npm_typescript } from "../json/deps.js";
4
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
+ import { getInstruction, getTestDependencies, getTestTask, nodeBunDevToolTasks, pmToRt } from "./utils.js";
6
+ //#region src/webframeworks/sveltekit.ts
7
+ const sveltekitDescription = {
8
+ label: "SvelteKit",
9
+ packageManagers: PACKAGE_MANAGER,
10
+ defaultPort: 5173,
11
+ init: async ({ packageManager: pm, testMode }) => ({
12
+ command: Array.from(getInitCommand(pm)),
13
+ dependencies: {
14
+ "@fedify/sveltekit": PACKAGE_VERSION,
15
+ ...pm === "deno" ? defaultDenoDependencies : {}
16
+ },
17
+ devDependencies: {
18
+ ...defaultDevDependencies,
19
+ "typescript": npm_typescript,
20
+ "@types/node": npm__types_node_25,
21
+ ...pmToRt(pm) === "deno" ? {} : { "@dotenvx/dotenvx": npm__dotenvx_dotenvx },
22
+ ...getTestDependencies(pm)
23
+ },
24
+ federationFile: "src/lib/federation.ts",
25
+ loggingFile: "src/lib/logging.ts",
26
+ testFile: "scripts/smoke.test.ts",
27
+ env: testMode ? { HOST: "127.0.0.1" } : {},
28
+ files: { "src/hooks.server.ts": await readTemplate("sveltekit/hooks.server.ts") },
29
+ tasks: pmToRt(pm) === "deno" ? { test: getTestTask("deno") } : {
30
+ ...TASKS,
31
+ test: getTestTask(pm)
32
+ },
33
+ instruction: getInstruction(pm, 5173)
34
+ })
35
+ };
36
+ /**
37
+ * Returns the shell command array to scaffold a new SvelteKit project
38
+ * in the current directory using the given package manager.
39
+ */
40
+ function* getInitCommand(pm) {
41
+ yield* getSvelteKitInitCommand(pm);
42
+ yield* [
43
+ ".",
44
+ "--template",
45
+ "minimal",
46
+ "--types",
47
+ "ts",
48
+ "--no-add-ons",
49
+ "--no-dir-check",
50
+ "--no-download-check",
51
+ "--install",
52
+ pm
53
+ ];
54
+ }
55
+ const getSvelteKitInitCommand = (pm) => pm === "bun" ? [
56
+ "bunx",
57
+ "sv",
58
+ "create"
59
+ ] : pm === "deno" ? [
60
+ "deno",
61
+ "run",
62
+ "-A",
63
+ "npm:sv",
64
+ "create"
65
+ ] : pm === "npm" ? [
66
+ "npx",
67
+ "sv",
68
+ "create"
69
+ ] : [
70
+ pm,
71
+ "dlx",
72
+ "sv",
73
+ "create"
74
+ ];
75
+ const TASKS = {
76
+ "dev": "dotenvx run -- vite dev",
77
+ "build": "dotenvx run -- vite build",
78
+ "preview": "dotenvx run -- vite preview",
79
+ ...nodeBunDevToolTasks
80
+ };
81
+ //#endregion
82
+ export { sveltekitDescription as default };
@@ -1,4 +1,5 @@
1
1
  import { getDevCommand } from "../lib.js";
2
+ import { "npm:tsx" as npm_tsx } from "../json/deps.js";
2
3
  import { commandLine, message } from "@optique/core/message";
3
4
  //#region src/webframeworks/utils.ts
4
5
  const nodeBunDevToolTasks = {
@@ -7,6 +8,19 @@ const nodeBunDevToolTasks = {
7
8
  lint: "oxlint ."
8
9
  };
9
10
  const getNodeBunDevToolTasks = (pm) => pm === "deno" ? {} : nodeBunDevToolTasks;
11
+ const SMOKE_TEST_FILE = "scripts/smoke.test.ts";
12
+ /**
13
+ * Returns the `test` task command that runs the generated smoke-test
14
+ * script (`WebFrameworkInitializer.testFile`) with the runtime matching the
15
+ * given package manager.
16
+ */
17
+ const getTestTask = (pm) => pmToRt(pm) === "deno" ? `deno run -A ${SMOKE_TEST_FILE}` : pmToRt(pm) === "bun" ? `bun run ${SMOKE_TEST_FILE}` : `tsx ${SMOKE_TEST_FILE}`;
18
+ /**
19
+ * Returns the dev dependencies the `test` task needs beyond what the
20
+ * framework already declares. Node.js runs the smoke-test script through
21
+ * `tsx`; Deno and Bun execute TypeScript natively.
22
+ */
23
+ const getTestDependencies = (pm) => pmToRt(pm) === "node" ? { tsx: npm_tsx } : {};
10
24
  /**
11
25
  * Generates the post-initialization instruction message that shows
12
26
  * the user how to start the dev server and look up an actor.
@@ -32,4 +46,4 @@ Then, try to look up an actor from your server:
32
46
  */
33
47
  const pmToRt = (pm) => pm !== "deno" && pm !== "bun" ? "node" : pm;
34
48
  //#endregion
35
- export { getInstruction, getNodeBunDevToolTasks, nodeBunDevToolTasks, pmToRt };
49
+ export { getInstruction, getNodeBunDevToolTasks, getTestDependencies, getTestTask, nodeBunDevToolTasks, pmToRt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/init",
3
- "version": "2.4.0-pr.934.40+3331d302",
3
+ "version": "2.4.0",
4
4
  "description": "Project initializer for Fedify",
5
5
  "keywords": [
6
6
  "fedify",
@@ -46,18 +46,19 @@
46
46
  ],
47
47
  "dependencies": {
48
48
  "@david/dax": "npm:dax@^0.46.1",
49
- "@fxts/core": "^1.20.0",
49
+ "@fxts/core": "^1.21.1",
50
50
  "@inquirer/prompts": "^7.8.4",
51
51
  "@logtape/logtape": "^2.2.0",
52
- "@optique/core": "^1.1.0",
53
- "@optique/run": "^1.1.0",
52
+ "@optique/core": "^1.3.2",
53
+ "@optique/run": "^1.3.2",
54
54
  "chalk": "^5.6.2",
55
55
  "es-toolkit": "1.46.1",
56
56
  "inquirer-toggle": "^1.0.1",
57
57
  "jsonc-parser": "^3.3.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/node": "^22.17.0",
60
+ "@std/assert": "npm:@jsr/std__assert@^1.0.13",
61
+ "@types/node": "^24.12.2",
61
62
  "tsdown": "^0.22.0",
62
63
  "typescript": "^6.0.0"
63
64
  },