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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/action/{configs.js → configs.mjs} +7 -9
  2. package/dist/action/{const.js → const.mjs} +1 -3
  3. package/dist/action/{deps.js → deps.mjs} +6 -10
  4. package/dist/action/{dir.js → dir.mjs} +1 -3
  5. package/dist/action/{env.js → env.mjs} +3 -6
  6. package/dist/action/{install.js → install.mjs} +2 -5
  7. package/dist/action/{mod.d.ts → mod.d.mts} +2 -3
  8. package/dist/action/{mod.js → mod.mjs} +15 -18
  9. package/dist/action/{notice.js → notice.mjs} +4 -6
  10. package/dist/action/{patch.js → patch.mjs} +8 -11
  11. package/dist/action/{precommand.js → precommand.mjs} +2 -5
  12. package/dist/action/{recommend.js → recommend.mjs} +5 -8
  13. package/dist/action/{set.js → set.mjs} +5 -8
  14. package/dist/action/{templates.js → templates.mjs} +4 -6
  15. package/dist/action/{utils.js → utils.mjs} +1 -3
  16. package/dist/ask/{dir.js → dir.mjs} +3 -6
  17. package/dist/ask/{kv.js → kv.mjs} +4 -7
  18. package/dist/ask/{mod.js → mod.mjs} +7 -10
  19. package/dist/ask/{mq.js → mq.mjs} +4 -7
  20. package/dist/ask/{pm.js → pm.mjs} +8 -11
  21. package/dist/ask/{wf.js → wf.mjs} +4 -7
  22. package/dist/{command.d.ts → command.d.mts} +9 -13
  23. package/dist/{command.js → command.mjs} +2 -4
  24. package/dist/{const.d.ts → const.d.mts} +0 -2
  25. package/dist/{const.js → const.mjs} +3 -5
  26. package/dist/deno.mjs +4 -0
  27. package/dist/json/biome.mjs +13 -0
  28. package/dist/json/db-to-check.mjs +25 -0
  29. package/dist/json/kv.mjs +75 -0
  30. package/dist/json/mq.mjs +93 -0
  31. package/dist/json/pm.mjs +35 -0
  32. package/dist/json/rt.mjs +30 -0
  33. package/dist/json/vscode-settings-for-deno.mjs +38 -0
  34. package/dist/json/vscode-settings.mjs +36 -0
  35. package/dist/{lib.js → lib.mjs} +9 -12
  36. package/dist/mod.d.mts +3 -0
  37. package/dist/mod.mjs +3 -0
  38. package/dist/test/{action.js → action.mjs} +7 -10
  39. package/dist/test/{create.js → create.mjs} +14 -21
  40. package/dist/test/{db.js → db.mjs} +5 -8
  41. package/dist/test/{fill.js → fill.mjs} +10 -12
  42. package/dist/test/{lookup.js → lookup.mjs} +10 -16
  43. package/dist/test/{mod.js → mod.mjs} +6 -8
  44. package/dist/test/{run.js → run.mjs} +5 -8
  45. package/dist/test/{utils.js → utils.mjs} +2 -4
  46. package/dist/{types.d.ts → types.d.mts} +3 -11
  47. package/dist/{utils.d.ts → utils.d.mts} +0 -3
  48. package/dist/{utils.js → utils.mjs} +15 -23
  49. package/dist/webframeworks/{astro.js → astro.mjs} +5 -8
  50. package/dist/webframeworks/{bare-bones.js → bare-bones.mjs} +5 -8
  51. package/dist/webframeworks/{const.js → const.mjs} +2 -4
  52. package/dist/webframeworks/{elysia.js → elysia.mjs} +5 -8
  53. package/dist/webframeworks/{express.js → express.mjs} +5 -8
  54. package/dist/webframeworks/{hono.js → hono.mjs} +6 -9
  55. package/dist/webframeworks/mod.mjs +26 -0
  56. package/dist/webframeworks/{next.js → next.mjs} +5 -8
  57. package/dist/webframeworks/{nitro.js → nitro.mjs} +5 -8
  58. package/dist/webframeworks/{utils.js → utils.mjs} +2 -4
  59. package/package.json +3 -3
  60. package/dist/deno.js +0 -38
  61. package/dist/json/biome.js +0 -18
  62. package/dist/json/db-to-check.js +0 -30
  63. package/dist/json/kv.js +0 -81
  64. package/dist/json/mq.js +0 -100
  65. package/dist/json/pm.js +0 -41
  66. package/dist/json/rt.js +0 -36
  67. package/dist/json/vscode-settings-for-deno.js +0 -50
  68. package/dist/json/vscode-settings.js +0 -46
  69. package/dist/mod.d.ts +0 -3
  70. package/dist/mod.js +0 -4
  71. package/dist/webframeworks/mod.js +0 -29
  72. /package/dist/test/{mod.d.ts → mod.d.mts} +0 -0
