@fedify/init 2.2.0-dev.628 → 2.2.0-dev.638
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/action/{configs.mjs → configs.js} +7 -7
- package/dist/action/{deps.mjs → deps.js} +7 -6
- package/dist/action/{env.mjs → env.js} +2 -2
- package/dist/action/{mod.d.mts → mod.d.ts} +2 -2
- package/dist/action/{mod.mjs → mod.js} +9 -11
- package/dist/action/{notice.mjs → notice.js} +2 -2
- package/dist/action/{patch.mjs → patch.js} +6 -6
- package/dist/action/{recommend.mjs → recommend.js} +4 -4
- package/dist/action/{set.mjs → set.js} +3 -3
- package/dist/action/{templates.mjs → templates.js} +2 -2
- package/dist/action/{utils.mjs → utils.js} +22 -1
- package/dist/ask/{dir.mjs → dir.js} +4 -3
- package/dist/ask/{kv.mjs → kv.js} +3 -3
- package/dist/ask/{mod.mjs → mod.js} +5 -5
- package/dist/ask/{mq.mjs → mq.js} +3 -3
- package/dist/ask/{pm.mjs → pm.js} +3 -3
- package/dist/ask/{wf.mjs → wf.js} +2 -2
- package/dist/{command.d.mts → command.d.ts} +3 -3
- package/dist/{command.mjs → command.js} +1 -1
- package/dist/{const.mjs → const.js} +4 -3
- package/dist/{deno.mjs → deno.js} +1 -1
- package/dist/json/deps.js +31 -0
- package/dist/json/deps.json +31 -0
- package/dist/json/{kv.mjs → kv.js} +3 -3
- package/dist/json/kv.json +63 -17
- package/dist/json/{mq.mjs → mq.js} +5 -5
- package/dist/json/mq.json +5 -5
- package/dist/{lib.mjs → lib.js} +10 -13
- package/dist/mod.d.ts +3 -0
- package/dist/mod.js +3 -0
- package/dist/templates/solidstart/app.config.ts.tpl +8 -0
- package/dist/templates/solidstart/src/app.tsx.tpl +11 -0
- package/dist/templates/solidstart/src/entry-client.tsx.tpl +4 -0
- package/dist/templates/solidstart/src/entry-server.tsx.tpl +20 -0
- package/dist/templates/solidstart/src/middleware/index.ts.tpl +4 -0
- package/dist/templates/solidstart/src/routes/index.tsx.tpl +10 -0
- package/dist/test/{action.mjs → action.js} +5 -5
- package/dist/test/{create.mjs → create.js} +14 -28
- package/dist/test/{db.mjs → db.js} +3 -3
- package/dist/test/{fill.mjs → fill.js} +1 -1
- package/dist/test/lookup.js +111 -0
- package/dist/test/{mod.mjs → mod.js} +4 -3
- package/dist/test/port.js +128 -0
- package/dist/test/{run.mjs → run.js} +4 -4
- package/dist/test/server.js +137 -0
- package/dist/test/{utils.mjs → utils.js} +1 -1
- package/dist/{types.d.mts → types.d.ts} +3 -3
- package/dist/{utils.d.mts → utils.d.ts} +1 -3
- package/dist/{utils.mjs → utils.js} +2 -78
- package/dist/webframeworks/{astro.mjs → astro.js} +10 -8
- package/dist/webframeworks/{bare-bones.mjs → bare-bones.js} +13 -12
- package/dist/webframeworks/{const.mjs → const.js} +4 -2
- package/dist/webframeworks/{elysia.mjs → elysia.js} +15 -14
- package/dist/webframeworks/{express.mjs → express.js} +10 -9
- package/dist/webframeworks/{hono.mjs → hono.js} +17 -16
- package/dist/webframeworks/{mod.mjs → mod.js} +10 -8
- package/dist/webframeworks/{next.mjs → next.js} +6 -5
- package/dist/webframeworks/{nitro.mjs → nitro.js} +4 -4
- package/dist/webframeworks/solidstart.js +70 -0
- package/dist/webframeworks/{utils.mjs → utils.js} +1 -1
- package/package.json +4 -1
- package/dist/action/install.mjs +0 -18
- package/dist/action/precommand.mjs +0 -22
- package/dist/mod.d.mts +0 -3
- package/dist/mod.mjs +0 -3
- package/dist/test/lookup.mjs +0 -185
- /package/dist/action/{const.mjs → const.js} +0 -0
- /package/dist/action/{dir.mjs → dir.js} +0 -0
- /package/dist/{const.d.mts → const.d.ts} +0 -0
- /package/dist/json/{biome.mjs → biome.js} +0 -0
- /package/dist/json/{db-to-check.mjs → db-to-check.js} +0 -0
- /package/dist/json/{pm.mjs → pm.js} +0 -0
- /package/dist/json/{rt.mjs → rt.js} +0 -0
- /package/dist/json/{vscode-settings-for-deno.mjs → vscode-settings-for-deno.js} +0 -0
- /package/dist/json/{vscode-settings.mjs → vscode-settings.js} +0 -0
- /package/dist/test/{mod.d.mts → mod.d.ts} +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isObject } from "@fxts/core";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { print, printError } from "@optique/run";
|
|
4
|
+
import { flow, toMerged } from "es-toolkit";
|
|
4
5
|
import { message } from "@optique/core";
|
|
5
6
|
import { Chalk } from "chalk";
|
|
6
|
-
import { flow, toMerged } from "es-toolkit";
|
|
7
|
-
import { spawn } from "node:child_process";
|
|
8
7
|
/** Chalk instance configured based on {@link colorEnabled}. */
|
|
9
8
|
const colors = new Chalk(process.stdout.isTTY && !("NO_COLOR" in process.env && process.env.NO_COLOR !== "") ? {} : { level: 0 });
|
|
10
9
|
/** Type guard that checks whether a value is a `Promise`. */
|
|
@@ -53,85 +52,10 @@ const formatJson = (obj) => JSON.stringify(obj, null, 2) + "\n";
|
|
|
53
52
|
const notEmpty = (s) => s.length > 0;
|
|
54
53
|
/** Type guard that checks whether an error is a "file not found" (`ENOENT`) error. */
|
|
55
54
|
const isNotFoundError = (e) => isObject(e) && "code" in e && e.code === "ENOENT";
|
|
56
|
-
/**
|
|
57
|
-
* Error thrown when a spawned shell command exits with a non-zero code.
|
|
58
|
-
* Captures stdout, stderr, exit code, and the original command array.
|
|
59
|
-
*/
|
|
60
|
-
var CommandError = class extends Error {
|
|
61
|
-
commandLine;
|
|
62
|
-
constructor(message, stdout, stderr, code, command) {
|
|
63
|
-
super(message);
|
|
64
|
-
this.stdout = stdout;
|
|
65
|
-
this.stderr = stderr;
|
|
66
|
-
this.code = code;
|
|
67
|
-
this.command = command;
|
|
68
|
-
this.name = "CommandError";
|
|
69
|
-
this.commandLine = command.join(" ");
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Executes a shell command (or a chain of commands joined by `"&&"`) as child
|
|
74
|
-
* processes and returns the combined stdout/stderr output.
|
|
75
|
-
* Throws a {@link CommandError} if any command in the chain exits with a
|
|
76
|
-
* non-zero code.
|
|
77
|
-
*
|
|
78
|
-
* @param command - The command as an array of strings; use `"&&"` to chain
|
|
79
|
-
* @param options - Options forwarded to `node:child_process.spawn`
|
|
80
|
-
* @returns A promise resolving to `{ stdout, stderr }`
|
|
81
|
-
*/
|
|
82
|
-
const runSubCommand = async (command, options) => {
|
|
83
|
-
const commands = command.reduce((acc, cur) => {
|
|
84
|
-
if (cur === "&&") acc.push([]);
|
|
85
|
-
else {
|
|
86
|
-
if (acc.length === 0) acc.push([]);
|
|
87
|
-
acc[acc.length - 1].push(cur);
|
|
88
|
-
}
|
|
89
|
-
return acc;
|
|
90
|
-
}, []);
|
|
91
|
-
const results = {
|
|
92
|
-
stdout: "",
|
|
93
|
-
stderr: ""
|
|
94
|
-
};
|
|
95
|
-
for (const cmd of commands) try {
|
|
96
|
-
const result = await runSingularCommand(cmd, options);
|
|
97
|
-
results.stdout += (results.stdout ? "\n" : "") + result.stdout;
|
|
98
|
-
results.stderr += (results.stderr ? "\n" : "") + result.stderr;
|
|
99
|
-
} catch (error) {
|
|
100
|
-
if (error instanceof CommandError) {
|
|
101
|
-
results.stdout += (results.stdout ? "\n" : "") + error.stdout;
|
|
102
|
-
results.stderr += (results.stderr ? "\n" : "") + error.stderr;
|
|
103
|
-
}
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
return results;
|
|
107
|
-
};
|
|
108
|
-
const runSingularCommand = (command, options) => new Promise((resolve, reject) => {
|
|
109
|
-
let stdout = "";
|
|
110
|
-
let stderr = "";
|
|
111
|
-
const child = spawn(command[0], command.slice(1), options);
|
|
112
|
-
child.stdout?.on("data", (data) => {
|
|
113
|
-
stdout += data.toString();
|
|
114
|
-
});
|
|
115
|
-
child.stderr?.on("data", (data) => {
|
|
116
|
-
stderr += data.toString();
|
|
117
|
-
});
|
|
118
|
-
child.on("close", (code) => {
|
|
119
|
-
if (code === 0) resolve({
|
|
120
|
-
stdout: stdout.trim(),
|
|
121
|
-
stderr: stderr.trim()
|
|
122
|
-
});
|
|
123
|
-
else reject(new CommandError(`Command exited with code ${code ?? "unknown"}`, stdout.trim(), stderr.trim(), code ?? -1, command));
|
|
124
|
-
});
|
|
125
|
-
child.on("error", (error) => {
|
|
126
|
-
reject(error);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
55
|
/** Returns the current working directory. */
|
|
130
56
|
const getCwd = () => process.cwd();
|
|
131
57
|
/** Returns the current OS platform (e.g., `"darwin"`, `"win32"`, `"linux"`). */
|
|
132
58
|
const getOsType = () => process.platform;
|
|
133
|
-
/** Exits the process with the given exit code. */
|
|
134
|
-
const exit = (code) => process.exit(code);
|
|
135
59
|
/**
|
|
136
60
|
* Generates the cartesian product of multiple iterables.
|
|
137
61
|
* Used by the test suite to enumerate all option combinations.
|
|
@@ -151,4 +75,4 @@ const printMessage = flow(message, print);
|
|
|
151
75
|
/** Prints a formatted error message to stderr using `@optique/run`'s `printError`. */
|
|
152
76
|
const printErrorMessage = flow(message, printError);
|
|
153
77
|
//#endregion
|
|
154
|
-
export {
|
|
78
|
+
export { colors, formatJson, getCwd, getOsType, isNotFoundError, merge$1 as merge, notEmpty, printErrorMessage, printMessage, product, replace, replaceAll, set };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PACKAGE_VERSION, readTemplate } from "../lib.
|
|
2
|
-
import { PACKAGE_MANAGER } from "../const.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { PACKAGE_VERSION, readTemplate } from "../lib.js";
|
|
2
|
+
import { PACKAGE_MANAGER } from "../const.js";
|
|
3
|
+
import { npm__astrojs_node, npm__deno_astro_adapter, npm__types_node_22, npm_typescript } from "../json/deps.js";
|
|
4
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
5
|
+
import { getInstruction } from "./utils.js";
|
|
5
6
|
//#region src/webframeworks/astro.ts
|
|
6
7
|
const astroDescription = {
|
|
7
8
|
label: "Astro",
|
|
@@ -11,17 +12,17 @@ const astroDescription = {
|
|
|
11
12
|
command: Array.from(getAstroInitCommand(pm)),
|
|
12
13
|
dependencies: pm === "deno" ? {
|
|
13
14
|
...defaultDenoDependencies,
|
|
14
|
-
"@deno/astro-adapter":
|
|
15
|
+
"@deno/astro-adapter": `npm:@deno/astro-adapter@${npm__deno_astro_adapter}`,
|
|
15
16
|
"@fedify/astro": PACKAGE_VERSION
|
|
16
17
|
} : {
|
|
17
|
-
"@astrojs/node":
|
|
18
|
+
"@astrojs/node": npm__astrojs_node,
|
|
18
19
|
"@fedify/astro": PACKAGE_VERSION
|
|
19
20
|
},
|
|
20
21
|
devDependencies: {
|
|
21
22
|
...defaultDevDependencies,
|
|
22
23
|
...pm !== "deno" ? {
|
|
23
|
-
typescript:
|
|
24
|
-
"@types/node":
|
|
24
|
+
typescript: npm_typescript,
|
|
25
|
+
"@types/node": npm__types_node_22
|
|
25
26
|
} : {}
|
|
26
27
|
},
|
|
27
28
|
federationFile: "src/federation.ts",
|
|
@@ -65,6 +66,7 @@ function* getAstroInitCommand(pm) {
|
|
|
65
66
|
yield "--no-git";
|
|
66
67
|
yield "--skip-houston";
|
|
67
68
|
yield "-y";
|
|
69
|
+
if (pm !== "deno") yield "--no-install";
|
|
68
70
|
yield "&&";
|
|
69
71
|
yield "rm";
|
|
70
72
|
yield "astro.config.mjs";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { readTemplate } from "../lib.
|
|
2
|
-
import { PACKAGE_MANAGER } from "../const.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { readTemplate } from "../lib.js";
|
|
2
|
+
import { PACKAGE_MANAGER } from "../const.js";
|
|
3
|
+
import { _hongminhee_x_forwarded_fetch, _std_dotenv, npm__dotenvx_dotenvx, npm__hono_node_server, npm__types_bun, npm__types_node_25, npm_tsx, npm_x_forwarded_fetch } from "../json/deps.js";
|
|
4
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
5
|
+
import { getInstruction, packageManagerToRuntime } from "./utils.js";
|
|
5
6
|
//#region src/webframeworks/bare-bones.ts
|
|
6
7
|
const bareBonesDescription = {
|
|
7
8
|
label: "Bare-bones",
|
|
@@ -10,17 +11,17 @@ const bareBonesDescription = {
|
|
|
10
11
|
init: async ({ packageManager: pm }) => ({
|
|
11
12
|
dependencies: pm === "deno" ? {
|
|
12
13
|
...defaultDenoDependencies,
|
|
13
|
-
"@std/dotenv":
|
|
14
|
-
"@hongminhee/x-forwarded-fetch":
|
|
15
|
-
} : pm === "bun" ? { "npm:x-forwarded-fetch":
|
|
16
|
-
"npm:@dotenvx/dotenvx":
|
|
17
|
-
"npm:@hono/node-server":
|
|
18
|
-
"npm:tsx":
|
|
19
|
-
"npm:x-forwarded-fetch":
|
|
14
|
+
"@std/dotenv": _std_dotenv,
|
|
15
|
+
"@hongminhee/x-forwarded-fetch": _hongminhee_x_forwarded_fetch
|
|
16
|
+
} : pm === "bun" ? { "npm:x-forwarded-fetch": npm_x_forwarded_fetch } : {
|
|
17
|
+
"npm:@dotenvx/dotenvx": npm__dotenvx_dotenvx,
|
|
18
|
+
"npm:@hono/node-server": npm__hono_node_server,
|
|
19
|
+
"npm:tsx": npm_tsx,
|
|
20
|
+
"npm:x-forwarded-fetch": npm_x_forwarded_fetch
|
|
20
21
|
},
|
|
21
22
|
devDependencies: {
|
|
22
23
|
...defaultDevDependencies,
|
|
23
|
-
...pm === "bun" ? { "@types/bun":
|
|
24
|
+
...pm === "bun" ? { "@types/bun": npm__types_bun } : { "@types/node": npm__types_node_25 }
|
|
24
25
|
},
|
|
25
26
|
federationFile: "src/federation.ts",
|
|
26
27
|
loggingFile: "src/logging.ts",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { PACKAGE_VERSION } from "../lib.
|
|
1
|
+
import { PACKAGE_VERSION } from "../lib.js";
|
|
2
|
+
import { npm__biomejs_biome, npm_eslint } from "../json/deps.js";
|
|
2
3
|
//#region src/webframeworks/const.ts
|
|
3
4
|
const defaultDevDependencies = {
|
|
4
5
|
"@fedify/lint": PACKAGE_VERSION,
|
|
5
|
-
"eslint":
|
|
6
|
+
"eslint": npm_eslint,
|
|
7
|
+
"@biomejs/biome": npm__biomejs_biome
|
|
6
8
|
};
|
|
7
9
|
const defaultDenoDependencies = { "@fedify/lint": PACKAGE_VERSION };
|
|
8
10
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PACKAGE_VERSION, readTemplate } from "../lib.
|
|
2
|
-
import { PACKAGE_MANAGER } from "../const.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { PACKAGE_VERSION, readTemplate } from "../lib.js";
|
|
2
|
+
import { PACKAGE_MANAGER } from "../const.js";
|
|
3
|
+
import { 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";
|
|
4
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
5
|
+
import { getInstruction, packageManagerToRuntime } from "./utils.js";
|
|
5
6
|
//#region src/webframeworks/elysia.ts
|
|
6
7
|
const elysiaDescription = {
|
|
7
8
|
label: "ElysiaJS",
|
|
@@ -10,25 +11,25 @@ const elysiaDescription = {
|
|
|
10
11
|
init: async ({ projectName, packageManager: pm }) => ({
|
|
11
12
|
dependencies: pm === "deno" ? {
|
|
12
13
|
...defaultDenoDependencies,
|
|
13
|
-
elysia:
|
|
14
|
+
elysia: `npm:elysia@${npm_elysia}`,
|
|
14
15
|
"@fedify/elysia": PACKAGE_VERSION
|
|
15
16
|
} : pm === "bun" ? {
|
|
16
|
-
elysia:
|
|
17
|
+
elysia: npm_elysia,
|
|
17
18
|
"@fedify/elysia": PACKAGE_VERSION
|
|
18
19
|
} : {
|
|
19
|
-
elysia:
|
|
20
|
-
"@elysiajs/node":
|
|
20
|
+
elysia: npm_elysia,
|
|
21
|
+
"@elysiajs/node": npm__elysiajs_node,
|
|
21
22
|
"@fedify/elysia": PACKAGE_VERSION,
|
|
22
23
|
...pm === "pnpm" ? {
|
|
23
|
-
"@sinclair/typebox":
|
|
24
|
-
"openapi-types":
|
|
24
|
+
"@sinclair/typebox": npm__sinclair_typebox,
|
|
25
|
+
"openapi-types": npm_openapi_types
|
|
25
26
|
} : {}
|
|
26
27
|
},
|
|
27
28
|
devDependencies: {
|
|
28
|
-
...pm === "bun" ? { "@types/bun":
|
|
29
|
-
tsx:
|
|
30
|
-
"@types/node":
|
|
31
|
-
typescript:
|
|
29
|
+
...pm === "bun" ? { "@types/bun": npm__types_bun } : {
|
|
30
|
+
tsx: npm_tsx,
|
|
31
|
+
"@types/node": npm__types_node_25,
|
|
32
|
+
typescript: npm_typescript
|
|
32
33
|
},
|
|
33
34
|
...defaultDevDependencies
|
|
34
35
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PACKAGE_VERSION, readTemplate } from "../lib.
|
|
2
|
-
import { PACKAGE_MANAGER } from "../const.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { PACKAGE_VERSION, readTemplate } from "../lib.js";
|
|
2
|
+
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";
|
|
4
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
5
|
+
import { getInstruction } from "./utils.js";
|
|
5
6
|
//#region src/webframeworks/express.ts
|
|
6
7
|
const expressDescription = {
|
|
7
8
|
label: "Express",
|
|
@@ -9,17 +10,17 @@ const expressDescription = {
|
|
|
9
10
|
defaultPort: 8e3,
|
|
10
11
|
init: async ({ projectName, packageManager: pm }) => ({
|
|
11
12
|
dependencies: {
|
|
12
|
-
"npm:express":
|
|
13
|
+
"npm:express": npm_express,
|
|
13
14
|
"@fedify/express": PACKAGE_VERSION,
|
|
14
15
|
...pm !== "deno" && pm !== "bun" ? {
|
|
15
|
-
"@dotenvx/dotenvx":
|
|
16
|
-
tsx:
|
|
16
|
+
"@dotenvx/dotenvx": npm__dotenvx_dotenvx,
|
|
17
|
+
tsx: npm_tsx
|
|
17
18
|
} : {},
|
|
18
19
|
...pm === "deno" ? defaultDenoDependencies : {}
|
|
19
20
|
},
|
|
20
21
|
devDependencies: {
|
|
21
|
-
"@types/express":
|
|
22
|
-
...pm === "bun" ? { "@types/bun":
|
|
22
|
+
"@types/express": npm__types_express,
|
|
23
|
+
...pm === "bun" ? { "@types/bun": npm__types_bun } : {},
|
|
23
24
|
...defaultDevDependencies
|
|
24
25
|
},
|
|
25
26
|
federationFile: "src/federation.ts",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { replace } from "../utils.
|
|
2
|
-
import { PACKAGE_VERSION, readTemplate } from "../lib.
|
|
3
|
-
import { PACKAGE_MANAGER } from "../const.
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { replace } from "../utils.js";
|
|
2
|
+
import { PACKAGE_VERSION, readTemplate } from "../lib.js";
|
|
3
|
+
import { PACKAGE_MANAGER } from "../const.js";
|
|
4
|
+
import { _hongminhee_x_forwarded_fetch, _hono_hono, _std_dotenv, npm__dotenvx_dotenvx, npm__hono_node_server, npm__types_bun, npm_hono, npm_tsx, npm_x_forwarded_fetch } from "../json/deps.js";
|
|
5
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
6
|
+
import { getInstruction, packageManagerToRuntime } from "./utils.js";
|
|
6
7
|
import { pipe } from "@fxts/core";
|
|
7
8
|
//#region src/webframeworks/hono.ts
|
|
8
9
|
const honoDescription = {
|
|
@@ -12,25 +13,25 @@ const honoDescription = {
|
|
|
12
13
|
init: async ({ projectName, packageManager: pm }) => ({
|
|
13
14
|
dependencies: pm === "deno" ? {
|
|
14
15
|
...defaultDenoDependencies,
|
|
15
|
-
"@std/dotenv":
|
|
16
|
-
"@hono/hono":
|
|
17
|
-
"@hongminhee/x-forwarded-fetch":
|
|
16
|
+
"@std/dotenv": _std_dotenv,
|
|
17
|
+
"@hono/hono": _hono_hono,
|
|
18
|
+
"@hongminhee/x-forwarded-fetch": _hongminhee_x_forwarded_fetch,
|
|
18
19
|
"@fedify/hono": PACKAGE_VERSION
|
|
19
20
|
} : pm === "bun" ? {
|
|
20
|
-
hono:
|
|
21
|
-
"x-forwarded-fetch":
|
|
21
|
+
hono: npm_hono,
|
|
22
|
+
"x-forwarded-fetch": npm_x_forwarded_fetch,
|
|
22
23
|
"@fedify/hono": PACKAGE_VERSION
|
|
23
24
|
} : {
|
|
24
|
-
"@dotenvx/dotenvx":
|
|
25
|
-
hono:
|
|
26
|
-
"@hono/node-server":
|
|
27
|
-
tsx:
|
|
28
|
-
"x-forwarded-fetch":
|
|
25
|
+
"@dotenvx/dotenvx": npm__dotenvx_dotenvx,
|
|
26
|
+
hono: npm_hono,
|
|
27
|
+
"@hono/node-server": npm__hono_node_server,
|
|
28
|
+
tsx: npm_tsx,
|
|
29
|
+
"x-forwarded-fetch": npm_x_forwarded_fetch,
|
|
29
30
|
"@fedify/hono": PACKAGE_VERSION
|
|
30
31
|
},
|
|
31
32
|
devDependencies: {
|
|
32
33
|
...defaultDevDependencies,
|
|
33
|
-
...pm === "bun" ? { "@types/bun":
|
|
34
|
+
...pm === "bun" ? { "@types/bun": npm__types_bun } : {}
|
|
34
35
|
},
|
|
35
36
|
federationFile: "src/federation.ts",
|
|
36
37
|
loggingFile: "src/logging.ts",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import astroDescription from "./astro.
|
|
2
|
-
import bareBonesDescription from "./bare-bones.
|
|
3
|
-
import elysiaDescription from "./elysia.
|
|
4
|
-
import expressDescription from "./express.
|
|
5
|
-
import honoDescription from "./hono.
|
|
6
|
-
import nextDescription from "./next.
|
|
7
|
-
import nitroDescription from "./nitro.
|
|
1
|
+
import astroDescription from "./astro.js";
|
|
2
|
+
import bareBonesDescription from "./bare-bones.js";
|
|
3
|
+
import elysiaDescription from "./elysia.js";
|
|
4
|
+
import expressDescription from "./express.js";
|
|
5
|
+
import honoDescription from "./hono.js";
|
|
6
|
+
import nextDescription from "./next.js";
|
|
7
|
+
import nitroDescription from "./nitro.js";
|
|
8
|
+
import solidstartDescription from "./solidstart.js";
|
|
8
9
|
//#region src/webframeworks/mod.ts
|
|
9
10
|
/**
|
|
10
11
|
* Registry of all supported web framework configurations.
|
|
@@ -20,7 +21,8 @@ const webFrameworks = {
|
|
|
20
21
|
express: expressDescription,
|
|
21
22
|
hono: honoDescription,
|
|
22
23
|
next: nextDescription,
|
|
23
|
-
nitro: nitroDescription
|
|
24
|
+
nitro: nitroDescription,
|
|
25
|
+
solidstart: solidstartDescription
|
|
24
26
|
};
|
|
25
27
|
//#endregion
|
|
26
28
|
export { webFrameworks as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PACKAGE_VERSION, readTemplate } from "../lib.
|
|
2
|
-
import { PACKAGE_MANAGER } from "../const.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { PACKAGE_VERSION, readTemplate } from "../lib.js";
|
|
2
|
+
import { PACKAGE_MANAGER } from "../const.js";
|
|
3
|
+
import { npm__types_node_20 } from "../json/deps.js";
|
|
4
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
5
|
+
import { getInstruction } from "./utils.js";
|
|
5
6
|
//#region src/webframeworks/next.ts
|
|
6
7
|
const nextDescription = {
|
|
7
8
|
label: "Next.js",
|
|
@@ -14,7 +15,7 @@ const nextDescription = {
|
|
|
14
15
|
...pm === "deno" ? defaultDenoDependencies : {}
|
|
15
16
|
},
|
|
16
17
|
devDependencies: {
|
|
17
|
-
"@types/node":
|
|
18
|
+
"@types/node": npm__types_node_20,
|
|
18
19
|
...defaultDevDependencies
|
|
19
20
|
},
|
|
20
21
|
federationFile: "federation/index.ts",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PACKAGE_VERSION, readTemplate } from "../lib.
|
|
2
|
-
import { PACKAGE_MANAGER } from "../const.
|
|
3
|
-
import { defaultDenoDependencies, defaultDevDependencies } from "./const.
|
|
4
|
-
import { getInstruction } from "./utils.
|
|
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
5
|
//#region src/webframeworks/nitro.ts
|
|
6
6
|
const nitroDescription = {
|
|
7
7
|
label: "Nitro",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { PACKAGE_VERSION, readTemplate } from "../lib.js";
|
|
2
|
+
import { PACKAGE_MANAGER } from "../const.js";
|
|
3
|
+
import { npm__solidjs_router, npm__solidjs_start, npm__types_node_22, npm_solid_js, npm_typescript, npm_vinxi } from "../json/deps.js";
|
|
4
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
5
|
+
import { getInstruction } from "./utils.js";
|
|
6
|
+
//#region src/webframeworks/solidstart.ts
|
|
7
|
+
const NPM_SOLIDSTART = `npm:@solidjs/start@${npm__solidjs_start}`;
|
|
8
|
+
const solidstartDescription = {
|
|
9
|
+
label: "SolidStart",
|
|
10
|
+
packageManagers: PACKAGE_MANAGER,
|
|
11
|
+
defaultPort: 3e3,
|
|
12
|
+
init: async ({ packageManager: pm }) => ({
|
|
13
|
+
dependencies: pm === "deno" ? {
|
|
14
|
+
...defaultDenoDependencies,
|
|
15
|
+
"@solidjs/router": `npm:@solidjs/router@${npm__solidjs_router}`,
|
|
16
|
+
"@solidjs/start": `${NPM_SOLIDSTART}`,
|
|
17
|
+
"@solidjs/start/client": `${NPM_SOLIDSTART}/client`,
|
|
18
|
+
"@solidjs/start/config": `${NPM_SOLIDSTART}/config`,
|
|
19
|
+
"@solidjs/start/middleware": `${NPM_SOLIDSTART}/middleware`,
|
|
20
|
+
"@solidjs/start/router": `${NPM_SOLIDSTART}/router`,
|
|
21
|
+
"@solidjs/start/server": `${NPM_SOLIDSTART}/server`,
|
|
22
|
+
"solid-js": `npm:solid-js@${npm_solid_js}`,
|
|
23
|
+
vinxi: `npm:vinxi@${npm_vinxi}`,
|
|
24
|
+
"@fedify/solidstart": PACKAGE_VERSION
|
|
25
|
+
} : {
|
|
26
|
+
"@solidjs/router": npm__solidjs_router,
|
|
27
|
+
"@solidjs/start": npm__solidjs_start,
|
|
28
|
+
"solid-js": npm_solid_js,
|
|
29
|
+
vinxi: npm_vinxi,
|
|
30
|
+
"@fedify/solidstart": PACKAGE_VERSION
|
|
31
|
+
},
|
|
32
|
+
devDependencies: {
|
|
33
|
+
...defaultDevDependencies,
|
|
34
|
+
typescript: npm_typescript,
|
|
35
|
+
"@types/node": npm__types_node_22
|
|
36
|
+
},
|
|
37
|
+
federationFile: "src/federation.ts",
|
|
38
|
+
loggingFile: "src/logging.ts",
|
|
39
|
+
files: {
|
|
40
|
+
"app.config.ts": (await readTemplate("solidstart/app.config.ts")).replace(/\/\* preset \*\//, pm === "deno" ? "deno-server" : "node-server"),
|
|
41
|
+
"src/app.tsx": await readTemplate("solidstart/src/app.tsx"),
|
|
42
|
+
"src/entry-client.tsx": await readTemplate("solidstart/src/entry-client.tsx"),
|
|
43
|
+
"src/entry-server.tsx": await readTemplate("solidstart/src/entry-server.tsx"),
|
|
44
|
+
"src/routes/index.tsx": await readTemplate("solidstart/src/routes/index.tsx"),
|
|
45
|
+
"src/middleware/index.ts": await readTemplate("solidstart/src/middleware/index.ts"),
|
|
46
|
+
...pm !== "deno" ? { "eslint.config.ts": await readTemplate("defaults/eslint.config.ts") } : {}
|
|
47
|
+
},
|
|
48
|
+
compilerOptions: pm === "deno" ? void 0 : {
|
|
49
|
+
target: "ESNext",
|
|
50
|
+
module: "ESNext",
|
|
51
|
+
moduleResolution: "Bundler",
|
|
52
|
+
allowSyntheticDefaultImports: true,
|
|
53
|
+
esModuleInterop: true,
|
|
54
|
+
jsx: "preserve",
|
|
55
|
+
jsxImportSource: "solid-js",
|
|
56
|
+
strict: true,
|
|
57
|
+
noEmit: true,
|
|
58
|
+
skipLibCheck: true
|
|
59
|
+
},
|
|
60
|
+
tasks: {
|
|
61
|
+
dev: pm === "deno" ? "deno run -A npm:vinxi dev" : pm === "bun" ? "bunx vinxi dev" : "vinxi dev",
|
|
62
|
+
build: pm === "deno" ? "deno run -A npm:vinxi build" : pm === "bun" ? "bunx vinxi build" : "vinxi build",
|
|
63
|
+
start: pm === "deno" ? "deno run -A npm:vinxi start" : pm === "bun" ? "bunx vinxi start" : "vinxi start",
|
|
64
|
+
...pm !== "deno" ? { lint: "eslint ." } : {}
|
|
65
|
+
},
|
|
66
|
+
instruction: getInstruction(pm, 3e3)
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { solidstartDescription as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/init",
|
|
3
|
-
"version": "2.2.0-dev.
|
|
3
|
+
"version": "2.2.0-dev.638+bd60323a",
|
|
4
4
|
"description": "Project initializer for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"README.md"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
+
"@david/dax": "npm:dax@^0.45.0",
|
|
51
52
|
"@fxts/core": "^1.20.0",
|
|
52
53
|
"@inquirer/prompts": "^7.8.4",
|
|
53
54
|
"@logtape/logtape": "^2.0.5",
|
|
@@ -66,6 +67,8 @@
|
|
|
66
67
|
"build:self": "tsdown",
|
|
67
68
|
"build": "pnpm --filter @fedify/init... run build:self",
|
|
68
69
|
"prepublish": "pnpm build",
|
|
70
|
+
"pretest": "pnpm build",
|
|
71
|
+
"test": "node --test --experimental-transform-types 'src/**/*.test.ts'",
|
|
69
72
|
"test-init": "deno task test-init"
|
|
70
73
|
}
|
|
71
74
|
}
|
package/dist/action/install.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CommandError, runSubCommand } from "../utils.mjs";
|
|
2
|
-
import { apply, pipe } from "@fxts/core";
|
|
3
|
-
//#region src/action/install.ts
|
|
4
|
-
/**
|
|
5
|
-
* Runs `<packageManager> install` in the project directory to install all
|
|
6
|
-
* dependencies. Logs an error message if the installation fails.
|
|
7
|
-
*/
|
|
8
|
-
const installDependencies = (data) => pipe(data, ({ packageManager, dir }) => [[packageManager, "install"], { cwd: dir }], apply(runSubCommand)).catch((e) => {
|
|
9
|
-
if (e instanceof CommandError) {
|
|
10
|
-
console.error(`Failed to install dependencies using ${data.packageManager}.`);
|
|
11
|
-
console.error("Command:", e.commandLine);
|
|
12
|
-
if (e.stderr) console.error("Error:", e.stderr);
|
|
13
|
-
throw e;
|
|
14
|
-
}
|
|
15
|
-
throw e;
|
|
16
|
-
});
|
|
17
|
-
//#endregion
|
|
18
|
-
export { installDependencies as default };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { CommandError, exit, runSubCommand } from "../utils.mjs";
|
|
2
|
-
//#region src/action/precommand.ts
|
|
3
|
-
/**
|
|
4
|
-
* Runs the precommand specified in the initializer to set up the project.
|
|
5
|
-
*
|
|
6
|
-
* @param data - The initialization command data containing the initializer command and directory
|
|
7
|
-
* @returns A promise that resolves when the precommand has been executed
|
|
8
|
-
*/
|
|
9
|
-
const runPrecommand = ({ initializer: { command }, dir }) => runSubCommand(command, {
|
|
10
|
-
cwd: dir,
|
|
11
|
-
stdio: "inherit"
|
|
12
|
-
}).catch((e) => {
|
|
13
|
-
if (e instanceof CommandError) {
|
|
14
|
-
console.error("Failed to run the precommand.");
|
|
15
|
-
console.error("Command:", e.commandLine);
|
|
16
|
-
if (e.stderr) console.error("Error:", e.stderr);
|
|
17
|
-
if (e.stdout) console.error("Output:", e.stdout);
|
|
18
|
-
} else console.error("Failed to run the precommand:", e);
|
|
19
|
-
exit(1);
|
|
20
|
-
});
|
|
21
|
-
//#endregion
|
|
22
|
-
export { runPrecommand as default };
|
package/dist/mod.d.mts
DELETED
package/dist/mod.mjs
DELETED