@fedify/init 2.2.0-dev.613 → 2.2.0-dev.628

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 (72) hide show
  1. package/dist/action/{configs.js → configs.mjs} +7 -9
  2. package/dist/action/{const.js → const.mjs} +1 -3
  3. package/dist/action/{deps.js → deps.mjs} +6 -10
  4. package/dist/action/{dir.js → dir.mjs} +1 -3
  5. package/dist/action/{env.js → env.mjs} +3 -6
  6. package/dist/action/{install.js → install.mjs} +2 -5
  7. package/dist/action/{mod.d.ts → mod.d.mts} +2 -3
  8. package/dist/action/{mod.js → mod.mjs} +15 -18
  9. package/dist/action/{notice.js → notice.mjs} +4 -6
  10. package/dist/action/{patch.js → patch.mjs} +8 -11
  11. package/dist/action/{precommand.js → precommand.mjs} +2 -5
  12. package/dist/action/{recommend.js → recommend.mjs} +5 -8
  13. package/dist/action/{set.js → set.mjs} +5 -8
  14. package/dist/action/{templates.js → templates.mjs} +4 -6
  15. package/dist/action/{utils.js → utils.mjs} +1 -3
  16. package/dist/ask/{dir.js → dir.mjs} +3 -6
  17. package/dist/ask/{kv.js → kv.mjs} +4 -7
  18. package/dist/ask/{mod.js → mod.mjs} +7 -10
  19. package/dist/ask/{mq.js → mq.mjs} +4 -7
  20. package/dist/ask/{pm.js → pm.mjs} +8 -11
  21. package/dist/ask/{wf.js → wf.mjs} +4 -7
  22. package/dist/{command.d.ts → command.d.mts} +9 -13
  23. package/dist/{command.js → command.mjs} +2 -4
  24. package/dist/{const.d.ts → const.d.mts} +0 -2
  25. package/dist/{const.js → const.mjs} +3 -5
  26. package/dist/deno.mjs +4 -0
  27. package/dist/json/biome.mjs +13 -0
  28. package/dist/json/db-to-check.mjs +25 -0
  29. package/dist/json/kv.mjs +75 -0
  30. package/dist/json/mq.mjs +93 -0
  31. package/dist/json/pm.mjs +35 -0
  32. package/dist/json/rt.mjs +30 -0
  33. package/dist/json/vscode-settings-for-deno.mjs +38 -0
  34. package/dist/json/vscode-settings.mjs +36 -0
  35. package/dist/{lib.js → lib.mjs} +9 -12
  36. package/dist/mod.d.mts +3 -0
  37. package/dist/mod.mjs +3 -0
  38. package/dist/test/{action.js → action.mjs} +7 -10
  39. package/dist/test/{create.js → create.mjs} +14 -21
  40. package/dist/test/{db.js → db.mjs} +5 -8
  41. package/dist/test/{fill.js → fill.mjs} +10 -12
  42. package/dist/test/{lookup.js → lookup.mjs} +10 -16
  43. package/dist/test/{mod.js → mod.mjs} +6 -8
  44. package/dist/test/{run.js → run.mjs} +5 -8
  45. package/dist/test/{utils.js → utils.mjs} +2 -4
  46. package/dist/{types.d.ts → types.d.mts} +3 -11
  47. package/dist/{utils.d.ts → utils.d.mts} +0 -3
  48. package/dist/{utils.js → utils.mjs} +15 -23
  49. package/dist/webframeworks/{astro.js → astro.mjs} +5 -8
  50. package/dist/webframeworks/{bare-bones.js → bare-bones.mjs} +5 -8
  51. package/dist/webframeworks/{const.js → const.mjs} +2 -4
  52. package/dist/webframeworks/{elysia.js → elysia.mjs} +5 -8
  53. package/dist/webframeworks/{express.js → express.mjs} +5 -8
  54. package/dist/webframeworks/{hono.js → hono.mjs} +6 -9
  55. package/dist/webframeworks/mod.mjs +26 -0
  56. package/dist/webframeworks/{next.js → next.mjs} +5 -8
  57. package/dist/webframeworks/{nitro.js → nitro.mjs} +5 -8
  58. package/dist/webframeworks/{utils.js → utils.mjs} +2 -4
  59. package/package.json +3 -3
  60. package/dist/deno.js +0 -38
  61. package/dist/json/biome.js +0 -18
  62. package/dist/json/db-to-check.js +0 -30
  63. package/dist/json/kv.js +0 -81
  64. package/dist/json/mq.js +0 -100
  65. package/dist/json/pm.js +0 -41
  66. package/dist/json/rt.js +0 -36
  67. package/dist/json/vscode-settings-for-deno.js +0 -50
  68. package/dist/json/vscode-settings.js +0 -46
  69. package/dist/mod.d.ts +0 -3
  70. package/dist/mod.js +0 -4
  71. package/dist/webframeworks/mod.js +0 -29
  72. /package/dist/test/{mod.d.ts → mod.d.mts} +0 -0