@@ -1,7 +1,5 @@
1
1
  //#region src/const.d.ts
2
-
3
2
  /** All supported package manager identifiers, in display order. */
4
3
  declare const PACKAGE_MANAGER: readonly ["deno", "pnpm", "bun", "yarn", "npm"];
5
- /** All supported web framework identifiers, in display order. */
6
4
  //#endregion
7
5
  export { PACKAGE_MANAGER };
@@ -1,6 +1,5 @@
1
- import kv_default from "./json/kv.js";
2
- import mq_default from "./json/mq.js";
3
-
1
+ import kv_default from "./json/kv.mjs";
2
+ import mq_default from "./json/mq.mjs";
4
3
  //#region src/const.ts
5
4
  /** All supported package manager identifiers, in display order. */
6
5
  const PACKAGE_MANAGER = [
@@ -34,6 +33,5 @@ const DB_TO_CHECK = [
34
33
  "mysql",
35
34
  "amqp"
36
35
  ];
37
-
38
36
  //#endregion
39
- export { DB_TO_CHECK, KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK };
37
+ export { DB_TO_CHECK, KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK };
package/dist/deno.mjs ADDED
@@ -0,0 +1,4 @@
1
+ //#region deno.json
2
+ var version = "2.2.0-dev.628+7f7a1e9b";
3
+ //#endregion
4
+ export { version };
@@ -0,0 +1,13 @@
1
+ //#region src/json/biome.json
2
+ var biome_default = {
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 }
11
+ };
12
+ //#endregion
13
+ export { biome_default as default };
@@ -0,0 +1,25 @@
1
+ //#region src/json/db-to-check.json
2
+ var db_to_check_default = {
3
+ redis: {
4
+ "name": "Redis",
5
+ "defaultPort": 6379,
6
+ "documentation": "https://redis.io/docs/latest/operate/oss_and_stack/install/archive/install-redis/"
7
+ },
8
+ postgres: {
9
+ "name": "PostgreSQL",
10
+ "defaultPort": 5432,
11
+ "documentation": "https://www.postgresql.org/download/"
12
+ },
13
+ mysql: {
14
+ "name": "MySQL/MariaDB",
15
+ "defaultPort": 3306,
16
+ "documentation": "https://dev.mysql.com/doc/mysql-installation-excerpt/en/"
17
+ },
18
+ amqp: {
19
+ "name": "RabbitMQ",
20
+ "defaultPort": 5672,
21
+ "documentation": "https://www.rabbitmq.com/docs/download"
22
+ }
23
+ };
24
+ //#endregion
25
+ export { db_to_check_default as default };
@@ -0,0 +1,75 @@
1
+ //#region src/json/kv.json
2
+ var kv_default = {
3
+ "in-memory": {
4
+ "label": "In-Memory",
5
+ "packageManagers": [
6
+ "deno",
7
+ "bun",
8
+ "npm",
9
+ "yarn",
10
+ "pnpm"
11
+ ],
12
+ "imports": { "@fedify/fedify": { "MemoryKvStore": "MemoryKvStore" } },
13
+ "object": "new MemoryKvStore()"
14
+ },
15
+ redis: {
16
+ "label": "Redis",
17
+ "packageManagers": [
18
+ "deno",
19
+ "bun",
20
+ "npm",
21
+ "yarn",
22
+ "pnpm"
23
+ ],
24
+ "dependencies": { "npm:ioredis": "^5.4.1" },
25
+ "imports": {
26
+ "@fedify/redis": { "RedisKvStore": "RedisKvStore" },
27
+ "ioredis": { "Redis": "Redis" }
28
+ },
29
+ "object": "new RedisKvStore(new Redis(process.env.REDIS_URL))",
30
+ "env": { "REDIS_URL": "redis://localhost:6379" }
31
+ },
32
+ postgres: {
33
+ "label": "PostgreSQL",
34
+ "packageManagers": [
35
+ "deno",
36
+ "bun",
37
+ "npm",
38
+ "yarn",
39
+ "pnpm"
40
+ ],
41
+ "dependencies": { "npm:postgres": "^3.4.5" },
42
+ "imports": {
43
+ "@fedify/postgres": { "PostgresKvStore": "PostgresKvStore" },
44
+ "postgres": { "default": "postgres" }
45
+ },
46
+ "object": "new PostgresKvStore(postgres(process.env.POSTGRES_URL))",
47
+ "env": { "POSTGRES_URL": "postgres://postgres@localhost:5432/postgres" }
48
+ },
49
+ mysql: {
50
+ "label": "MySQL/MariaDB",
51
+ "packageManagers": [
52
+ "deno",
53
+ "bun",
54
+ "npm",
55
+ "yarn",
56
+ "pnpm"
57
+ ],
58
+ "dependencies": { "npm:mysql2": "^3.18.0" },
59
+ "imports": {
60
+ "@fedify/mysql": { "MysqlKvStore": "MysqlKvStore" },
61
+ "mysql2/promise": { "default": "mysql" }
62
+ },
63
+ "object": "new MysqlKvStore(mysql.createPool(process.env.MYSQL_URL))",
64
+ "env": { "MYSQL_URL": "mysql://root@localhost/fedify" }
65
+ },
66
+ denokv: {
67
+ "label": "Deno KV",
68
+ "packageManagers": ["deno"],
69
+ "imports": { "@fedify/denokv": { "DenoKvStore": "DenoKvStore" } },
70
+ "object": "new DenoKvStore(await Deno.openKv())",
71
+ "denoUnstable": ["kv"]
72
+ }
73
+ };
74
+ //#endregion
75
+ export { kv_default as default };
@@ -0,0 +1,93 @@
1
+ //#region src/json/mq.json
2
+ var mq_default = {
3
+ "in-process": {
4
+ "label": "In-Process",
5
+ "packageManagers": [
6
+ "deno",
7
+ "bun",
8
+ "npm",
9
+ "yarn",
10
+ "pnpm"
11
+ ],
12
+ "imports": { "@fedify/fedify": { "InProcessMessageQueue": "InProcessMessageQueue" } },
13
+ "object": "new InProcessMessageQueue()"
14
+ },
15
+ redis: {
16
+ "label": "Redis",
17
+ "packageManagers": [
18
+ "deno",
19
+ "bun",
20
+ "npm",
21
+ "yarn",
22
+ "pnpm"
23
+ ],
24
+ "dependencies": { "npm:ioredis": "^5.4.1" },
25
+ "imports": {
26
+ "@fedify/redis": { "RedisMessageQueue": "RedisMessageQueue" },
27
+ "ioredis": { "Redis": "Redis" }
28
+ },
29
+ "object": "new RedisMessageQueue(() => new Redis(process.env.REDIS_URL))",
30
+ "env": { "REDIS_URL": "redis://localhost:6379" }
31
+ },
32
+ postgres: {
33
+ "label": "PostgreSQL",
34
+ "packageManagers": [
35
+ "deno",
36
+ "bun",
37
+ "npm",
38
+ "yarn",
39
+ "pnpm"
40
+ ],
41
+ "dependencies": { "npm:postgres": "^3.4.5" },
42
+ "imports": {
43
+ "@fedify/postgres": { "PostgresMessageQueue": "PostgresMessageQueue" },
44
+ "postgres": { "default": "postgres" }
45
+ },
46
+ "object": "new PostgresMessageQueue(postgres(process.env.POSTGRES_URL))",
47
+ "env": { "POSTGRES_URL": "postgres://postgres@localhost:5432/postgres" }
48
+ },
49
+ mysql: {
50
+ "label": "MySQL/MariaDB",
51
+ "packageManagers": [
52
+ "deno",
53
+ "bun",
54
+ "npm",
55
+ "yarn",
56
+ "pnpm"
57
+ ],
58
+ "dependencies": { "npm:mysql2": "^3.18.0" },
59
+ "imports": {
60
+ "@fedify/mysql": { "MysqlMessageQueue": "MysqlMessageQueue" },
61
+ "mysql2/promise": { "default": "mysql" }
62
+ },
63
+ "object": "new MysqlMessageQueue(mysql.createPool(process.env.MYSQL_URL))",
64
+ "env": { "MYSQL_URL": "mysql://root@localhost/fedify" }
65
+ },
66
+ amqp: {
67
+ "label": "AMQP (e.g., RabbitMQ)",
68
+ "packageManagers": [
69
+ "deno",
70
+ "bun",
71
+ "npm",
72
+ "yarn",
73
+ "pnpm"
74
+ ],
75
+ "dependencies": { "npm:amqplib": "^0.10.4" },
76
+ "devDependencies": { "npm:@types/amqplib": "^0.10.5" },
77
+ "imports": {
78
+ "@fedify/amqp": { "AmqpMessageQueue": "AmqpMessageQueue" },
79
+ "amqplib": { "connect": "connect" }
80
+ },
81
+ "object": "new AmqpMessageQueue(await connect(process.env.AMQP_URL))",
82
+ "env": { "AMQP_URL": "amqp://localhost" }
83
+ },
84
+ denokv: {
85
+ "label": "Deno KV",
86
+ "packageManagers": ["deno"],
87
+ "imports": { "@fedify/denokv": { "DenoKvMessageQueue": "DenoKvMessageQueue" } },
88
+ "object": "new DenoKvMessageQueue(await Deno.openKv())",
89
+ "denoUnstable": ["kv"]
90
+ }
91
+ };
92
+ //#endregion
93
+ export { mq_default as default };
@@ -0,0 +1,35 @@
1
+ //#region src/json/pm.json
2
+ var pm_default = {
3
+ deno: {
4
+ "label": "deno",
5
+ "checkCommand": ["deno", "--version"],
6
+ "outputPattern": "^deno\\s+\\d+\\.\\d+\\.\\d+\\b",
7
+ "installUrl": "https://docs.deno.com/runtime/getting_started/installation"
8
+ },
9
+ bun: {
10
+ "label": "bun",
11
+ "checkCommand": ["bun", "--version"],
12
+ "outputPattern": "^\\d+\\.\\d+\\.\\d+$",
13
+ "installUrl": "https://bun.sh/docs/installation"
14
+ },
15
+ npm: {
16
+ "label": "npm",
17
+ "checkCommand": ["npm", "--version"],
18
+ "outputPattern": "^\\d+\\.\\d+\\.\\d+$",
19
+ "installUrl": "https://docs.npmjs.com/downloading-and-installing-node-js-and-npm"
20
+ },
21
+ yarn: {
22
+ "label": "Yarn",
23
+ "checkCommand": ["yarn", "--version"],
24
+ "outputPattern": "^\\d+\\.\\d+\\.\\d+$",
25
+ "installUrl": "https://classic.yarnpkg.com/en/docs/install/#windows-stable"
26
+ },
27
+ pnpm: {
28
+ "label": "pnpm",
29
+ "checkCommand": ["pnpm", "--version"],
30
+ "outputPattern": "^\\d+\\.\\d+\\.\\d+$",
31
+ "installUrl": "https://pnpm.io/installation"
32
+ }
33
+ };
34
+ //#endregion
35
+ export { pm_default as default };
@@ -0,0 +1,30 @@
1
+ //#region src/json/rt.json
2
+ var rt_default = {
3
+ deno: {
4
+ "label": "Deno",
5
+ "checkCommand": ["deno", "--version"],
6
+ "outputPattern": "^deno\\s+\\d+\\.\\d+\\.\\d+\\b"
7
+ },
8
+ bun: {
9
+ "label": "Bun",
10
+ "checkCommand": ["bun", "--version"],
11
+ "outputPattern": "^\\d+\\.\\d+\\.\\d+$"
12
+ },
13
+ pnpm: {
14
+ "label": "Node.js",
15
+ "checkCommand": ["node", "--version"],
16
+ "outputPattern": "^v\\d+\\.\\d+\\.\\d+$"
17
+ },
18
+ yarn: {
19
+ "label": "Node.js",
20
+ "checkCommand": ["node", "--version"],
21
+ "outputPattern": "^v\\d+\\.\\d+\\.\\d+$"
22
+ },
23
+ npm: {
24
+ "label": "Node.js",
25
+ "checkCommand": ["node", "--version"],
26
+ "outputPattern": "^v\\d+\\.\\d+\\.\\d+$"
27
+ }
28
+ };
29
+ //#endregion
30
+ export { rt_default as default };
@@ -0,0 +1,38 @@
1
+ //#region src/json/vscode-settings-for-deno.json
2
+ var vscode_settings_for_deno_default = {
3
+ "deno.enable": true,
4
+ "deno.unstable": true,
5
+ "editor.detectIndentation": false,
6
+ "editor.indentSize": 2,
7
+ "editor.insertSpaces": true,
8
+ "[javascript]": {
9
+ "editor.defaultFormatter": "denoland.vscode-deno",
10
+ "editor.formatOnSave": true,
11
+ "editor.codeActionsOnSave": { "source.sortImports": "always" }
12
+ },
13
+ "[javascriptreact]": {
14
+ "editor.defaultFormatter": "denoland.vscode-deno",
15
+ "editor.formatOnSave": true,
16
+ "editor.codeActionsOnSave": { "source.sortImports": "always" }
17
+ },
18
+ "[json]": {
19
+ "editor.defaultFormatter": "vscode.json-language-features",
20
+ "editor.formatOnSave": true
21
+ },
22
+ "[jsonc]": {
23
+ "editor.defaultFormatter": "vscode.json-language-features",
24
+ "editor.formatOnSave": true
25
+ },
26
+ "[typescript]": {
27
+ "editor.defaultFormatter": "denoland.vscode-deno",
28
+ "editor.formatOnSave": true,
29
+ "editor.codeActionsOnSave": { "source.sortImports": "always" }
30
+ },
31
+ "[typescriptreact]": {
32
+ "editor.defaultFormatter": "denoland.vscode-deno",
33
+ "editor.formatOnSave": true,
34
+ "editor.codeActionsOnSave": { "source.sortImports": "always" }
35
+ }
36
+ };
37
+ //#endregion
38
+ export { vscode_settings_for_deno_default as default };
@@ -0,0 +1,36 @@
1
+ //#region src/json/vscode-settings.json
2
+ var vscode_settings_default = {
3
+ "editor.detectIndentation": false,
4
+ "editor.indentSize": 2,
5
+ "editor.insertSpaces": true,
6
+ "[javascript]": {
7
+ "editor.defaultFormatter": "biomejs.biome",
8
+ "editor.formatOnSave": true,
9
+ "editor.codeActionsOnSave": { "source.organizeImports.biome": "always" }
10
+ },
11
+ "[javascriptreact]": {
12
+ "editor.defaultFormatter": "biomejs.biome",
13
+ "editor.formatOnSave": true,
14
+ "editor.codeActionsOnSave": { "source.organizeImports.biome": "always" }
15
+ },
16
+ "[json]": {
17
+ "editor.defaultFormatter": "biomejs.biome",
18
+ "editor.formatOnSave": true
19
+ },
20
+ "[jsonc]": {
21
+ "editor.defaultFormatter": "biomejs.biome",
22
+ "editor.formatOnSave": true
23
+ },
24
+ "[typescript]": {
25
+ "editor.defaultFormatter": "biomejs.biome",
26
+ "editor.formatOnSave": true,
27
+ "editor.codeActionsOnSave": { "source.organizeImports.biome": "always" }
28
+ },
29
+ "[typescriptreact]": {
30
+ "editor.defaultFormatter": "biomejs.biome",
31
+ "editor.formatOnSave": true,
32
+ "editor.codeActionsOnSave": { "source.organizeImports.biome": "always" }
33
+ }
34
+ };
35
+ //#endregion
36
+ export { vscode_settings_default as default };
@@ -1,9 +1,9 @@
1
- import { isNotFoundError, runSubCommand } from "./utils.js";
2
- import deno_default from "./deno.js";
3
- import kv_default from "./json/kv.js";
4
- import mq_default from "./json/mq.js";
5
- import pm_default from "./json/pm.js";
6
- import rt_default from "./json/rt.js";
1
+ import { isNotFoundError, runSubCommand } from "./utils.mjs";
2
+ import { version } from "./deno.mjs";
3
+ import kv_default from "./json/kv.mjs";
4
+ import mq_default from "./json/mq.mjs";
5
+ import pm_default from "./json/pm.mjs";
6
+ import rt_default from "./json/rt.mjs";
7
7
  import { entries, evolve, fromEntries, isObject, map, negate, pipe, throwIf } from "@fxts/core";
