@fedify/init 2.2.0-dev.750 → 2.2.0-dev.752
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/command.d.ts +3 -3
- package/dist/const.js +1 -0
- package/dist/deno.js +1 -1
- package/dist/json/deps.json +4 -0
- package/dist/templates/nuxt/nuxt.config.ts.tpl +6 -0
- package/dist/test/lookup.js +2 -1
- package/dist/test/port.js +7 -5
- package/dist/webframeworks/mod.js +2 -0
- package/dist/webframeworks/nuxt.js +66 -0
- package/package.json +1 -1
package/dist/command.d.ts
CHANGED
|
@@ -9,14 +9,14 @@ import { InferValue } from "@optique/core";
|
|
|
9
9
|
*/
|
|
10
10
|
declare const initOptions: _$_optique_core0.Parser<"sync", {
|
|
11
11
|
readonly dir: string;
|
|
12
|
-
readonly webFramework: "bare-bones" | "hono" | "nitro" | "next" | "elysia" | "astro" | "express" | "solidstart";
|
|
12
|
+
readonly webFramework: "bare-bones" | "hono" | "nitro" | "next" | "elysia" | "astro" | "express" | "nuxt" | "solidstart";
|
|
13
13
|
readonly packageManager: "deno" | "pnpm" | "bun" | "yarn" | "npm";
|
|
14
14
|
readonly kvStore: "postgres" | "mysql" | "in-memory" | "redis" | "denokv";
|
|
15
15
|
readonly messageQueue: "postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp";
|
|
16
16
|
readonly dryRun: boolean;
|
|
17
17
|
}, {
|
|
18
18
|
readonly dir: [_$_optique_core0.ValueParserResult<string>];
|
|
19
|
-
readonly webFramework: [_$_optique_core0.ValueParserResult<"bare-bones" | "hono" | "nitro" | "next" | "elysia" | "astro" | "express" | "solidstart">];
|
|
19
|
+
readonly webFramework: [_$_optique_core0.ValueParserResult<"bare-bones" | "hono" | "nitro" | "next" | "elysia" | "astro" | "express" | "nuxt" | "solidstart">];
|
|
20
20
|
readonly packageManager: [_$_optique_core0.ValueParserResult<"deno" | "pnpm" | "bun" | "yarn" | "npm">];
|
|
21
21
|
readonly kvStore: [_$_optique_core0.ValueParserResult<"postgres" | "mysql" | "in-memory" | "redis" | "denokv">];
|
|
22
22
|
readonly messageQueue: [_$_optique_core0.ValueParserResult<"postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp">];
|
|
@@ -27,7 +27,7 @@ declare const initOptions: _$_optique_core0.Parser<"sync", {
|
|
|
27
27
|
*/
|
|
28
28
|
declare const initCommand: _$_optique_core0.Parser<"sync", {
|
|
29
29
|
readonly dir: string;
|
|
30
|
-
readonly webFramework: "bare-bones" | "hono" | "nitro" | "next" | "elysia" | "astro" | "express" | "solidstart";
|
|
30
|
+
readonly webFramework: "bare-bones" | "hono" | "nitro" | "next" | "elysia" | "astro" | "express" | "nuxt" | "solidstart";
|
|
31
31
|
readonly packageManager: "deno" | "pnpm" | "bun" | "yarn" | "npm";
|
|
32
32
|
readonly kvStore: "postgres" | "mysql" | "in-memory" | "redis" | "denokv";
|
|
33
33
|
readonly messageQueue: "postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp";
|
package/dist/const.js
CHANGED
package/dist/deno.js
CHANGED
package/dist/json/deps.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"npm:@dotenvx/dotenvx": "^1.59.1",
|
|
10
10
|
"npm:@elysiajs/node": "^1.4.5",
|
|
11
11
|
"npm:@hono/node-server": "^1.19.12",
|
|
12
|
+
"npm:@nuxt/kit": "^4.4.2",
|
|
12
13
|
"npm:@sinclair/typebox": "^0.34.49",
|
|
13
14
|
"npm:@solidjs/router": "^0.16.1",
|
|
14
15
|
"npm:@solidjs/start": "^1.3.2",
|
|
@@ -21,7 +22,10 @@
|
|
|
21
22
|
"npm:elysia": "^1.4.28",
|
|
22
23
|
"npm:eslint": "^9.0.0",
|
|
23
24
|
"npm:express": "^5.2.1",
|
|
25
|
+
"npm:h3": "^1.15.0",
|
|
24
26
|
"npm:hono": "^4.12.9",
|
|
27
|
+
"npm:nuxi": "^3.34.0",
|
|
28
|
+
"npm:nuxt": "^4.4.2",
|
|
25
29
|
"npm:openapi-types": "^12.1.3",
|
|
26
30
|
"npm:solid-js": "^1.9.12",
|
|
27
31
|
"npm:tsx": "^4.21.0",
|
package/dist/test/lookup.js
CHANGED
|
@@ -12,7 +12,8 @@ const HANDLE = "john";
|
|
|
12
12
|
const BANNED_LOOKUP_REASONS = {
|
|
13
13
|
"next,*,*,*": "Next.js doesn't support remote packages",
|
|
14
14
|
"solidstart,deno,*,*": "Error occurred while loading submodules in Deno",
|
|
15
|
-
"astro,deno,*,*": "Astro doesn't support remote packages in Deno"
|
|
15
|
+
"astro,deno,*,*": "Astro doesn't support remote packages in Deno",
|
|
16
|
+
"nuxt,deno,*,*": "Nuxt doesn't support remote packages in Deno"
|
|
16
17
|
};
|
|
17
18
|
const BANNED_LOOKUP_CASES = Object.keys(BANNED_LOOKUP_REASONS).map((key) => key.split(","));
|
|
18
19
|
/**
|
package/dist/test/port.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { printErrorMessage, printMessage } from "../utils.js";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import {
|
|
3
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { execFile } from "node:child_process";
|
|
6
6
|
import { createConnection, createServer } from "node:net";
|
|
@@ -90,11 +90,17 @@ const ENTRY_FILES = {
|
|
|
90
90
|
hono: "src/index.ts",
|
|
91
91
|
elysia: "src/index.ts"
|
|
92
92
|
};
|
|
93
|
+
const WF_READ_PORT_FROM_ENV = new Set([
|
|
94
|
+
"nuxt",
|
|
95
|
+
"nitro",
|
|
96
|
+
"solidstart"
|
|
97
|
+
]);
|
|
93
98
|
/**
|
|
94
99
|
* Replace the hardcoded default port with `newPort` in the generated test
|
|
95
100
|
* app's source files. Strategy varies by framework.
|
|
96
101
|
*/
|
|
97
102
|
async function replacePortInApp(dir, wf, defaultPort, newPort) {
|
|
103
|
+
if (WF_READ_PORT_FROM_ENV.has(wf)) return;
|
|
98
104
|
if (defaultPort === newPort) return;
|
|
99
105
|
const entryFile = ENTRY_FILES[wf];
|
|
100
106
|
if (entryFile) {
|
|
@@ -102,10 +108,6 @@ async function replacePortInApp(dir, wf, defaultPort, newPort) {
|
|
|
102
108
|
await writeFile(filePath, (await readFile(filePath, "utf8")).replaceAll(String(defaultPort), String(newPort)));
|
|
103
109
|
return;
|
|
104
110
|
}
|
|
105
|
-
if (wf === "nitro") {
|
|
106
|
-
await appendFile(join(dir, ".env"), `\nPORT=${newPort}\n`);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
111
|
if (wf === "astro") {
|
|
110
112
|
const configPath = join(dir, "astro.config.ts");
|
|
111
113
|
await writeFile(configPath, (await readFile(configPath, "utf8")).replace("defineConfig({", `defineConfig({\n server: { port: ${newPort} },`));
|
|
@@ -5,6 +5,7 @@ import expressDescription from "./express.js";
|
|
|
5
5
|
import honoDescription from "./hono.js";
|
|
6
6
|
import nextDescription from "./next.js";
|
|
7
7
|
import nitroDescription from "./nitro.js";
|
|
8
|
+
import nuxtDescription from "./nuxt.js";
|
|
8
9
|
import solidstartDescription from "./solidstart.js";
|
|
9
10
|
//#region src/webframeworks/mod.ts
|
|
10
11
|
/**
|
|
@@ -22,6 +23,7 @@ const webFrameworks = {
|
|
|
22
23
|
hono: honoDescription,
|
|
23
24
|
next: nextDescription,
|
|
24
25
|
nitro: nitroDescription,
|
|
26
|
+
nuxt: nuxtDescription,
|
|
25
27
|
solidstart: solidstartDescription
|
|
26
28
|
};
|
|
27
29
|
//#endregion
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PACKAGE_VERSION, readTemplate } from "../lib.js";
|
|
2
|
+
import { PACKAGE_MANAGER } from "../const.js";
|
|
3
|
+
import { npm__types_node_25, npm_typescript } from "../json/deps.js";
|
|
4
|
+
import { defaultDenoDependencies, defaultDevDependencies } from "./const.js";
|
|
5
|
+
import { getInstruction } from "./utils.js";
|
|
6
|
+
//#region src/webframeworks/nuxt.ts
|
|
7
|
+
const nuxtDescription = {
|
|
8
|
+
label: "Nuxt",
|
|
9
|
+
packageManagers: PACKAGE_MANAGER,
|
|
10
|
+
defaultPort: 3e3,
|
|
11
|
+
init: async ({ packageManager: pm, testMode }) => ({
|
|
12
|
+
command: Array.from(getInitCommand(pm)),
|
|
13
|
+
dependencies: getDeps(pm),
|
|
14
|
+
devDependencies: {
|
|
15
|
+
...defaultDevDependencies,
|
|
16
|
+
"typescript": npm_typescript,
|
|
17
|
+
"@types/node": npm__types_node_25
|
|
18
|
+
},
|
|
19
|
+
federationFile: "server/federation.ts",
|
|
20
|
+
loggingFile: "server/logging.ts",
|
|
21
|
+
env: testMode ? { HOST: "127.0.0.1" } : {},
|
|
22
|
+
files: {
|
|
23
|
+
"nuxt.config.ts": await readTemplate("nuxt/nuxt.config.ts"),
|
|
24
|
+
...pm !== "deno" && { "eslint.config.ts": await readTemplate("defaults/eslint.config.ts") }
|
|
25
|
+
},
|
|
26
|
+
tasks: pm !== "deno" ? { "lint": "eslint ." } : {},
|
|
27
|
+
instruction: getInstruction(pm, 3e3)
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
function* getInitCommand(pm) {
|
|
31
|
+
yield* getNuxtInitCommand(pm);
|
|
32
|
+
yield* [
|
|
33
|
+
"init",
|
|
34
|
+
".",
|
|
35
|
+
"--template",
|
|
36
|
+
"minimal",
|
|
37
|
+
"--no-install",
|
|
38
|
+
"--force",
|
|
39
|
+
"--packageManager",
|
|
40
|
+
pm,
|
|
41
|
+
"--no-gitInit",
|
|
42
|
+
"--no-modules",
|
|
43
|
+
"&&",
|
|
44
|
+
"rm",
|
|
45
|
+
"nuxt.config.ts"
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns the shell command array to scaffold a new Nuxt project
|
|
50
|
+
* in the current directory using the given package manager.
|
|
51
|
+
*/
|
|
52
|
+
const getNuxtInitCommand = (pm) => pm === "bun" ? ["bunx", "nuxi"] : pm === "deno" ? [
|
|
53
|
+
"deno",
|
|
54
|
+
"-A",
|
|
55
|
+
"npm:nuxi@latest"
|
|
56
|
+
] : pm === "npm" ? ["npx", "nuxi"] : [
|
|
57
|
+
pm,
|
|
58
|
+
"dlx",
|
|
59
|
+
"nuxi"
|
|
60
|
+
];
|
|
61
|
+
const getDeps = (pm) => pm !== "deno" ? { "@fedify/nuxt": PACKAGE_VERSION } : {
|
|
62
|
+
...defaultDenoDependencies,
|
|
63
|
+
"@fedify/nuxt": PACKAGE_VERSION
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { nuxtDescription as default };
|