@@ -1,13 +1,12 @@
1
- import { printErrorMessage, printMessage, runSubCommand } from "../utils.js";
2
- import { getDevCommand } from "../lib.js";
3
- import webframeworks_default from "../webframeworks/mod.js";
1
+ import { printErrorMessage, printMessage, runSubCommand } from "../utils.mjs";
2
+ import { getDevCommand } from "../lib.mjs";
3
+ import webFrameworks from "../webframeworks/mod.mjs";
4
4
  import process from "node:process";
5
5
  import { values } from "@optique/core";
6
6
  import { spawn } from "node:child_process";
7
7
  import { createWriteStream } from "node:fs";
8
8
  import { join, sep } from "node:path";
9
9
  import { isEmpty } from "@fxts/core/index.js";
10
-
11
10
  //#region src/test/lookup.ts
12
11
  const HANDLE = "john";
13
12
  const STARTUP_TIMEOUT = 3e4;
@@ -38,8 +37,7 @@ function filterWebFrameworks(dirs) {
38
37
  const wfs = new Set(dirs.map((dir) => dir.split(sep).slice(-4, -3)[0]));
39
38
  const hasBanned = BANNED_WFS.filter((wf) => wfs.has(wf));
40
39
  if (isEmpty(hasBanned)) return dirs;
41
- const bannedLabels = hasBanned.map((wf) => webframeworks_default[wf]["label"]);
42
- printErrorMessage`\n${values(bannedLabels)} is not supported in lookup test yet.`;
40
+ printErrorMessage`\n${values(hasBanned.map((wf) => webFrameworks[wf]["label"]))} is not supported in lookup test yet.`;
43
41
  return dirs.filter((dir) => !BANNED_WFS.includes(dir.split(sep).slice(-4, -3)[0]));
44
42
  }
