@intlayer/cli 9.7.0 → 9.7.1
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 +1 -2
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/cjs/_virtual/_utils_asset.cjs +2 -3
- package/dist/cjs/auth/login.cjs +8 -9
- package/dist/cjs/auth/sessionToken.cjs +1 -2
- package/dist/cjs/auth/setupRepository.cjs +6 -7
- package/dist/cjs/build.cjs +2 -3
- package/dist/cjs/bundle.cjs +1 -2
- package/dist/cjs/ci.cjs +2 -3
- package/dist/cjs/cli.cjs +5 -6
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +2 -3
- package/dist/cjs/editor.cjs +3 -4
- package/dist/cjs/extract.cjs +7 -8
- package/dist/cjs/fill/deepMergeContent.cjs +1 -2
- package/dist/cjs/fill/extractTranslatableContent.cjs +1 -2
- package/dist/cjs/fill/fill.cjs +9 -10
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs +2 -3
- package/dist/cjs/fill/formatFillData.cjs +2 -3
- package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs +1 -2
- package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +1 -2
- package/dist/cjs/fill/index.cjs +2 -2
- package/dist/cjs/fill/listTranslationsTasks.cjs +4 -5
- package/dist/cjs/fill/translateDictionary.cjs +6 -7
- package/dist/cjs/fill/writeFill.cjs +4 -5
- package/dist/cjs/getTargetDictionary.cjs +2 -3
- package/dist/cjs/index.cjs +27 -27
- package/dist/cjs/init.cjs +12 -13
- package/dist/cjs/initChromeExtension.cjs +5 -6
- package/dist/cjs/initInfra.cjs +3 -4
- package/dist/cjs/initMCP.cjs +6 -7
- package/dist/cjs/initSkills.cjs +6 -7
- package/dist/cjs/listContentDeclaration.cjs +3 -4
- package/dist/cjs/listProjects.cjs +1 -2
- package/dist/cjs/liveSync.cjs +4 -5
- package/dist/cjs/loadPrompts.cjs +1 -2
- package/dist/cjs/pull.cjs +9 -11
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/push/pullLog.cjs +2 -3
- package/dist/cjs/push/push.cjs +10 -10
- package/dist/cjs/push/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +4 -5
- package/dist/cjs/pushLog.cjs +2 -3
- package/dist/cjs/reviewDoc/reviewDoc.cjs +15 -15
- package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +8 -9
- package/dist/cjs/reviewDoc/reviewDocLog.cjs +2 -3
- package/dist/cjs/reviewDoc/reviewDocProgress.cjs +2 -3
- package/dist/cjs/reviewDoc/reviewDocSynthesis.cjs +2 -3
- package/dist/cjs/scan.cjs +2 -3
- package/dist/cjs/searchDoc.cjs +2 -3
- package/dist/cjs/test/index.cjs +2 -2
- package/dist/cjs/test/listMissingTranslations.cjs +2 -3
- package/dist/cjs/test/test.cjs +3 -4
- package/dist/cjs/translateDoc/index.cjs +3 -3
- package/dist/cjs/translateDoc/translateDoc.cjs +12 -13
- package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
- package/dist/cjs/translateDoc/translateFile.cjs +8 -9
- package/dist/cjs/translateDoc/validation.cjs +1 -2
- package/dist/cjs/upgrade.cjs +2 -3
- package/dist/cjs/utils/calculateChunks.cjs +1 -2
- package/dist/cjs/utils/checkAccess.cjs +5 -6
- package/dist/cjs/utils/checkConfigConsistency.cjs +1 -2
- package/dist/cjs/utils/checkFileModifiedRange.cjs +3 -4
- package/dist/cjs/utils/checkLastUpdateTime.cjs +1 -2
- package/dist/cjs/utils/chunkInference.cjs +2 -3
- package/dist/cjs/utils/detectGitRepository.cjs +2 -3
- package/dist/cjs/utils/fixChunkStartEndChars.cjs +1 -2
- package/dist/cjs/utils/formatLineRanges.cjs +1 -2
- package/dist/cjs/utils/formatTimeDiff.cjs +1 -2
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -2
- package/dist/cjs/utils/getOutputFilePath.cjs +1 -2
- package/dist/cjs/utils/getParentPackageJSON.cjs +2 -3
- package/dist/cjs/utils/isInteractiveTerminal.cjs +1 -2
- package/dist/cjs/utils/listSpecialChars.cjs +1 -2
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs +2 -3
- package/dist/cjs/utils/openBrowser.cjs +1 -2
- package/dist/cjs/utils/parseChoice.cjs +1 -2
- package/dist/cjs/utils/reorderParagraphs.cjs +2 -3
- package/dist/cjs/utils/selectCmsEnvironment.cjs +2 -3
- package/dist/cjs/utils/setupAI.cjs +3 -4
- package/dist/cjs/watch.cjs +2 -3
- package/dist/esm/IntlayerEventListener.mjs +1 -2
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/esm/_virtual/_utils_asset.mjs +2 -3
- package/dist/esm/auth/login.mjs +4 -5
- package/dist/esm/auth/sessionToken.mjs +1 -2
- package/dist/esm/auth/setupRepository.mjs +3 -4
- package/dist/esm/build.mjs +2 -3
- package/dist/esm/bundle.mjs +1 -2
- package/dist/esm/ci.mjs +2 -3
- package/dist/esm/cli.mjs +4 -5
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +2 -3
- package/dist/esm/editor.mjs +2 -3
- package/dist/esm/extract.mjs +5 -6
- package/dist/esm/fill/deepMergeContent.mjs +1 -2
- package/dist/esm/fill/extractTranslatableContent.mjs +1 -2
- package/dist/esm/fill/fill.mjs +3 -4
- package/dist/esm/fill/formatAutoFilledFilePath.mjs +2 -3
- package/dist/esm/fill/formatFillData.mjs +1 -2
- package/dist/esm/fill/getAvailableLocalesInDictionary.mjs +1 -2
- package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +1 -2
- package/dist/esm/fill/index.mjs +1 -1
- package/dist/esm/fill/listTranslationsTasks.mjs +2 -3
- package/dist/esm/fill/translateDictionary.mjs +2 -3
- package/dist/esm/fill/writeFill.mjs +2 -3
- package/dist/esm/getTargetDictionary.mjs +2 -3
- package/dist/esm/index.mjs +13 -13
- package/dist/esm/init.mjs +6 -7
- package/dist/esm/initChromeExtension.mjs +2 -3
- package/dist/esm/initInfra.mjs +1 -2
- package/dist/esm/initMCP.mjs +3 -4
- package/dist/esm/initSkills.mjs +2 -3
- package/dist/esm/listContentDeclaration.mjs +3 -4
- package/dist/esm/listProjects.mjs +1 -2
- package/dist/esm/liveSync.mjs +2 -3
- package/dist/esm/loadPrompts.mjs +1 -2
- package/dist/esm/pull.mjs +6 -8
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/push/pullLog.mjs +1 -2
- package/dist/esm/push/push.mjs +6 -6
- package/dist/esm/push/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +2 -3
- package/dist/esm/pushLog.mjs +1 -2
- package/dist/esm/reviewDoc/reviewDoc.mjs +8 -8
- package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +3 -4
- package/dist/esm/reviewDoc/reviewDocLog.mjs +2 -3
- package/dist/esm/reviewDoc/reviewDocProgress.mjs +1 -2
- package/dist/esm/reviewDoc/reviewDocSynthesis.mjs +1 -2
- package/dist/esm/scan.mjs +1 -2
- package/dist/esm/searchDoc.mjs +2 -3
- package/dist/esm/test/listMissingTranslations.mjs +2 -3
- package/dist/esm/test/test.mjs +1 -2
- package/dist/esm/translateDoc/index.mjs +2 -2
- package/dist/esm/translateDoc/translateDoc.mjs +7 -8
- package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
- package/dist/esm/translateDoc/translateFile.mjs +4 -5
- package/dist/esm/translateDoc/validation.mjs +1 -2
- package/dist/esm/upgrade.mjs +1 -2
- package/dist/esm/utils/calculateChunks.mjs +1 -2
- package/dist/esm/utils/checkAccess.mjs +2 -3
- package/dist/esm/utils/checkConfigConsistency.mjs +1 -2
- package/dist/esm/utils/checkFileModifiedRange.mjs +1 -2
- package/dist/esm/utils/checkLastUpdateTime.mjs +1 -2
- package/dist/esm/utils/chunkInference.mjs +1 -2
- package/dist/esm/utils/detectGitRepository.mjs +2 -3
- package/dist/esm/utils/fixChunkStartEndChars.mjs +1 -2
- package/dist/esm/utils/formatLineRanges.mjs +1 -2
- package/dist/esm/utils/formatTimeDiff.mjs +1 -2
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -2
- package/dist/esm/utils/getOutputFilePath.mjs +1 -2
- package/dist/esm/utils/getParentPackageJSON.mjs +2 -3
- package/dist/esm/utils/isInteractiveTerminal.mjs +1 -2
- package/dist/esm/utils/listSpecialChars.mjs +1 -2
- package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -2
- package/dist/esm/utils/openBrowser.mjs +1 -2
- package/dist/esm/utils/parseChoice.mjs +1 -2
- package/dist/esm/utils/reorderParagraphs.mjs +1 -2
- package/dist/esm/utils/selectCmsEnvironment.mjs +1 -2
- package/dist/esm/utils/setupAI.mjs +1 -2
- package/dist/esm/watch.mjs +2 -3
- package/dist/types/IntlayerEventListener.d.ts +0 -2
- package/dist/types/IntlayerEventListener.d.ts.map +1 -1
- package/dist/types/auth/login.d.ts +1 -2
- package/dist/types/auth/login.d.ts.map +1 -1
- package/dist/types/auth/sessionToken.d.ts +0 -2
- package/dist/types/auth/sessionToken.d.ts.map +1 -1
- package/dist/types/auth/setupRepository.d.ts +1 -2
- package/dist/types/auth/setupRepository.d.ts.map +1 -1
- package/dist/types/build.d.ts +1 -2
- package/dist/types/build.d.ts.map +1 -1
- package/dist/types/bundle.d.ts +0 -2
- package/dist/types/bundle.d.ts.map +1 -1
- package/dist/types/ci.d.ts +1 -2
- package/dist/types/ci.d.ts.map +1 -1
- package/dist/types/cli.d.ts +1 -2
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/editor.d.ts +1 -2
- package/dist/types/editor.d.ts.map +1 -1
- package/dist/types/extract.d.ts +1 -2
- package/dist/types/extract.d.ts.map +1 -1
- package/dist/types/fill/deepMergeContent.d.ts +0 -2
- package/dist/types/fill/deepMergeContent.d.ts.map +1 -1
- package/dist/types/fill/extractTranslatableContent.d.ts +0 -2
- package/dist/types/fill/extractTranslatableContent.d.ts.map +1 -1
- package/dist/types/fill/fill.d.ts +0 -2
- package/dist/types/fill/fill.d.ts.map +1 -1
- package/dist/types/fill/formatAutoFilledFilePath.d.ts +0 -2
- package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
- package/dist/types/fill/formatFillData.d.ts +0 -2
- package/dist/types/fill/formatFillData.d.ts.map +1 -1
- package/dist/types/fill/getAvailableLocalesInDictionary.d.ts +0 -2
- package/dist/types/fill/getAvailableLocalesInDictionary.d.ts.map +1 -1
- package/dist/types/fill/getFilterMissingContentPerLocale.d.ts +0 -2
- package/dist/types/fill/getFilterMissingContentPerLocale.d.ts.map +1 -1
- package/dist/types/fill/listTranslationsTasks.d.ts +0 -2
- package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
- package/dist/types/fill/translateDictionary.d.ts +2 -3
- package/dist/types/fill/translateDictionary.d.ts.map +1 -1
- package/dist/types/fill/writeFill.d.ts +0 -2
- package/dist/types/fill/writeFill.d.ts.map +1 -1
- package/dist/types/getTargetDictionary.d.ts +0 -2
- package/dist/types/getTargetDictionary.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/init.d.ts +1 -2
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/initChromeExtension.d.ts +0 -2
- package/dist/types/initChromeExtension.d.ts.map +1 -1
- package/dist/types/initInfra.d.ts +0 -2
- package/dist/types/initInfra.d.ts.map +1 -1
- package/dist/types/initMCP.d.ts +0 -2
- package/dist/types/initMCP.d.ts.map +1 -1
- package/dist/types/initSkills.d.ts +0 -2
- package/dist/types/initSkills.d.ts.map +1 -1
- package/dist/types/listContentDeclaration.d.ts +1 -2
- package/dist/types/listContentDeclaration.d.ts.map +1 -1
- package/dist/types/listProjects.d.ts +0 -2
- package/dist/types/listProjects.d.ts.map +1 -1
- package/dist/types/liveSync.d.ts +1 -2
- package/dist/types/liveSync.d.ts.map +1 -1
- package/dist/types/loadPrompts.d.ts +0 -2
- package/dist/types/loadPrompts.d.ts.map +1 -1
- package/dist/types/pull.d.ts +1 -2
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/push/pullLog.d.ts +0 -2
- package/dist/types/push/pullLog.d.ts.map +1 -1
- package/dist/types/push/push.d.ts +1 -2
- package/dist/types/push/push.d.ts.map +1 -1
- package/dist/types/pushConfig.d.ts +1 -2
- package/dist/types/pushConfig.d.ts.map +1 -1
- package/dist/types/pushLog.d.ts +0 -2
- package/dist/types/pushLog.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDoc.d.ts +1 -2
- package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocLog.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocLog.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocProgress.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocProgress.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocSynthesis.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocSynthesis.d.ts.map +1 -1
- package/dist/types/scan.d.ts +0 -2
- package/dist/types/scan.d.ts.map +1 -1
- package/dist/types/searchDoc.d.ts +1 -2
- package/dist/types/searchDoc.d.ts.map +1 -1
- package/dist/types/test/listMissingTranslations.d.ts +0 -2
- package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
- package/dist/types/test/test.d.ts +1 -2
- package/dist/types/test/test.d.ts.map +1 -1
- package/dist/types/translateDoc/index.d.ts +1 -1
- package/dist/types/translateDoc/translateDoc.d.ts +0 -2
- package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
- package/dist/types/translateDoc/translateFile.d.ts +0 -2
- package/dist/types/translateDoc/translateFile.d.ts.map +1 -1
- package/dist/types/translateDoc/types.d.ts +0 -2
- package/dist/types/translateDoc/types.d.ts.map +1 -1
- package/dist/types/translateDoc/validation.d.ts +0 -2
- package/dist/types/translateDoc/validation.d.ts.map +1 -1
- package/dist/types/upgrade.d.ts +0 -2
- package/dist/types/upgrade.d.ts.map +1 -1
- package/dist/types/utils/calculateChunks.d.ts +0 -2
- package/dist/types/utils/calculateChunks.d.ts.map +1 -1
- package/dist/types/utils/checkAccess.d.ts +0 -2
- package/dist/types/utils/checkAccess.d.ts.map +1 -1
- package/dist/types/utils/checkConfigConsistency.d.ts +0 -2
- package/dist/types/utils/checkConfigConsistency.d.ts.map +1 -1
- package/dist/types/utils/checkFileModifiedRange.d.ts +1 -2
- package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
- package/dist/types/utils/checkLastUpdateTime.d.ts +0 -2
- package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
- package/dist/types/utils/chunkInference.d.ts +1 -2
- package/dist/types/utils/chunkInference.d.ts.map +1 -1
- package/dist/types/utils/detectGitRepository.d.ts +0 -2
- package/dist/types/utils/detectGitRepository.d.ts.map +1 -1
- package/dist/types/utils/fixChunkStartEndChars.d.ts +0 -2
- package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
- package/dist/types/utils/formatLineRanges.d.ts +0 -2
- package/dist/types/utils/formatLineRanges.d.ts.map +1 -1
- package/dist/types/utils/formatTimeDiff.d.ts +0 -2
- package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts +0 -2
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
- package/dist/types/utils/getOutputFilePath.d.ts +0 -2
- package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
- package/dist/types/utils/getParentPackageJSON.d.ts +1 -2
- package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
- package/dist/types/utils/isInteractiveTerminal.d.ts +0 -2
- package/dist/types/utils/isInteractiveTerminal.d.ts.map +1 -1
- package/dist/types/utils/listSpecialChars.d.ts +1 -2
- package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
- package/dist/types/utils/mapChunksBetweenFiles.d.ts +0 -2
- package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
- package/dist/types/utils/openBrowser.d.ts +0 -2
- package/dist/types/utils/openBrowser.d.ts.map +1 -1
- package/dist/types/utils/parseChoice.d.ts +0 -2
- package/dist/types/utils/parseChoice.d.ts.map +1 -1
- package/dist/types/utils/reorderParagraphs.d.ts +0 -2
- package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
- package/dist/types/utils/selectCmsEnvironment.d.ts +0 -2
- package/dist/types/utils/selectCmsEnvironment.d.ts.map +1 -1
- package/dist/types/utils/setupAI.d.ts +1 -2
- package/dist/types/utils/setupAI.d.ts.map +1 -1
- package/dist/types/watch.d.ts +1 -2
- package/dist/types/watch.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -2,7 +2,7 @@ import { getPatternForLocale, resolveOutputPattern } from "../utils/getOutputFil
|
|
|
2
2
|
import { basename, dirname, extname, relative } from "node:path";
|
|
3
3
|
import { getFormatFromExtension } from "@intlayer/engine/utils";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/fill/formatFillData.ts
|
|
6
6
|
/** Merge FillData entries that resolve to the same file path. */
|
|
7
7
|
const groupByFilePath = (entries) => entries.reduce((acc, curr) => {
|
|
8
8
|
const existing = acc.find((item) => item.filePath === curr.filePath);
|
|
@@ -89,6 +89,5 @@ const formatFillData = async (fillField, localeList, filePath, dictionaryKey, co
|
|
|
89
89
|
return processPattern(fillField, localeList);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
//#endregion
|
|
93
92
|
export { formatFillData };
|
|
94
93
|
//# sourceMappingURL=formatFillData.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/fill/getAvailableLocalesInDictionary.ts
|
|
2
2
|
/**
|
|
3
3
|
* Recursively traverses dictionary content to find all locales that have actual translations.
|
|
4
4
|
* Returns a Set of locale strings that are present in the translation nodes.
|
|
@@ -20,6 +20,5 @@ const getAvailableLocalesInDictionary = (dictionary) => {
|
|
|
20
20
|
return Array.from(localesSet);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
//#endregion
|
|
24
23
|
export { getAvailableLocalesInDictionary };
|
|
25
24
|
//# sourceMappingURL=getAvailableLocalesInDictionary.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/fill/getFilterMissingContentPerLocale.ts
|
|
2
2
|
/**
|
|
3
3
|
* Recursively compares source content with target content and returns only the missing parts.
|
|
4
4
|
* For per-locale files where content is simple JSON (not translation nodes).
|
|
@@ -45,6 +45,5 @@ const getFilterMissingContentPerLocale = (sourceDictionary, targetDictionary) =>
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
//#endregion
|
|
49
48
|
export { getFilterMissingContentPerLocale };
|
|
50
49
|
//# sourceMappingURL=getFilterMissingContentPerLocale.mjs.map
|
package/dist/esm/fill/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { listMissingTranslationsWithConfig } from "../test/listMissingTranslations.mjs";
|
|
2
|
-
import { basename } from "node:path";
|
|
3
2
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
4
3
|
import { colon, colorize, colorizeKey, colorizePath, getAppLogger } from "@intlayer/config/logger";
|
|
4
|
+
import { basename } from "node:path";
|
|
5
5
|
import { formatLocale } from "@intlayer/engine/utils";
|
|
6
6
|
import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
|
|
7
7
|
import { getFilterTranslationsOnlyDictionary } from "@intlayer/core/plugins";
|
|
8
8
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// src/fill/listTranslationsTasks.ts
|
|
11
11
|
const listTranslationsTasks = (localIds, outputLocales, mode, baseLocale, configuration) => {
|
|
12
12
|
const appLogger = getAppLogger(configuration);
|
|
13
13
|
const mergedDictionariesRecord = getDictionaries(configuration);
|
|
@@ -65,6 +65,5 @@ const listTranslationsTasks = (localIds, outputLocales, mode, baseLocale, config
|
|
|
65
65
|
return translationTasks;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
//#endregion
|
|
69
68
|
export { listTranslationsTasks };
|
|
70
69
|
//# sourceMappingURL=listTranslationsTasks.mjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getAuthenticatedAPI } from "../utils/checkAccess.mjs";
|
|
2
2
|
import { deepMergeContent } from "./deepMergeContent.mjs";
|
|
3
3
|
import { extractTranslatableContent, reinsertTranslatedContent } from "./extractTranslatableContent.mjs";
|
|
4
|
-
import { basename } from "node:path";
|
|
5
4
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
6
5
|
import { colon, colorize, colorizeNumber, colorizePath, getAppLogger } from "@intlayer/config/logger";
|
|
6
|
+
import { basename } from "node:path";
|
|
7
7
|
import { chunkJSON, excludeObjectFormat, formatLocale, mergeChunks, reconstructFromSingleChunk, verifyIdenticObjectFormat } from "@intlayer/engine/utils";
|
|
8
8
|
import { retryManager } from "@intlayer/config/utils";
|
|
9
9
|
import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
|
|
10
10
|
import { getFilterMissingTranslationsDictionary, getMultilingualDictionary, getPerLocaleDictionary, insertContentInDictionary } from "@intlayer/core/plugins";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// src/fill/translateDictionary.ts
|
|
13
13
|
const createChunkPreset = (chunkIndex, totalChunks) => {
|
|
14
14
|
if (totalChunks <= 1) return "";
|
|
15
15
|
return colon([
|
|
@@ -212,6 +212,5 @@ const translateDictionary = async (task, configuration, options) => {
|
|
|
212
212
|
})();
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
-
//#endregion
|
|
216
215
|
export { translateDictionary };
|
|
217
216
|
//# sourceMappingURL=translateDictionary.mjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { formatFillData } from "./formatFillData.mjs";
|
|
2
2
|
import { getAvailableLocalesInDictionary } from "./getAvailableLocalesInDictionary.mjs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
3
|
import { colorizeKey, getAppLogger } from "@intlayer/config/logger";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
5
|
import { formatLocale, formatPath } from "@intlayer/engine/utils";
|
|
6
6
|
import { writeContentDeclaration } from "@intlayer/engine/build";
|
|
7
7
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/fill/writeFill.ts
|
|
10
10
|
const writeFill = async (contentDeclarationFile, outputLocales, parentLocales, configuration) => {
|
|
11
11
|
const appLogger = getAppLogger(configuration);
|
|
12
12
|
const fullDictionary = getDictionaries(configuration)[contentDeclarationFile.key];
|
|
@@ -46,6 +46,5 @@ const writeFill = async (contentDeclarationFile, outputLocales, parentLocales, c
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
//#endregion
|
|
50
49
|
export { writeFill };
|
|
51
50
|
//# sourceMappingURL=writeFill.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
1
2
|
import { listGitFiles } from "@intlayer/engine/cli";
|
|
2
3
|
import { join, relative } from "node:path";
|
|
3
|
-
import { getConfiguration } from "@intlayer/config/node";
|
|
4
4
|
import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/getTargetDictionary.ts
|
|
7
7
|
const ensureArray = (value) => [value].flat();
|
|
8
8
|
const getTargetUnmergedDictionaries = async (options) => {
|
|
9
9
|
const configuration = getConfiguration(options?.configOptions);
|
|
@@ -29,6 +29,5 @@ const getTargetUnmergedDictionaries = async (options) => {
|
|
|
29
29
|
return result;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { ensureArray, getTargetUnmergedDictionaries };
|
|
34
33
|
//# sourceMappingURL=getTargetDictionary.mjs.map
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { clearCliSessionToken, readCliSessionToken } from "./auth/sessionToken.mjs";
|
|
2
1
|
import { login } from "./auth/login.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, initInfra, parseInfraMode } from "./initInfra.mjs";
|
|
5
|
-
import { PLATFORM_OPTIONS, initSkills, parsePlatform, parseSkills, promptPlatform, resolvePlatformWithoutPrompt } from "./initSkills.mjs";
|
|
6
|
-
import { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, LOCALE_ROUTING_CHOICES, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot } from "./init.mjs";
|
|
2
|
+
import { clearCliSessionToken, readCliSessionToken } from "./auth/sessionToken.mjs";
|
|
7
3
|
import { build } from "./build.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { getRemoteEditorRunners, startEditor } from "./editor.mjs";
|
|
10
|
-
import { scan } from "./scan.mjs";
|
|
4
|
+
import { bundle } from "./bundle.mjs";
|
|
11
5
|
import { dirname, setAPI } from "./cli.mjs";
|
|
6
|
+
import { getRemoteEditorRunners, startEditor } from "./editor.mjs";
|
|
12
7
|
import { extract } from "./extract.mjs";
|
|
13
|
-
import { bundle } from "./bundle.mjs";
|
|
14
|
-
import { checkConfigConsistency } from "./utils/checkConfigConsistency.mjs";
|
|
15
|
-
import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
|
|
16
|
-
import { listMissingTranslations, listMissingTranslationsWithConfig } from "./test/listMissingTranslations.mjs";
|
|
17
|
-
import { testMissingTranslations } from "./test/test.mjs";
|
|
18
8
|
import { fill } from "./fill/fill.mjs";
|
|
19
9
|
import { IntlayerEventListener } from "./IntlayerEventListener.mjs";
|
|
10
|
+
import { listMissingTranslations, listMissingTranslationsWithConfig } from "./test/listMissingTranslations.mjs";
|
|
11
|
+
import { testMissingTranslations } from "./test/test.mjs";
|
|
12
|
+
import { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, LOCALE_ROUTING_CHOICES, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot } from "./init.mjs";
|
|
13
|
+
import { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, MOZILLA_EXTENSION_URL, initChromeExtension, parseExtensionBrowsers } from "./initChromeExtension.mjs";
|
|
14
|
+
import { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, initInfra, parseInfraMode } from "./initInfra.mjs";
|
|
15
|
+
import { PLATFORM_OPTIONS, initSkills, parsePlatform, parseSkills, promptPlatform, resolvePlatformWithoutPrompt } from "./initSkills.mjs";
|
|
20
16
|
import { listContentDeclaration, listContentDeclarationRows } from "./listContentDeclaration.mjs";
|
|
17
|
+
import { listProjectsCommand } from "./listProjects.mjs";
|
|
21
18
|
import { liveSync } from "./liveSync.mjs";
|
|
22
19
|
import { pull } from "./pull.mjs";
|
|
23
20
|
import { push } from "./push/push.mjs";
|
|
24
21
|
import { pushConfig } from "./pushConfig.mjs";
|
|
25
22
|
import { reviewDoc } from "./reviewDoc/reviewDoc.mjs";
|
|
23
|
+
import { scan } from "./scan.mjs";
|
|
26
24
|
import { searchDoc } from "./searchDoc.mjs";
|
|
27
25
|
import { translateDoc } from "./translateDoc/translateDoc.mjs";
|
|
26
|
+
import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
|
|
27
|
+
import { checkConfigConsistency } from "./utils/checkConfigConsistency.mjs";
|
|
28
28
|
|
|
29
29
|
export { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, INFRA_MODES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, IntlayerEventListener, LOCALE_ROUTING_CHOICES, MOZILLA_EXTENSION_URL, OPT_IN_INIT_STEPS, PLATFORM_OPTIONS, build, bundle, checkCMSAuth, checkConfigConsistency, clearCliSessionToken, dirname, extract, fill, findProjectRoot, getAuthenticatedAPI, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRemoteEditorRunners, getRoutingInitOptions, init, initChromeExtension, initCms, initInfra, initRepository, initSkills, initSteps, isEslintInstalled, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, listProjectsCommand, liveSync, login, parseContentLayoutChoice, parseExtensionBrowsers, parseInfraMode, parseLocaleRoutingChoice, parsePlatform, parseSkills, promptPlatform, pull, push, pushConfig, readCliSessionToken, resolvePlatformWithoutPrompt, resolveProjectRoot, reviewDoc, scan, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
|
package/dist/esm/init.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { login } from "./auth/login.mjs";
|
|
2
2
|
import { setupRepository } from "./auth/setupRepository.mjs";
|
|
3
|
-
import { loadPrompts } from "./loadPrompts.mjs";
|
|
4
|
-
import { isInteractiveTerminal } from "./utils/isInteractiveTerminal.mjs";
|
|
5
|
-
import { parseChoice } from "./utils/parseChoice.mjs";
|
|
6
3
|
import { initChromeExtension } from "./initChromeExtension.mjs";
|
|
7
4
|
import { initInfra } from "./initInfra.mjs";
|
|
5
|
+
import { initMCP } from "./initMCP.mjs";
|
|
8
6
|
import { initSkills } from "./initSkills.mjs";
|
|
7
|
+
import { loadPrompts } from "./loadPrompts.mjs";
|
|
9
8
|
import { detectGitRepository } from "./utils/detectGitRepository.mjs";
|
|
10
|
-
import {
|
|
9
|
+
import { isInteractiveTerminal } from "./utils/isInteractiveTerminal.mjs";
|
|
10
|
+
import { parseChoice } from "./utils/parseChoice.mjs";
|
|
11
11
|
import { CATALOG_MESSAGE_FORMATS, CONTENT_FORMATS_BY_LAYOUT, detectCompatI18nLibraries, hasLintTooling, hasUrlRoutingFramework, initIntlayer, logInitSuccessMessage, setupCmsCredentials } from "@intlayer/engine/cli";
|
|
12
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
13
12
|
import { join, resolve } from "node:path";
|
|
13
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// src/init.ts
|
|
16
16
|
const findProjectRoot = (startDir) => {
|
|
17
17
|
let currentDir = startDir;
|
|
18
18
|
while (currentDir !== resolve(currentDir, "..")) {
|
|
@@ -472,6 +472,5 @@ const init = async (projectRoot, options, interactive) => {
|
|
|
472
472
|
await runInteractiveInit(resolveProjectRoot(projectRoot), options);
|
|
473
473
|
};
|
|
474
474
|
|
|
475
|
-
//#endregion
|
|
476
475
|
export { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, LOCALE_ROUTING_CHOICES, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot };
|
|
477
476
|
//# sourceMappingURL=init.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { openBrowser } from "./utils/openBrowser.mjs";
|
|
2
1
|
import { loadPrompts } from "./loadPrompts.mjs";
|
|
3
2
|
import { isInteractiveTerminal } from "./utils/isInteractiveTerminal.mjs";
|
|
3
|
+
import { openBrowser } from "./utils/openBrowser.mjs";
|
|
4
4
|
import { parseChoice } from "./utils/parseChoice.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/initChromeExtension.ts
|
|
7
7
|
const CHROME_EXTENSION_URL = "https://chromewebstore.google.com/detail/intlayer_i18n_scanner/pmlehcgmjmfimmjnembihbakhnheiabc";
|
|
8
8
|
const MOZILLA_EXTENSION_URL = "https://addons.mozilla.org/en-US/firefox/addon/intlayer-i18n-scanner/";
|
|
9
9
|
const BROWSER_EXTENSION_OPTIONS = [{
|
|
@@ -47,6 +47,5 @@ const initChromeExtension = async (options = {}) => {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
//#endregion
|
|
51
50
|
export { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, MOZILLA_EXTENSION_URL, initChromeExtension, parseExtensionBrowsers };
|
|
52
51
|
//# sourceMappingURL=initChromeExtension.mjs.map
|
package/dist/esm/initInfra.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { spawn } from "node:child_process";
|
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/initInfra.ts
|
|
9
9
|
/** Setup modes understood by the hosted installer. */
|
|
10
10
|
const INFRA_MODES = [
|
|
11
11
|
"desktop",
|
|
@@ -101,6 +101,5 @@ const initInfra = async (options = {}) => {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
//#endregion
|
|
105
104
|
export { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, initInfra, parseInfraMode };
|
|
106
105
|
//# sourceMappingURL=initInfra.mjs.map
|
package/dist/esm/initMCP.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { resolveProjectRoot } from "./init.mjs";
|
|
2
|
+
import { promptPlatform, resolvePlatformWithoutPrompt } from "./initSkills.mjs";
|
|
1
3
|
import { loadPrompts } from "./loadPrompts.mjs";
|
|
2
4
|
import { isInteractiveTerminal } from "./utils/isInteractiveTerminal.mjs";
|
|
3
5
|
import { parseChoice } from "./utils/parseChoice.mjs";
|
|
4
|
-
import { promptPlatform, resolvePlatformWithoutPrompt } from "./initSkills.mjs";
|
|
5
|
-
import { resolveProjectRoot } from "./init.mjs";
|
|
6
6
|
import { MCP_TRANSPORTS, installMCP } from "@intlayer/engine/cli";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/initMCP.ts
|
|
9
9
|
/** Validates a `--transport` value, ignoring case. */
|
|
10
10
|
const parseMCPTransport = (value) => parseChoice(value, MCP_TRANSPORTS, "--transport");
|
|
11
11
|
/**
|
|
@@ -53,6 +53,5 @@ const initMCP = async (projectRoot, options = {}) => {
|
|
|
53
53
|
p.outro("Intlayer MCP Server initialization complete");
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
//#endregion
|
|
57
56
|
export { initMCP, parseMCPTransport };
|
|
58
57
|
//# sourceMappingURL=initMCP.mjs.map
|
package/dist/esm/initSkills.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { getProjectDependencies, resolveProjectRoot } from "./init.mjs";
|
|
1
2
|
import { loadPrompts } from "./loadPrompts.mjs";
|
|
2
3
|
import { isInteractiveTerminal } from "./utils/isInteractiveTerminal.mjs";
|
|
3
4
|
import { parseChoice } from "./utils/parseChoice.mjs";
|
|
4
|
-
import { getProjectDependencies, resolveProjectRoot } from "./init.mjs";
|
|
5
5
|
import { PLATFORMS, PLATFORMS_METADATA, SKILLS, SKILLS_METADATA, detectPlatform, getInitialSkills, installSkills } from "@intlayer/engine/cli";
|
|
6
6
|
import enquirer from "enquirer";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/initSkills.ts
|
|
9
9
|
const PLATFORM_OPTIONS = PLATFORMS.map((platform) => ({
|
|
10
10
|
value: platform,
|
|
11
11
|
label: PLATFORMS_METADATA[platform]?.label ?? "",
|
|
@@ -97,6 +97,5 @@ const initSkills = async (projectRoot, options = {}) => {
|
|
|
97
97
|
return platform;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
//#endregion
|
|
101
100
|
export { PLATFORM_OPTIONS, initSkills, parsePlatform, parseSkills, promptPlatform, resolvePlatformWithoutPrompt };
|
|
102
101
|
//# sourceMappingURL=initSkills.mjs.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { prepareIntlayer } from "@intlayer/engine/cli";
|
|
2
|
-
import { relative } from "node:path";
|
|
3
1
|
import { colon, colorizeKey, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
|
|
4
2
|
import { getConfiguration } from "@intlayer/config/node";
|
|
3
|
+
import { prepareIntlayer } from "@intlayer/engine/cli";
|
|
4
|
+
import { relative } from "node:path";
|
|
5
5
|
import { formatPath } from "@intlayer/engine/utils";
|
|
6
6
|
import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/listContentDeclaration.ts
|
|
9
9
|
const listContentDeclarationRows = async (options) => {
|
|
10
10
|
const config = getConfiguration(options?.configOptions);
|
|
11
11
|
await prepareIntlayer(config);
|
|
@@ -38,6 +38,5 @@ const listContentDeclaration = async (options) => {
|
|
|
38
38
|
appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
//#endregion
|
|
42
41
|
export { listContentDeclaration, listContentDeclarationRows };
|
|
43
42
|
//# sourceMappingURL=listContentDeclaration.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { listProjects } from "@intlayer/engine/cli";
|
|
2
2
|
import { relative } from "node:path";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/listProjects.ts
|
|
5
5
|
const listProjectsCommand = async (options) => {
|
|
6
6
|
const { searchDir, projectsPath } = await listProjects(options);
|
|
7
7
|
const projectsRelativePath = projectsPath.map((projectPath) => options?.absolute ? projectPath : relative(searchDir, projectPath)).map((projectPath) => projectPath === "" ? "." : projectPath);
|
|
@@ -22,6 +22,5 @@ const listProjectsCommand = async (options) => {
|
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
//#endregion
|
|
26
25
|
export { listProjectsCommand };
|
|
27
26
|
//# sourceMappingURL=listProjects.mjs.map
|
package/dist/esm/liveSync.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IntlayerEventListener } from "./IntlayerEventListener.mjs";
|
|
2
|
-
import { createServer } from "node:http";
|
|
3
2
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
4
3
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
5
4
|
import { getConfiguration } from "@intlayer/config/node";
|
|
5
|
+
import { createServer } from "node:http";
|
|
6
6
|
import { runParallel } from "@intlayer/engine/utils";
|
|
7
7
|
import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
|
|
8
8
|
import { buildDictionary } from "@intlayer/engine/build";
|
|
@@ -10,7 +10,7 @@ import { getLocalizedContent } from "@intlayer/core/plugins";
|
|
|
10
10
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
11
11
|
import packageJson from "@intlayer/config/package.json" with { type: "json" };
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// src/liveSync.ts
|
|
14
14
|
const writeDictionary = async (dictionary, configuration) => {
|
|
15
15
|
getAppLogger(configuration)(`Writing dictionary ${dictionary.key}`);
|
|
16
16
|
await buildDictionary([dictionary], configuration);
|
|
@@ -158,6 +158,5 @@ const liveSync = async (options) => {
|
|
|
158
158
|
process.on("exit", cleanup);
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
//#endregion
|
|
162
161
|
export { liveSync };
|
|
163
162
|
//# sourceMappingURL=liveSync.mjs.map
|
package/dist/esm/loadPrompts.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/loadPrompts.ts
|
|
2
2
|
/**
|
|
3
3
|
* Load the interactive prompt toolkit on demand.
|
|
4
4
|
*
|
|
@@ -12,6 +12,5 @@
|
|
|
12
12
|
*/
|
|
13
13
|
const loadPrompts = async () => await import("@clack/prompts");
|
|
14
14
|
|
|
15
|
-
//#endregion
|
|
16
15
|
export { loadPrompts };
|
|
17
16
|
//# sourceMappingURL=loadPrompts.mjs.map
|
package/dist/esm/pull.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
|
|
2
1
|
import { PullLogger } from "./push/pullLog.mjs";
|
|
2
|
+
import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
|
|
3
3
|
import { selectCmsEnvironment } from "./utils/selectCmsEnvironment.mjs";
|
|
4
|
-
import { logConfigDetails } from "@intlayer/engine/cli";
|
|
5
|
-
import { existsSync } from "node:fs";
|
|
6
|
-
import { join } from "node:path";
|
|
7
4
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
8
5
|
import { getAppLogger } from "@intlayer/config/logger";
|
|
9
6
|
import { getConfiguration } from "@intlayer/config/node";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { logConfigDetails } from "@intlayer/engine/cli";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { getProjectRequire, parallelize } from "@intlayer/config/utils";
|
|
12
11
|
import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
|
|
13
12
|
import { writeContentDeclaration } from "@intlayer/engine/build";
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
// src/pull.ts
|
|
16
15
|
/**
|
|
17
16
|
* Fetch distant dictionaries and write them locally,
|
|
18
17
|
* with progress indicators and concurrency control.
|
|
@@ -147,6 +146,5 @@ const pull = async (options) => {
|
|
|
147
146
|
}
|
|
148
147
|
};
|
|
149
148
|
|
|
150
|
-
//#endregion
|
|
151
149
|
export { pull };
|
|
152
150
|
//# sourceMappingURL=pull.mjs.map
|
package/dist/esm/pull.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.mjs","names":[],"sources":["../../src/pull.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getProjectRequire } from '@intlayer/config/utils';\nimport { getUnmergedDictionaries } from '@intlayer/dictionaries-entry/unmerged';\nimport {\n type DictionaryStatus,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { parallelize } from '@intlayer/engine/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { PullLogger, type PullStatus } from './push/pullLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\nimport { selectCmsEnvironment } from './utils/selectCmsEnvironment';\n\ntype PullOptions = {\n dictionaries?: string[];\n newDictionariesPath?: string;\n configOptions?: GetConfigurationOptions;\n};\n\ntype DictionariesStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n/**\n * Fetch distant dictionaries and write them locally,\n * with progress indicators and concurrency control.\n */\nexport const pull = async (options?: PullOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n try {\n logConfigDetails(options?.configOptions);\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(\n options?.configOptions?.env,\n intlayerAPI,\n config\n );\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n // Get remote update timestamps map\n const getDictionariesUpdateTimestampResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesUpdateTimestampResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n let distantDictionariesUpdateTimeStamp: Record<string, any> =\n getDictionariesUpdateTimestampResult.data;\n\n // Optional filtering by requested dictionaries\n if (options?.dictionaries) {\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) =>\n options.dictionaries?.includes(key)\n )\n );\n }\n\n // Filter by location\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) => {\n const localDictionaries = unmergedDictionariesRecord[key];\n const location =\n localDictionaries?.[0]?.location ??\n config.dictionary?.location ??\n 'remote';\n\n return location === 'remote' || location === 'hybrid';\n })\n );\n\n // Load local cached remote dictionaries (if any)\n const remoteDictionariesPath = join(\n config.system.mainDir,\n 'remote_dictionaries.cjs'\n );\n const requireFunction = config.build?.require ?? getProjectRequire();\n const remoteDictionariesRecord: Record<string, any> = existsSync(\n remoteDictionariesPath\n )\n ? (requireFunction(remoteDictionariesPath) as any)\n : {};\n\n // Determine which keys need fetching by comparing updatedAt with local cache\n const entries = Object.entries(distantDictionariesUpdateTimeStamp);\n const keysToFetch = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n if (!remoteUpdatedAtValue) return true;\n\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n if (!local) return true;\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n if (typeof localUpdatedAt !== 'number') return true;\n return remoteUpdatedAt > localUpdatedAt;\n })\n .map(([key]) => key);\n\n const cachedKeys = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n })\n .map(([key]) => key);\n\n // Check if dictionaries list is empty\n if (entries.length === 0) {\n appLogger('No dictionaries to fetch', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Fetching dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = [\n ...cachedKeys.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'imported' as DictionaryStatus,\n })),\n ...keysToFetch.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'pending' as const,\n })),\n ];\n\n // Initialize aggregated logger\n const logger = new PullLogger();\n logger.update(\n dictionariesStatuses.map<PullStatus>((s) => ({\n dictionaryKey: s.dictionaryKey,\n status: s.status,\n }))\n );\n\n const successfullyFetchedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n const isCached =\n statusObj.status === 'imported' || statusObj.status === 'up-to-date';\n\n if (!isCached) {\n statusObj.status = 'fetching';\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'fetching' },\n ]);\n }\n\n try {\n let sourceDictionary: Dictionary | undefined;\n\n if (isCached) {\n sourceDictionary = remoteDictionariesRecord[\n statusObj.dictionaryKey\n ] as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(statusObj.dictionaryKey);\n\n sourceDictionary = getDictionaryResult.data as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n throw new Error(\n `Dictionary ${statusObj.dictionaryKey} not found on remote`\n );\n }\n\n // Check if there is a local version of this dictionary that is hybrid\n const localDictionaries =\n unmergedDictionariesRecord[statusObj.dictionaryKey];\n const localAndRemoteDictionary = localDictionaries?.find(\n (d) => d.location === 'hybrid'\n );\n\n if (localAndRemoteDictionary) {\n // We want to preserve the local properties but use the remote content\n sourceDictionary = {\n ...sourceDictionary,\n location: 'hybrid',\n filePath: localAndRemoteDictionary.filePath,\n localId: localAndRemoteDictionary.localId,\n };\n }\n\n // Now, write the dictionary to local file\n const { status } = await writeContentDeclaration(\n sourceDictionary,\n config,\n options\n );\n\n statusObj.status = status;\n logger.update([{ dictionaryKey: statusObj.dictionaryKey, status }]);\n\n successfullyFetchedDictionaries.push(sourceDictionary);\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error fetching dictionary ${statusObj.dictionaryKey}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with concurrency limit\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n // Per-dictionary summary\n const iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n case 'reimported in JSON':\n case 'new content file':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n };\n\n const colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n return ANSIColors.GREEN;\n case 'reimported in JSON':\n case 'new content file':\n return ANSIColors.YELLOW;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n };\n\n for (const s of dictionariesStatuses) {\n const icon = iconFor(s.status);\n const color = colorFor(s.status);\n appLogger(\n ` - ${s.dictionaryKey} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,SAAS,iBAAiB,SAAS,aAAa;CACtD,MAAM,YAAY,aAAa,MAAM;CAErC,IAAI;EACF,iBAAiB,SAAS,aAAa;EAIvC,IAAI,CAAC,MAFoB,aAAa,MAAM,GAE3B;EAEjB,MAAM,cAAc,MAAM,oBAAoB,MAAM;EAEpD,MAAM,qBACJ,SAAS,eAAe,KACxB,aACA,MACF;EAEA,MAAM,6BAA6B,wBAAwB,MAAM;EAGjE,MAAM,uCACJ,MAAM,YAAY,WAAW,+BAA+B;EAE9D,IAAI,CAAC,qCAAqC,MACxC,MAAM,IAAI,MAAM,+BAA+B;EAGjD,IAAI,qCACF,qCAAqC;EAGvC,IAAI,SAAS,cACX,qCAAqC,OAAO,YAC1C,OAAO,QAAQ,kCAAkC,CAAC,C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;IAClB,UAAU,eAAe,6BAA6B,UAAU,cAAc,IAAI;IAClF,OAAO,OAAO,CACZ;KAAE,eAAe,UAAU;KAAe,QAAQ;IAAQ,CAC5D,CAAC;GACH;EACF;EAGA,MAAM,YAAY,sBAAsB,mBAAmB,CAAC;EAG5D,OAAO,OAAO;EAGd,MAAM,WAAW,WAAyC;GACxD,QAAQ,QAAR;IACE,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,oBACH,OAAO;IACT,KAAK,SACH,OAAO;IACT,SACE,OAAO;GACX;EACF;EAEA,MAAM,YAAY,WAAyC;GACzD,QAAQ,QAAR;IACE,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,cACH,OAAO,WAAW;IACpB,KAAK;IACL,KAAK,oBACH,OAAO,WAAW;IACpB,KAAK,SACH,OAAO,WAAW;IACpB,SACE,OAAO,WAAW;GACtB;EACF;EAEA,KAAK,MAAM,KAAK,sBAAsB;GACpC,MAAM,OAAO,QAAQ,EAAE,MAAM;GAC7B,MAAM,QAAQ,SAAS,EAAE,MAAM;GAC/B,UACE,MAAM,EAAE,cAAc,GAAG,WAAW,KAAK,GAAG,QAAQ,KAAK,GAAG,EAAE,SAAS,WAAW,KAAK,GAAG,WAAW,OACvG;EACF;EAGA,KAAK,MAAM,aAAa,sBACtB,IAAI,UAAU,cACZ,UAAU,UAAU,cAAc,EAChC,OAAO,QACT,CAAC;CAGP,SAAS,OAAO;EACd,UAAU,OAAO,EACf,OAAO,QACT,CAAC;CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"pull.mjs","names":[],"sources":["../../src/pull.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getProjectRequire, parallelize } from '@intlayer/config/utils';\nimport { getUnmergedDictionaries } from '@intlayer/dictionaries-entry/unmerged';\nimport {\n type DictionaryStatus,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { PullLogger, type PullStatus } from './push/pullLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\nimport { selectCmsEnvironment } from './utils/selectCmsEnvironment';\n\ntype PullOptions = {\n dictionaries?: string[];\n newDictionariesPath?: string;\n configOptions?: GetConfigurationOptions;\n};\n\ntype DictionariesStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n/**\n * Fetch distant dictionaries and write them locally,\n * with progress indicators and concurrency control.\n */\nexport const pull = async (options?: PullOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n try {\n logConfigDetails(options?.configOptions);\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(\n options?.configOptions?.env,\n intlayerAPI,\n config\n );\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n // Get remote update timestamps map\n const getDictionariesUpdateTimestampResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesUpdateTimestampResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n let distantDictionariesUpdateTimeStamp: Record<string, any> =\n getDictionariesUpdateTimestampResult.data;\n\n // Optional filtering by requested dictionaries\n if (options?.dictionaries) {\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) =>\n options.dictionaries?.includes(key)\n )\n );\n }\n\n // Filter by location\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) => {\n const localDictionaries = unmergedDictionariesRecord[key];\n const location =\n localDictionaries?.[0]?.location ??\n config.dictionary?.location ??\n 'remote';\n\n return location === 'remote' || location === 'hybrid';\n })\n );\n\n // Load local cached remote dictionaries (if any)\n const remoteDictionariesPath = join(\n config.system.mainDir,\n 'remote_dictionaries.cjs'\n );\n const requireFunction = config.build?.require ?? getProjectRequire();\n const remoteDictionariesRecord: Record<string, any> = existsSync(\n remoteDictionariesPath\n )\n ? (requireFunction(remoteDictionariesPath) as any)\n : {};\n\n // Determine which keys need fetching by comparing updatedAt with local cache\n const entries = Object.entries(distantDictionariesUpdateTimeStamp);\n const keysToFetch = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n if (!remoteUpdatedAtValue) return true;\n\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n if (!local) return true;\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n if (typeof localUpdatedAt !== 'number') return true;\n return remoteUpdatedAt > localUpdatedAt;\n })\n .map(([key]) => key);\n\n const cachedKeys = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n })\n .map(([key]) => key);\n\n // Check if dictionaries list is empty\n if (entries.length === 0) {\n appLogger('No dictionaries to fetch', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Fetching dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = [\n ...cachedKeys.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'imported' as DictionaryStatus,\n })),\n ...keysToFetch.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'pending' as const,\n })),\n ];\n\n // Initialize aggregated logger\n const logger = new PullLogger();\n logger.update(\n dictionariesStatuses.map<PullStatus>((s) => ({\n dictionaryKey: s.dictionaryKey,\n status: s.status,\n }))\n );\n\n const successfullyFetchedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n const isCached =\n statusObj.status === 'imported' || statusObj.status === 'up-to-date';\n\n if (!isCached) {\n statusObj.status = 'fetching';\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'fetching' },\n ]);\n }\n\n try {\n let sourceDictionary: Dictionary | undefined;\n\n if (isCached) {\n sourceDictionary = remoteDictionariesRecord[\n statusObj.dictionaryKey\n ] as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(statusObj.dictionaryKey);\n\n sourceDictionary = getDictionaryResult.data as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n throw new Error(\n `Dictionary ${statusObj.dictionaryKey} not found on remote`\n );\n }\n\n // Check if there is a local version of this dictionary that is hybrid\n const localDictionaries =\n unmergedDictionariesRecord[statusObj.dictionaryKey];\n const localAndRemoteDictionary = localDictionaries?.find(\n (d) => d.location === 'hybrid'\n );\n\n if (localAndRemoteDictionary) {\n // We want to preserve the local properties but use the remote content\n sourceDictionary = {\n ...sourceDictionary,\n location: 'hybrid',\n filePath: localAndRemoteDictionary.filePath,\n localId: localAndRemoteDictionary.localId,\n };\n }\n\n // Now, write the dictionary to local file\n const { status } = await writeContentDeclaration(\n sourceDictionary,\n config,\n options\n );\n\n statusObj.status = status;\n logger.update([{ dictionaryKey: statusObj.dictionaryKey, status }]);\n\n successfullyFetchedDictionaries.push(sourceDictionary);\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error fetching dictionary ${statusObj.dictionaryKey}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with concurrency limit\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n // Per-dictionary summary\n const iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n case 'reimported in JSON':\n case 'new content file':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n };\n\n const colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n return ANSIColors.GREEN;\n case 'reimported in JSON':\n case 'new content file':\n return ANSIColors.YELLOW;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n };\n\n for (const s of dictionariesStatuses) {\n const icon = iconFor(s.status);\n const color = colorFor(s.status);\n appLogger(\n ` - ${s.dictionaryKey} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,SAAS,iBAAiB,SAAS,aAAa;CACtD,MAAM,YAAY,aAAa,MAAM;CAErC,IAAI;EACF,iBAAiB,SAAS,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AAU,UAAU,cAAc,EAChC,OAAO,QACT,CAAC;CAGP,SAAS,OAAO;EACd,UAAU,OAAO,EACf,OAAO,QACT,CAAC;CACH;AACF"}
|
|
@@ -2,7 +2,7 @@ import * as ANSIColors from "@intlayer/config/colors";
|
|
|
2
2
|
import { colorize, spinnerFrames } from "@intlayer/config/logger";
|
|
3
3
|
import { getConfiguration } from "@intlayer/config/node";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/push/pullLog.ts
|
|
6
6
|
var PullLogger = class {
|
|
7
7
|
statuses = [];
|
|
8
8
|
spinnerTimer = null;
|
|
@@ -99,6 +99,5 @@ var PullLogger = class {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
//#endregion
|
|
103
102
|
export { PullLogger };
|
|
104
103
|
//# sourceMappingURL=pullLog.mjs.map
|
package/dist/esm/push/push.mjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { loadPrompts } from "../loadPrompts.mjs";
|
|
2
|
+
import { PushLogger } from "../pushLog.mjs";
|
|
2
3
|
import { checkCMSAuth, getAuthenticatedAPI } from "../utils/checkAccess.mjs";
|
|
3
4
|
import { selectCmsEnvironment } from "../utils/selectCmsEnvironment.mjs";
|
|
4
|
-
import { PushLogger } from "../pushLog.mjs";
|
|
5
|
-
import { listGitFiles, logConfigDetails } from "@intlayer/engine/cli";
|
|
6
|
-
import { join } from "node:path";
|
|
7
5
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
8
6
|
import { colorize, colorizeKey, getAppLogger } from "@intlayer/config/logger";
|
|
9
7
|
import { getConfiguration } from "@intlayer/config/node";
|
|
8
|
+
import { listGitFiles, logConfigDetails } from "@intlayer/engine/cli";
|
|
9
|
+
import { join } from "node:path";
|
|
10
10
|
import * as fsPromises from "node:fs/promises";
|
|
11
|
-
import { formatPath
|
|
11
|
+
import { formatPath } from "@intlayer/engine/utils";
|
|
12
|
+
import { parallelize } from "@intlayer/config/utils";
|
|
12
13
|
import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
|
|
13
14
|
import { prepareIntlayer as prepareIntlayer$1, writeContentDeclaration } from "@intlayer/engine/build";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
// src/push/push.ts
|
|
16
17
|
const statusIconsAndColors = {
|
|
17
18
|
pushed: {
|
|
18
19
|
icon: "✔",
|
|
@@ -199,6 +200,5 @@ const deleteLocalDictionaries = async (dictionariesToDelete, options) => {
|
|
|
199
200
|
}
|
|
200
201
|
};
|
|
201
202
|
|
|
202
|
-
//#endregion
|
|
203
203
|
export { push };
|
|
204
204
|
//# sourceMappingURL=push.mjs.map
|