@fedify/init 2.0.8 → 2.0.10
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.js +1 -3
- package/dist/action/const.js +1 -3
- package/dist/action/deps.js +2 -6
- package/dist/action/dir.js +1 -3
- package/dist/action/env.js +1 -4
- package/dist/action/install.js +1 -4
- package/dist/action/mod.d.ts +0 -1
- package/dist/action/mod.js +10 -13
- package/dist/action/notice.js +3 -5
- package/dist/action/patch.js +2 -5
- package/dist/action/precommand.js +1 -4
- package/dist/action/recommend.js +1 -4
- package/dist/action/set.js +3 -6
- package/dist/action/templates.js +2 -4
- package/dist/action/utils.js +1 -3
- package/dist/ask/dir.js +1 -4
- package/dist/ask/kv.js +1 -4
- package/dist/ask/mod.js +7 -10
- package/dist/ask/mq.js +1 -4
- package/dist/ask/pm.js +6 -9
- package/dist/ask/wf.js +3 -6
- package/dist/command.d.ts +9 -9
- package/dist/command.js +1 -3
- package/dist/const.d.ts +0 -1
- package/dist/const.js +1 -3
- package/dist/deno.js +2 -36
- package/dist/json/biome.js +9 -14
- package/dist/json/db-to-check.js +16 -20
- package/dist/json/kv.js +53 -58
- package/dist/json/mq.js +70 -76
- package/dist/json/pm.js +31 -37
- package/dist/json/rt.js +26 -32
- package/dist/json/vscode-settings-for-deno.js +34 -46
- package/dist/json/vscode-settings.js +32 -42
- package/dist/lib.js +4 -7
- package/dist/mod.js +2 -3
- package/dist/test/action.js +3 -6
- package/dist/test/create.js +11 -18
- package/dist/test/db.js +2 -5
- package/dist/test/fill.js +9 -11
- package/dist/test/lookup.js +8 -14
- package/dist/test/mod.js +5 -7
- package/dist/test/run.js +4 -7
- package/dist/test/utils.js +1 -3
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +15 -19
- package/dist/webframeworks.js +1 -4
- package/package.json +5 -3
package/dist/test/action.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { set } from "../utils.js";
|
|
2
2
|
import { checkRequiredDbs } from "./db.js";
|
|
3
3
|
import { fillEmptyOptions } from "./fill.js";
|
|
4
|
-
import
|
|
4
|
+
import runTests from "./run.js";
|
|
5
5
|
import { emptyTestDir, genRunId, genTestDirPrefix, logTestDir } from "./utils.js";
|
|
6
6
|
import { pipe, tap, when } from "@fxts/core";
|
|
7
|
-
|
|
8
7
|
//#region src/test/action.ts
|
|
9
|
-
const runTestInit = (options) => pipe(options, set("runId", genRunId), set("testDirPrefix", genTestDirPrefix), tap(emptyTestDir), fillEmptyOptions, tap(checkRequiredDbs), tap(logTestDir), tap(when(isDryRun,
|
|
8
|
+
const runTestInit = (options) => pipe(options, set("runId", genRunId), set("testDirPrefix", genTestDirPrefix), tap(emptyTestDir), fillEmptyOptions, tap(checkRequiredDbs), tap(logTestDir), tap(when(isDryRun, runTests(true))), tap(when(isHydRun, runTests(false))));
|
|
10
9
|
const isDryRun = ({ dryRun }) => dryRun;
|
|
11
10
|
const isHydRun = ({ hydRun }) => hydRun;
|
|
12
|
-
var action_default = runTestInit;
|
|
13
|
-
|
|
14
11
|
//#endregion
|
|
15
|
-
export {
|
|
12
|
+
export { runTestInit as default };
|
package/dist/test/create.js
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import { CommandError, printErrorMessage, printMessage, product, runSubCommand } from "../utils.js";
|
|
2
2
|
import pm_default from "../json/pm.js";
|
|
3
3
|
import { kvStores, messageQueues } from "../lib.js";
|
|
4
|
-
import
|
|
4
|
+
import webFrameworks from "../webframeworks.js";
|
|
5
5
|
import { filter, isEmpty, pipe, toArray } from "@fxts/core";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { values } from "@optique/core";
|
|
8
8
|
import { appendFile, mkdir } from "node:fs/promises";
|
|
9
9
|
import { join as join$1, sep } from "node:path";
|
|
10
|
-
|
|
11
10
|
//#region src/test/create.ts
|
|
12
11
|
const BANNED_PMS = ["bun", "yarn"];
|
|
13
12
|
const createTestApp = (testDirPrefix, dry) => async (options) => {
|
|
14
13
|
const testDir = join$1(testDirPrefix, ...options);
|
|
15
14
|
const vals = values(testDir.split(sep).slice(-4));
|
|
16
15
|
try {
|
|
17
|
-
|
|
16
|
+
await saveOutputs(testDir, await runSubCommand(toArray(genInitCommand(testDir, dry, options)), {
|
|
18
17
|
cwd: join$1(import.meta.dirname, "../.."),
|
|
19
18
|
stdio: [
|
|
20
19
|
"ignore",
|
|
21
20
|
"pipe",
|
|
22
21
|
"pipe"
|
|
23
22
|
]
|
|
24
|
-
});
|
|
25
|
-
await saveOutputs(testDir, result);
|
|
23
|
+
}));
|
|
26
24
|
printMessage` Pass: ${vals}`;
|
|
27
25
|
return testDir;
|
|
28
26
|
} catch (error) {
|
|
@@ -30,18 +28,14 @@ const createTestApp = (testDirPrefix, dry) => async (options) => {
|
|
|
30
28
|
stdout: error.stdout,
|
|
31
29
|
stderr: error.stderr
|
|
32
30
|
});
|
|
33
|
-
else {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
stderr: errorMessage
|
|
38
|
-
});
|
|
39
|
-
}
|
|
31
|
+
else await saveOutputs(testDir, {
|
|
32
|
+
stdout: "",
|
|
33
|
+
stderr: error instanceof Error ? error.message : String(error)
|
|
34
|
+
});
|
|
40
35
|
printMessage` Fail: ${vals}`;
|
|
41
36
|
return "";
|
|
42
37
|
}
|
|
43
38
|
};
|
|
44
|
-
var create_default = createTestApp;
|
|
45
39
|
function* genInitCommand(testDir, dry, [webFramework, packageManager, kvStore, messageQueue]) {
|
|
46
40
|
yield "deno";
|
|
47
41
|
yield "run";
|
|
@@ -69,8 +63,8 @@ const generateTestCases = ({ webFramework, packageManager, kvStore, messageQueue
|
|
|
69
63
|
]);
|
|
70
64
|
return product(webFramework, pms, kvStore, messageQueue);
|
|
71
65
|
};
|
|
72
|
-
const filterPackageManager = (pm) => pipe(pm, filter((pm
|
|
73
|
-
supported in test mode yet because ${pm_default[pm
|
|
66
|
+
const filterPackageManager = (pm) => pipe(pm, filter((pm) => BANNED_PMS.includes(pm) ? printErrorMessage`${pm_default[pm]["label"]} is not \
|
|
67
|
+
supported in test mode yet because ${pm_default[pm]["label"]} don't \
|
|
74
68
|
support local file dependencies properly.` : true), toArray);
|
|
75
69
|
const exitIfCasesEmpty = (cases) => {
|
|
76
70
|
if (cases.some(isEmpty)) {
|
|
@@ -86,11 +80,10 @@ const saveOutputs = async (dirPath, { stdout, stderr }) => {
|
|
|
86
80
|
function filterOptions(options) {
|
|
87
81
|
const [wf, pm, kv, mq] = options;
|
|
88
82
|
return [
|
|
89
|
-
|
|
83
|
+
webFrameworks[wf].packageManagers,
|
|
90
84
|
kvStores[kv].packageManagers,
|
|
91
85
|
messageQueues[mq].packageManagers
|
|
92
86
|
].every((pms) => pms.includes(pm));
|
|
93
87
|
}
|
|
94
|
-
|
|
95
88
|
//#endregion
|
|
96
|
-
export {
|
|
89
|
+
export { createTestApp as default, filterOptions, generateTestCases };
|
package/dist/test/db.js
CHANGED
|
@@ -3,7 +3,6 @@ import { DB_TO_CHECK } from "../const.js";
|
|
|
3
3
|
import db_to_check_default from "../json/db-to-check.js";
|
|
4
4
|
import { concat, filter, pipe, toArray, uniq } from "@fxts/core";
|
|
5
5
|
import { createConnection } from "node:net";
|
|
6
|
-
|
|
7
6
|
//#region src/test/db.ts
|
|
8
7
|
/**
|
|
9
8
|
* Checks if a given port is open by attempting a raw TCP connection to
|
|
@@ -42,11 +41,9 @@ async function checkRequiredDbs(options) {
|
|
|
42
41
|
for (const db of dbs) {
|
|
43
42
|
const info = db_to_check_default[db];
|
|
44
43
|
const port = String(info.defaultPort);
|
|
45
|
-
|
|
46
|
-
if (running) printMessage` ${info.name} is running on port ${port}.`;
|
|
44
|
+
if (await isPortOpen(info.defaultPort)) printMessage` ${info.name} is running on port ${port}.`;
|
|
47
45
|
else printErrorMessage`${info.name} is not running on port ${port}. Tests requiring ${info.name} may fail. Install: ${info.documentation}`;
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
|
-
|
|
51
48
|
//#endregion
|
|
52
|
-
export { checkRequiredDbs };
|
|
49
|
+
export { checkRequiredDbs };
|
package/dist/test/fill.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK } from "../const.js";
|
|
2
2
|
import { isEmpty, omit, pipe } from "@fxts/core";
|
|
3
|
-
|
|
4
3
|
//#region src/test/fill.ts
|
|
5
4
|
const fillEmptyOptions = (options) => pipe(options, fillWebFramework, fillPackageManager, fillKVStore, fillMessageQueue, fillRunMode);
|
|
6
5
|
const fillOption = (key, allValues) => (options) => ({
|
|
@@ -11,19 +10,18 @@ const fillWebFramework = fillOption("webFramework", WEB_FRAMEWORK);
|
|
|
11
10
|
const fillPackageManager = fillOption("packageManager", PACKAGE_MANAGER);
|
|
12
11
|
const fillKVStore = fillOption("kvStore", KV_STORE);
|
|
13
12
|
const fillMessageQueue = fillOption("messageQueue", MESSAGE_QUEUE);
|
|
14
|
-
const fillRunMode = (options) => pipe(options, (options
|
|
15
|
-
...omit(["noHydRun"], options
|
|
16
|
-
hydRun: !options
|
|
13
|
+
const fillRunMode = (options) => pipe(options, (options) => "noHydRun" in options ? {
|
|
14
|
+
...omit(["noHydRun"], options),
|
|
15
|
+
hydRun: !options.noHydRun
|
|
17
16
|
} : {
|
|
18
|
-
...options
|
|
17
|
+
...options,
|
|
19
18
|
hydRun: true
|
|
20
|
-
}, (options
|
|
21
|
-
...omit(["noDryRun"], options
|
|
22
|
-
dryRun: !options
|
|
19
|
+
}, (options) => "noDryRun" in options ? {
|
|
20
|
+
...omit(["noDryRun"], options),
|
|
21
|
+
dryRun: !options.noDryRun
|
|
23
22
|
} : {
|
|
24
|
-
...options
|
|
23
|
+
...options,
|
|
25
24
|
dryRun: true
|
|
26
25
|
});
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
|
-
export { fillEmptyOptions };
|
|
27
|
+
export { fillEmptyOptions };
|
package/dist/test/lookup.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { printErrorMessage, printMessage, runSubCommand } from "../utils.js";
|
|
2
2
|
import { getDevCommand } from "../lib.js";
|
|
3
|
-
import
|
|
3
|
+
import webFrameworks from "../webframeworks.js";
|
|
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
|
-
|
|
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),
|
|
54
|
+
const result = await serverClosure(dir, getDevCommand(pm), webFrameworks[wf].defaultPort, sendLookup);
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|
package/dist/test/mod.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { testInitCommand } from "../command.js";
|
|
2
|
-
import
|
|
2
|
+
import runTestInit from "./action.js";
|
|
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
|
-
|
|
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
|
-
|
|
13
|
+
//#endregion
|
|
14
|
+
export {};
|
package/dist/test/run.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { printMessage } from "../utils.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import createTestApp, { filterOptions, generateTestCases } from "./create.js";
|
|
3
|
+
import runServerAndLookupUser from "./lookup.js";
|
|
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
|
|
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 {
|
|
19
|
+
export { runTests as default };
|
package/dist/test/utils.js
CHANGED
|
@@ -2,7 +2,6 @@ import { printMessage } from "../utils.js";
|
|
|
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 run completed.
|
|
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 };
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -5,13 +5,10 @@ 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
|
-
const colorEnabled = process.stdout.isTTY && !("NO_COLOR" in process.env && process.env.NO_COLOR !== "");
|
|
11
|
-
const colors = new Chalk(colorEnabled ? {} : { level: 0 });
|
|
8
|
+
const colors = new Chalk(process.stdout.isTTY && !("NO_COLOR" in process.env && process.env.NO_COLOR !== "") ? {} : { level: 0 });
|
|
12
9
|
const isPromise = (value) => value instanceof Promise;
|
|
13
10
|
function set(key, f) {
|
|
14
|
-
return (obj) => {
|
|
11
|
+
return ((obj) => {
|
|
15
12
|
const result = f(obj);
|
|
16
13
|
if (isPromise(result)) return result.then((value) => ({
|
|
17
14
|
...obj,
|
|
@@ -21,28 +18,28 @@ function set(key, f) {
|
|
|
21
18
|
...obj,
|
|
22
19
|
[key]: result
|
|
23
20
|
};
|
|
24
|
-
};
|
|
21
|
+
});
|
|
25
22
|
}
|
|
26
23
|
const merge$1 = (source = {}) => (target = {}) => toMerged(target, source);
|
|
27
|
-
const replace = (pattern, replacement) => (text
|
|
28
|
-
const replaceAll = (pattern, replacement) => (text
|
|
24
|
+
const replace = (pattern, replacement) => (text) => text.replace(pattern, replacement);
|
|
25
|
+
const replaceAll = (pattern, replacement) => (text) => text.replaceAll(pattern, replacement);
|
|
29
26
|
const formatJson = (obj) => JSON.stringify(obj, null, 2) + "\n";
|
|
30
27
|
const notEmpty = (s) => s.length > 0;
|
|
31
28
|
const isNotFoundError = (e) => isObject(e) && "code" in e && e.code === "ENOENT";
|
|
32
29
|
var CommandError = class extends Error {
|
|
33
30
|
commandLine;
|
|
34
|
-
constructor(message
|
|
35
|
-
super(message
|
|
31
|
+
constructor(message, stdout, stderr, code, command) {
|
|
32
|
+
super(message);
|
|
36
33
|
this.stdout = stdout;
|
|
37
34
|
this.stderr = stderr;
|
|
38
35
|
this.code = code;
|
|
39
|
-
this.command = command
|
|
36
|
+
this.command = command;
|
|
40
37
|
this.name = "CommandError";
|
|
41
|
-
this.commandLine = command
|
|
38
|
+
this.commandLine = command.join(" ");
|
|
42
39
|
}
|
|
43
40
|
};
|
|
44
|
-
const runSubCommand = async (command
|
|
45
|
-
const commands = command
|
|
41
|
+
const runSubCommand = async (command, options) => {
|
|
42
|
+
const commands = command.reduce((acc, cur) => {
|
|
46
43
|
if (cur === "&&") acc.push([]);
|
|
47
44
|
else {
|
|
48
45
|
if (acc.length === 0) acc.push([]);
|
|
@@ -67,10 +64,10 @@ const runSubCommand = async (command$1, options) => {
|
|
|
67
64
|
}
|
|
68
65
|
return results;
|
|
69
66
|
};
|
|
70
|
-
const runSingularCommand = (command
|
|
67
|
+
const runSingularCommand = (command, options) => new Promise((resolve, reject) => {
|
|
71
68
|
let stdout = "";
|
|
72
69
|
let stderr = "";
|
|
73
|
-
const child = spawn(command
|
|
70
|
+
const child = spawn(command[0], command.slice(1), options);
|
|
74
71
|
child.stdout?.on("data", (data) => {
|
|
75
72
|
stdout += data.toString();
|
|
76
73
|
});
|
|
@@ -82,7 +79,7 @@ const runSingularCommand = (command$1, options) => new Promise((resolve, reject)
|
|
|
82
79
|
stdout: stdout.trim(),
|
|
83
80
|
stderr: stderr.trim()
|
|
84
81
|
});
|
|
85
|
-
else reject(new CommandError(`Command exited with code ${code ?? "unknown"}`, stdout.trim(), stderr.trim(), code ?? -1, command
|
|
82
|
+
else reject(new CommandError(`Command exited with code ${code ?? "unknown"}`, stdout.trim(), stderr.trim(), code ?? -1, command));
|
|
86
83
|
});
|
|
87
84
|
child.on("error", (error) => {
|
|
88
85
|
reject(error);
|
|
@@ -97,6 +94,5 @@ function* product(...[head, ...tail]) {
|
|
|
97
94
|
}
|
|
98
95
|
const printMessage = flow(message, print);
|
|
99
96
|
const printErrorMessage = flow(message, printError);
|
|
100
|
-
|
|
101
97
|
//#endregion
|
|
102
|
-
export { CommandError, colors, exit, formatJson, getCwd, getOsType, isNotFoundError, merge$1 as merge, notEmpty, printErrorMessage, printMessage, product, replace, replaceAll, runSubCommand, set };
|
|
98
|
+
export { CommandError, colors, exit, formatJson, getCwd, getOsType, isNotFoundError, merge$1 as merge, notEmpty, printErrorMessage, printMessage, product, replace, replaceAll, runSubCommand, set };
|
package/dist/webframeworks.js
CHANGED
|
@@ -2,7 +2,6 @@ import { replace } from "./utils.js";
|
|
|
2
2
|
import { PACKAGE_VERSION, getInstruction, getNextInitCommand, getNitroInitCommand, packageManagerToRuntime, readTemplate } from "./lib.js";
|
|
3
3
|
import { PACKAGE_MANAGER } from "./const.js";
|
|
4
4
|
import { pipe } from "@fxts/core";
|
|
5
|
-
|
|
6
5
|
//#region src/webframeworks.ts
|
|
7
6
|
const webFrameworks = {
|
|
8
7
|
"bare-bones": {
|
|
@@ -254,12 +253,10 @@ const webFrameworks = {
|
|
|
254
253
|
defaultPort: 3e3
|
|
255
254
|
}
|
|
256
255
|
};
|
|
257
|
-
var webframeworks_default = webFrameworks;
|
|
258
256
|
const defaultDevDependencies = {
|
|
259
257
|
"eslint": "^9.0.0",
|
|
260
258
|
"@fedify/lint": PACKAGE_VERSION
|
|
261
259
|
};
|
|
262
260
|
const defaultDenoDependencies = { "@fedify/lint": PACKAGE_VERSION };
|
|
263
|
-
|
|
264
261
|
//#endregion
|
|
265
|
-
export {
|
|
262
|
+
export { webFrameworks as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/init",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "Project initializer for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -59,13 +59,15 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "^22.17.0",
|
|
62
|
-
"tsdown": "^0.
|
|
63
|
-
"typescript": "^5.9.
|
|
62
|
+
"tsdown": "^0.21.6",
|
|
63
|
+
"typescript": "^5.9.2"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build:self": "tsdown",
|
|
67
67
|
"build": "pnpm --filter @fedify/init... run build:self",
|
|
68
68
|
"prepublish": "pnpm build",
|
|
69
|
+
"pretest": "pnpm build",
|
|
70
|
+
"test": "node --test --experimental-transform-types 'src/**/*.test.ts'",
|
|
69
71
|
"test-init": "deno task test-init"
|
|
70
72
|
}
|
|
71
73
|
}
|