45
43
  /**
@@ -53,7 +51,7 @@ async function testApp(dir) {
53
51
  kv,
54
52
  mq
55
53
  ])}...`;
56
- const result = await serverClosure(dir, getDevCommand(pm), webframeworks_default[wf].defaultPort, sendLookup).catch(() => false);
54
+ const result = await serverClosure(dir, getDevCommand(pm), webFrameworks[wf].defaultPort, sendLookup).catch(() => false);
57
55
  printMessage` Lookup ${result ? "successful" : "failed"} for ${values([
58
56
  wf,
59
57
  pm,
@@ -70,8 +68,7 @@ const sendLookup = async (port) => {
70
68
  const serverUrl = `http://localhost:${port}`;
71
69
  const lookupTarget = `${serverUrl}/users/${HANDLE}`;
72
70
  printMessage` Waiting for server to start at ${serverUrl}...`;
73
- const isReady = await waitForServer(serverUrl, STARTUP_TIMEOUT);
74
- if (!isReady) {
71
+ if (!await waitForServer(serverUrl, STARTUP_TIMEOUT)) {
75
72
  printErrorMessage`Server did not start within \
76
73
  ${String(STARTUP_TIMEOUT)}ms`;
77
74
  return false;
@@ -98,8 +95,7 @@ async function waitForServer(url, timeout) {
98
95
  const startTime = Date.now();
99
96
  while (Date.now() - startTime < timeout) {
100
97
  try {
101
- const response = await fetch(url, { signal: AbortSignal.timeout(1e3) });
102
- if (response.ok) return true;
98
+ if ((await fetch(url, { signal: AbortSignal.timeout(1e3) })).ok) return true;
103
99
  } catch {}
104
100
  await new Promise((resolve) => setTimeout(resolve, 500));
105
101
  }
@@ -121,12 +117,11 @@ async function serverClosure(dir, cmd, defaultPort, callback) {
121
117
  serverProcess.stdout?.pipe(stdout);
122
118
  serverProcess.stderr?.pipe(stderr);
123
119
  try {
124
- const port = await determinePort(serverProcess).catch((err) => {
120
+ return await callback(await determinePort(serverProcess).catch((err) => {
125
121
  printErrorMessage`Failed to determine server port: ${err.message}`;
126
122
  printErrorMessage`Use default port ${String(defaultPort)} for lookup.`;
127
123
  return defaultPort;
128
- });
129
- return await callback(port);
124
+ }));
130
125
  } finally {
131
126
  try {
132
127
  process.kill(-serverProcess.pid, "SIGKILL");
@@ -186,6 +181,5 @@ function determinePort(server) {
186
181
  });
187
182
  });
188
183
  }
189
-
190
184
  //#endregion
191
- export { runServerAndLookupUser };
185
+ export { runServerAndLookupUser as default };
@@ -1,16 +1,14 @@
1
- import { testInitCommand } from "../command.js";
2
- import action_default from "./action.js";
1
+ import { testInitCommand } from "../command.mjs";
2
+ import runTestInit from "./action.mjs";
3
3
  import { run } from "@optique/run";
4
-
5
4
  //#region src/test/mod.ts
6
5
  async function main() {
7
6
  console.log("Running test-init command...");
8
- const result = run(testInitCommand, {
7
+ await runTestInit(run(testInitCommand, {
9
8
  programName: "fedify-test-init",
10
9
  help: "both"
11
- });
12
- await action_default(result);
10
+ }));
13
11
  }
14
12
  await main();
15
-
16
- //#endregion
13
+ //#endregion
14
+ export {};
@@ -1,13 +1,11 @@
1
- import { printMessage } from "../utils.js";
2
- import create_default, { filterOptions, generateTestCases } from "./create.js";
3
- import { runServerAndLookupUser } from "./lookup.js";
1
+ import { printMessage } from "../utils.mjs";
2
+ import createTestApp, { filterOptions, generateTestCases } from "./create.mjs";
3
+ import runServerAndLookupUser from "./lookup.mjs";
4
4
  import { always, filter, map, pipe, tap, unless } from "@fxts/core";
5
5
  import { optionNames } from "@optique/core";
6
6
  import { join as join$1 } from "node:path";
7
-
8
7
  //#region src/test/run.ts
9
- const runTests = (dry) => ({ testDirPrefix, dryRun, hydRun,...options }) => pipe(options, printStartMessage(dry), generateTestCases, filter(filterOptions), map(create_default(join$1(testDirPrefix, getMid(dryRun, hydRun, dry)), dry)), Array.fromAsync, unless(always(dry), runServerAndLookupUser));
10
- var run_default = runTests;
8
+ const runTests = (dry) => ({ testDirPrefix, dryRun, hydRun, ...options }) => pipe(options, printStartMessage(dry), generateTestCases, filter(filterOptions), map(createTestApp(join$1(testDirPrefix, getMid(dryRun, hydRun, dry)), dry)), Array.fromAsync, unless(always(dry), runServerAndLookupUser));
11
9
  const printStartMessage = (dry) => tap(() => printMessage`\n
12
10
  Init ${dry ? "Dry" : "Hyd"} Test start!
13
11
  Options: ${optionNames([
@@ -17,6 +15,5 @@ Options: ${optionNames([
17
15
  "Message Queue"
18
16
  ])}`);
19
17
  const getMid = (dryRun, hydRun, dry) => dryRun === hydRun ? dry ? "dry" : "hyd" : "";
20
-
21
18
  //#endregion
22
- export { run_default as default };
19
+ export { runTests as default };
@@ -1,8 +1,7 @@
1
- import { printMessage } from "../utils.js";
1
+ import { printMessage } from "../utils.mjs";
2
2
  import { rm } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import { tmpdir } from "node:os";
5
-
6
5
  //#region src/test/utils.ts
7
6
  const genRunId = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`;
8
7
  const genTestDirPrefix = ({ runId }) => join(tmpdir(), "fedify-init", runId);
@@ -10,6 +9,5 @@ const emptyTestDir = ({ testDirPrefix }) => rm(testDirPrefix, { recursive: true
10
9
  const logTestDir = ({ runId, testDirPrefix }) => printMessage`Test running with
11
10
  Run ID: ${runId}
12
11
  Path: ${testDirPrefix}`;
13
-
14
12
  //#endregion
15
- export { emptyTestDir, genRunId, genTestDirPrefix, logTestDir };
13
+ export { emptyTestDir, genRunId, genTestDirPrefix, logTestDir };
@@ -1,13 +1,11 @@
1
- import { InitCommand } from "./command.js";
2
- import { PACKAGE_MANAGER } from "./const.js";
3
- import { RequiredNotNull } from "./utils.js";
1
+ import { InitCommand } from "./command.mjs";
2
+ import { PACKAGE_MANAGER } from "./const.mjs";
3
+ import { RequiredNotNull } from "./utils.mjs";
4
4
  import { Message } from "@optique/core";
5
5
 
6
6
  //#region src/types.d.ts
7
7
  /** Supported package manager identifiers: `"deno"`, `"pnpm"`, `"bun"`, `"yarn"`, `"npm"`. */
