@intlayer/cli 8.4.3 → 8.4.5
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/cjs/IntlayerEventListener.cjs +186 -1
- package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/_virtual/_utils_asset.cjs +98 -0
- package/dist/cjs/auth/login.cjs +90 -2
- package/dist/cjs/auth/login.cjs.map +1 -1
- package/dist/cjs/build.cjs +30 -1
- package/dist/cjs/build.cjs.map +1 -1
- package/dist/cjs/ci.cjs +76 -1
- package/dist/cjs/ci.cjs.map +1 -1
- package/dist/cjs/cli.cjs +485 -1
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +15 -1
- package/dist/cjs/config.cjs.map +1 -1
- package/dist/cjs/editor.cjs +50 -1
- package/dist/cjs/editor.cjs.map +1 -1
- package/dist/cjs/extract.cjs +108 -1
- package/dist/cjs/extract.cjs.map +1 -1
- package/dist/cjs/fill/deepMergeContent.cjs +27 -1
- package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
- package/dist/cjs/fill/fill.cjs +84 -1
- package/dist/cjs/fill/fill.cjs.map +1 -1
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs +32 -1
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
- package/dist/cjs/fill/formatFillData.cjs +87 -1
- package/dist/cjs/fill/formatFillData.cjs.map +1 -1
- package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs +26 -1
- package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
- package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +51 -1
- package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
- package/dist/cjs/fill/index.cjs +6 -1
- package/dist/cjs/fill/listTranslationsTasks.cjs +72 -1
- package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
- package/dist/cjs/fill/translateDictionary.cjs +240 -1
- package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
- package/dist/cjs/fill/writeFill.cjs +55 -1
- package/dist/cjs/fill/writeFill.cjs.map +1 -1
- package/dist/cjs/getTargetDictionary.cjs +36 -1
- package/dist/cjs/getTargetDictionary.cjs.map +1 -1
- package/dist/cjs/index.cjs +44 -1
- package/dist/cjs/init.cjs +22 -1
- package/dist/cjs/init.cjs.map +1 -1
- package/dist/cjs/initMCP.cjs +69 -1
- package/dist/cjs/initMCP.cjs.map +1 -1
- package/dist/cjs/initSkills.cjs +93 -1
- package/dist/cjs/initSkills.cjs.map +1 -1
- package/dist/cjs/listContentDeclaration.cjs +42 -1
- package/dist/cjs/listContentDeclaration.cjs.map +1 -1
- package/dist/cjs/listProjects.cjs +28 -1
- package/dist/cjs/listProjects.cjs.map +1 -1
- package/dist/cjs/liveSync.cjs +153 -8
- package/dist/cjs/liveSync.cjs.map +1 -1
- package/dist/cjs/pull.cjs +153 -1
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/push/pullLog.cjs +105 -3
- package/dist/cjs/push/pullLog.cjs.map +1 -1
- package/dist/cjs/push/push.cjs +212 -1
- package/dist/cjs/push/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +22 -1
- package/dist/cjs/pushConfig.cjs.map +1 -1
- package/dist/cjs/pushLog.cjs +86 -3
- package/dist/cjs/pushLog.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDoc.cjs +73 -1
- package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +98 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
- package/dist/cjs/searchDoc.cjs +41 -1
- package/dist/cjs/searchDoc.cjs.map +1 -1
- package/dist/cjs/test/index.cjs +7 -1
- package/dist/cjs/test/listMissingTranslations.cjs +52 -1
- package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
- package/dist/cjs/test/test.cjs +56 -1
- package/dist/cjs/test/test.cjs.map +1 -1
- package/dist/cjs/translateDoc/index.cjs +9 -1
- package/dist/cjs/translateDoc/translateDoc.cjs +79 -1
- package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
- package/dist/cjs/translateDoc/translateFile.cjs +106 -2
- package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
- package/dist/cjs/translateDoc/validation.cjs +49 -5
- package/dist/cjs/translateDoc/validation.cjs.map +1 -1
- package/dist/cjs/translation-alignment/alignBlocks.cjs +67 -1
- package/dist/cjs/translation-alignment/alignBlocks.cjs.map +1 -1
- package/dist/cjs/translation-alignment/computeSimilarity.cjs +25 -1
- package/dist/cjs/translation-alignment/computeSimilarity.cjs.map +1 -1
- package/dist/cjs/translation-alignment/fingerprintBlock.cjs +23 -1
- package/dist/cjs/translation-alignment/fingerprintBlock.cjs.map +1 -1
- package/dist/cjs/translation-alignment/index.cjs +22 -1
- package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs +18 -1
- package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs.map +1 -1
- package/dist/cjs/translation-alignment/normalizeBlock.cjs +22 -1
- package/dist/cjs/translation-alignment/normalizeBlock.cjs.map +1 -1
- package/dist/cjs/translation-alignment/pipeline.cjs +37 -1
- package/dist/cjs/translation-alignment/pipeline.cjs.map +1 -1
- package/dist/cjs/translation-alignment/planActions.cjs +46 -1
- package/dist/cjs/translation-alignment/planActions.cjs.map +1 -1
- package/dist/cjs/translation-alignment/rebuildDocument.cjs +49 -2
- package/dist/cjs/translation-alignment/rebuildDocument.cjs.map +1 -1
- package/dist/cjs/translation-alignment/segmentDocument.cjs +66 -5
- package/dist/cjs/translation-alignment/segmentDocument.cjs.map +1 -1
- package/dist/cjs/utils/calculateChunks.cjs +89 -2
- package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
- package/dist/cjs/utils/checkAccess.cjs +83 -1
- package/dist/cjs/utils/checkAccess.cjs.map +1 -1
- package/dist/cjs/utils/checkConfigConsistency.cjs +16 -1
- package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
- package/dist/cjs/utils/checkFileModifiedRange.cjs +81 -1
- package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
- package/dist/cjs/utils/checkLastUpdateTime.cjs +19 -1
- package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
- package/dist/cjs/utils/chunkInference.cjs +45 -1
- package/dist/cjs/utils/chunkInference.cjs.map +1 -1
- package/dist/cjs/utils/fixChunkStartEndChars.cjs +27 -3
- package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
- package/dist/cjs/utils/formatTimeDiff.cjs +20 -1
- package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +16 -1
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
- package/dist/cjs/utils/getOutputFilePath.cjs +74 -1
- package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
- package/dist/cjs/utils/getParentPackageJSON.cjs +20 -1
- package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
- package/dist/cjs/utils/listSpecialChars.cjs +54 -2
- package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs +102 -1
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
- package/dist/cjs/utils/openBrowser.cjs +19 -1
- package/dist/cjs/utils/openBrowser.cjs.map +1 -1
- package/dist/cjs/utils/reorderParagraphs.cjs +91 -3
- package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
- package/dist/cjs/utils/setupAI.cjs +66 -1
- package/dist/cjs/utils/setupAI.cjs.map +1 -1
- package/dist/cjs/watch.cjs +47 -1
- package/dist/cjs/watch.cjs.map +1 -1
- package/dist/esm/IntlayerEventListener.mjs +183 -1
- package/dist/esm/IntlayerEventListener.mjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/esm/_virtual/_utils_asset.mjs +97 -0
- package/dist/esm/auth/login.mjs +86 -2
- package/dist/esm/auth/login.mjs.map +1 -1
- package/dist/esm/build.mjs +28 -1
- package/dist/esm/build.mjs.map +1 -1
- package/dist/esm/ci.mjs +74 -1
- package/dist/esm/ci.mjs.map +1 -1
- package/dist/esm/cli.mjs +482 -1
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +13 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/editor.mjs +50 -1
- package/dist/esm/editor.mjs.map +1 -0
- package/dist/esm/extract.mjs +104 -1
- package/dist/esm/extract.mjs.map +1 -1
- package/dist/esm/fill/deepMergeContent.mjs +25 -1
- package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
- package/dist/esm/fill/fill.mjs +81 -1
- package/dist/esm/fill/fill.mjs.map +1 -1
- package/dist/esm/fill/formatAutoFilledFilePath.mjs +30 -1
- package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
- package/dist/esm/fill/formatFillData.mjs +85 -1
- package/dist/esm/fill/formatFillData.mjs.map +1 -1
- package/dist/esm/fill/getAvailableLocalesInDictionary.mjs +24 -1
- package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
- package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +49 -1
- package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
- package/dist/esm/fill/index.mjs +4 -1
- package/dist/esm/fill/listTranslationsTasks.mjs +69 -1
- package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
- package/dist/esm/fill/translateDictionary.mjs +237 -1
- package/dist/esm/fill/translateDictionary.mjs.map +1 -1
- package/dist/esm/fill/writeFill.mjs +53 -1
- package/dist/esm/fill/writeFill.mjs.map +1 -1
- package/dist/esm/getTargetDictionary.mjs +33 -1
- package/dist/esm/getTargetDictionary.mjs.map +1 -1
- package/dist/esm/index.mjs +20 -1
- package/dist/esm/init.mjs +19 -1
- package/dist/esm/init.mjs.map +1 -1
- package/dist/esm/initMCP.mjs +65 -1
- package/dist/esm/initMCP.mjs.map +1 -1
- package/dist/esm/initSkills.mjs +87 -1
- package/dist/esm/initSkills.mjs.map +1 -1
- package/dist/esm/listContentDeclaration.mjs +39 -1
- package/dist/esm/listContentDeclaration.mjs.map +1 -1
- package/dist/esm/listProjects.mjs +26 -1
- package/dist/esm/listProjects.mjs.map +1 -1
- package/dist/esm/liveSync.mjs +150 -8
- package/dist/esm/liveSync.mjs.map +1 -1
- package/dist/esm/pull.mjs +150 -1
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/push/pullLog.mjs +102 -3
- package/dist/esm/push/pullLog.mjs.map +1 -1
- package/dist/esm/push/push.mjs +208 -1
- package/dist/esm/push/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +20 -1
- package/dist/esm/pushConfig.mjs.map +1 -1
- package/dist/esm/pushLog.mjs +83 -3
- package/dist/esm/pushLog.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDoc.mjs +69 -1
- package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +95 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
- package/dist/esm/searchDoc.mjs +39 -1
- package/dist/esm/searchDoc.mjs.map +1 -1
- package/dist/esm/test/index.mjs +4 -1
- package/dist/esm/test/listMissingTranslations.mjs +49 -1
- package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
- package/dist/esm/test/test.mjs +53 -1
- package/dist/esm/test/test.mjs.map +1 -1
- package/dist/esm/translateDoc/index.mjs +5 -1
- package/dist/esm/translateDoc/translateDoc.mjs +75 -1
- package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
- package/dist/esm/translateDoc/translateFile.mjs +103 -2
- package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
- package/dist/esm/translateDoc/validation.mjs +46 -5
- package/dist/esm/translateDoc/validation.mjs.map +1 -1
- package/dist/esm/translation-alignment/alignBlocks.mjs +66 -1
- package/dist/esm/translation-alignment/alignBlocks.mjs.map +1 -1
- package/dist/esm/translation-alignment/computeSimilarity.mjs +22 -1
- package/dist/esm/translation-alignment/computeSimilarity.mjs.map +1 -1
- package/dist/esm/translation-alignment/fingerprintBlock.mjs +20 -1
- package/dist/esm/translation-alignment/fingerprintBlock.mjs.map +1 -1
- package/dist/esm/translation-alignment/index.mjs +11 -1
- package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs +16 -1
- package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs.map +1 -1
- package/dist/esm/translation-alignment/normalizeBlock.mjs +20 -1
- package/dist/esm/translation-alignment/normalizeBlock.mjs.map +1 -1
- package/dist/esm/translation-alignment/pipeline.mjs +35 -1
- package/dist/esm/translation-alignment/pipeline.mjs.map +1 -1
- package/dist/esm/translation-alignment/planActions.mjs +44 -1
- package/dist/esm/translation-alignment/planActions.mjs.map +1 -1
- package/dist/esm/translation-alignment/rebuildDocument.mjs +46 -2
- package/dist/esm/translation-alignment/rebuildDocument.mjs.map +1 -1
- package/dist/esm/translation-alignment/segmentDocument.mjs +64 -5
- package/dist/esm/translation-alignment/segmentDocument.mjs.map +1 -1
- package/dist/esm/utils/calculateChunks.mjs +87 -2
- package/dist/esm/utils/calculateChunks.mjs.map +1 -1
- package/dist/esm/utils/checkAccess.mjs +79 -1
- package/dist/esm/utils/checkAccess.mjs.map +1 -1
- package/dist/esm/utils/checkConfigConsistency.mjs +14 -1
- package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
- package/dist/esm/utils/checkFileModifiedRange.mjs +80 -1
- package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
- package/dist/esm/utils/checkLastUpdateTime.mjs +17 -1
- package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
- package/dist/esm/utils/chunkInference.mjs +43 -1
- package/dist/esm/utils/chunkInference.mjs.map +1 -1
- package/dist/esm/utils/fixChunkStartEndChars.mjs +25 -3
- package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
- package/dist/esm/utils/formatTimeDiff.mjs +18 -1
- package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs +14 -1
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
- package/dist/esm/utils/getOutputFilePath.mjs +72 -1
- package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
- package/dist/esm/utils/getParentPackageJSON.mjs +18 -1
- package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
- package/dist/esm/utils/listSpecialChars.mjs +52 -2
- package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
- package/dist/esm/utils/mapChunksBetweenFiles.mjs +100 -1
- package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
- package/dist/esm/utils/openBrowser.mjs +17 -1
- package/dist/esm/utils/openBrowser.mjs.map +1 -1
- package/dist/esm/utils/reorderParagraphs.mjs +90 -3
- package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
- package/dist/esm/utils/setupAI.mjs +63 -1
- package/dist/esm/utils/setupAI.mjs.map +1 -1
- package/dist/esm/watch.mjs +45 -1
- package/dist/esm/watch.mjs.map +1 -1
- package/dist/types/fill/fill.d.ts +1 -1
- package/dist/types/fill/translateDictionary.d.ts +1 -1
- package/dist/types/getTargetDictionary.d.ts +19 -2
- package/dist/types/getTargetDictionary.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +1 -1
- package/dist/types/test/index.d.ts +2 -2
- package/dist/types/test/listMissingTranslations.d.ts +28 -2
- package/dist/types/test/listMissingTranslations.d.ts.map +1 -0
- package/dist/types/test/test.d.ts +11 -2
- package/dist/types/test/test.d.ts.map +1 -0
- package/dist/types/translateDoc/index.d.ts +1 -1
- package/dist/types/translateDoc/translateDoc.d.ts +1 -1
- package/dist/types/translateDoc/translateFile.d.ts +1 -1
- package/dist/types/translateDoc/types.d.ts +48 -2
- package/dist/types/translateDoc/types.d.ts.map +1 -0
- package/dist/types/utils/chunkInference.d.ts +1 -1
- package/dist/types/utils/setupAI.d.ts +21 -2
- package/dist/types/utils/setupAI.d.ts.map +1 -0
- package/package.json +12 -12
- package/dist/cjs/_utils_asset-ghp_Cjwk.cjs +0 -2
- package/dist/cjs/chunk-Bmb41Sf3.cjs +0 -1
- package/dist/esm/_utils_asset-B187VPMw.mjs +0 -2
- package/dist/esm/editor-D8BGlLzF.mjs +0 -2
- package/dist/esm/editor-D8BGlLzF.mjs.map +0 -1
- package/dist/types/getTargetDictionary-RBSRtaQj.d.ts +0 -19
- package/dist/types/getTargetDictionary-RBSRtaQj.d.ts.map +0 -1
- package/dist/types/listMissingTranslations-DxKw7nqI.d.ts +0 -28
- package/dist/types/listMissingTranslations-DxKw7nqI.d.ts.map +0 -1
- package/dist/types/setupAI-Bosjx7ah.d.ts +0 -21
- package/dist/types/setupAI-Bosjx7ah.d.ts.map +0 -1
- package/dist/types/test-DUTiJR5_.d.ts +0 -11
- package/dist/types/test-DUTiJR5_.d.ts.map +0 -1
- package/dist/types/types-BKvc3FmV.d.ts +0 -48
- package/dist/types/types-BKvc3FmV.d.ts.map +0 -1
package/dist/esm/initMCP.mjs
CHANGED
|
@@ -1,2 +1,66 @@
|
|
|
1
|
-
import{findProjectRoot
|
|
1
|
+
import { findProjectRoot } from "./init.mjs";
|
|
2
|
+
import { PLATFORM_OPTIONS, getDetectedPlatform } from "./initSkills.mjs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { PLATFORMS, installMCP } from "@intlayer/chokidar/cli";
|
|
5
|
+
import enquirer from "enquirer";
|
|
6
|
+
import * as p from "@clack/prompts";
|
|
7
|
+
|
|
8
|
+
//#region src/initMCP.ts
|
|
9
|
+
const initMCP = async (projectRoot) => {
|
|
10
|
+
const root = findProjectRoot(projectRoot ? resolve(projectRoot) : process.cwd());
|
|
11
|
+
p.intro("Initializing Intlayer MCP Server");
|
|
12
|
+
const detectedPlatform = getDetectedPlatform();
|
|
13
|
+
let platform;
|
|
14
|
+
try {
|
|
15
|
+
platform = (await enquirer.prompt({
|
|
16
|
+
type: "autocomplete",
|
|
17
|
+
name: "platforms",
|
|
18
|
+
message: "Which platform are you using? (Type to search)",
|
|
19
|
+
multiple: false,
|
|
20
|
+
initial: detectedPlatform ? PLATFORMS.indexOf(detectedPlatform) : void 0,
|
|
21
|
+
choices: PLATFORM_OPTIONS.map((opt) => ({
|
|
22
|
+
name: opt.value,
|
|
23
|
+
message: opt.label,
|
|
24
|
+
hint: opt.hint
|
|
25
|
+
}))
|
|
26
|
+
})).platforms;
|
|
27
|
+
} catch {
|
|
28
|
+
p.cancel("Operation cancelled.");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!platform) {
|
|
32
|
+
p.cancel("Operation cancelled. No platform selected.");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const transport = await p.select({
|
|
36
|
+
message: "Which transport method do you want to use?",
|
|
37
|
+
options: [{
|
|
38
|
+
value: "stdio",
|
|
39
|
+
label: "Local server (stdio)",
|
|
40
|
+
hint: "Recommended. Integrates all features including CLI tools."
|
|
41
|
+
}, {
|
|
42
|
+
value: "sse",
|
|
43
|
+
label: "Remote server (SSE)",
|
|
44
|
+
hint: "Hosted by Intlayer. Documentation only."
|
|
45
|
+
}]
|
|
46
|
+
});
|
|
47
|
+
if (p.isCancel(transport) || !transport) {
|
|
48
|
+
p.cancel("Operation cancelled.");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const s = p.spinner();
|
|
52
|
+
s.start("Configuring MCP Server...");
|
|
53
|
+
try {
|
|
54
|
+
const result = await installMCP(root, platform, transport);
|
|
55
|
+
s.stop("MCP Server configured successfully");
|
|
56
|
+
p.note(result, "Success");
|
|
57
|
+
} catch (error) {
|
|
58
|
+
s.stop("Failed to configure MCP Server");
|
|
59
|
+
p.log.error(error instanceof Error ? error.message : String(error));
|
|
60
|
+
}
|
|
61
|
+
p.outro("Intlayer MCP Server initialization complete");
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { initMCP };
|
|
2
66
|
//# sourceMappingURL=initMCP.mjs.map
|
package/dist/esm/initMCP.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initMCP.mjs","names":[],"sources":["../../src/initMCP.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installMCP,\n type MCPTransport,\n PLATFORMS,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: any;\n try {\n const response = await enquirer.prompt<{ platforms: any }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.cancel('Operation cancelled. No platform selected.');\n return;\n }\n\n const transport = (await p.select({\n message: 'Which transport method do you want to use?',\n options: [\n {\n value: 'stdio',\n label: 'Local server (stdio)',\n hint: 'Recommended. Integrates all features including CLI tools.',\n },\n {\n value: 'sse',\n label: 'Remote server (SSE)',\n hint: 'Hosted by Intlayer. Documentation only.',\n },\n ],\n })) as MCPTransport;\n\n if (p.isCancel(transport) || !transport) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const s = p.spinner();\n s.start('Configuring MCP Server...');\n\n try {\n const result = await installMCP(root, platform, transport);\n\n s.stop('MCP Server configured successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to configure MCP Server');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer MCP Server initialization complete');\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"initMCP.mjs","names":[],"sources":["../../src/initMCP.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installMCP,\n type MCPTransport,\n PLATFORMS,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: any;\n try {\n const response = await enquirer.prompt<{ platforms: any }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.cancel('Operation cancelled. No platform selected.');\n return;\n }\n\n const transport = (await p.select({\n message: 'Which transport method do you want to use?',\n options: [\n {\n value: 'stdio',\n label: 'Local server (stdio)',\n hint: 'Recommended. Integrates all features including CLI tools.',\n },\n {\n value: 'sse',\n label: 'Remote server (SSE)',\n hint: 'Hosted by Intlayer. Documentation only.',\n },\n ],\n })) as MCPTransport;\n\n if (p.isCancel(transport) || !transport) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const s = p.spinner();\n s.start('Configuring MCP Server...');\n\n try {\n const result = await installMCP(root, platform, transport);\n\n s.stop('MCP Server configured successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to configure MCP Server');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer MCP Server initialization complete');\n};\n"],"mappings":";;;;;;;;AAWA,MAAa,UAAU,OAAO,gBAAyB;CACrD,MAAM,OAAO,gBACX,cAAc,QAAQ,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,GAAE,MAAM,mCAAmC;CAE3C,MAAM,mBAAmB,qBAAqB;CAE9C,IAAI;AACJ,KAAI;AAeF,cAdiB,MAAM,SAAS,OAA2B;GACzD,MAAM;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS,mBACL,UAAU,QAAQ,iBAAiB,GACnC;GACJ,SAAS,iBAAiB,KAAK,SAAS;IACtC,MAAM,IAAI;IACV,SAAS,IAAI;IACb,MAAM,IAAI;IACX,EAAE;GACJ,CAAC,EACkB;SACd;AACN,IAAE,OAAO,uBAAuB;AAChC;;AAGF,KAAI,CAAC,UAAU;AACb,IAAE,OAAO,6CAA6C;AACtD;;CAGF,MAAM,YAAa,MAAM,EAAE,OAAO;EAChC,SAAS;EACT,SAAS,CACP;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,EACD;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,CACF;EACF,CAAC;AAEF,KAAI,EAAE,SAAS,UAAU,IAAI,CAAC,WAAW;AACvC,IAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,IAAI,EAAE,SAAS;AACrB,GAAE,MAAM,4BAA4B;AAEpC,KAAI;EACF,MAAM,SAAS,MAAM,WAAW,MAAM,UAAU,UAAU;AAE1D,IAAE,KAAK,qCAAqC;AAE5C,IAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,iCAAiC;AACxC,IAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,GAAE,MAAM,8CAA8C"}
|
package/dist/esm/initSkills.mjs
CHANGED
|
@@ -1,2 +1,88 @@
|
|
|
1
|
-
import{findProjectRoot
|
|
1
|
+
import { findProjectRoot } from "./init.mjs";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { PLATFORMS, PLATFORMS_METADATA, SKILLS, SKILLS_METADATA, getInitialSkills, installSkills } from "@intlayer/chokidar/cli";
|
|
5
|
+
import enquirer from "enquirer";
|
|
6
|
+
import * as p from "@clack/prompts";
|
|
7
|
+
|
|
8
|
+
//#region src/initSkills.ts
|
|
9
|
+
const PLATFORM_CHECKS = PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform].check).map((platform) => ({
|
|
10
|
+
check: PLATFORMS_METADATA[platform].check ?? (() => false),
|
|
11
|
+
platform
|
|
12
|
+
}));
|
|
13
|
+
const PLATFORM_OPTIONS = PLATFORMS.map((platform) => ({
|
|
14
|
+
value: platform,
|
|
15
|
+
label: PLATFORMS_METADATA[platform].label,
|
|
16
|
+
hint: `(${PLATFORMS_METADATA[platform].dir})`
|
|
17
|
+
}));
|
|
18
|
+
const getDetectedPlatform = () => PLATFORM_CHECKS.find(({ check }) => check())?.platform;
|
|
19
|
+
const getDependencies = (root) => {
|
|
20
|
+
try {
|
|
21
|
+
const packageJsonPath = join(root, "package.json");
|
|
22
|
+
if (!existsSync(packageJsonPath)) return {};
|
|
23
|
+
const { dependencies = {}, devDependencies = {} } = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
24
|
+
return {
|
|
25
|
+
...dependencies,
|
|
26
|
+
...devDependencies
|
|
27
|
+
};
|
|
28
|
+
} catch {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const initSkills = async (projectRoot) => {
|
|
33
|
+
const root = findProjectRoot(projectRoot ? resolve(projectRoot) : process.cwd());
|
|
34
|
+
p.intro("Initializing Intlayer skills");
|
|
35
|
+
const detectedPlatform = getDetectedPlatform();
|
|
36
|
+
let platform;
|
|
37
|
+
try {
|
|
38
|
+
platform = (await enquirer.prompt({
|
|
39
|
+
type: "autocomplete",
|
|
40
|
+
name: "platforms",
|
|
41
|
+
message: "Which platforms are you using? (Type to search)",
|
|
42
|
+
multiple: false,
|
|
43
|
+
initial: detectedPlatform ? PLATFORMS.indexOf(detectedPlatform) : void 0,
|
|
44
|
+
choices: PLATFORM_OPTIONS.map((opt) => ({
|
|
45
|
+
name: opt.value,
|
|
46
|
+
message: opt.label,
|
|
47
|
+
hint: opt.hint
|
|
48
|
+
}))
|
|
49
|
+
})).platforms;
|
|
50
|
+
} catch {
|
|
51
|
+
p.cancel("Operation cancelled.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!platform) {
|
|
55
|
+
p.log.warn("No platform selected. Nothing to install.");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const initialValues = getInitialSkills(getDependencies(root));
|
|
59
|
+
const selectedSkills = await p.multiselect({
|
|
60
|
+
message: "Select the documentation skills to provide to your AI:",
|
|
61
|
+
initialValues,
|
|
62
|
+
options: SKILLS.map((skill) => ({
|
|
63
|
+
value: skill,
|
|
64
|
+
label: skill,
|
|
65
|
+
hint: SKILLS_METADATA[skill]
|
|
66
|
+
})),
|
|
67
|
+
required: false
|
|
68
|
+
});
|
|
69
|
+
if (p.isCancel(selectedSkills) || !selectedSkills || selectedSkills.length === 0) {
|
|
70
|
+
p.cancel("Operation cancelled. No skills selected.");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const s = p.spinner();
|
|
74
|
+
s.start("Installing skills...");
|
|
75
|
+
try {
|
|
76
|
+
const result = await installSkills(root, platform, selectedSkills);
|
|
77
|
+
s.stop("Skills installed successfully");
|
|
78
|
+
p.note(result, "Success");
|
|
79
|
+
} catch (error) {
|
|
80
|
+
s.stop("Failed to install skills");
|
|
81
|
+
p.log.error(error instanceof Error ? error.message : String(error));
|
|
82
|
+
}
|
|
83
|
+
p.outro("Intlayer skills initialization complete");
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
export { PLATFORM_OPTIONS, getDetectedPlatform, initSkills };
|
|
2
88
|
//# sourceMappingURL=initSkills.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSkills.mjs","names":[],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n getInitialSkills,\n installSkills,\n PLATFORMS,\n PLATFORMS_METADATA,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> =\n PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform].check).map(\n (platform) => ({\n check: PLATFORMS_METADATA[platform].check ?? (() => false),\n platform,\n })\n );\n\nexport const PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = PLATFORMS.map((platform) => ({\n value: platform,\n label: PLATFORMS_METADATA[platform].label,\n hint: `(${PLATFORMS_METADATA[platform].dir})`,\n}));\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nconst getDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: Platform;\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const result = await installSkills(root, platform, selectedSkills);\n\n s.stop('Skills installed successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"initSkills.mjs","names":[],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n getInitialSkills,\n installSkills,\n PLATFORMS,\n PLATFORMS_METADATA,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> =\n PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform].check).map(\n (platform) => ({\n check: PLATFORMS_METADATA[platform].check ?? (() => false),\n platform,\n })\n );\n\nexport const PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = PLATFORMS.map((platform) => ({\n value: platform,\n label: PLATFORMS_METADATA[platform].label,\n hint: `(${PLATFORMS_METADATA[platform].dir})`,\n}));\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nconst getDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: Platform;\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const result = await installSkills(root, platform, selectedSkills);\n\n s.stop('Skills installed successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":";;;;;;;;AAeA,MAAM,kBACJ,UAAU,QAAQ,aAAa,mBAAmB,UAAU,MAAM,CAAC,KAChE,cAAc;CACb,OAAO,mBAAmB,UAAU,gBAAgB;CACpD;CACD,EACF;AAEH,MAAa,mBAIR,UAAU,KAAK,cAAc;CAChC,OAAO;CACP,OAAO,mBAAmB,UAAU;CACpC,MAAM,IAAI,mBAAmB,UAAU,IAAI;CAC5C,EAAE;AAEH,MAAa,4BACX,gBAAgB,MAAM,EAAE,YAAY,OAAO,CAAC,EAAE;AAEhD,MAAM,mBAAmB,SAAyC;AAChE,KAAI;EACF,MAAM,kBAAkB,KAAK,MAAM,eAAe;AAClD,MAAI,CAAC,WAAW,gBAAgB,CAAE,QAAO,EAAE;EAE3C,MAAM,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,KAAK,MACvD,aAAa,iBAAiB,QAAQ,CACvC;AACD,SAAO;GAAE,GAAG;GAAc,GAAG;GAAiB;SACxC;AACN,SAAO,EAAE;;;AAIb,MAAa,aAAa,OAAO,gBAAyB;CACxD,MAAM,OAAO,gBACX,cAAc,QAAQ,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,GAAE,MAAM,+BAA+B;CAEvC,MAAM,mBAAmB,qBAAqB;CAE9C,IAAI;AACJ,KAAI;AAeF,cAdiB,MAAM,SAAS,OAAgC;GAC9D,MAAM;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS,mBACL,UAAU,QAAQ,iBAAiB,GACnC;GACJ,SAAS,iBAAiB,KAAK,SAAS;IACtC,MAAM,IAAI;IACV,SAAS,IAAI;IACb,MAAM,IAAI;IACX,EAAE;GACJ,CAAC,EACkB;SACd;AACN,IAAE,OAAO,uBAAuB;AAChC;;AAGF,KAAI,CAAC,UAAU;AACb,IAAE,IAAI,KAAK,4CAA4C;AACvD;;CAIF,MAAM,gBAAgB,iBADD,gBAAgB,KAAK,CACU;CAEpD,MAAM,iBAAiB,MAAM,EAAE,YAAY;EACzC,SAAS;EACT;EACA,SAAS,OAAO,KAAK,WAAW;GAC9B,OAAO;GACP,OAAO;GACP,MAAM,gBAAgB;GACvB,EAAE;EACH,UAAU;EACX,CAAC;AAEF,KACE,EAAE,SAAS,eAAe,IAC1B,CAAC,kBACA,eAA4B,WAAW,GACxC;AACA,IAAE,OAAO,2CAA2C;AACpD;;CAGF,MAAM,IAAI,EAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAE/B,KAAI;EACF,MAAM,SAAS,MAAM,cAAc,MAAM,UAAU,eAAe;AAElE,IAAE,KAAK,gCAAgC;AAEvC,IAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,IAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,GAAE,MAAM,0CAA0C"}
|
|
@@ -1,2 +1,40 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { relative } from "node:path";
|
|
2
|
+
import { formatPath } from "@intlayer/chokidar/utils";
|
|
3
|
+
import { colon, colorizeKey, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
|
|
4
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
5
|
+
import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
|
|
6
|
+
|
|
7
|
+
//#region src/listContentDeclaration.ts
|
|
8
|
+
const listContentDeclarationRows = (options) => {
|
|
9
|
+
const config = getConfiguration(options?.configOptions);
|
|
10
|
+
const unmergedDictionariesRecord = getUnmergedDictionaries(config);
|
|
11
|
+
return Object.values(unmergedDictionariesRecord).flat().map((dictionary) => ({
|
|
12
|
+
key: dictionary.key ?? "",
|
|
13
|
+
path: options?.absolute ? dictionary.filePath ?? "Remote" : relative(config.system.baseDir, dictionary.filePath ?? "Remote")
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
const listContentDeclaration = (options) => {
|
|
17
|
+
const rows = listContentDeclarationRows(options);
|
|
18
|
+
if (options?.json) {
|
|
19
|
+
console.log(JSON.stringify(rows));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const appLogger = getAppLogger(getConfiguration(options?.configOptions));
|
|
23
|
+
const lines = rows.map((row) => [
|
|
24
|
+
colon(` - ${colorizeKey(row.key)}`, {
|
|
25
|
+
colSize: rows.map((row) => row.key.length),
|
|
26
|
+
maxSize: 60
|
|
27
|
+
}),
|
|
28
|
+
" - ",
|
|
29
|
+
formatPath(row.path)
|
|
30
|
+
].join(""));
|
|
31
|
+
appLogger(`Content declaration files:`);
|
|
32
|
+
lines.forEach((line) => {
|
|
33
|
+
appLogger(line, { level: "info" });
|
|
34
|
+
});
|
|
35
|
+
appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { listContentDeclaration, listContentDeclarationRows };
|
|
2
40
|
//# sourceMappingURL=listContentDeclaration.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listContentDeclaration.mjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = (\n options?: ListContentDeclarationOptions\n) => {\n const rows = listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"listContentDeclaration.mjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = (\n options?: ListContentDeclarationOptions\n) => {\n const rows = listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;AAoBA,MAAa,8BACX,YACG;CACH,MAAM,SAAS,iBAAiB,SAAS,cAAc;CAEvD,MAAM,6BAA6B,wBAAwB,OAAO;AAUlE,QARa,OAAO,OAAO,2BAA2B,CACnD,MAAM,CACN,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,MAAM,SAAS,WACV,WAAW,YAAY,WACxB,SAAS,OAAO,OAAO,SAAS,WAAW,YAAY,SAAS;EACrE,EAAE;;AAIP,MAAa,0BACX,YACG;CACH,MAAM,OAAO,2BAA2B,QAAQ;AAEhD,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,KAAK,UAAU,KAAK,CAAC;AACjC;;CAIF,MAAM,YAAY,aADH,iBAAiB,SAAS,cAAc,CACjB;CAEtC,MAAM,QAAQ,KAAK,KAAK,QACtB;EACE,MAAM,MAAM,YAAY,IAAI,IAAI,IAAI;GAClC,SAAS,KAAK,KAAK,QAAQ,IAAI,IAAI,OAAO;GAC1C,SAAS;GACV,CAAC;EACF;EACA,WAAW,IAAI,KAAK;EACrB,CAAC,KAAK,GAAG,CACX;AAED,WAAU,6BAA6B;AAEvC,OAAM,SAAS,SAAS;AACtB,YAAU,MAAM,EACd,OAAO,QACR,CAAC;GACF;AAEF,WAAU,oCAAoC,eAAe,KAAK,OAAO,GAAG"}
|
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
import{relative
|
|
1
|
+
import { relative } from "node:path";
|
|
2
|
+
import { listProjects } from "@intlayer/chokidar/cli";
|
|
3
|
+
|
|
4
|
+
//#region src/listProjects.ts
|
|
5
|
+
const listProjectsCommand = async (options) => {
|
|
6
|
+
const { searchDir, projectsPath } = await listProjects(options);
|
|
7
|
+
const projectsRelativePath = projectsPath.map((projectPath) => options?.absolute ? projectPath : relative(searchDir, projectPath)).map((projectPath) => projectPath === "" ? "." : projectPath);
|
|
8
|
+
if (options?.json) {
|
|
9
|
+
console.dir(projectsRelativePath, {
|
|
10
|
+
depth: null,
|
|
11
|
+
arrayLimit: null
|
|
12
|
+
});
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (projectsPath.length === 0) {
|
|
16
|
+
console.log("No Intlayer projects found.");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
console.log(`Found ${projectsPath.length} Intlayer project(s):\n`);
|
|
20
|
+
projectsPath.forEach((project) => {
|
|
21
|
+
console.log(` - ${project}`);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { listProjectsCommand };
|
|
2
27
|
//# sourceMappingURL=listProjects.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listProjects.mjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/chokidar/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"listProjects.mjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/chokidar/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":";;;;AAQA,MAAa,sBAAsB,OACjC,YACG;CACH,MAAM,EAAE,WAAW,iBAAiB,MAAM,aAAa,QAAQ;CAE/D,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,SAAS,WAAW,cAAc,SAAS,WAAW,YAAY,CACnE,CACA,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,YAAa;AAEjE,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,sBAAsB;GAAE,OAAO;GAAM,YAAY;GAAM,CAAC;AACpE;;AAGF,KAAI,aAAa,WAAW,GAAG;AAC7B,UAAQ,IAAI,8BAA8B;AAC1C;;AAGF,SAAQ,IAAI,SAAS,aAAa,OAAO,yBAAyB;AAClE,cAAa,SAAS,YAAY;AAChC,UAAQ,IAAI,OAAO,UAAU;GAC7B"}
|
package/dist/esm/liveSync.mjs
CHANGED
|
@@ -1,10 +1,152 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
1
|
+
import { IntlayerEventListener } from "./IntlayerEventListener.mjs";
|
|
2
|
+
import { buildDictionary } from "@intlayer/chokidar/build";
|
|
3
|
+
import { runParallel } from "@intlayer/chokidar/utils";
|
|
4
|
+
import { getAppLogger } from "@intlayer/config/logger";
|
|
5
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
6
|
+
import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
|
|
7
|
+
import { createServer } from "node:http";
|
|
8
|
+
import packageJson from "@intlayer/config/package.json" with { type: "json" };
|
|
9
|
+
import { getLocalizedContent } from "@intlayer/core/plugins";
|
|
10
|
+
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
11
|
+
|
|
12
|
+
//#region src/liveSync.ts
|
|
13
|
+
const writeDictionary = async (dictionary, configuration) => {
|
|
14
|
+
getAppLogger(configuration)(`Writing dictionary ${dictionary.key}`);
|
|
15
|
+
await buildDictionary([dictionary], configuration);
|
|
16
|
+
};
|
|
17
|
+
const liveSync = async (options) => {
|
|
18
|
+
const configuration = getConfiguration(options?.configOptions);
|
|
19
|
+
const appLogger = getAppLogger(configuration);
|
|
20
|
+
const { liveSyncPort, liveSyncURL } = configuration.editor;
|
|
21
|
+
let parallelProcess = null;
|
|
22
|
+
let eventListener = null;
|
|
23
|
+
if (options?.with) {
|
|
24
|
+
parallelProcess = runParallel(options.with);
|
|
25
|
+
parallelProcess.result.catch(() => {});
|
|
26
|
+
}
|
|
27
|
+
if (configuration.editor.liveSync && configuration.editor.backendURL && configuration.editor.clientId && configuration.editor.clientSecret) {
|
|
28
|
+
eventListener = new IntlayerEventListener(configuration);
|
|
29
|
+
eventListener.onConnectionOpen = () => {
|
|
30
|
+
appLogger("Live sync connection established");
|
|
31
|
+
};
|
|
32
|
+
eventListener.onConnectionError = (error) => {
|
|
33
|
+
const errorEvent = error;
|
|
34
|
+
appLogger(`Live sync connection error: ${errorEvent.message ?? "Unknown error"}`, { level: "warn" });
|
|
35
|
+
if (errorEvent.message?.includes("terminated") || errorEvent.message?.includes("closed")) appLogger("Server connection was terminated, automatic reconnection will be attempted...", { level: "info" });
|
|
36
|
+
};
|
|
37
|
+
eventListener.onDictionaryAdded = (dictionary) => writeDictionary(dictionary, configuration);
|
|
38
|
+
eventListener.onDictionaryChange = (dictionary) => writeDictionary(dictionary, configuration);
|
|
39
|
+
eventListener.onDictionaryDeleted = (dictionary) => writeDictionary(dictionary, configuration);
|
|
40
|
+
try {
|
|
41
|
+
await eventListener.initialize();
|
|
42
|
+
} catch (error) {
|
|
43
|
+
appLogger("Failed to initialize IntlayerEventListener:", { level: "error" });
|
|
44
|
+
appLogger(`Error: ${error instanceof Error ? error.message : String(error)}`, { level: "error" });
|
|
45
|
+
}
|
|
46
|
+
} else if (!configuration.editor.liveSync) appLogger("Hot reload is disabled. Please enable it in the configuration (editor.liveSync).");
|
|
47
|
+
else if (!configuration.editor.clientId || !configuration.editor.clientSecret) appLogger("Missing client credentials for hot reload. Please configure clientId and clientSecret");
|
|
48
|
+
const server = createServer(async (req, res) => {
|
|
49
|
+
if (req.method === "OPTIONS") {
|
|
50
|
+
res.writeHead(200, {
|
|
51
|
+
"Access-Control-Allow-Origin": "*",
|
|
52
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
|
53
|
+
"Access-Control-Allow-Headers": "Content-Type, Authorization"
|
|
54
|
+
});
|
|
55
|
+
res.end();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (req.url?.startsWith("/dictionaries")) {
|
|
59
|
+
res.writeHead(200, {
|
|
60
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
61
|
+
"Cache-Control": "no-store",
|
|
62
|
+
"Access-Control-Allow-Origin": "*",
|
|
63
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
|
64
|
+
"Access-Control-Allow-Headers": "Content-Type, Authorization"
|
|
65
|
+
});
|
|
66
|
+
const dictionaries = getDictionaries(configuration);
|
|
67
|
+
if (req.url.startsWith("/dictionaries/")) {
|
|
68
|
+
const [key, locale] = decodeURIComponent(req.url).slice(14).split("/");
|
|
69
|
+
const dictionary = dictionaries[key] ?? null;
|
|
70
|
+
if (locale) {
|
|
71
|
+
const sourceLocaleContent = getLocalizedContent(dictionary.content, locale, {
|
|
72
|
+
dictionaryKey: key,
|
|
73
|
+
keyPath: []
|
|
74
|
+
});
|
|
75
|
+
res.end(JSON.stringify(sourceLocaleContent));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
res.end(JSON.stringify(dictionary));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
res.end(JSON.stringify(dictionaries));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (req.url?.startsWith("/unmerged_dictionaries")) {
|
|
85
|
+
res.writeHead(200, {
|
|
86
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
87
|
+
"Cache-Control": "no-store",
|
|
88
|
+
"Access-Control-Allow-Origin": "*",
|
|
89
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
|
90
|
+
"Access-Control-Allow-Headers": "Content-Type, Authorization"
|
|
91
|
+
});
|
|
92
|
+
const unmergedDictionaries = getUnmergedDictionaries(configuration);
|
|
93
|
+
if (req.url.startsWith("/unmerged_dictionaries/")) {
|
|
94
|
+
const one = unmergedDictionaries[decodeURIComponent(req.url.slice(23))] ?? null;
|
|
95
|
+
res.end(JSON.stringify(one));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
res.end(JSON.stringify(unmergedDictionaries));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (req.url === "/configuration") {
|
|
102
|
+
res.writeHead(200, {
|
|
103
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
104
|
+
"Cache-Control": "no-store",
|
|
105
|
+
"Access-Control-Allow-Origin": "*",
|
|
106
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
|
107
|
+
"Access-Control-Allow-Headers": "Content-Type, Authorization"
|
|
108
|
+
});
|
|
109
|
+
res.end(JSON.stringify(configuration));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (req.url === "/health") {
|
|
113
|
+
res.writeHead(200, { "Content-Type": "application/json; charset=utf-8" });
|
|
114
|
+
res.end(JSON.stringify({ status: "ok" }));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
res.end("Not found");
|
|
118
|
+
});
|
|
119
|
+
const getLiveSyncParam = () => {
|
|
120
|
+
if (!configuration.editor.liveSync) return "\x1B[31m✗ Disabled\x1B[0m";
|
|
121
|
+
return "\x1B[32m✓ Enabled\x1B[0m";
|
|
122
|
+
};
|
|
123
|
+
server.listen(liveSyncPort, () => {
|
|
124
|
+
console.log(`
|
|
125
|
+
\x1b[1;90mINTLAYER v${packageJson.version}\x1b[0m
|
|
3
126
|
|
|
4
|
-
Live server running at: \x1b[90m${
|
|
5
|
-
- Backend URL: \x1b[90m${
|
|
6
|
-
- Live sync: ${
|
|
7
|
-
- Parallel process: ${
|
|
8
|
-
- Access key: ${
|
|
9
|
-
`)
|
|
127
|
+
Live server running at: \x1b[90m${liveSyncURL}\x1b[0m
|
|
128
|
+
- Backend URL: \x1b[90m${configuration.editor.backendURL ?? "-"}\x1b[0m
|
|
129
|
+
- Live sync: ${getLiveSyncParam()}
|
|
130
|
+
- Parallel process: ${options?.with ? `\x1b[90m${Array.isArray(options.with) ? options.with.join(" ") : options.with}\x1b[0m` : "-"}
|
|
131
|
+
- Access key: ${configuration.editor.clientId ?? "-"}
|
|
132
|
+
`);
|
|
133
|
+
});
|
|
134
|
+
const cleanup = () => {
|
|
135
|
+
if (eventListener) {
|
|
136
|
+
appLogger("Closing SSE connection...");
|
|
137
|
+
eventListener.cleanup();
|
|
138
|
+
}
|
|
139
|
+
if (parallelProcess) parallelProcess.kill();
|
|
140
|
+
server.close(() => {
|
|
141
|
+
appLogger("Live sync server stopped");
|
|
142
|
+
process.exit(0);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
process.on("SIGINT", cleanup);
|
|
146
|
+
process.on("SIGTERM", cleanup);
|
|
147
|
+
process.on("exit", cleanup);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
//#endregion
|
|
151
|
+
export { liveSync };
|
|
10
152
|
//# sourceMappingURL=liveSync.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveSync.mjs","names":[],"sources":["../../src/liveSync.ts"],"sourcesContent":["import { createServer } from 'node:http';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { buildDictionary } from '@intlayer/chokidar/build';\nimport { type ParallelHandle, runParallel } from '@intlayer/chokidar/utils';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { getLocalizedContent } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { IntlayerEventListener } from './IntlayerEventListener';\n\ntype LiveSyncOptions = {\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\nconst writeDictionary = async (\n dictionary: DictionaryAPI,\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n appLogger(`Writing dictionary ${dictionary.key}`);\n await buildDictionary([dictionary], configuration);\n};\n\nexport const liveSync = async (options?: LiveSyncOptions) => {\n const configuration = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(configuration);\n\n const { liveSyncPort, liveSyncURL } = configuration.editor;\n\n let parallelProcess: ParallelHandle | null = null;\n let eventListener: IntlayerEventListener | null = null;\n let _isHotReloadConnected = false;\n let _connectionStatus = 'disconnected'; // 'connected', 'connecting', 'reconnecting', 'disconnected', 'error'\n\n // Start the parallel process if provided\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n // Initialize the event listener for hot reload if configured\n if (\n configuration.editor.liveSync &&\n configuration.editor.backendURL &&\n configuration.editor.clientId &&\n configuration.editor.clientSecret\n ) {\n eventListener = new IntlayerEventListener(configuration);\n _connectionStatus = 'connecting';\n\n // Set up connection callbacks\n eventListener.onConnectionOpen = () => {\n _connectionStatus = 'connected';\n _isHotReloadConnected = true;\n appLogger('Live sync connection established');\n };\n\n eventListener.onConnectionError = (error) => {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n const errorEvent = error as any;\n appLogger(\n `Live sync connection error: ${errorEvent.message ?? 'Unknown error'}`,\n {\n level: 'warn',\n }\n );\n\n // If this is a \"terminated: other side closed\" error, it's likely a server restart\n if (\n errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed')\n ) {\n appLogger(\n 'Server connection was terminated, automatic reconnection will be attempted...',\n {\n level: 'info',\n }\n );\n _connectionStatus = 'reconnecting';\n }\n };\n\n // Set up dictionary change callbacks\n eventListener.onDictionaryAdded = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryChange = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryDeleted = (dictionary) =>\n writeDictionary(dictionary, configuration);\n\n try {\n await eventListener.initialize();\n } catch (error) {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n appLogger('Failed to initialize IntlayerEventListener:', {\n level: 'error',\n });\n appLogger(\n `Error: ${error instanceof Error ? error.message : String(error)}`,\n {\n level: 'error',\n }\n );\n }\n } else if (!configuration.editor.liveSync) {\n appLogger(\n 'Hot reload is disabled. Please enable it in the configuration (editor.liveSync).'\n );\n } else if (\n !configuration.editor.clientId ||\n !configuration.editor.clientSecret\n ) {\n appLogger(\n 'Missing client credentials for hot reload. Please configure clientId and clientSecret'\n );\n }\n\n const server = createServer(async (req, res) => {\n // Handle CORS preflight requests\n if (req.method === 'OPTIONS') {\n res.writeHead(200, {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n\n res.end();\n return;\n }\n\n if (req.url?.startsWith('/dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const dictionaries = getDictionaries(configuration);\n\n const prefix = '/dictionaries/';\n if (req.url.startsWith(prefix)) {\n const [key, locale] = decodeURIComponent(req.url)\n .slice(prefix.length)\n .split('/');\n\n const dictionary = dictionaries[key] ?? null;\n\n if (locale) {\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const sourceLocaleContent = getLocalizedContent(\n dictionary.content,\n locale,\n {\n dictionaryKey: key,\n keyPath: [],\n }\n );\n\n res.end(JSON.stringify(sourceLocaleContent));\n return;\n }\n\n res.end(JSON.stringify(dictionary));\n return;\n }\n\n res.end(JSON.stringify(dictionaries));\n return;\n }\n\n if (req.url?.startsWith('/unmerged_dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const prefix = '/unmerged_dictionaries/';\n if (req.url.startsWith(prefix)) {\n const key = decodeURIComponent(req.url.slice(prefix.length));\n const one = unmergedDictionaries[key] ?? null;\n\n res.end(JSON.stringify(one));\n return;\n }\n\n res.end(JSON.stringify(unmergedDictionaries));\n return;\n }\n\n if (req.url === '/configuration') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n res.end(JSON.stringify(configuration));\n return;\n }\n\n if (req.url === '/health') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n });\n res.end(JSON.stringify({ status: 'ok' }));\n return;\n }\n\n res.end('Not found');\n return;\n });\n\n const getLiveSyncParam = () => {\n if (!configuration.editor.liveSync) return '\\x1b[31m✗ Disabled\\x1b[0m';\n\n return '\\x1b[32m✓ Enabled\\x1b[0m';\n };\n server.listen(liveSyncPort, () => {\n console.log(`\n \\x1b[1;90mINTLAYER v${packageJson.version}\\x1b[0m\n \n Live server running at: \\x1b[90m${liveSyncURL}\\x1b[0m\n - Backend URL: \\x1b[90m${configuration.editor.backendURL ?? '-'}\\x1b[0m\n - Live sync: ${getLiveSyncParam()}\n - Parallel process: ${options?.with ? `\\x1b[90m${Array.isArray(options.with) ? options.with.join(' ') : options.with}\\x1b[0m` : '-'}\n - Access key: ${configuration.editor.clientId ?? '-'}\n `);\n });\n\n // Cleanup function to terminate child process and event listener when the main process exits\n const cleanup = () => {\n // Clean up event listener\n if (eventListener) {\n appLogger('Closing SSE connection...');\n eventListener.cleanup();\n }\n\n if (parallelProcess) {\n parallelProcess.kill();\n }\n\n server.close(() => {\n appLogger('Live sync server stopped');\n process.exit(0);\n });\n };\n\n // Handle process termination signals\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n process.on('exit', cleanup);\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"liveSync.mjs","names":[],"sources":["../../src/liveSync.ts"],"sourcesContent":["import { createServer } from 'node:http';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { buildDictionary } from '@intlayer/chokidar/build';\nimport { type ParallelHandle, runParallel } from '@intlayer/chokidar/utils';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { getLocalizedContent } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { IntlayerEventListener } from './IntlayerEventListener';\n\ntype LiveSyncOptions = {\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\nconst writeDictionary = async (\n dictionary: DictionaryAPI,\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n appLogger(`Writing dictionary ${dictionary.key}`);\n await buildDictionary([dictionary], configuration);\n};\n\nexport const liveSync = async (options?: LiveSyncOptions) => {\n const configuration = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(configuration);\n\n const { liveSyncPort, liveSyncURL } = configuration.editor;\n\n let parallelProcess: ParallelHandle | null = null;\n let eventListener: IntlayerEventListener | null = null;\n let _isHotReloadConnected = false;\n let _connectionStatus = 'disconnected'; // 'connected', 'connecting', 'reconnecting', 'disconnected', 'error'\n\n // Start the parallel process if provided\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n // Initialize the event listener for hot reload if configured\n if (\n configuration.editor.liveSync &&\n configuration.editor.backendURL &&\n configuration.editor.clientId &&\n configuration.editor.clientSecret\n ) {\n eventListener = new IntlayerEventListener(configuration);\n _connectionStatus = 'connecting';\n\n // Set up connection callbacks\n eventListener.onConnectionOpen = () => {\n _connectionStatus = 'connected';\n _isHotReloadConnected = true;\n appLogger('Live sync connection established');\n };\n\n eventListener.onConnectionError = (error) => {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n const errorEvent = error as any;\n appLogger(\n `Live sync connection error: ${errorEvent.message ?? 'Unknown error'}`,\n {\n level: 'warn',\n }\n );\n\n // If this is a \"terminated: other side closed\" error, it's likely a server restart\n if (\n errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed')\n ) {\n appLogger(\n 'Server connection was terminated, automatic reconnection will be attempted...',\n {\n level: 'info',\n }\n );\n _connectionStatus = 'reconnecting';\n }\n };\n\n // Set up dictionary change callbacks\n eventListener.onDictionaryAdded = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryChange = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryDeleted = (dictionary) =>\n writeDictionary(dictionary, configuration);\n\n try {\n await eventListener.initialize();\n } catch (error) {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n appLogger('Failed to initialize IntlayerEventListener:', {\n level: 'error',\n });\n appLogger(\n `Error: ${error instanceof Error ? error.message : String(error)}`,\n {\n level: 'error',\n }\n );\n }\n } else if (!configuration.editor.liveSync) {\n appLogger(\n 'Hot reload is disabled. Please enable it in the configuration (editor.liveSync).'\n );\n } else if (\n !configuration.editor.clientId ||\n !configuration.editor.clientSecret\n ) {\n appLogger(\n 'Missing client credentials for hot reload. Please configure clientId and clientSecret'\n );\n }\n\n const server = createServer(async (req, res) => {\n // Handle CORS preflight requests\n if (req.method === 'OPTIONS') {\n res.writeHead(200, {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n\n res.end();\n return;\n }\n\n if (req.url?.startsWith('/dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const dictionaries = getDictionaries(configuration);\n\n const prefix = '/dictionaries/';\n if (req.url.startsWith(prefix)) {\n const [key, locale] = decodeURIComponent(req.url)\n .slice(prefix.length)\n .split('/');\n\n const dictionary = dictionaries[key] ?? null;\n\n if (locale) {\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const sourceLocaleContent = getLocalizedContent(\n dictionary.content,\n locale,\n {\n dictionaryKey: key,\n keyPath: [],\n }\n );\n\n res.end(JSON.stringify(sourceLocaleContent));\n return;\n }\n\n res.end(JSON.stringify(dictionary));\n return;\n }\n\n res.end(JSON.stringify(dictionaries));\n return;\n }\n\n if (req.url?.startsWith('/unmerged_dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const prefix = '/unmerged_dictionaries/';\n if (req.url.startsWith(prefix)) {\n const key = decodeURIComponent(req.url.slice(prefix.length));\n const one = unmergedDictionaries[key] ?? null;\n\n res.end(JSON.stringify(one));\n return;\n }\n\n res.end(JSON.stringify(unmergedDictionaries));\n return;\n }\n\n if (req.url === '/configuration') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n res.end(JSON.stringify(configuration));\n return;\n }\n\n if (req.url === '/health') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n });\n res.end(JSON.stringify({ status: 'ok' }));\n return;\n }\n\n res.end('Not found');\n return;\n });\n\n const getLiveSyncParam = () => {\n if (!configuration.editor.liveSync) return '\\x1b[31m✗ Disabled\\x1b[0m';\n\n return '\\x1b[32m✓ Enabled\\x1b[0m';\n };\n server.listen(liveSyncPort, () => {\n console.log(`\n \\x1b[1;90mINTLAYER v${packageJson.version}\\x1b[0m\n \n Live server running at: \\x1b[90m${liveSyncURL}\\x1b[0m\n - Backend URL: \\x1b[90m${configuration.editor.backendURL ?? '-'}\\x1b[0m\n - Live sync: ${getLiveSyncParam()}\n - Parallel process: ${options?.with ? `\\x1b[90m${Array.isArray(options.with) ? options.with.join(' ') : options.with}\\x1b[0m` : '-'}\n - Access key: ${configuration.editor.clientId ?? '-'}\n `);\n });\n\n // Cleanup function to terminate child process and event listener when the main process exits\n const cleanup = () => {\n // Clean up event listener\n if (eventListener) {\n appLogger('Closing SSE connection...');\n eventListener.cleanup();\n }\n\n if (parallelProcess) {\n parallelProcess.kill();\n }\n\n server.close(() => {\n appLogger('Live sync server stopped');\n process.exit(0);\n });\n };\n\n // Handle process termination signals\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n process.on('exit', cleanup);\n};\n"],"mappings":"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"}
|