8
8
  import process from "node:process";
9
9
  import { toMerged } from "es-toolkit";
@@ -11,10 +11,9 @@ import { getLogger } from "@logtape/logtape";
11
11
  import { readFileSync } from "node:fs";
12
12
  import { mkdir, readdir, writeFile } from "node:fs/promises";
13
13
  import { dirname, join as join$1 } from "node:path";
14
-
15
14
  //#region src/lib.ts
16
15
  /** The current `@fedify/init` package version, read from *deno.json*. */
17
- const PACKAGE_VERSION = deno_default.version;
16
+ const PACKAGE_VERSION = version;
18
17
  /** Logger instance for the `fedify init` command, scoped to `["fedify", "cli", "init"]`. */
19
18
  const logger = getLogger([
20
19
  "fedify",
@@ -128,8 +127,7 @@ const throwUnlessNotExists = throwIf(negate(isNotExistsError));
128
127
  */
129
128
  const isDirectoryEmpty = async (path) => {
130
129
  try {
131
- const files = await readdir(path);
132
- return files.length === 0;
130
+ return (await readdir(path)).length === 0;
133
131
  } catch (e) {
134
132
  throwUnlessNotExists(e);
135
133
  return true;
@@ -137,6 +135,5 @@ const isDirectoryEmpty = async (path) => {
137
135
  };
138
136
  /** Returns `true` if the current run is in test mode. */
139
137
  const isTest = ({ testMode }) => testMode;
140
-
141
138
  //#endregion
142
- export { PACKAGE_VERSION, createFile, getDevCommand, getInstallUrl, isDirectoryEmpty, isPackageManagerAvailable, isTest, kvStores, logger, messageQueues, packageManagers, readTemplate, runtimes, throwUnlessNotExists };
139
+ export { PACKAGE_VERSION, createFile, getDevCommand, getInstallUrl, isDirectoryEmpty, isPackageManagerAvailable, isTest, kvStores, logger, messageQueues, packageManagers, readTemplate, runtimes, throwUnlessNotExists };
package/dist/mod.d.mts ADDED
@@ -0,0 +1,3 @@
1
+ import { initCommand, initOptions } from "./command.mjs";
2
+ import { runInit } from "./action/mod.mjs";
3
+ export { initCommand, initOptions, runInit };
package/dist/mod.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import runInit from "./action/mod.mjs";
2
+ import { initCommand, initOptions } from "./command.mjs";
3
+ export { initCommand, initOptions, runInit };
@@ -1,15 +1,12 @@
1
- import { set } from "../utils.js";
2
- import { checkRequiredDbs } from "./db.js";
3
- import { fillEmptyOptions } from "./fill.js";
4
- import run_default from "./run.js";
5
- import { emptyTestDir, genRunId, genTestDirPrefix, logTestDir } from "./utils.js";
1
+ import { set } from "../utils.mjs";
2
+ import { checkRequiredDbs } from "./db.mjs";
3
+ import { fillEmptyOptions } from "./fill.mjs";
4
+ import runTests from "./run.mjs";
5
+ import { emptyTestDir, genRunId, genTestDirPrefix, logTestDir } from "./utils.mjs";
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, run_default(true))), tap(when(isHydRun, run_default(false))));
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 { action_default as default };
12
+ export { runTestInit as default };
@@ -1,28 +1,26 @@
1
- import { CommandError, printErrorMessage, printMessage, product, runSubCommand } from "../utils.js";
2
- import pm_default from "../json/pm.js";
3
- import { kvStores, messageQueues } from "../lib.js";
4
- import webframeworks_default from "../webframeworks/mod.js";
1
+ import { CommandError, printErrorMessage, printMessage, product, runSubCommand } from "../utils.mjs";
2
+ import pm_default from "../json/pm.mjs";
3
+ import { kvStores, messageQueues } from "../lib.mjs";
4
+ import webFrameworks from "../webframeworks/mod.mjs";
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
- const result = await runSubCommand(toArray(genInitCommand(testDir, dry, options)), {
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,13 +28,10 @@ const createTestApp = (testDirPrefix, dry) => async (options) => {
30
28
  stdout: error.stdout,
31
29
  stderr: error.stderr
32
30
  });
33
- else {
34
- const errorMessage = error instanceof Error ? error.message : String(error);
35
- await saveOutputs(testDir, {
36
- stdout: "",
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
  printMessage` Check out these files for more details:
42
37
  ${join$1(testDir, "out.txt")} and
@@ -44,7 +39,6 @@ const createTestApp = (testDirPrefix, dry) => async (options) => {
44
39
  return "";
45
40
  }
46
41
  };
47
- var create_default = createTestApp;
48
42
  function* genInitCommand(testDir, dry, [webFramework, packageManager, kvStore, messageQueue]) {
49
43
  yield "deno";
50
44
  yield "run";
@@ -72,8 +66,8 @@ const generateTestCases = ({ webFramework, packageManager, kvStore, messageQueue
72
66
  ]);
73
67
  return product(webFramework, pms, kvStore, messageQueue);
74
68
  };
75
- const filterPackageManager = (pm) => pipe(pm, filter((pm$1) => BANNED_PMS.includes(pm$1) ? printErrorMessage`${pm_default[pm$1]["label"]} is not \
76
- supported in test mode yet because ${pm_default[pm$1]["label"]} don't \
69
+ const filterPackageManager = (pm) => pipe(pm, filter((pm) => BANNED_PMS.includes(pm) ? printErrorMessage`${pm_default[pm]["label"]} is not \
70
+ supported in test mode yet because ${pm_default[pm]["label"]} don't \
77
71
  support local file dependencies properly.` : true), toArray);
78
72
  const exitIfCasesEmpty = (cases) => {
79
73
  if (cases.some(isEmpty)) {
@@ -89,11 +83,10 @@ const saveOutputs = async (dirPath, { stdout, stderr }) => {
89
83
  function filterOptions(options) {
90
84
  const [wf, pm, kv, mq] = options;
91
85
  return [
92
- webframeworks_default[wf].packageManagers,
86
+ webFrameworks[wf].packageManagers,
93
87
  kvStores[kv].packageManagers,
94
88
  messageQueues[mq].packageManagers
95
89
  ].every((pms) => pms.includes(pm));
96
90
  }
97
-
98
91
  //#endregion
99
- export { create_default as default, filterOptions, generateTestCases };
92
+ export { createTestApp as default, filterOptions, generateTestCases };
@@ -1,9 +1,8 @@
1
- import { printErrorMessage, printMessage } from "../utils.js";
2
- import { DB_TO_CHECK } from "../const.js";
3
- import db_to_check_default from "../json/db-to-check.js";
1
+ import { printErrorMessage, printMessage } from "../utils.mjs";
2
+ import { DB_TO_CHECK } from "../const.mjs";
3
+ import db_to_check_default from "../json/db-to-check.mjs";
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
- const running = await isPortOpen(info.defaultPort);
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 };
@@ -1,6 +1,5 @@
1
- import { KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK } from "../const.js";
1
+ import { KV_STORE, MESSAGE_QUEUE, PACKAGE_MANAGER, WEB_FRAMEWORK } from "../const.mjs";
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$1) => "noHydRun" in options$1 ? {
15
- ...omit(["noHydRun"], options$1),
16
- hydRun: !options$1.noHydRun
13
+ const fillRunMode = (options) => pipe(options, (options) => "noHydRun" in options ? {
14
+ ...omit(["noHydRun"], options),
15
+ hydRun: !options.noHydRun
17
16
  } : {
18
- ...options$1,
17
+ ...options,
19
18
  hydRun: true
20
- }, (options$1) => "noDryRun" in options$1 ? {
21
- ...omit(["noDryRun"], options$1),
22
- dryRun: !options$1.noDryRun
19
+ }, (options) => "noDryRun" in options ? {
20
+ ...omit(["noDryRun"], options),
21
+ dryRun: !options.noDryRun
23
22
  } : {
24
- ...options$1,
23
+ ...options,
25
24
  dryRun: true
26
25
  });
27
-
28
26
  //#endregion
29
- export { fillEmptyOptions };
27
+ export { fillEmptyOptions };