8
8
  type PackageManager = typeof PACKAGE_MANAGER[number];
9
- /** Supported web framework identifiers: `"hono"`, `"nitro"`, `"next"`, `"elysia"`, `"astro"`, `"express"`. */
10
-
11
9
  /**
12
10
  * The result returned by a web framework's `init()` function.
13
11
  * Contains all the information needed to scaffold a project for that framework,
@@ -33,11 +31,6 @@ interface WebFrameworkInitializer {
33
31
  /** Instructions shown to the user after project initialization is complete. */
34
32
  instruction: Message;
35
33
  }
36
- /**
37
- * Describes a web framework integration (Hono, Express, Nitro, Next.js,
38
- * ElysiaJS, Astro) and how to initialize a project with it.
39
- */
40
-
41
34
  /**
42
35
  * Describes a message queue backend (Deno KV, Redis, PostgreSQL, AMQP) and
43
36
  * the dependencies, imports, and environment variables it requires.
@@ -106,6 +99,5 @@ interface InitCommandData extends InitCommandOptions {
106
99
  /** Combined environment variables from both KV store and message queue. */
107
100
  readonly env: Record<string, string>;
108
101
  }
109
- /** A synchronous side-effect function that operates on {@link InitCommandData}. */
110
102
  //#endregion
111
103
  export { InitCommandData };
@@ -1,12 +1,9 @@
1
1
  import { message } from "@optique/core";
2
- import "chalk";
3
2
  import { toMerged } from "es-toolkit";
4
3
  import { spawn } from "node:child_process";
5
4
 
6
5
  //#region src/utils.d.ts
7
-
8
6
  /** Makes all properties of `T` required and non-nullable. */
9
7
  type RequiredNotNull<T> = { [P in keyof T]: NonNullable<T[P]> };
10
- /** Type guard that checks whether a value is a `Promise`. */
11
8
  //#endregion
12
9
  export { RequiredNotNull };
@@ -5,15 +5,8 @@ import { message } from "@optique/core";
5
5
  import { Chalk } from "chalk";
6
6
  import { flow, toMerged } from "es-toolkit";
7
7
  import { spawn } from "node:child_process";
8
-
9
- //#region src/utils.ts
10
- /**
11
- * Whether terminal color output is enabled.
12
- * `true` when stdout is a TTY and the `NO_COLOR` environment variable is not set.
13
- */
14
- const colorEnabled = process.stdout.isTTY && !("NO_COLOR" in process.env && process.env.NO_COLOR !== "");
15
8
  /** Chalk instance configured based on {@link colorEnabled}. */
16
- const colors = new Chalk(colorEnabled ? {} : { level: 0 });
9
+ const colors = new Chalk(process.stdout.isTTY && !("NO_COLOR" in process.env && process.env.NO_COLOR !== "") ? {} : { level: 0 });
17
10
  /** Type guard that checks whether a value is a `Promise`. */
18
11
  const isPromise = (value) => value instanceof Promise;
19
12
  /**
@@ -27,7 +20,7 @@ const isPromise = (value) => value instanceof Promise;
27
20
  * @returns A function that augments the input object with the computed property
28
21
  */
