@fedify/init 2.2.0-dev.946 → 2.2.0-dev.949
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/templates.js
CHANGED
|
@@ -15,13 +15,19 @@ import { toMerged } from "es-toolkit";
|
|
|
15
15
|
*/
|
|
16
16
|
const loadFederation = async ({ imports, projectName, kv, mq, packageManager }) => pipe(await readTemplate("defaults/federation.ts"), replace(/\/\* imports \*\//, imports), replace(/\/\* logger \*\//, JSON.stringify(projectName)), replace(/\/\* kv \*\//, convertEnv(kv.object, packageManager)), replace(/\/\* queue \*\//, convertEnv(mq.object, packageManager)));
|
|
17
17
|
/**
|
|
18
|
-
* Loads
|
|
19
|
-
* Reads the default logging template and replaces the project name placeholder.
|
|
18
|
+
* Loads logging configuration file content for the initializer.
|
|
20
19
|
*
|
|
21
|
-
* @
|
|
20
|
+
* `loadLogging` accepts the full {@link InitCommandData} so it can read the
|
|
21
|
+
* project name and the framework initializer. It uses {@link readTemplate} to
|
|
22
|
+
* read `initializer.loggingTemplate` when provided, or falls back to
|
|
23
|
+
* *defaults/logging.ts*, then replaces the project name placeholder.
|
|
24
|
+
*
|
|
25
|
+
* @param param0 - {@link InitCommandData} containing `projectName` and
|
|
26
|
+
* `initializer`; `initializer.loggingTemplate` selects a framework-specific
|
|
27
|
+
* logging template when present.
|
|
22
28
|
* @returns The complete logging configuration file content as a string
|
|
23
29
|
*/
|
|
24
|
-
const loadLogging = async ({ projectName }) => pipe(await readTemplate("defaults/logging.ts"), replace(/\/\* project name \*\//, JSON.stringify(projectName)));
|
|
30
|
+
const loadLogging = async ({ projectName, initializer }) => pipe(await readTemplate(initializer.loggingTemplate ?? "defaults/logging.ts"), replace(/\/\* project name \*\//, JSON.stringify(projectName)));
|
|
25
31
|
/**
|
|
26
32
|
* Generates import statements for KV store and message queue dependencies.
|
|
27
33
|
* Merges imports from both KV and MQ configurations and creates proper
|
package/dist/deno.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { configure, getConsoleSink } from "@logtape/logtape";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
+
|
|
4
|
+
export default configure({
|
|
5
|
+
contextLocalStorage: new AsyncLocalStorage(),
|
|
6
|
+
sinks: {
|
|
7
|
+
console: getConsoleSink(),
|
|
8
|
+
},
|
|
9
|
+
filters: {},
|
|
10
|
+
loggers: [
|
|
11
|
+
{
|
|
12
|
+
category: /* project name */,
|
|
13
|
+
lowestLevel: "debug",
|
|
14
|
+
sinks: ["console"],
|
|
15
|
+
},
|
|
16
|
+
{ category: "fedify", lowestLevel: "info", sinks: ["console"] },
|
|
17
|
+
{
|
|
18
|
+
category: ["logtape", "meta"],
|
|
19
|
+
lowestLevel: "warning",
|
|
20
|
+
sinks: ["console"],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ interface WebFrameworkInitializer {
|
|
|
22
22
|
federationFile: string;
|
|
23
23
|
/** Relative path where the logging configuration file will be created. */
|
|
24
24
|
loggingFile: string;
|
|
25
|
+
/** Optional template path for the logging configuration file. */
|
|
26
|
+
loggingTemplate?: string;
|
|
25
27
|
/**
|
|
26
28
|
* Additional files to create, keyed by relative path to file content.
|
|
27
29
|
* Do not use `".env"` as a key — use the {@link env} property instead so
|
|
@@ -18,9 +18,11 @@ const nuxtDescription = {
|
|
|
18
18
|
},
|
|
19
19
|
federationFile: "server/federation.ts",
|
|
20
20
|
loggingFile: "server/logging.ts",
|
|
21
|
+
loggingTemplate: "nuxt/server/logging.ts",
|
|
21
22
|
env: testMode ? { HOST: "127.0.0.1" } : {},
|
|
22
23
|
files: {
|
|
23
24
|
"nuxt.config.ts": await readTemplate("nuxt/nuxt.config.ts"),
|
|
25
|
+
"server/plugins/logging.ts": await readTemplate("nuxt/server/plugins/logging.ts"),
|
|
24
26
|
...pm !== "deno" && { "eslint.config.ts": await readTemplate("defaults/eslint.config.ts") }
|
|
25
27
|
},
|
|
26
28
|
tasks: pm !== "deno" ? { "lint": "eslint ." } : {},
|