@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/action/configs.js
CHANGED
|
@@ -8,7 +8,6 @@ import { uniq } from "es-toolkit";
|
|
|
8
8
|
import { realpathSync } from "node:fs";
|
|
9
9
|
import { join, relative } from "node:path";
|
|
10
10
|
import { concat, filter, keys, map, pick, pipe, toArray } from "@fxts/core/index.js";
|
|
11
|
-
|
|
12
11
|
//#region src/action/configs.ts
|
|
13
12
|
/**
|
|
14
13
|
* Loads Deno configuration object with compiler options, unstable features, and tasks.
|
|
@@ -84,6 +83,5 @@ const devToolConfigs = {
|
|
|
84
83
|
data: { recommendations: ["denoland.vscode-deno"] }
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
|
-
|
|
88
86
|
//#endregion
|
|
89
|
-
export { devToolConfigs, loadDenoConfig, loadPackageJson, loadTsConfig };
|
|
87
|
+
export { devToolConfigs, loadDenoConfig, loadPackageJson, loadTsConfig };
|
package/dist/action/const.js
CHANGED
package/dist/action/deps.js
CHANGED
|
@@ -4,7 +4,6 @@ import { getPackagesPath } from "./const.js";
|
|
|
4
4
|
import { isDeno } from "./utils.js";
|
|
5
5
|
import { always, entries, filter, fromEntries, map, pipe, when } from "@fxts/core";
|
|
6
6
|
import { join as join$1 } from "node:path";
|
|
7
|
-
|
|
8
7
|
//#region src/action/deps.ts
|
|
9
8
|
/**
|
|
10
9
|
* Gathers all dependencies required for the project based on the initializer,
|
|
@@ -40,13 +39,10 @@ const getDevDependencies = ({ initializer, kv, mq, packageManager }) => pipe({ "
|
|
|
40
39
|
* @returns \{ name: `${registry}:${package}@${version}` } for deno
|
|
41
40
|
*/
|
|
42
41
|
const joinDepsReg = (pm) => (dependencies) => pipe(dependencies, entries, map(([name, version]) => {
|
|
43
|
-
|
|
44
|
-
const fullSpec = version.startsWith("npm:") || version.startsWith("jsr:") ? version : `${name}@${getPackageVersion(pm, version)}`;
|
|
45
|
-
return [cleanName, fullSpec];
|
|
42
|
+
return [name.substring(4), version.startsWith("npm:") || version.startsWith("jsr:") ? version : `${name}@${getPackageVersion(pm, version)}`];
|
|
46
43
|
}), fromEntries);
|
|
47
44
|
const getPackageVersion = (pm, version) => pm !== "deno" && version.includes("+") ? version.substring(0, version.indexOf("+")) : version;
|
|
48
45
|
const normalizePackageNames = (pm) => (deps) => pipe(deps, entries, map(([name, version]) => [getPackageName(pm, name), version]), fromEntries);
|
|
49
46
|
const getPackageName = (pm, name) => pm !== "deno" ? name.startsWith("npm:") ? name.replace("npm:", "") : name : name.startsWith("npm:") ? name : `jsr:${name}`;
|
|
50
|
-
|
|
51
47
|
//#endregion
|
|
52
|
-
export { getDependencies, getDevDependencies, joinDepsReg };
|
|
48
|
+
export { getDependencies, getDevDependencies, joinDepsReg };
|
package/dist/action/dir.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { mkdir } from "node:fs/promises";
|
|
2
|
-
|
|
3
2
|
//#region src/action/dir.ts
|
|
4
3
|
/**
|
|
5
4
|
* Creates the target directory if it does not exist.
|
|
@@ -8,6 +7,5 @@ import { mkdir } from "node:fs/promises";
|
|
|
8
7
|
* @returns A promise that resolves when the directory is created
|
|
9
8
|
*/
|
|
10
9
|
const makeDirIfHyd = ({ dir }) => mkdir(dir, { recursive: true });
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
export { makeDirIfHyd };
|
|
11
|
+
export { makeDirIfHyd };
|
package/dist/action/env.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { notEmpty } from "../utils.js";
|
|
2
2
|
import { noticeConfigEnv, noticeEnvKeyValue } from "./notice.js";
|
|
3
3
|
import { entries, forEach, pipeLazy, tap, toArray, when } from "@fxts/core";
|
|
4
|
-
|
|
5
4
|
//#region src/action/env.ts
|
|
6
5
|
const recommendConfigEnv = pipeLazy((data) => data.env, entries, toArray, when(notEmpty, tap(noticeConfigEnv)), forEach(noticeEnvKeyValue));
|
|
7
|
-
var env_default = recommendConfigEnv;
|
|
8
|
-
|
|
9
6
|
//#endregion
|
|
10
|
-
export {
|
|
7
|
+
export { recommendConfigEnv as default };
|
package/dist/action/install.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommandError, runSubCommand } from "../utils.js";
|
|
2
2
|
import { apply, pipe } from "@fxts/core";
|
|
3
|
-
|
|
4
3
|
//#region src/action/install.ts
|
|
5
4
|
const installDependencies = (data) => pipe(data, ({ packageManager, dir }) => [[packageManager, "install"], { cwd: dir }], apply(runSubCommand)).catch((e) => {
|
|
6
5
|
if (e instanceof CommandError) {
|
|
@@ -11,7 +10,5 @@ const installDependencies = (data) => pipe(data, ({ packageManager, dir }) => [[
|
|
|
11
10
|
}
|
|
12
11
|
throw e;
|
|
13
12
|
});
|
|
14
|
-
var install_default = installDependencies;
|
|
15
|
-
|
|
16
13
|
//#endregion
|
|
17
|
-
export {
|
|
14
|
+
export { installDependencies as default };
|
package/dist/action/mod.d.ts
CHANGED
package/dist/action/mod.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { set } from "../utils.js";
|
|
2
|
-
import
|
|
2
|
+
import askOptions from "../ask/mod.js";
|
|
3
3
|
import { makeDirIfHyd } from "./dir.js";
|
|
4
4
|
import { drawDinosaur, noticeHowToRun, noticeOptions, noticePrecommand } from "./notice.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import recommendConfigEnv from "./env.js";
|
|
6
|
+
import installDependencies from "./install.js";
|
|
7
7
|
import { hasCommand, isDry } from "./utils.js";
|
|
8
8
|
import { patchFiles, recommendPatchFiles } from "./patch.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import runPrecommand from "./precommand.js";
|
|
10
|
+
import recommendDependencies from "./recommend.js";
|
|
11
|
+
import setData from "./set.js";
|
|
12
12
|
import { pipe, tap, unless, when } from "@fxts/core";
|
|
13
13
|
import process from "node:process";
|
|
14
|
-
|
|
15
14
|
//#region src/action/mod.ts
|
|
16
15
|
/**
|
|
17
16
|
* Execution flow of the `runInit` function:
|
|
@@ -28,11 +27,9 @@ import process from "node:process";
|
|
|
28
27
|
* 7. Recommends configuration environment via `recommendConfigEnv`.
|
|
29
28
|
* 8. Shows how to run the project via `noticeHowToRun`.
|
|
30
29
|
*/
|
|
31
|
-
const runInit = (options) => pipe(options, tap(drawDinosaur), setTestMode,
|
|
32
|
-
var action_default = runInit;
|
|
30
|
+
const runInit = (options) => pipe(options, tap(drawDinosaur), setTestMode, askOptions, tap(noticeOptions), setData, when(isDry, handleDryRun), unless(isDry, handleHydRun), tap(recommendConfigEnv), tap(noticeHowToRun));
|
|
33
31
|
const setTestMode = set("testMode", () => Boolean(process.env["FEDIFY_TEST_MODE"]));
|
|
34
|
-
const handleDryRun = (data) => pipe(data, tap(when(hasCommand, noticePrecommand)), tap(recommendPatchFiles), tap(
|
|
35
|
-
const handleHydRun = (data) => pipe(data, tap(makeDirIfHyd), tap(when(hasCommand,
|
|
36
|
-
|
|
32
|
+
const handleDryRun = (data) => pipe(data, tap(when(hasCommand, noticePrecommand)), tap(recommendPatchFiles), tap(recommendDependencies));
|
|
33
|
+
const handleHydRun = (data) => pipe(data, tap(makeDirIfHyd), tap(when(hasCommand, runPrecommand)), tap(patchFiles), tap(installDependencies));
|
|
37
34
|
//#endregion
|
|
38
|
-
export {
|
|
35
|
+
export { runInit as default };
|
package/dist/action/notice.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { colors, printMessage } from "../utils.js";
|
|
2
2
|
import { text } from "@optique/core";
|
|
3
3
|
import { flow } from "es-toolkit";
|
|
4
|
-
|
|
5
4
|
//#region src/action/notice.ts
|
|
6
5
|
function drawDinosaur() {
|
|
7
6
|
const d = flow(colors.bgBlue, colors.black);
|
|
@@ -21,10 +20,10 @@ const noticeOptions = ({ packageManager, webFramework, kvStore, messageQueue })
|
|
|
21
20
|
Key–value store: ${kvStore};
|
|
22
21
|
Message queue: ${messageQueue};
|
|
23
22
|
`;
|
|
24
|
-
function noticePrecommand({ initializer: { command
|
|
23
|
+
function noticePrecommand({ initializer: { command }, dir }) {
|
|
25
24
|
printMessage`📦 Would run command:`;
|
|
26
25
|
printMessage` cd ${dir}`;
|
|
27
|
-
printMessage` ${command
|
|
26
|
+
printMessage` ${command.join(" ")}\n`;
|
|
28
27
|
}
|
|
29
28
|
const noticeFilesToCreate = () => printMessage`📄 Would create files:\n`;
|
|
30
29
|
const noticeFilesToInsert = () => printMessage`Would create/update JSON files:\n`;
|
|
@@ -47,6 +46,5 @@ ${instruction}
|
|
|
47
46
|
|
|
48
47
|
Start by editing the ${text(federationFile)} file to define your federation!
|
|
49
48
|
`;
|
|
50
|
-
|
|
51
49
|
//#endregion
|
|
52
|
-
export { displayFile, drawDinosaur, noticeConfigEnv, noticeDeps, noticeDepsIfExist, noticeDevDepsIfExist, noticeEnvKeyValue, noticeFilesToCreate, noticeFilesToInsert, noticeHowToRun, noticeOptions, noticePrecommand };
|
|
50
|
+
export { displayFile, drawDinosaur, noticeConfigEnv, noticeDeps, noticeDepsIfExist, noticeDevDepsIfExist, noticeEnvKeyValue, noticeFilesToCreate, noticeFilesToInsert, noticeHowToRun, noticeOptions, noticePrecommand };
|
package/dist/action/patch.js
CHANGED
|
@@ -7,7 +7,6 @@ import { getImports, loadFederation, loadLogging } from "./templates.js";
|
|
|
7
7
|
import { always, apply, entries, map, pipe, pipeLazy, tap } from "@fxts/core";
|
|
8
8
|
import { toMerged } from "es-toolkit";
|
|
9
9
|
import { readFile } from "node:fs/promises";
|
|
10
|
-
|
|
11
10
|
//#region src/action/patch.ts
|
|
12
11
|
/**
|
|
13
12
|
* Main function that initializes the project by creating necessary files and configurations.
|
|
@@ -97,8 +96,7 @@ const processAllFiles = (process) => ({ dir, files }) => pipe(files, entries, ma
|
|
|
97
96
|
*/
|
|
98
97
|
async function patchContent(path, content) {
|
|
99
98
|
const prev = await readFileIfExists(path);
|
|
100
|
-
|
|
101
|
-
return [path, data];
|
|
99
|
+
return [path, typeof content === "object" ? mergeJson(prev, content) : appendText(prev, content)];
|
|
102
100
|
}
|
|
103
101
|
/**
|
|
104
102
|
* Merges new JSON data with existing JSON content and formats the result.
|
|
@@ -139,6 +137,5 @@ const appendText = (prev, data) => prev ? `${prev}\n${data}` : data;
|
|
|
139
137
|
* @throws Error if file access fails for reasons other than file not existing
|
|
140
138
|
*/
|
|
141
139
|
const readFileIfExists = (path) => readFile(path, "utf8").catch(pipeLazy(tap(throwUnlessNotExists), always("")));
|
|
142
|
-
|
|
143
140
|
//#endregion
|
|
144
|
-
export { patchFiles, recommendPatchFiles };
|
|
141
|
+
export { patchFiles, recommendPatchFiles };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CommandError, exit, runSubCommand } from "../utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/action/precommand.ts
|
|
4
3
|
/**
|
|
5
4
|
* Runs the precommand specified in the initializer to set up the project.
|
|
@@ -19,7 +18,5 @@ const runPrecommand = ({ initializer: { command }, dir }) => runSubCommand(comma
|
|
|
19
18
|
} else console.error("Failed to run the precommand:", e);
|
|
20
19
|
exit(1);
|
|
21
20
|
});
|
|
22
|
-
var precommand_default = runPrecommand;
|
|
23
|
-
|
|
24
21
|
//#endregion
|
|
25
|
-
export {
|
|
22
|
+
export { runPrecommand as default };
|
package/dist/action/recommend.js
CHANGED
|
@@ -3,7 +3,6 @@ import { noticeDeps, noticeDepsIfExist, noticeDevDepsIfExist } from "./notice.js
|
|
|
3
3
|
import { isDeno } from "./utils.js";
|
|
4
4
|
import { getDependencies, getDevDependencies } from "./deps.js";
|
|
5
5
|
import { map, peek, pipeLazy, tap, unless, when } from "@fxts/core";
|
|
6
|
-
|
|
7
6
|
//#region src/action/recommend.ts
|
|
8
7
|
const recommendDeps = pipeLazy(getDependencies, Object.entries, when(notEmpty, tap(noticeDepsIfExist)), peek(noticeDeps));
|
|
9
8
|
const recommendDevDeps = pipeLazy(getDevDependencies, Object.entries, when(notEmpty, tap(noticeDevDepsIfExist)), map(noticeDeps));
|
|
@@ -15,7 +14,5 @@ const recommendDevDeps = pipeLazy(getDevDependencies, Object.entries, when(notEm
|
|
|
15
14
|
* @returns An InitCommandIo function that performs the recommendation
|
|
16
15
|
*/
|
|
17
16
|
const recommendDependencies = pipeLazy(tap(recommendDeps), unless(isDeno, tap(recommendDevDeps)));
|
|
18
|
-
var recommend_default = recommendDependencies;
|
|
19
|
-
|
|
20
17
|
//#endregion
|
|
21
|
-
export {
|
|
18
|
+
export { recommendDependencies as default };
|
package/dist/action/set.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { merge, set } from "../utils.js";
|
|
2
2
|
import { kvStores, messageQueues } from "../lib.js";
|
|
3
|
-
import
|
|
3
|
+
import webFrameworks from "../webframeworks.js";
|
|
4
4
|
import { pipe } from "@fxts/core";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { realpath } from "node:fs/promises";
|
|
7
7
|
import { basename, normalize } from "node:path";
|
|
8
|
-
|
|
9
8
|
//#region src/action/set.ts
|
|
10
9
|
/**
|
|
11
10
|
* Set all necessary data for initializing the project.
|
|
@@ -17,12 +16,10 @@ import { basename, normalize } from "node:path";
|
|
|
17
16
|
* @returns A promise resolving to a complete InitCommandData object
|
|
18
17
|
*/
|
|
19
18
|
const setData = (data) => pipe(data, setProjectName, setInitializer, setKv, setMq, setEnv);
|
|
20
|
-
var set_default = setData;
|
|
21
19
|
const setProjectName = set("projectName", async ({ dir }) => basename(existsSync(dir) ? await realpath(dir) : normalize(dir)));
|
|
22
|
-
const setInitializer = set("initializer", (data) =>
|
|
20
|
+
const setInitializer = set("initializer", (data) => webFrameworks[data.webFramework].init(data));
|
|
23
21
|
const setKv = set("kv", ({ kvStore }) => kvStores[kvStore]);
|
|
24
22
|
const setMq = set("mq", ({ messageQueue }) => messageQueues[messageQueue]);
|
|
25
23
|
const setEnv = set("env", ({ kv, mq }) => merge(kv.env)(mq.env));
|
|
26
|
-
|
|
27
24
|
//#endregion
|
|
28
|
-
export {
|
|
25
|
+
export { setData as default };
|
package/dist/action/templates.js
CHANGED
|
@@ -2,7 +2,6 @@ import { replace } from "../utils.js";
|
|
|
2
2
|
import { readTemplate } from "../lib.js";
|
|
3
3
|
import { entries, join, map, pipe } from "@fxts/core";
|
|
4
4
|
import { toMerged } from "es-toolkit";
|
|
5
|
-
|
|
6
5
|
//#region src/action/templates.ts
|
|
7
6
|
/**
|
|
8
7
|
* Loads the federation configuration file content from template.
|
|
@@ -27,7 +26,7 @@ const loadLogging = ({ projectName }) => pipe("defaults/logging.ts", readTemplat
|
|
|
27
26
|
* @param param0 - Destructured object containing kv and mq configurations
|
|
28
27
|
* @returns A multi-line string containing all necessary import statements
|
|
29
28
|
*/
|
|
30
|
-
const getImports = ({ kv, mq }) => pipe(toMerged(kv.imports, mq.imports), entries, map(([module, { "default": defaultImport = ""
|
|
29
|
+
const getImports = ({ kv, mq }) => pipe(toMerged(kv.imports, mq.imports), entries, map(([module, { "default": defaultImport = "", ...imports }]) => [
|
|
31
30
|
module,
|
|
32
31
|
defaultImport,
|
|
33
32
|
getAlias(imports)
|
|
@@ -50,6 +49,5 @@ const ENV_REG_EXP = /process\.env\.(\w+)/g;
|
|
|
50
49
|
* @returns The converted object string with appropriate environment variable access syntax
|
|
51
50
|
*/
|
|
52
51
|
const convertEnv = (obj, pm) => pm === "deno" && ENV_REG_EXP.test(obj) ? obj.replaceAll(ENV_REG_EXP, (_, g1) => `Deno.env.get("${g1}")`) : obj;
|
|
53
|
-
|
|
54
52
|
//#endregion
|
|
55
|
-
export { getImports, loadFederation, loadLogging };
|
|
53
|
+
export { getImports, loadFederation, loadLogging };
|
package/dist/action/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
|
|
3
2
|
//#region src/action/utils.ts
|
|
4
3
|
const isDry = ({ dryRun }) => dryRun;
|
|
5
4
|
const hasCommand = (data) => !!data.initializer.command;
|
|
@@ -42,6 +41,5 @@ function stringifyEnvs(object) {
|
|
|
42
41
|
}
|
|
43
42
|
return lines.join("\n");
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
//#endregion
|
|
47
|
-
export { hasCommand, isDeno, isDry, joinDir, stringifyEnvs };
|
|
45
|
+
export { hasCommand, isDeno, isDry, joinDir, stringifyEnvs };
|
package/dist/ask/dir.js
CHANGED
|
@@ -5,7 +5,6 @@ import { input } from "@inquirer/prompts";
|
|
|
5
5
|
import { message } from "@optique/core/message";
|
|
6
6
|
import { printError } from "@optique/run";
|
|
7
7
|
import toggle from "inquirer-toggle";
|
|
8
|
-
|
|
9
8
|
//#region src/ask/dir.ts
|
|
10
9
|
/**
|
|
11
10
|
* Fills in the project directory by prompting the user if not provided.
|
|
@@ -23,7 +22,6 @@ const fillDir = async (options) => {
|
|
|
23
22
|
dir
|
|
24
23
|
} : await fillDir(options);
|
|
25
24
|
};
|
|
26
|
-
var dir_default = fillDir;
|
|
27
25
|
const askDir = (cwd) => input({
|
|
28
26
|
message: "Project directory:",
|
|
29
27
|
default: cwd
|
|
@@ -74,6 +72,5 @@ const getPowershellTrashCommand = (dir) => [
|
|
|
74
72
|
"'OnlyErrorDialogs',",
|
|
75
73
|
"'SendToRecycleBin')"
|
|
76
74
|
].join(" ");
|
|
77
|
-
|
|
78
75
|
//#endregion
|
|
79
|
-
export {
|
|
76
|
+
export { fillDir as default };
|
package/dist/ask/kv.js
CHANGED
|
@@ -3,7 +3,6 @@ import { isTest, kvStores } from "../lib.js";
|
|
|
3
3
|
import { KV_STORE } from "../const.js";
|
|
4
4
|
import { select } from "@inquirer/prompts";
|
|
5
5
|
import { pipe, tap, throwError, unless, when } from "@fxts/core/index.js";
|
|
6
|
-
|
|
7
6
|
//#region src/ask/kv.ts
|
|
8
7
|
/**
|
|
9
8
|
* Fills in the key-value store by prompting the user if not provided.
|
|
@@ -13,7 +12,6 @@ import { pipe, tap, throwError, unless, when } from "@fxts/core/index.js";
|
|
|
13
12
|
* @returns A promise resolving to options with a guaranteed kvStore
|
|
14
13
|
*/
|
|
15
14
|
const fillKvStore = (options) => pipe(options, when(isKvStoreEmpty, askKvStore), unless(isKvSupportsPm, (opt) => pipe(opt, when(isTest, throwError(unmatchedWhileTesting)), tap(noticeUnmatched), fillKvStore)));
|
|
16
|
-
var kv_default = fillKvStore;
|
|
17
15
|
const isKvStoreEmpty = (options) => !options.kvStore;
|
|
18
16
|
const askKvStore = async (data) => ({
|
|
19
17
|
...data,
|
|
@@ -36,6 +34,5 @@ const choiceKvStore = (pm) => (kv) => ({
|
|
|
36
34
|
})
|
|
37
35
|
});
|
|
38
36
|
const isKvSupportsPm = ({ kvStore, packageManager }) => kvStores[kvStore].packageManagers.includes(packageManager);
|
|
39
|
-
|
|
40
37
|
//#endregion
|
|
41
|
-
export {
|
|
38
|
+
export { fillKvStore as default };
|
package/dist/ask/mod.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import fillDir from "./dir.js";
|
|
2
|
+
import fillKvStore from "./kv.js";
|
|
3
|
+
import fillMessageQueue from "./mq.js";
|
|
4
|
+
import fillPackageManager from "./pm.js";
|
|
5
|
+
import fillWebFramework from "./wf.js";
|
|
6
6
|
import { pipe } from "@fxts/core";
|
|
7
|
-
|
|
8
7
|
//#region src/ask/mod.ts
|
|
9
|
-
const askOptions = (options) => pipe(options,
|
|
10
|
-
var ask_default = askOptions;
|
|
11
|
-
|
|
8
|
+
const askOptions = (options) => pipe(options, fillDir, fillWebFramework, fillPackageManager, fillMessageQueue, fillKvStore);
|
|
12
9
|
//#endregion
|
|
13
|
-
export {
|
|
10
|
+
export { askOptions as default };
|
package/dist/ask/mq.js
CHANGED
|
@@ -3,7 +3,6 @@ import { isTest, messageQueues } from "../lib.js";
|
|
|
3
3
|
import { MESSAGE_QUEUE } from "../const.js";
|
|
4
4
|
import { select } from "@inquirer/prompts";
|
|
5
5
|
import { pipe, tap, throwError, unless, when } from "@fxts/core/index.js";
|
|
6
|
-
|
|
7
6
|
//#region src/ask/mq.ts
|
|
8
7
|
/**
|
|
9
8
|
* Fills in the message queue by prompting the user if not provided.
|
|
@@ -13,7 +12,6 @@ import { pipe, tap, throwError, unless, when } from "@fxts/core/index.js";
|
|
|
13
12
|
* @returns A promise resolving to options with a guaranteed messageQueue
|
|
14
13
|
*/
|
|
15
14
|
const fillMessageQueue = (options) => pipe(options, when(isMessageQueueEmpty, askMessageQueue), unless(isMqSupportsPm, (opt) => pipe(opt, when(isTest, throwError(unmatchedWhileTesting)), tap(noticeUnmatched), fillMessageQueue)));
|
|
16
|
-
var mq_default = fillMessageQueue;
|
|
17
15
|
const isMessageQueueEmpty = (options) => !options.messageQueue;
|
|
18
16
|
const askMessageQueue = async (data) => ({
|
|
19
17
|
...data,
|
|
@@ -38,6 +36,5 @@ const choiceMessageQueue = (packageManager) => (messageQueue) => ({
|
|
|
38
36
|
})
|
|
39
37
|
});
|
|
40
38
|
const isMqSupportsPm = ({ messageQueue, packageManager }) => messageQueues[messageQueue].packageManagers.includes(packageManager);
|
|
41
|
-
|
|
42
39
|
//#endregion
|
|
43
|
-
export {
|
|
40
|
+
export { fillMessageQueue as default };
|
package/dist/ask/pm.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { getInstallUrl, isPackageManagerAvailable, kvStores, messageQueues, packageManagers, runtimes } from "../lib.js";
|
|
2
2
|
import { PACKAGE_MANAGER } from "../const.js";
|
|
3
|
-
import
|
|
3
|
+
import webFrameworks from "../webframeworks.js";
|
|
4
4
|
import { pipe, when } from "@fxts/core";
|
|
5
5
|
import { select } from "@inquirer/prompts";
|
|
6
6
|
import { message } from "@optique/core/message";
|
|
7
7
|
import { print } from "@optique/run";
|
|
8
|
-
|
|
9
8
|
//#region src/ask/pm.ts
|
|
10
9
|
/**
|
|
11
10
|
* Fills in the package manager by prompting the user if not provided.
|
|
@@ -15,7 +14,7 @@ import { print } from "@optique/run";
|
|
|
15
14
|
* @param options - Initialization options possibly containing a packageManager and webFramework
|
|
16
15
|
* @returns A promise resolving to options with a guaranteed packageManager
|
|
17
16
|
*/
|
|
18
|
-
const fillPackageManager = async ({ packageManager
|
|
17
|
+
const fillPackageManager = async ({ packageManager, ...options }) => {
|
|
19
18
|
const pm = packageManager ?? await askPackageManager(options.webFramework);
|
|
20
19
|
if (await isPackageManagerAvailable(pm)) return {
|
|
21
20
|
...options,
|
|
@@ -24,17 +23,16 @@ const fillPackageManager = async ({ packageManager,...options }) => {
|
|
|
24
23
|
noticeInstallUrl(pm);
|
|
25
24
|
return await fillPackageManager(options);
|
|
26
25
|
};
|
|
27
|
-
var pm_default = fillPackageManager;
|
|
28
26
|
const askPackageManager = (wf) => select({
|
|
29
27
|
message: "Choose the package manager to use",
|
|
30
28
|
choices: PACKAGE_MANAGER.map(choicePackageManager(wf))
|
|
31
29
|
});
|
|
32
30
|
const choicePackageManager = (wf) => (value) => ({
|
|
33
|
-
name: isWfSupportsPm(wf, value) ? value : `${value} (not supported with ${
|
|
31
|
+
name: isWfSupportsPm(wf, value) ? value : `${value} (not supported with ${webFrameworks[wf].label})`,
|
|
34
32
|
value,
|
|
35
33
|
disabled: !isWfSupportsPm(wf, value)
|
|
36
34
|
});
|
|
37
|
-
const isWfSupportsPm = (wf, pm) =>
|
|
35
|
+
const isWfSupportsPm = (wf, pm) => webFrameworks[wf].packageManagers.includes(pm);
|
|
38
36
|
const noticeInstallUrl = (pm) => {
|
|
39
37
|
const label = getLabel(pm);
|
|
40
38
|
const url = getInstallUrl(pm);
|
|
@@ -42,8 +40,7 @@ const noticeInstallUrl = (pm) => {
|
|
|
42
40
|
print(message` You can install it from following link: ${url}`);
|
|
43
41
|
print(message` or choose another package manager:`);
|
|
44
42
|
};
|
|
45
|
-
const getLabel = (name) => pipe(name, whenHasLabel(
|
|
43
|
+
const getLabel = (name) => pipe(name, whenHasLabel(webFrameworks), whenHasLabel(packageManagers), whenHasLabel(messageQueues), whenHasLabel(kvStores), whenHasLabel(runtimes));
|
|
46
44
|
const whenHasLabel = (desc) => when((name) => name in desc, (name) => desc[name].label);
|
|
47
|
-
|
|
48
45
|
//#endregion
|
|
49
|
-
export {
|
|
46
|
+
export { fillPackageManager as default };
|
package/dist/ask/wf.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { WEB_FRAMEWORK } from "../const.js";
|
|
2
|
-
import
|
|
2
|
+
import webFrameworks from "../webframeworks.js";
|
|
3
3
|
import { select } from "@inquirer/prompts";
|
|
4
|
-
|
|
5
4
|
//#region src/ask/wf.ts
|
|
6
5
|
/**
|
|
7
6
|
* Fills in the web framework by prompting the user if not provided.
|
|
@@ -13,14 +12,12 @@ const fillWebFramework = async (options) => ({
|
|
|
13
12
|
...options,
|
|
14
13
|
webFramework: options.webFramework ?? await askWebFramework()
|
|
15
14
|
});
|
|
16
|
-
var wf_default = fillWebFramework;
|
|
17
15
|
const askWebFramework = () => select({
|
|
18
16
|
message: "Choose the web framework to use",
|
|
19
17
|
choices: WEB_FRAMEWORK.map((value) => ({
|
|
20
|
-
name:
|
|
18
|
+
name: webFrameworks[value].label,
|
|
21
19
|
value
|
|
22
20
|
}))
|
|
23
21
|
});
|
|
24
|
-
|
|
25
22
|
//#endregion
|
|
26
|
-
export {
|
|
23
|
+
export { fillWebFramework as default };
|
package/dist/command.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as _optique_core0 from "@optique/core";
|
|
1
|
+
import * as _$_optique_core0 from "@optique/core";
|
|
2
2
|
import { InferValue } from "@optique/core";
|
|
3
3
|
|
|
4
4
|
//#region src/command.d.ts
|
|
5
|
-
declare const initOptions: _optique_core0.Parser<"sync", {
|
|
5
|
+
declare const initOptions: _$_optique_core0.Parser<"sync", {
|
|
6
6
|
readonly dir: string;
|
|
7
7
|
readonly webFramework: "bare-bones" | "hono" | "nitro" | "next" | "elysia" | "express";
|
|
8
8
|
readonly packageManager: "deno" | "pnpm" | "bun" | "yarn" | "npm";
|
|
@@ -10,14 +10,14 @@ declare const initOptions: _optique_core0.Parser<"sync", {
|
|
|
10
10
|
readonly messageQueue: "postgres" | "redis" | "denokv" | "in-process" | "amqp";
|
|
11
11
|
readonly dryRun: boolean;
|
|
12
12
|
}, {
|
|
13
|
-
readonly dir: [_optique_core0.ValueParserResult<string>];
|
|
14
|
-
readonly webFramework: [_optique_core0.ValueParserResult<"bare-bones" | "hono" | "nitro" | "next" | "elysia" | "express">];
|
|
15
|
-
readonly packageManager: [_optique_core0.ValueParserResult<"deno" | "pnpm" | "bun" | "yarn" | "npm">];
|
|
16
|
-
readonly kvStore: [_optique_core0.ValueParserResult<"postgres" | "in-memory" | "redis" | "denokv">];
|
|
17
|
-
readonly messageQueue: [_optique_core0.ValueParserResult<"postgres" | "redis" | "denokv" | "in-process" | "amqp">];
|
|
18
|
-
readonly dryRun: _optique_core0.ValueParserResult<boolean>;
|
|
13
|
+
readonly dir: [_$_optique_core0.ValueParserResult<string>];
|
|
14
|
+
readonly webFramework: [_$_optique_core0.ValueParserResult<"bare-bones" | "hono" | "nitro" | "next" | "elysia" | "express">];
|
|
15
|
+
readonly packageManager: [_$_optique_core0.ValueParserResult<"deno" | "pnpm" | "bun" | "yarn" | "npm">];
|
|
16
|
+
readonly kvStore: [_$_optique_core0.ValueParserResult<"postgres" | "in-memory" | "redis" | "denokv">];
|
|
17
|
+
readonly messageQueue: [_$_optique_core0.ValueParserResult<"postgres" | "redis" | "denokv" | "in-process" | "amqp">];
|
|
18
|
+
readonly dryRun: _$_optique_core0.ValueParserResult<boolean>;
|
|
19
19
|
}>;
|
|
20
|
-
declare const initCommand: _optique_core0.Parser<"sync", {
|
|
20
|
+
declare const initCommand: _$_optique_core0.Parser<"sync", {
|
|
21
21
|
readonly dir: string;
|
|
22
22
|
readonly webFramework: "bare-bones" | "hono" | "nitro" | "next" | "elysia" | "express";
|
|
23
23
|
readonly packageManager: "deno" | "pnpm" | "bun" | "yarn" | "npm";
|
package/dist/command.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK } from "./const.js";
|
|
2
2
|
import { path } from "@optique/run";
|
|
3
3
|
import { argument, choice, command, constant, merge, message, multiple, object, option, optionNames, optional, or } from "@optique/core";
|
|
4
|
-
|
|
5
4
|
//#region src/command.ts
|
|
6
5
|
const webFramework = optional(option("-w", "--web-framework", choice(WEB_FRAMEWORK, { metavar: "WEB_FRAMEWORK" }), { description: message`The web framework to integrate Fedify with.` }));
|
|
7
6
|
const packageManager = optional(option("-p", "--package-manager", choice(PACKAGE_MANAGER, { metavar: "PACKAGE_MANAGER" }), { description: message`The package manager to use for installing dependencies.` }));
|
|
@@ -36,6 +35,5 @@ const testInitCommand = command("test-init", merge(object("Initialization option
|
|
|
36
35
|
|
|
37
36
|
Unless you specify all options (${optionNames(["-w", "--web-framework"])}, ${optionNames(["-p", "--package-manager"])}, ${optionNames(["-k", "--kv-store"])}, and ${optionNames(["-m", "--message-queue"])}), it will test all combinations of the options.`
|
|
38
37
|
});
|
|
39
|
-
|
|
40
38
|
//#endregion
|
|
41
|
-
export { initCommand, initOptions, testInitCommand };
|
|
39
|
+
export { initCommand, initOptions, testInitCommand };
|
package/dist/const.d.ts
CHANGED
package/dist/const.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import kv_default from "./json/kv.js";
|
|
2
2
|
import mq_default from "./json/mq.js";
|
|
3
|
-
|
|
4
3
|
//#region src/const.ts
|
|
5
4
|
/** All supported package manager identifiers, in display order. */
|
|
6
5
|
const PACKAGE_MANAGER = [
|
|
@@ -27,6 +26,5 @@ const DB_TO_CHECK = [
|
|
|
27
26
|
"postgres",
|
|
28
27
|
"amqp"
|
|
29
28
|
];
|
|
30
|
-
|
|
31
29
|
//#endregion
|
|
32
|
-
export { DB_TO_CHECK, KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK };
|
|
30
|
+
export { DB_TO_CHECK, KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK };
|
package/dist/deno.js
CHANGED
|
@@ -1,38 +1,4 @@
|
|
|
1
1
|
//#region deno.json
|
|
2
|
-
var
|
|
3
|
-
var version = "2.0.8";
|
|
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
|
-
|
|
2
|
+
var version = "2.0.10";
|
|
37
3
|
//#endregion
|
|
38
|
-
export {
|
|
4
|
+
export { version };
|
package/dist/json/biome.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
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
2
|
var biome_default = {
|
|
11
|
-
$schema,
|
|
12
|
-
organizeImports,
|
|
13
|
-
formatter
|
|
14
|
-
|
|
3
|
+
$schema: "https://biomejs.dev/schemas/1.8.3/schema.json",
|
|
4
|
+
organizeImports: { "enabled": true },
|
|
5
|
+
formatter: {
|
|
6
|
+
"enabled": true,
|
|
7
|
+
"indentStyle": "space",
|
|
8
|
+
"indentWidth": 2
|
|
9
|
+
},
|
|
10
|
+
linter: { "enabled": false }
|
|
15
11
|
};
|
|
16
|
-
|
|
17
12
|
//#endregion
|
|
18
|
-
export { biome_default as default };
|
|
13
|
+
export { biome_default as default };
|