29
22
  function set(key, f) {
30
- return (obj) => {
23
+ return ((obj) => {
31
24
  const result = f(obj);
32
25
  if (isPromise(result)) return result.then((value) => ({
33
26
  ...obj,
@@ -37,7 +30,7 @@ function set(key, f) {
37
30
  ...obj,
38
31
  [key]: result
39
32
  };
40
- };
33
+ });
41
34
  }
42
35
  /**
43
36
  * Curried deep merge helper. Returns a function that merges `source` into the
@@ -48,12 +41,12 @@ const merge$1 = (source = {}) => (target = {}) => toMerged(target, source);
48
41
  * Curried `String.prototype.replace`. Returns a function that performs the
49
42
  * replacement on the given text.
50
43
  */
51
- const replace = (pattern, replacement) => (text$1) => text$1.replace(pattern, replacement);
44
+ const replace = (pattern, replacement) => (text) => text.replace(pattern, replacement);
52
45
  /**
53
46
  * Curried `String.prototype.replaceAll`. Returns a function that replaces all
54
47
  * occurrences of the pattern in the given text.
55
48
  */
56
- const replaceAll = (pattern, replacement) => (text$1) => text$1.replaceAll(pattern, replacement);
49
+ const replaceAll = (pattern, replacement) => (text) => text.replaceAll(pattern, replacement);
57
50
  /** Serializes a value to a pretty-printed JSON string with a trailing newline. */
58
51
  const formatJson = (obj) => JSON.stringify(obj, null, 2) + "\n";
59
52
  /** Checks whether a string or array-like value has a length greater than zero. */
@@ -66,14 +59,14 @@ const isNotFoundError = (e) => isObject(e) && "code" in e && e.code === "ENOENT"
66
59
  */
67
60
  var CommandError = class extends Error {
68
61
  commandLine;
69
- constructor(message$1, stdout, stderr, code, command$1) {
70
- super(message$1);
62
+ constructor(message, stdout, stderr, code, command) {
63
+ super(message);
71
64
  this.stdout = stdout;
72
65
  this.stderr = stderr;
73
66
  this.code = code;
74
- this.command = command$1;
67
+ this.command = command;
75
68
  this.name = "CommandError";
76
- this.commandLine = command$1.join(" ");
69
+ this.commandLine = command.join(" ");
77
70
  }
78
71
  };
79
72
  /**
@@ -86,8 +79,8 @@ var CommandError = class extends Error {
86
79
  * @param options - Options forwarded to `node:child_process.spawn`
87
80
  * @returns A promise resolving to `{ stdout, stderr }`
88
81
  */
89
- const runSubCommand = async (command$1, options) => {
90
- const commands = command$1.reduce((acc, cur) => {
82
+ const runSubCommand = async (command, options) => {
83
+ const commands = command.reduce((acc, cur) => {
91
84
  if (cur === "&&") acc.push([]);
92
85
  else {
93
86
  if (acc.length === 0) acc.push([]);
@@ -112,10 +105,10 @@ const runSubCommand = async (command$1, options) => {
112
105
  }
113
106
  return results;
114
107
  };
115
- const runSingularCommand = (command$1, options) => new Promise((resolve, reject) => {
108
+ const runSingularCommand = (command, options) => new Promise((resolve, reject) => {
116
109
  let stdout = "";
117
110
  let stderr = "";
118
- const child = spawn(command$1[0], command$1.slice(1), options);
111
+ const child = spawn(command[0], command.slice(1), options);
119
112
  child.stdout?.on("data", (data) => {
120
113
  stdout += data.toString();
121
114
  });
@@ -127,7 +120,7 @@ const runSingularCommand = (command$1, options) => new Promise((resolve, reject)
127
120
  stdout: stdout.trim(),
128
121
  stderr: stderr.trim()
129
122
  });
130
- else reject(new CommandError(`Command exited with code ${code ?? "unknown"}`, stdout.trim(), stderr.trim(), code ?? -1, command$1));
123
+ else reject(new CommandError(`Command exited with code ${code ?? "unknown"}`, stdout.trim(), stderr.trim(), code ?? -1, command));
131
124
  });
132
125
  child.on("error", (error) => {
133
126
  reject(error);
@@ -157,6 +150,5 @@ function* product(...[head, ...tail]) {
157
150
  const printMessage = flow(message, print);
158
151
  /** Prints a formatted error message to stderr using `@optique/run`'s `printError`. */
159
152
  const printErrorMessage = flow(message, printError);
160
-
161
153
  //#endregion
162
- export { CommandError, colors, exit, formatJson, getCwd, getOsType, isNotFoundError, merge$1 as merge, notEmpty, printErrorMessage, printMessage, product, replace, replaceAll, runSubCommand, set };
154
+ export { CommandError, colors, exit, formatJson, getCwd, getOsType, isNotFoundError, merge$1 as merge, notEmpty, printErrorMessage, printMessage, product, replace, replaceAll, runSubCommand, set };
@@ -1,8 +1,7 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
- import { PACKAGE_MANAGER } from "../const.js";
3
- import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
4
- import { getInstruction } from "./utils.js";
5
-
1
+ import { PACKAGE_VERSION, readTemplate } from "../lib.mjs";
2
+ import { PACKAGE_MANAGER } from "../const.mjs";
3
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.mjs";
4
+ import { getInstruction } from "./utils.mjs";
6
5
  //#region src/webframeworks/astro.ts
7
6
  const astroDescription = {
8
7
  label: "Astro",
@@ -52,7 +51,6 @@ const astroDescription = {
52
51
  instruction: getInstruction(pm, 4321)
53
52
  })
54
53
  };
55
- var astro_default = astroDescription;
56
54
  /**
57
55
  * Returns the shell command array to scaffold a new Astro project
58
56
  * in the current directory using the given package manager.
@@ -78,6 +76,5 @@ const createAstroAppCommand = (pm) => pm === "deno" ? [
78
76
  "-y",
79
77
  "--npm"
80
78
  ] : [pm, "create"];
81
-
82
79
  //#endregion
83
- export { astro_default as default };
80
+ export { astroDescription as default };
@@ -1,8 +1,7 @@
1
- import { readTemplate } from "../lib.js";
2
- import { PACKAGE_MANAGER } from "../const.js";
3
- import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
4
- import { getInstruction, packageManagerToRuntime } from "./utils.js";
5
-
1
+ import { readTemplate } from "../lib.mjs";
2
+ import { PACKAGE_MANAGER } from "../const.mjs";
3
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.mjs";
4
+ import { getInstruction, packageManagerToRuntime } from "./utils.mjs";
6
5
  //#region src/webframeworks/bare-bones.ts
7
6
  const bareBonesDescription = {
8
7
  label: "Bare-bones",
@@ -49,7 +48,5 @@ const bareBonesDescription = {
49
48
  instruction: getInstruction(pm, 8e3)
50
49
  })
51
50
  };
52
- var bare_bones_default = bareBonesDescription;
53
-
54
51
  //#endregion
55
- export { bare_bones_default as default };
52
+ export { bareBonesDescription as default };
@@ -1,11 +1,9 @@
1
- import { PACKAGE_VERSION } from "../lib.js";
2
-
1
+ import { PACKAGE_VERSION } from "../lib.mjs";
3
2
  //#region src/webframeworks/const.ts
4
3
  const defaultDevDependencies = {
5
4
  "@fedify/lint": PACKAGE_VERSION,
6
5
  "eslint": "^9.0.0"
7
6
  };
8
7
  const defaultDenoDependencies = { "@fedify/lint": PACKAGE_VERSION };
9
-
10
8
  //#endregion
11
- export { defaultDenoDependencies, defaultDevDependencies };
9
+ export { defaultDenoDependencies, defaultDevDependencies };
@@ -1,8 +1,7 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
- import { PACKAGE_MANAGER } from "../const.js";
3
- import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
4
- import { getInstruction, packageManagerToRuntime } from "./utils.js";
5
-
1
+ import { PACKAGE_VERSION, readTemplate } from "../lib.mjs";
2
+ import { PACKAGE_MANAGER } from "../const.mjs";
3
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.mjs";
4
+ import { getInstruction, packageManagerToRuntime } from "./utils.mjs";
6
5
  //#region src/webframeworks/elysia.ts
7
6
  const elysiaDescription = {
8
7
  label: "ElysiaJS",
@@ -60,7 +59,5 @@ const elysiaDescription = {
60
59
  instruction: getInstruction(pm, 3e3)
61
60
  })
62
61
  };
63
- var elysia_default = elysiaDescription;
64
-
65
62
  //#endregion
66
- export { elysia_default as default };
63
+ export { elysiaDescription as default };
@@ -1,8 +1,7 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
- import { PACKAGE_MANAGER } from "../const.js";
3
- import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
4
- import { getInstruction } from "./utils.js";
5
-
1
+ import { PACKAGE_VERSION, readTemplate } from "../lib.mjs";
2
+ import { PACKAGE_MANAGER } from "../const.mjs";
3
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.mjs";
4
+ import { getInstruction } from "./utils.mjs";
6
5
  //#region src/webframeworks/express.ts
7
6
  const expressDescription = {
8
7
  label: "Express",
@@ -48,7 +47,5 @@ const expressDescription = {
48
47
  instruction: getInstruction(pm, 8e3)
49
48
  })
50
49
  };
51
- var express_default = expressDescription;
52
-
53
50
  //#endregion
54
- export { express_default as default };
51
+ export { expressDescription as default };
@@ -1,10 +1,9 @@
1
- import { replace } from "../utils.js";
2
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
3
- import { PACKAGE_MANAGER } from "../const.js";
4
- import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
5
- import { getInstruction, packageManagerToRuntime } from "./utils.js";
1
+ import { replace } from "../utils.mjs";
2
+ import { PACKAGE_VERSION, readTemplate } from "../lib.mjs";
3
+ import { PACKAGE_MANAGER } from "../const.mjs";
4
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.mjs";
5
+ import { getInstruction, packageManagerToRuntime } from "./utils.mjs";
6
6
  import { pipe } from "@fxts/core";
7
-
8
7
  //#region src/webframeworks/hono.ts
9
8
  const honoDescription = {
10
9
  label: "Hono",
@@ -60,7 +59,5 @@ const honoDescription = {
60
59
  instruction: getInstruction(pm, 8e3)
61
60
  })
62
61
  };
63
- var hono_default = honoDescription;
64
-
65
62
  //#endregion
66
- export { hono_default as default };
63
+ export { honoDescription as default };
@@ -0,0 +1,26 @@
1
+ import astroDescription from "./astro.mjs";
2
+ import bareBonesDescription from "./bare-bones.mjs";
3
+ import elysiaDescription from "./elysia.mjs";
4
+ import expressDescription from "./express.mjs";
5
+ import honoDescription from "./hono.mjs";
6
+ import nextDescription from "./next.mjs";
7
+ import nitroDescription from "./nitro.mjs";
8
+ //#region src/webframeworks/mod.ts
9
+ /**
10
+ * Registry of all supported web framework configurations.
11
+ * Each entry defines the framework's label, supported package managers,
12
+ * default port, and an `init()` factory that produces a
13
+ * {@link WebFrameworkInitializer} with dependencies, templates, tasks,
14
+ * and instructions tailored to the selected package manager.
15
+ */
16
+ const webFrameworks = {
17
+ "bare-bones": bareBonesDescription,
18
+ astro: astroDescription,
19
+ elysia: elysiaDescription,
20
+ express: expressDescription,
21
+ hono: honoDescription,
22
+ next: nextDescription,
23
+ nitro: nitroDescription
24
+ };
25
+ //#endregion
26
+ export { webFrameworks as default };
@@ -1,8 +1,7 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
- import { PACKAGE_MANAGER } from "../const.js";
3
- import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
4
- import { getInstruction } from "./utils.js";
5
-
1
+ import { PACKAGE_VERSION, readTemplate } from "../lib.mjs";
2
+ import { PACKAGE_MANAGER } from "../const.mjs";
3
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.mjs";
4
+ import { getInstruction } from "./utils.mjs";
6
5
  //#region src/webframeworks/next.ts
7
6
  const nextDescription = {
8
7
  label: "Next.js",
@@ -28,7 +27,6 @@ const nextDescription = {
28
27
  instruction: getInstruction(pm, 3e3)
29
28
  })
30
29
  };
31
- var next_default = nextDescription;
32
30
  /**
33
31
  * Returns the shell command array to scaffold a new Next.js project
34
32
  * in the current directory using the given package manager.
@@ -51,6 +49,5 @@ const createNextAppCommand = (pm) => pm === "deno" ? [
51
49
  "dlx",
52
50
  "create-next-app"
53
51
  ];
54
-
55
52
  //#endregion
56
- export { next_default as default };
53
+ export { nextDescription as default };
@@ -1,8 +1,7 @@
1
- import { PACKAGE_VERSION, readTemplate } from "../lib.js";
2
- import { PACKAGE_MANAGER } from "../const.js";
3
- import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
4
- import { getInstruction } from "./utils.js";
5
-
1
+ import { PACKAGE_VERSION, readTemplate } from "../lib.mjs";
2
+ import { PACKAGE_MANAGER } from "../const.mjs";
3
+ import { defaultDenoDependencies, defaultDevDependencies } from "./const.mjs";
4
+ import { getInstruction } from "./utils.mjs";
6
5
  //#region src/webframeworks/nitro.ts
7
6
  const nitroDescription = {
8
7
  label: "Nitro",
@@ -28,7 +27,6 @@ const nitroDescription = {
28
27
  instruction: getInstruction(pm, 3e3)
29
28
  })
30
29
  };
31
- var nitro_default = nitroDescription;
32
30
  /**
33
31
  * Returns the shell command array to scaffold a new Nitro project
34
32
  * in the current directory using the given package manager.
@@ -48,6 +46,5 @@ const createNitroAppCommand = (pm) => pm === "deno" ? [
48
46
  "run",
49
47
  "-A"
50
48
  ] : pm === "bun" ? ["bunx"] : pm === "npm" ? ["npx"] : [pm, "dlx"];
51
-
52
49
  //#endregion
53
- export { nitro_default as default };
50
+ export { nitroDescription as default };
@@ -1,6 +1,5 @@
1
- import { getDevCommand } from "../lib.js";
1
+ import { getDevCommand } from "../lib.mjs";
2
2
  import { commandLine, message } from "@optique/core/message";
3
-
4
3
  //#region src/webframeworks/utils.ts
5
4
  /**
6
5
  * Generates the post-initialization instruction message that shows
@@ -26,6 +25,5 @@ Then, try to look up an actor from your server:
26
25
  * @returns The runtime name (deno, bun, or node)
27
26
  */
28
27
  const packageManagerToRuntime = (pm) => pm === "deno" ? "deno" : pm === "bun" ? "bun" : "node";
29
-
30
28
  //#endregion
31
- export { getInstruction, packageManagerToRuntime };
29
+ export { getInstruction, packageManagerToRuntime };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/init",
3
- "version": "2.2.0-dev.613+cf8cd122",
3
+ "version": "2.2.0-dev.628+7f7a1e9b",
4
4
  "description": "Project initializer for Fedify",
5
5
  "keywords": [
6
6
  "fedify",
@@ -59,8 +59,8 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/node": "^22.17.0",
62
- "tsdown": "^0.12.9",
63
- "typescript": "^5.9.3"
62
+ "tsdown": "^0.21.6",
63
+ "typescript": "^5.9.2"
64
64
  },
65
65
  "scripts": {
66
66
  "build:self": "tsdown",
package/dist/deno.js DELETED
@@ -1,38 +0,0 @@
1
- //#region deno.json
2
- var name = "@fedify/init";
3
- var version = "2.2.0-dev.613+cf8cd122";
4
- var license = "MIT";
5
- var exports = "./src/mod.ts";
6
- var imports = {
7
- "@inquirer/prompts": "npm:@inquirer/prompts@^7.8.4",
8
- "inquirer-toggle": "npm:inquirer-toggle@^1.0.1"
9
- };
10
- var exclude = ["dist/", "node_modules/"];
11
- var publish = { "exclude": ["**/*.test.ts"] };
12
- var tasks = {
13
- "check": "deno fmt --check && deno lint && deno check src/**/*.ts",
14
- "run": "deno run --allow-all src/mod.ts",
15
- "test-init": "FEDIFY_TEST_MODE=true deno run --allow-all src/test/mod.ts test-init"
16
- };
17
- var fmt = { "exclude": ["src/templates/**"] };
18
- var lint = {
19
- "exclude": ["src/templates/**"],
20
- "rules": { "exclude": ["no-slow-types"] }
21
- };
22
- var test = { "exclude": ["src/test/**"] };
23
- var deno_default = {
24
- name,
25
- version,
26
- license,
27
- exports,
28
- imports,
29
- exclude,
30
- publish,
31
- tasks,
32
- fmt,
33
- lint,
34
- test
35
- };
36
-
37
- //#endregion
38
- export { deno_default as default };
@@ -1,18 +0,0 @@
1
- //#region src/json/biome.json
2
- var $schema = "https://biomejs.dev/schemas/1.8.3/schema.json";
3
- var organizeImports = { "enabled": true };
4
- var formatter = {
5
- "enabled": true,
6
- "indentStyle": "space",
7
- "indentWidth": 2
8
- };
9
- var linter = { "enabled": false };
10
- var biome_default = {
11
- $schema,
12
- organizeImports,
13
- formatter,
14
- linter
15
- };
16
-
17
- //#endregion
18
- export { biome_default as default };
@@ -1,30 +0,0 @@
1
- //#region src/json/db-to-check.json
2
- var redis = {
3
- "name": "Redis",
4
- "defaultPort": 6379,
5
- "documentation": "https://redis.io/docs/latest/operate/oss_and_stack/install/archive/install-redis/"
6
- };
7
- var postgres = {
8
- "name": "PostgreSQL",
9
- "defaultPort": 5432,
10
- "documentation": "https://www.postgresql.org/download/"
11
- };
12
- var mysql = {
13
- "name": "MySQL/MariaDB",
14
- "defaultPort": 3306,
15
- "documentation": "https://dev.mysql.com/doc/mysql-installation-excerpt/en/"
16
- };
17
- var amqp = {
18
- "name": "RabbitMQ",
19
- "defaultPort": 5672,
20
- "documentation": "https://www.rabbitmq.com/docs/download"
21
- };
22
- var db_to_check_default = {
23
- redis,
24
- postgres,
25
- mysql,
26
- amqp
27
- };
28
-
29
- //#endregion
30
- export { db_to_check_default as default };