@intlayer/cli 9.5.6 → 9.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
  2. package/dist/cjs/auth/login.cjs +4 -4
  3. package/dist/cjs/build.cjs +1 -1
  4. package/dist/cjs/ci.cjs +1 -1
  5. package/dist/cjs/cli.cjs +5 -1
  6. package/dist/cjs/cli.cjs.map +1 -1
  7. package/dist/cjs/config.cjs +1 -1
  8. package/dist/cjs/editor.cjs +1 -1
  9. package/dist/cjs/extract.cjs +5 -5
  10. package/dist/cjs/fill/fill.cjs +2 -2
  11. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +1 -1
  12. package/dist/cjs/fill/listTranslationsTasks.cjs +1 -1
  13. package/dist/cjs/fill/translateDictionary.cjs +1 -1
  14. package/dist/cjs/fill/writeFill.cjs +1 -1
  15. package/dist/cjs/getTargetDictionary.cjs +1 -1
  16. package/dist/cjs/index.cjs +13 -7
  17. package/dist/cjs/init.cjs +15 -2
  18. package/dist/cjs/init.cjs.map +1 -1
  19. package/dist/cjs/initBuildOptimization.cjs +1 -1
  20. package/dist/cjs/initCompiler.cjs +1 -1
  21. package/dist/cjs/initInfra.cjs +105 -0
  22. package/dist/cjs/initInfra.cjs.map +1 -0
  23. package/dist/cjs/initSkills.cjs +1 -1
  24. package/dist/cjs/listContentDeclaration.cjs +2 -2
  25. package/dist/cjs/liveSync.cjs +4 -4
  26. package/dist/cjs/pull.cjs +4 -4
  27. package/dist/cjs/push/push.cjs +5 -5
  28. package/dist/cjs/pushConfig.cjs +1 -1
  29. package/dist/cjs/reviewDoc/reviewDoc.cjs +3 -3
  30. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +3 -3
  31. package/dist/cjs/reviewDoc/reviewDocLog.cjs +1 -1
  32. package/dist/cjs/searchDoc.cjs +1 -1
  33. package/dist/cjs/test/listMissingTranslations.cjs +1 -1
  34. package/dist/cjs/test/test.cjs +1 -1
  35. package/dist/cjs/translateDoc/translateDoc.cjs +2 -2
  36. package/dist/cjs/translateDoc/translateFile.cjs +2 -2
  37. package/dist/cjs/utils/getOutputFilePath.cjs +1 -1
  38. package/dist/cjs/utils/getParentPackageJSON.cjs +1 -1
  39. package/dist/cjs/watch.cjs +1 -1
  40. package/dist/esm/_virtual/_utils_asset.mjs +1 -1
  41. package/dist/esm/auth/login.mjs +3 -3
  42. package/dist/esm/build.mjs +1 -1
  43. package/dist/esm/ci.mjs +1 -1
  44. package/dist/esm/cli.mjs +5 -1
  45. package/dist/esm/cli.mjs.map +1 -1
  46. package/dist/esm/config.mjs +1 -1
  47. package/dist/esm/editor.mjs +1 -1
  48. package/dist/esm/extract.mjs +6 -6
  49. package/dist/esm/extract.mjs.map +1 -1
  50. package/dist/esm/fill/fill.mjs +4 -4
  51. package/dist/esm/fill/fill.mjs.map +1 -1
  52. package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -1
  53. package/dist/esm/fill/listTranslationsTasks.mjs +1 -1
  54. package/dist/esm/fill/translateDictionary.mjs +1 -1
  55. package/dist/esm/fill/writeFill.mjs +1 -1
  56. package/dist/esm/getTargetDictionary.mjs +1 -1
  57. package/dist/esm/index.mjs +9 -8
  58. package/dist/esm/init.mjs +15 -2
  59. package/dist/esm/init.mjs.map +1 -1
  60. package/dist/esm/initBuildOptimization.mjs +1 -1
  61. package/dist/esm/initCompiler.mjs +1 -1
  62. package/dist/esm/initInfra.mjs +100 -0
  63. package/dist/esm/initInfra.mjs.map +1 -0
  64. package/dist/esm/initSkills.mjs +1 -1
  65. package/dist/esm/listContentDeclaration.mjs +2 -2
  66. package/dist/esm/liveSync.mjs +3 -3
  67. package/dist/esm/pull.mjs +4 -4
  68. package/dist/esm/push/push.mjs +7 -7
  69. package/dist/esm/push/push.mjs.map +1 -1
  70. package/dist/esm/pushConfig.mjs +1 -1
  71. package/dist/esm/reviewDoc/reviewDoc.mjs +3 -3
  72. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +3 -3
  73. package/dist/esm/reviewDoc/reviewDocLog.mjs +1 -1
  74. package/dist/esm/searchDoc.mjs +1 -1
  75. package/dist/esm/test/listMissingTranslations.mjs +1 -1
  76. package/dist/esm/test/test.mjs +1 -1
  77. package/dist/esm/translateDoc/translateDoc.mjs +2 -2
  78. package/dist/esm/translateDoc/translateFile.mjs +2 -2
  79. package/dist/esm/utils/getOutputFilePath.mjs +1 -1
  80. package/dist/esm/utils/getParentPackageJSON.mjs +1 -1
  81. package/dist/esm/watch.mjs +1 -1
  82. package/dist/types/index.d.ts +2 -1
  83. package/dist/types/init.d.ts.map +1 -1
  84. package/dist/types/initInfra.d.ts +32 -0
  85. package/dist/types/initInfra.d.ts.map +1 -0
  86. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"init.mjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport {\n type ContentStrategy,\n detectCompatI18nLibraries,\n type InitOptions,\n initIntlayer,\n PLATFORMS,\n type Platform,\n type RoutingMode,\n setupCmsCredentials,\n} from '@intlayer/engine/cli';\nimport enquirer from 'enquirer';\nimport { login } from './auth/login';\nimport { initBuildOptimization } from './initBuildOptimization';\nimport { initCompiler } from './initCompiler';\nimport { initMCP } from './initMCP';\nimport {\n getDetectedPlatform,\n initSkills,\n PLATFORM_OPTIONS,\n} from './initSkills';\nimport { loadPrompts } from './loadPrompts';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\n/** Individually selectable setup steps exposed by the interactive init flow. */\ntype InitStep =\n | 'packages'\n | 'githubActions'\n | 'frameworkSetup'\n | 'vscodeExtension'\n | 'lsp'\n | 'eslint'\n | 'skills'\n | 'mcp'\n | 'compiler'\n | 'buildOptimization';\n\nconst BASE_INIT_STEP_OPTIONS: Array<{\n value: InitStep;\n label: string;\n hint: string;\n}> = [\n {\n value: 'packages',\n label: 'Install & upgrade packages',\n hint: 'install missing Intlayer dependencies and upgrade outdated ones',\n },\n {\n value: 'githubActions',\n label: 'CI/CD (GitHub Actions)',\n hint: 'scaffold the fill and test workflows that run on every pull request (covers every project in a monorepo)',\n },\n {\n value: 'frameworkSetup',\n label: 'Framework setup',\n hint: 'middleware/proxy and providers in layout/page',\n },\n {\n value: 'vscodeExtension',\n label: 'VS Code extension',\n hint: 'recommend the Intlayer extension',\n },\n {\n value: 'lsp',\n label: 'Editor LSP',\n hint: 'go-to-definition from keys to .content files',\n },\n {\n value: 'eslint',\n label: 'Lint rules (ESLint / oxlint)',\n hint: 'flag hardcoded text and dynamic calls the compiler cannot optimize',\n },\n {\n value: 'skills',\n label: 'AI skills',\n hint: 'install the Intlayer documentation as agent skills',\n },\n {\n value: 'mcp',\n label: 'MCP server',\n hint: 'configure the Intlayer MCP server',\n },\n];\n\n/** Locale routing strategies offered by the interactive init flow. */\nconst ROUTING_MODE_OPTIONS: Array<{\n value: RoutingMode;\n label: string;\n hint: string;\n}> = [\n {\n value: 'prefix-no-default',\n label: 'Prefix all except the default locale',\n hint: '/about, /fr/about (default)',\n },\n {\n value: 'prefix-all',\n label: 'Prefix all locales',\n hint: '/en/about, /fr/about',\n },\n {\n value: 'no-prefix',\n label: 'No locale in the URL',\n hint: '/about',\n },\n {\n value: 'search-params',\n label: 'Use a search parameter',\n hint: '/about?locale=fr',\n },\n];\n\n/**\n * Content organization strategies offered by the interactive init flow.\n * Drives the `compiler.output` template (autogenerated content: compiler /\n * autofill / extract) or the injection of the syncJSON plugin.\n */\nconst CONTENT_STRATEGY_OPTIONS: Array<{\n value: ContentStrategy;\n label: string;\n hint: string;\n}> = [\n {\n value: 'per-component',\n label: 'Per component (default)',\n hint: 'multilingual .content files co-located with the components',\n },\n {\n value: 'centralized',\n label: 'Centralized folder',\n hint: 'per-locale JSON dictionaries under /locales/{locale}/{key}.content.json',\n },\n {\n value: 'json-namespaces',\n label: 'JSON namespaces',\n hint: 'plain /locales/{locale}/{namespace}.json files synced via @intlayer/sync-json-plugin',\n },\n];\n\n/** Reads the merged dependencies of the project at `root`. */\nconst getProjectDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\n/** Returns true when the project at `root` depends on Next.js. */\nconst isNextJsProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).next);\n\n/** Returns true when the project at `root` depends on Vite. */\nconst isViteProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).vite);\n\n/**\n * Returns true when the project uses a URL-based router for which a locale\n * routing strategy is meaningful: Next.js, React Router, or TanStack Router.\n * Apps without URL routing (e.g. React Native / Expo) are excluded, since\n * `routing.mode` has no effect there.\n */\nconst hasUrlRouting = (root: string): boolean => {\n const deps = getProjectDependencies(root);\n\n // React Native / Expo apps have no URL routing — never ask for a strategy.\n if (deps['react-native'] || deps.expo) return false;\n\n return Boolean(\n deps.next ||\n deps['react-router'] ||\n deps['react-router-dom'] ||\n deps['@tanstack/react-router'] ||\n deps['@tanstack/react-start']\n );\n};\n\n/**\n * Runs `init` in interactive mode: prompts the user with a checkbox of setup\n * steps, then forwards the selection to {@link initIntlayer} (packages, GitHub\n * Actions, VS Code extension, LSP) and runs the dedicated skills/MCP installers\n * for the steps that own their own prompts. The `.gitignore` entry is not\n * offered as a checkbox — it is always added (unless `--no-gitignore` is set).\n */\nconst runInteractiveInit = async (\n root: string,\n baseOptions?: InitOptions\n): Promise<void> => {\n const p = await loadPrompts();\n\n p.intro('Initialize Intlayer');\n\n const stepOptions = [...BASE_INIT_STEP_OPTIONS];\n\n const nextJsProject = isNextJsProject(root);\n\n // The compiler is plugged in directly on Vite; on Next.js it needs a Babel\n // config. Only offer the step when one of those frameworks is detected.\n if (nextJsProject || isViteProject(root)) {\n stepOptions.push({\n value: 'compiler',\n label: 'Compiler',\n hint: nextJsProject\n ? 'add the Babel compiler config to extract inline content (Next.js)'\n : 'auto-extract inline content at build time (already plugged in on Vite)',\n });\n }\n\n if (nextJsProject) {\n stepOptions.push({\n value: 'buildOptimization',\n label: 'Bundle optimization',\n hint: 'choose @intlayer/babel or @intlayer/swc for tree-shaking and minification (Next.js only)',\n });\n }\n\n const selected = await p.multiselect<InitStep>({\n message: 'Select what you want to set up:',\n options: stepOptions,\n initialValues: BASE_INIT_STEP_OPTIONS.map((option) => option.value),\n required: false,\n });\n\n if (p.isCancel(selected)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const steps = selected as InitStep[];\n\n // Locale routing strategy → written to `routing.mode` in the config file.\n // Only relevant for URL-based routers (Next.js, React Router, TanStack);\n // skipped for apps without URL routing such as React Native / Expo.\n let routingMode: RoutingMode | undefined;\n\n if (hasUrlRouting(root)) {\n const selectedRoutingMode = await p.select<RoutingMode>({\n message: 'Which locale routing strategy do you want?',\n options: ROUTING_MODE_OPTIONS,\n initialValue: 'prefix-no-default',\n });\n\n if (p.isCancel(selectedRoutingMode)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n routingMode = selectedRoutingMode;\n }\n\n // Compat i18n library detection — never asked, always derived from the\n // installed packages. `detectMissingIntlayerPackages` reads the very same\n // dependency map to schedule the compat adapter, the sync plugin and the\n // catalog template, so a project without any of those packages is simply set\n // up on Intlayer alone.\n const detectedCompatLibraries = detectCompatI18nLibraries(\n getProjectDependencies(root)\n );\n const hasCompatLib = detectedCompatLibraries.length > 0;\n\n if (hasCompatLib) {\n p.log.info(\n `Detected existing i18n ${detectedCompatLibraries.length > 1 ? 'libraries' : 'library'}: ${detectedCompatLibraries.join(', ')} — the matching Intlayer compat adapter and catalog sync will be set up.`\n );\n }\n\n // Content organization strategy → drives `compiler.output` (autogenerated\n // content) or the syncJSON plugin injection. A compat library already\n // dictates the catalog layout (its JSON/PO files are synced as-is), so the\n // question is only asked when none is in play.\n let contentStrategy: ContentStrategy | undefined;\n\n if (!hasCompatLib) {\n const selectedContentStrategy = await p.select<ContentStrategy>({\n message: 'How do you want to organize your translated content?',\n options: CONTENT_STRATEGY_OPTIONS,\n initialValue: 'per-component',\n });\n\n if (p.isCancel(selectedContentStrategy)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n contentStrategy = selectedContentStrategy;\n }\n\n const options: InitOptions = {\n ...baseOptions,\n routingMode,\n contentStrategy,\n noInstallPackages: !steps.includes('packages'),\n // The `.gitignore` entry is never offered as a checkbox: in interactive\n // mode we always add `.intlayer` to `.gitignore`, only honoring an explicit\n // `--no-gitignore` flag from the command line.\n noGitignore: baseOptions?.noGitignore,\n // Respect explicit `--no-*` flags from the command line even when the\n // corresponding step is selected in the checkbox.\n noGithubActions:\n baseOptions?.noGithubActions || !steps.includes('githubActions'),\n noFrameworkSetup:\n baseOptions?.noFrameworkSetup || !steps.includes('frameworkSetup'),\n noVscodeExtension: !steps.includes('vscodeExtension'),\n noLsp: !steps.includes('lsp'),\n noEslint: !steps.includes('eslint'),\n };\n\n await initIntlayer(root, options);\n\n const needsPlatform = steps.includes('skills') || steps.includes('mcp');\n\n let sharedPlatform: Platform | undefined;\n\n if (needsPlatform) {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\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 sharedPlatform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (steps.includes('skills')) {\n await initSkills(root, sharedPlatform);\n }\n\n if (steps.includes('mcp')) {\n await initMCP(root, sharedPlatform);\n }\n\n if (steps.includes('compiler')) {\n await initCompiler(root);\n }\n\n if (steps.includes('buildOptimization')) {\n await initBuildOptimization(root);\n }\n\n // CMS / visual editor is the last step: an opt-in browser login that\n // persists the access-key credentials to `.env` and enables the editor in the\n // config file. Asked last so the browser flow does not interrupt setup.\n const shouldSetUpCms = await p.confirm({\n message:\n 'Set up the Intlayer CMS now? (opens your browser to log in, then stores the credentials in your .env)',\n initialValue: false,\n });\n\n if (p.isCancel(shouldSetUpCms)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (shouldSetUpCms) {\n p.log.info('Opening your browser to log in to the Intlayer CMS...');\n // `exitAfter: false` keeps the process alive so the flow can finish; the\n // credentials are persisted to `.env` and the editor enabled in the config.\n await login({\n exitAfter: false,\n onCredentials: (credentials) => setupCmsCredentials(root, credentials),\n });\n }\n\n p.outro('Intlayer initialization complete');\n};\n\nexport const init = async (\n projectRoot?: string,\n options?: InitOptions,\n interactive?: boolean\n) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n if (interactive) {\n await runInteractiveInit(root, options);\n return;\n }\n\n await initIntlayer(root, options);\n};\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;CAEjB,OAAO,eAAe,QAAQ,YAAY,IAAI,GAAG;EAC/C,IAAI,WAAW,KAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,aAAa,QAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAeA,MAAM,yBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM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AW;EACvE,CAAC;CACH;CAEA,EAAE,MAAM,kCAAkC;AAC5C;AAEA,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,gBAAgB,QAAQ,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,MAAM,aAAa,MAAM,OAAO;AAClC"}
1
+ {"version":3,"file":"init.mjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport {\n type ContentStrategy,\n detectCompatI18nLibraries,\n type InitOptions,\n initIntlayer,\n PLATFORMS,\n type Platform,\n type RoutingMode,\n setupCmsCredentials,\n} from '@intlayer/engine/cli';\nimport enquirer from 'enquirer';\nimport { login } from './auth/login';\nimport { initBuildOptimization } from './initBuildOptimization';\nimport { initCompiler } from './initCompiler';\nimport { initInfra } from './initInfra';\nimport { initMCP } from './initMCP';\nimport {\n getDetectedPlatform,\n initSkills,\n PLATFORM_OPTIONS,\n} from './initSkills';\nimport { loadPrompts } from './loadPrompts';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\n/** Individually selectable setup steps exposed by the interactive init flow. */\ntype InitStep =\n | 'packages'\n | 'githubActions'\n | 'frameworkSetup'\n | 'vscodeExtension'\n | 'lsp'\n | 'eslint'\n | 'skills'\n | 'mcp'\n | 'compiler'\n | 'buildOptimization'\n | 'infra';\n\nconst BASE_INIT_STEP_OPTIONS: Array<{\n value: InitStep;\n label: string;\n hint: string;\n}> = [\n {\n value: 'packages',\n label: 'Install & upgrade packages',\n hint: 'install missing Intlayer dependencies and upgrade outdated ones',\n },\n {\n value: 'githubActions',\n label: 'CI/CD (GitHub Actions)',\n hint: 'scaffold the fill and test workflows that run on every pull request (covers every project in a monorepo)',\n },\n {\n value: 'frameworkSetup',\n label: 'Framework setup',\n hint: 'middleware/proxy and providers in layout/page',\n },\n {\n value: 'vscodeExtension',\n label: 'VS Code extension',\n hint: 'recommend the Intlayer extension',\n },\n {\n value: 'lsp',\n label: 'Editor LSP',\n hint: 'go-to-definition from keys to .content files',\n },\n {\n value: 'eslint',\n label: 'Lint rules (ESLint / oxlint)',\n hint: 'flag hardcoded text and dynamic calls the compiler cannot optimize',\n },\n {\n value: 'skills',\n label: 'AI skills',\n hint: 'install the Intlayer documentation as agent skills',\n },\n {\n value: 'mcp',\n label: 'MCP server',\n hint: 'configure the Intlayer MCP server',\n },\n];\n\n/**\n * Steps that are opt-in: offered in the checkbox but not pre-selected. The\n * infrastructure installer touches the machine (downloads an app, pulls\n * Docker images) rather than the project, so it must be an explicit choice.\n */\nconst OPT_IN_INIT_STEP_OPTIONS: Array<{\n value: InitStep;\n label: string;\n hint: string;\n}> = [\n {\n value: 'infra',\n label: 'Infrastructure (desktop app / self-hosting)',\n hint: 'install the desktop app, or self-host with Docker (all-in-one or Compose)',\n },\n];\n\n/** Locale routing strategies offered by the interactive init flow. */\nconst ROUTING_MODE_OPTIONS: Array<{\n value: RoutingMode;\n label: string;\n hint: string;\n}> = [\n {\n value: 'prefix-no-default',\n label: 'Prefix all except the default locale',\n hint: '/about, /fr/about (default)',\n },\n {\n value: 'prefix-all',\n label: 'Prefix all locales',\n hint: '/en/about, /fr/about',\n },\n {\n value: 'no-prefix',\n label: 'No locale in the URL',\n hint: '/about',\n },\n {\n value: 'search-params',\n label: 'Use a search parameter',\n hint: '/about?locale=fr',\n },\n];\n\n/**\n * Content organization strategies offered by the interactive init flow.\n * Drives the `compiler.output` template (autogenerated content: compiler /\n * autofill / extract) or the injection of the syncJSON plugin.\n */\nconst CONTENT_STRATEGY_OPTIONS: Array<{\n value: ContentStrategy;\n label: string;\n hint: string;\n}> = [\n {\n value: 'per-component',\n label: 'Per component (default)',\n hint: 'multilingual .content files co-located with the components',\n },\n {\n value: 'centralized',\n label: 'Centralized folder',\n hint: 'per-locale JSON dictionaries under /locales/{locale}/{key}.content.json',\n },\n {\n value: 'json-namespaces',\n label: 'JSON namespaces',\n hint: 'plain /locales/{locale}/{namespace}.json files synced via @intlayer/sync-json-plugin',\n },\n];\n\n/** Reads the merged dependencies of the project at `root`. */\nconst getProjectDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\n/** Returns true when the project at `root` depends on Next.js. */\nconst isNextJsProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).next);\n\n/** Returns true when the project at `root` depends on Vite. */\nconst isViteProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).vite);\n\n/**\n * Returns true when the project uses a URL-based router for which a locale\n * routing strategy is meaningful: Next.js, React Router, or TanStack Router.\n * Apps without URL routing (e.g. React Native / Expo) are excluded, since\n * `routing.mode` has no effect there.\n */\nconst hasUrlRouting = (root: string): boolean => {\n const deps = getProjectDependencies(root);\n\n // React Native / Expo apps have no URL routing — never ask for a strategy.\n if (deps['react-native'] || deps.expo) return false;\n\n return Boolean(\n deps.next ||\n deps['react-router'] ||\n deps['react-router-dom'] ||\n deps['@tanstack/react-router'] ||\n deps['@tanstack/react-start']\n );\n};\n\n/**\n * Runs `init` in interactive mode: prompts the user with a checkbox of setup\n * steps, then forwards the selection to {@link initIntlayer} (packages, GitHub\n * Actions, VS Code extension, LSP) and runs the dedicated skills/MCP installers\n * for the steps that own their own prompts. The `.gitignore` entry is not\n * offered as a checkbox — it is always added (unless `--no-gitignore` is set).\n */\nconst runInteractiveInit = async (\n root: string,\n baseOptions?: InitOptions\n): Promise<void> => {\n const p = await loadPrompts();\n\n p.intro('Initialize Intlayer');\n\n const stepOptions = [...BASE_INIT_STEP_OPTIONS];\n\n const nextJsProject = isNextJsProject(root);\n\n // The compiler is plugged in directly on Vite; on Next.js it needs a Babel\n // config. Only offer the step when one of those frameworks is detected.\n if (nextJsProject || isViteProject(root)) {\n stepOptions.push({\n value: 'compiler',\n label: 'Compiler',\n hint: nextJsProject\n ? 'add the Babel compiler config to extract inline content (Next.js)'\n : 'auto-extract inline content at build time (already plugged in on Vite)',\n });\n }\n\n if (nextJsProject) {\n stepOptions.push({\n value: 'buildOptimization',\n label: 'Bundle optimization',\n hint: 'choose @intlayer/babel or @intlayer/swc for tree-shaking and minification (Next.js only)',\n });\n }\n\n stepOptions.push(...OPT_IN_INIT_STEP_OPTIONS);\n\n const selected = await p.multiselect<InitStep>({\n message: 'Select what you want to set up:',\n options: stepOptions,\n initialValues: BASE_INIT_STEP_OPTIONS.map((option) => option.value),\n required: false,\n });\n\n if (p.isCancel(selected)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const steps = selected as InitStep[];\n\n // Locale routing strategy → written to `routing.mode` in the config file.\n // Only relevant for URL-based routers (Next.js, React Router, TanStack);\n // skipped for apps without URL routing such as React Native / Expo.\n let routingMode: RoutingMode | undefined;\n\n if (hasUrlRouting(root)) {\n const selectedRoutingMode = await p.select<RoutingMode>({\n message: 'Which locale routing strategy do you want?',\n options: ROUTING_MODE_OPTIONS,\n initialValue: 'prefix-no-default',\n });\n\n if (p.isCancel(selectedRoutingMode)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n routingMode = selectedRoutingMode;\n }\n\n // Compat i18n library detection — never asked, always derived from the\n // installed packages. `detectMissingIntlayerPackages` reads the very same\n // dependency map to schedule the compat adapter, the sync plugin and the\n // catalog template, so a project without any of those packages is simply set\n // up on Intlayer alone.\n const detectedCompatLibraries = detectCompatI18nLibraries(\n getProjectDependencies(root)\n );\n const hasCompatLib = detectedCompatLibraries.length > 0;\n\n if (hasCompatLib) {\n p.log.info(\n `Detected existing i18n ${detectedCompatLibraries.length > 1 ? 'libraries' : 'library'}: ${detectedCompatLibraries.join(', ')} — the matching Intlayer compat adapter and catalog sync will be set up.`\n );\n }\n\n // Content organization strategy → drives `compiler.output` (autogenerated\n // content) or the syncJSON plugin injection. A compat library already\n // dictates the catalog layout (its JSON/PO files are synced as-is), so the\n // question is only asked when none is in play.\n let contentStrategy: ContentStrategy | undefined;\n\n if (!hasCompatLib) {\n const selectedContentStrategy = await p.select<ContentStrategy>({\n message: 'How do you want to organize your translated content?',\n options: CONTENT_STRATEGY_OPTIONS,\n initialValue: 'per-component',\n });\n\n if (p.isCancel(selectedContentStrategy)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n contentStrategy = selectedContentStrategy;\n }\n\n const options: InitOptions = {\n ...baseOptions,\n routingMode,\n contentStrategy,\n noInstallPackages: !steps.includes('packages'),\n // The `.gitignore` entry is never offered as a checkbox: in interactive\n // mode we always add `.intlayer` to `.gitignore`, only honoring an explicit\n // `--no-gitignore` flag from the command line.\n noGitignore: baseOptions?.noGitignore,\n // Respect explicit `--no-*` flags from the command line even when the\n // corresponding step is selected in the checkbox.\n noGithubActions:\n baseOptions?.noGithubActions || !steps.includes('githubActions'),\n noFrameworkSetup:\n baseOptions?.noFrameworkSetup || !steps.includes('frameworkSetup'),\n noVscodeExtension: !steps.includes('vscodeExtension'),\n noLsp: !steps.includes('lsp'),\n noEslint: !steps.includes('eslint'),\n };\n\n await initIntlayer(root, options);\n\n const needsPlatform = steps.includes('skills') || steps.includes('mcp');\n\n let sharedPlatform: Platform | undefined;\n\n if (needsPlatform) {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\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 sharedPlatform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (steps.includes('skills')) {\n await initSkills(root, sharedPlatform);\n }\n\n if (steps.includes('mcp')) {\n await initMCP(root, sharedPlatform);\n }\n\n if (steps.includes('compiler')) {\n await initCompiler(root);\n }\n\n if (steps.includes('buildOptimization')) {\n await initBuildOptimization(root);\n }\n\n // Delegated to the hosted install script, which owns its own menu.\n if (steps.includes('infra')) {\n await initInfra();\n }\n\n // CMS / visual editor is the last step: an opt-in browser login that\n // persists the access-key credentials to `.env` and enables the editor in the\n // config file. Asked last so the browser flow does not interrupt setup.\n const shouldSetUpCms = await p.confirm({\n message:\n 'Set up the Intlayer CMS now? (opens your browser to log in, then stores the credentials in your .env)',\n initialValue: false,\n });\n\n if (p.isCancel(shouldSetUpCms)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (shouldSetUpCms) {\n p.log.info('Opening your browser to log in to the Intlayer CMS...');\n // `exitAfter: false` keeps the process alive so the flow can finish; the\n // credentials are persisted to `.env` and the editor enabled in the config.\n await login({\n exitAfter: false,\n onCredentials: (credentials) => setupCmsCredentials(root, credentials),\n });\n }\n\n p.outro('Intlayer initialization complete');\n};\n\nexport const init = async (\n projectRoot?: string,\n options?: InitOptions,\n interactive?: boolean\n) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n if (interactive) {\n await runInteractiveInit(root, options);\n return;\n }\n\n await initIntlayer(root, options);\n};\n"],"mappings":";;;;;;;;;;;;;AAyBA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;CAEjB,OAAO,eAAe,QAAQ,YAAY,IAAI,GAAG;EAC/C,IAAI,WAAW,KAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,aAAa,QAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAgBA,MAAM,y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;CAIlC,IAAI,MAAM,SAAS,OAAO,GACxB,MAAM,UAAU;CAMlB,MAAM,iBAAiB,MAAM,EAAE,QAAQ;EACrC,SACE;EACF,cAAc;CAChB,CAAC;CAED,IAAI,EAAE,SAAS,cAAc,GAAG;EAC9B,EAAE,OAAO,sBAAsB;EAC/B;CACF;CAEA,IAAI,gBAAgB;EAClB,EAAE,IAAI,KAAK,uDAAuD;EAGlE,MAAM,MAAM;GACV,WAAW;GACX,gBAAgB,gBAAgB,oBAAoB,MAAM,WAAW;EACvE,CAAC;CACH;CAEA,EAAE,MAAM,kCAAkC;AAC5C;AAEA,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,gBAAgB,QAAQ,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,MAAM,aAAa,MAAM,OAAO;AAClC"}
@@ -1,8 +1,8 @@
1
1
  import { loadPrompts } from "./loadPrompts.mjs";
2
2
  import { findProjectRoot } from "./init.mjs";
3
- import { existsSync, writeFileSync } from "node:fs";
4
3
  import { join, resolve } from "node:path";
5
4
  import { NEXT_INTLAYER_BABEL_CONFIG_CONTENT, detectPackageManager, installPackages } from "@intlayer/engine/cli";
5
+ import { existsSync, writeFileSync } from "node:fs";
6
6
 
7
7
  //#region src/initBuildOptimization.ts
8
8
  /** Babel config filenames Next.js picks up, ordered by preference. */
@@ -1,8 +1,8 @@
1
1
  import { loadPrompts } from "./loadPrompts.mjs";
2
2
  import { findProjectRoot } from "./init.mjs";
3
- import { existsSync, readFileSync } from "node:fs";
4
3
  import { join, resolve } from "node:path";
5
4
  import { detectPackageManager, installPackages } from "@intlayer/engine/cli";
5
+ import { existsSync, readFileSync } from "node:fs";
6
6
 
7
7
  //#region src/initCompiler.ts
8
8
  /**
@@ -0,0 +1,100 @@
1
+ import { loadPrompts } from "./loadPrompts.mjs";
2
+ import { join } from "node:path";
3
+ import { spawn } from "node:child_process";
4
+ import { tmpdir } from "node:os";
5
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
6
+
7
+ //#region src/initInfra.ts
8
+ /** Setup modes understood by the hosted installer. */
9
+ const INFRA_MODES = [
10
+ "desktop",
11
+ "docker",
12
+ "compose"
13
+ ];
14
+ /**
15
+ * The hosted installers are the single source of truth for the infrastructure
16
+ * setup flow (desktop app, all-in-one container, Compose stack). The CLI runs
17
+ * them rather than re-implementing the same steps in JavaScript.
18
+ */
19
+ const INSTALL_SCRIPT_URL = "https://intlayer.org/install.sh";
20
+ const INSTALL_SCRIPT_URL_WINDOWS = "https://intlayer.org/install.ps1";
21
+ const POSIX_RUNNER = {
22
+ url: INSTALL_SCRIPT_URL,
23
+ fileName: "install.sh",
24
+ command: (scriptPath, mode) => ["sh", [scriptPath, ...mode ? ["--mode", mode] : []]]
25
+ };
26
+ const WINDOWS_RUNNER = {
27
+ url: INSTALL_SCRIPT_URL_WINDOWS,
28
+ fileName: "install.ps1",
29
+ command: (scriptPath, mode) => ["powershell", [
30
+ "-NoProfile",
31
+ "-ExecutionPolicy",
32
+ "Bypass",
33
+ "-File",
34
+ scriptPath,
35
+ ...mode ? ["-Mode", mode] : []
36
+ ]]
37
+ };
38
+ const getInstallerRunner = () => process.platform === "win32" ? WINDOWS_RUNNER : POSIX_RUNNER;
39
+ /**
40
+ * Validates a user-provided mode against {@link INFRA_MODES}.
41
+ *
42
+ * @throws When the value is not a known mode.
43
+ */
44
+ const parseInfraMode = (value) => {
45
+ if (INFRA_MODES.includes(value)) return value;
46
+ throw new Error(`Unknown infra mode "${value}". Expected one of: ${INFRA_MODES.join(", ")}`);
47
+ };
48
+ /**
49
+ * Runs the installer with the terminal attached, so its own prompts and
50
+ * progress bars reach the user unchanged.
51
+ *
52
+ * @returns The script's exit code.
53
+ */
54
+ const runInstaller = (command, args) => new Promise((resolve, reject) => {
55
+ const child = spawn(command, args, { stdio: "inherit" });
56
+ child.on("error", reject);
57
+ child.on("close", (code) => resolve(code ?? 1));
58
+ });
59
+ /**
60
+ * Downloads the hosted installer and runs it: desktop app, all-in-one Docker
61
+ * container or Docker Compose stack, chosen interactively unless `mode` is set.
62
+ *
63
+ * Exposed as `intlayer init infra` and as a step of `intlayer init --interactive`.
64
+ */
65
+ const initInfra = async (options = {}) => {
66
+ const p = await loadPrompts();
67
+ const runner = getInstallerRunner();
68
+ const scriptUrl = options.scriptUrl ?? runner.url;
69
+ const spinner = p.spinner();
70
+ spinner.start(`Fetching ${scriptUrl}`);
71
+ let script;
72
+ try {
73
+ const response = await fetch(scriptUrl);
74
+ if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
75
+ script = await response.text();
76
+ } catch (error) {
77
+ spinner.stop("Could not download the installer", 1);
78
+ p.log.error(`${error.message}\nRun it directly: ${process.platform === "win32" ? `irm ${scriptUrl} | iex` : `curl -fsSL ${scriptUrl} | sh`}`);
79
+ process.exitCode = 1;
80
+ return;
81
+ }
82
+ spinner.stop("Installer downloaded");
83
+ const directory = await mkdtemp(join(tmpdir(), "intlayer-install-"));
84
+ const scriptPath = join(directory, runner.fileName);
85
+ try {
86
+ await writeFile(scriptPath, script, { mode: 448 });
87
+ const [command, args] = runner.command(scriptPath, options.mode);
88
+ const exitCode = await runInstaller(command, args);
89
+ if (exitCode !== 0) process.exitCode = exitCode;
90
+ } finally {
91
+ await rm(directory, {
92
+ recursive: true,
93
+ force: true
94
+ });
95
+ }
96
+ };
97
+
98
+ //#endregion
99
+ export { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, initInfra, parseInfraMode };
100
+ //# sourceMappingURL=initInfra.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initInfra.mjs","names":[],"sources":["../../src/initInfra.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { mkdtemp, rm, writeFile } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { loadPrompts } from './loadPrompts';\n\n/** Setup modes understood by the hosted installer. */\nexport const INFRA_MODES = ['desktop', 'docker', 'compose'] as const;\n\nexport type InfraMode = (typeof INFRA_MODES)[number];\n\n/**\n * The hosted installers are the single source of truth for the infrastructure\n * setup flow (desktop app, all-in-one container, Compose stack). The CLI runs\n * them rather than re-implementing the same steps in JavaScript.\n */\nexport const INSTALL_SCRIPT_URL = 'https://intlayer.org/install.sh';\nexport const INSTALL_SCRIPT_URL_WINDOWS = 'https://intlayer.org/install.ps1';\n\nexport type InitInfraOptions = {\n /** Skip the interactive menu and run this mode directly. */\n mode?: InfraMode;\n /** Installer URL override (forks, staging). Defaults to the platform's script. */\n scriptUrl?: string;\n};\n\n/** How to fetch and execute the installer on the current platform. */\ntype InstallerRunner = {\n url: string;\n fileName: string;\n /** Builds the command and arguments that execute the downloaded script. */\n command: (scriptPath: string, mode?: InfraMode) => [string, string[]];\n};\n\nconst POSIX_RUNNER: InstallerRunner = {\n url: INSTALL_SCRIPT_URL,\n fileName: 'install.sh',\n command: (scriptPath, mode) => [\n 'sh',\n [scriptPath, ...(mode ? ['--mode', mode] : [])],\n ],\n};\n\nconst WINDOWS_RUNNER: InstallerRunner = {\n url: INSTALL_SCRIPT_URL_WINDOWS,\n fileName: 'install.ps1',\n command: (scriptPath, mode) => [\n 'powershell',\n [\n '-NoProfile',\n '-ExecutionPolicy',\n 'Bypass',\n '-File',\n scriptPath,\n ...(mode ? ['-Mode', mode] : []),\n ],\n ],\n};\n\nconst getInstallerRunner = (): InstallerRunner =>\n process.platform === 'win32' ? WINDOWS_RUNNER : POSIX_RUNNER;\n\n/**\n * Validates a user-provided mode against {@link INFRA_MODES}.\n *\n * @throws When the value is not a known mode.\n */\nexport const parseInfraMode = (value: string): InfraMode => {\n if ((INFRA_MODES as readonly string[]).includes(value)) {\n return value as InfraMode;\n }\n\n throw new Error(\n `Unknown infra mode \"${value}\". Expected one of: ${INFRA_MODES.join(', ')}`\n );\n};\n\n/**\n * Runs the installer with the terminal attached, so its own prompts and\n * progress bars reach the user unchanged.\n *\n * @returns The script's exit code.\n */\nconst runInstaller = (command: string, args: string[]): Promise<number> =>\n new Promise((resolve, reject) => {\n const child = spawn(command, args, { stdio: 'inherit' });\n\n child.on('error', reject);\n child.on('close', (code) => resolve(code ?? 1));\n });\n\n/**\n * Downloads the hosted installer and runs it: desktop app, all-in-one Docker\n * container or Docker Compose stack, chosen interactively unless `mode` is set.\n *\n * Exposed as `intlayer init infra` and as a step of `intlayer init --interactive`.\n */\nexport const initInfra = async (\n options: InitInfraOptions = {}\n): Promise<void> => {\n const p = await loadPrompts();\n const runner = getInstallerRunner();\n const scriptUrl = options.scriptUrl ?? runner.url;\n\n const spinner = p.spinner();\n spinner.start(`Fetching ${scriptUrl}`);\n\n let script: string;\n\n try {\n const response = await fetch(scriptUrl);\n\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}`);\n }\n\n script = await response.text();\n } catch (error) {\n spinner.stop('Could not download the installer', 1);\n p.log.error(\n `${(error as Error).message}\\nRun it directly: ${\n process.platform === 'win32'\n ? `irm ${scriptUrl} | iex`\n : `curl -fsSL ${scriptUrl} | sh`\n }`\n );\n process.exitCode = 1;\n return;\n }\n\n spinner.stop('Installer downloaded');\n\n const directory = await mkdtemp(join(tmpdir(), 'intlayer-install-'));\n const scriptPath = join(directory, runner.fileName);\n\n try {\n await writeFile(scriptPath, script, { mode: 0o700 });\n\n const [command, args] = runner.command(scriptPath, options.mode);\n const exitCode = await runInstaller(command, args);\n\n if (exitCode !== 0) {\n process.exitCode = exitCode;\n }\n } finally {\n await rm(directory, { recursive: true, force: true });\n }\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,cAAc;CAAC;CAAW;CAAU;AAAS;;;;;;AAS1D,MAAa,qBAAqB;AAClC,MAAa,6BAA6B;AAiB1C,MAAM,eAAgC;CACpC,KAAK;CACL,UAAU;CACV,UAAU,YAAY,SAAS,CAC7B,MACA,CAAC,YAAY,GAAI,OAAO,CAAC,UAAU,IAA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EnC,MAAM,YAAY,MAAM,QAAQ,KAAK,OAAO,GAAG,mBAAmB,CAAC;CACnE,MAAM,aAAa,KAAK,WAAW,OAAO,QAAQ;CAElD,IAAI;EACF,MAAM,UAAU,YAAY,QAAQ,EAAE,MAAM,IAAM,CAAC;EAEnD,MAAM,CAAC,SAAS,QAAQ,OAAO,QAAQ,YAAY,QAAQ,IAAI;EAC/D,MAAM,WAAW,MAAM,aAAa,SAAS,IAAI;EAEjD,IAAI,aAAa,GACf,QAAQ,WAAW;CAEvB,UAAU;EACR,MAAM,GAAG,WAAW;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;CACtD;AACF"}
@@ -1,9 +1,9 @@
1
1
  import { loadPrompts } from "./loadPrompts.mjs";
2
2
  import { findProjectRoot } from "./init.mjs";
3
- import { existsSync, readFileSync } from "node:fs";
4
3
  import { join, resolve } from "node:path";
5
4
  import { PLATFORMS, PLATFORMS_METADATA, SKILLS, SKILLS_METADATA, getInitialSkills, installSkills } from "@intlayer/engine/cli";
6
5
  import enquirer from "enquirer";
6
+ import { existsSync, readFileSync } from "node:fs";
7
7
 
8
8
  //#region src/initSkills.ts
9
9
  const PLATFORM_CHECKS = PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform]?.check).map((platform) => ({
@@ -1,9 +1,9 @@
1
1
  import { relative } from "node:path";
2
+ import { prepareIntlayer } from "@intlayer/engine/cli";
2
3
  import { colon, colorizeKey, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
3
4
  import { getConfiguration } from "@intlayer/config/node";
4
- import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
5
- import { prepareIntlayer } from "@intlayer/engine/cli";
6
5
  import { formatPath } from "@intlayer/engine/utils";
6
+ import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
7
7
 
8
8
  //#region src/listContentDeclaration.ts
9
9
  const listContentDeclarationRows = async (options) => {
@@ -1,14 +1,14 @@
1
1
  import { IntlayerEventListener } from "./IntlayerEventListener.mjs";
2
+ import { createServer } from "node:http";
2
3
  import * as ANSIColors from "@intlayer/config/colors";
3
4
  import { colorize, getAppLogger } from "@intlayer/config/logger";
4
5
  import { getConfiguration } from "@intlayer/config/node";
6
+ import { runParallel } from "@intlayer/engine/utils";
5
7
  import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
6
8
  import { buildDictionary } from "@intlayer/engine/build";
7
- import { runParallel } from "@intlayer/engine/utils";
8
- import { createServer } from "node:http";
9
- import packageJson from "@intlayer/config/package.json" with { type: "json" };
10
9
  import { getLocalizedContent } from "@intlayer/core/plugins";
11
10
  import { getDictionaries } from "@intlayer/dictionaries-entry";
11
+ import packageJson from "@intlayer/config/package.json" with { type: "json" };
12
12
 
13
13
  //#region src/liveSync.ts
14
14
  const writeDictionary = async (dictionary, configuration) => {
package/dist/esm/pull.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { PullLogger } from "./push/pullLog.mjs";
2
1
  import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
2
+ import { PullLogger } from "./push/pullLog.mjs";
3
3
  import { selectCmsEnvironment } from "./utils/selectCmsEnvironment.mjs";
4
- import { existsSync } from "node:fs";
5
4
  import { join } from "node:path";
5
+ import { logConfigDetails } from "@intlayer/engine/cli";
6
+ import { existsSync } from "node:fs";
6
7
  import * as ANSIColors from "@intlayer/config/colors";
7
8
  import { getAppLogger } from "@intlayer/config/logger";
8
9
  import { getConfiguration } from "@intlayer/config/node";
10
+ import { parallelize } from "@intlayer/engine/utils";
9
11
  import { getProjectRequire } from "@intlayer/config/utils";
10
12
  import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
11
13
  import { writeContentDeclaration } from "@intlayer/engine/build";
12
- import { logConfigDetails } from "@intlayer/engine/cli";
13
- import { parallelize } from "@intlayer/engine/utils";
14
14
 
15
15
  //#region src/pull.ts
16
16
  /**
@@ -1,16 +1,16 @@
1
+ import { loadPrompts } from "../loadPrompts.mjs";
1
2
  import { checkCMSAuth, getAuthenticatedAPI } from "../utils/checkAccess.mjs";
2
3
  import { selectCmsEnvironment } from "../utils/selectCmsEnvironment.mjs";
3
4
  import { PushLogger } from "../pushLog.mjs";
4
- import { loadPrompts } from "../loadPrompts.mjs";
5
5
  import { join } from "node:path";
6
+ import { listGitFiles, logConfigDetails } from "@intlayer/engine/cli";
6
7
  import * as ANSIColors from "@intlayer/config/colors";
7
8
  import { colorize, colorizeKey, getAppLogger } from "@intlayer/config/logger";
8
9
  import { getConfiguration } from "@intlayer/config/node";
9
- import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
10
- import { prepareIntlayer, writeContentDeclaration } from "@intlayer/engine/build";
11
- import { listGitFiles, logConfigDetails } from "@intlayer/engine/cli";
12
- import { formatPath, parallelize } from "@intlayer/engine/utils";
13
10
  import * as fsPromises from "node:fs/promises";
11
+ import { formatPath, parallelize } from "@intlayer/engine/utils";
12
+ import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
13
+ import { prepareIntlayer as prepareIntlayer$1, writeContentDeclaration } from "@intlayer/engine/build";
14
14
 
15
15
  //#region src/push/push.ts
16
16
  const statusIconsAndColors = {
@@ -45,8 +45,8 @@ const push = async (options) => {
45
45
  const config = getConfiguration(options?.configOptions);
46
46
  logConfigDetails(options?.configOptions);
47
47
  const appLogger = getAppLogger(config);
48
- if (options?.build === true) await prepareIntlayer(config, { forceRun: true });
49
- else if (typeof options?.build === "undefined") await prepareIntlayer(config);
48
+ if (options?.build === true) await prepareIntlayer$1(config, { forceRun: true });
49
+ else if (typeof options?.build === "undefined") await prepareIntlayer$1(config);
50
50
  try {
51
51
  if (!await checkCMSAuth(config)) return;
52
52
  const intlayerAPI = await getAuthenticatedAPI(config);
@@ -1 +1 @@
1
- {"version":3,"file":"push.mjs","names":[],"sources":["../../../src/push/push.ts"],"sourcesContent":["import * as fsPromises from 'node:fs/promises';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizeKey, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/dictionaries-entry/unmerged';\nimport {\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport { formatPath, parallelize } from '@intlayer/engine/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { loadPrompts } from '../loadPrompts';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from '../utils/checkAccess';\nimport { selectCmsEnvironment } from '../utils/selectCmsEnvironment';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status:\n | 'pending'\n | 'pushing'\n | 'modified'\n | 'pushed'\n | 'up-to-date'\n | 'unknown'\n | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n// Print per-dictionary summary similar to loadDictionaries\nconst statusIconsAndColors = {\n pushed: { icon: '✔', color: ANSIColors.GREEN },\n modified: { icon: '✔', color: ANSIColors.GREEN },\n 'up-to-date': { icon: '=', color: ANSIColors.GREY },\n error: { icon: '✖', color: ANSIColors.RED },\n default: { icon: '⏲', color: ANSIColors.BLUE },\n};\n\nconst getIconAndColor = (status: DictionariesStatus['status']) => {\n return (\n statusIconsAndColors[status as keyof typeof statusIconsAndColors] ??\n statusIconsAndColors.default\n );\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n try {\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 const allDictionaries = Object.values(unmergedDictionariesRecord).flat();\n\n const customLocations = Array.from(\n new Set(\n allDictionaries\n .map((dictionary) => dictionary.location)\n .filter(\n (location) =>\n location && !['remote', 'local', 'hybrid'].includes(location)\n )\n )\n ) as string[];\n\n // Include all custom locations automatically — no interactive prompt needed.\n const selectedCustomLocations: string[] = customLocations;\n\n let dictionaries: Dictionary[] = allDictionaries.filter((dictionary) => {\n const location =\n dictionary.location ?? config.dictionary?.location ?? 'local';\n\n return (\n location === 'remote' ||\n location === 'hybrid' ||\n selectedCustomLocations.includes(location)\n );\n });\n\n // Check if the dictionaries list is empty after filtering by location\n if (dictionaries.length === 0) {\n appLogger(\n `No dictionaries found to push. Only dictionaries with location ${colorize('remote', ANSIColors.BLUE, ANSIColors.RESET)}, ${colorize('hybrid', ANSIColors.BLUE, ANSIColors.RESET)} or selected custom locations are pushed.`,\n { level: 'warn' }\n );\n appLogger(\n `You can set the location in your dictionary file (e.g. ${colorize(\"{ key: 'my-key', location: 'hybrid', ... }\", ANSIColors.BLUE, ANSIColors.RESET)} or globally in your intlayer.config.ts file (e.g. ${colorize(\"{ dictionary: { location: 'hybrid' } }\", ANSIColors.BLUE, ANSIColors.RESET)}).`,\n { level: 'info' }\n );\n return;\n }\n\n const existingDictionariesKeys: string[] = Object.keys(\n unmergedDictionariesRecord\n );\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries?.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.system.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries ?? [];\n const newDictionaries = pushResult.data?.newDictionaries ?? [];\n const upToDateDictionaries =\n pushResult.data?.upToDateDictionaries ?? [];\n\n const allDictionaries = [\n ...updatedDictionaries,\n ...newDictionaries,\n ...upToDateDictionaries,\n ];\n\n for (const remoteDictionaryData of allDictionaries) {\n const localDictionary = unmergedDictionariesRecord[\n remoteDictionaryData.key\n ]?.find(\n (dictionary) => dictionary.localId === remoteDictionaryData.localId\n );\n\n if (!localDictionary) continue;\n\n await writeContentDeclaration(\n { ...localDictionary, id: remoteDictionaryData.id },\n config\n );\n }\n\n if (\n updatedDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (\n newDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else if (\n upToDateDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'up-to-date';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'up-to-date' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n for (const dictionaryStatus of dictionariesStatuses) {\n const { icon, color } = getIconAndColor(dictionaryStatus.status);\n appLogger(\n ` - ${colorizeKey(dictionaryStatus.dictionary.key)} ${ANSIColors.GREY}[${color}${icon} ${dictionaryStatus.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\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const remoteDictionaries = successfullyPushedDictionaries.filter(\n (dictionary) => dictionary.location === 'remote'\n );\n const remoteDictionariesKeys = remoteDictionaries.map(\n (dictionary) => dictionary.key\n );\n\n if (remoteDictionaries.length > 0) {\n const { confirm, isCancel } = await loadPrompts();\n\n const shouldDelete = await confirm({\n message: `Do you want to delete the local dictionaries that were successfully pushed? ${colorize('(Dictionaries:', ANSIColors.GREY, ANSIColors.RESET)} ${colorizeKey(remoteDictionariesKeys)}${colorize(')', ANSIColors.GREY, ANSIColors.RESET)}`,\n initialValue: false,\n });\n\n if (isCancel(shouldDelete)) {\n return;\n }\n\n if (shouldDelete) {\n await deleteLocalDictionaries(remoteDictionaries, options);\n }\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(\n `Dictionary ${colorizeKey(dictionary.key)} does not have a file path`,\n {\n level: 'error',\n }\n );\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],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AAS,aAAa;CACtD,MAAM,YAAY,aAAa,MAAM;CAGrC,MAAM,+BAA4B,IAAI,IAAI;CAE1C,KAAK,MAAM,cAAc,sBAAsB;EAC7C,MAAM,EAAE,aAAa;EAErB,IAAI,CAAC,UAAU;GACb,UACE,cAAc,YAAY,WAAW,GAAG,EAAE,6BAC1C,EACE,OAAO,QACT,CACF;GACA;EACF;EAEA,aAAa,IAAI,QAAQ;CAC3B;CAEA,KAAK,MAAM,YAAY,cACrB,IAAI;EACF,MAAM,QAAQ,MAAM,WAAW,MAAM,QAAQ;EAE7C,IAAI,MAAM,OAAO,GAAG;GAClB,MAAM,WAAW,OAAO,QAAQ;GAChC,UAAU,gBAAgB,WAAW,QAAQ,KAAK,CAAC,CAAC;EACtD,OAAO,IAAI,MAAM,YAAY,GAC3B,UAAU,uBAAuB,WAAW,QAAQ,EAAE,cAAc,CAAC,CAAC;OAEtE,UACE,yBAAyB,WAAW,QAAQ,EAAE,cAC9C,CAAC,CACH;CAEJ,SAAS,KAAK;EACZ,UAAU,kBAAkB,WAAW,QAAQ,EAAE,IAAI,OAAO,EAC1D,OAAO,QACT,CAAC;CACH;AAEJ"}
1
+ {"version":3,"file":"push.mjs","names":["prepareIntlayer"],"sources":["../../../src/push/push.ts"],"sourcesContent":["import * as fsPromises from 'node:fs/promises';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizeKey, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/dictionaries-entry/unmerged';\nimport {\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport { formatPath, parallelize } from '@intlayer/engine/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { loadPrompts } from '../loadPrompts';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from '../utils/checkAccess';\nimport { selectCmsEnvironment } from '../utils/selectCmsEnvironment';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status:\n | 'pending'\n | 'pushing'\n | 'modified'\n | 'pushed'\n | 'up-to-date'\n | 'unknown'\n | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n// Print per-dictionary summary similar to loadDictionaries\nconst statusIconsAndColors = {\n pushed: { icon: '✔', color: ANSIColors.GREEN },\n modified: { icon: '✔', color: ANSIColors.GREEN },\n 'up-to-date': { icon: '=', color: ANSIColors.GREY },\n error: { icon: '✖', color: ANSIColors.RED },\n default: { icon: '⏲', color: ANSIColors.BLUE },\n};\n\nconst getIconAndColor = (status: DictionariesStatus['status']) => {\n return (\n statusIconsAndColors[status as keyof typeof statusIconsAndColors] ??\n statusIconsAndColors.default\n );\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n try {\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 const allDictionaries = Object.values(unmergedDictionariesRecord).flat();\n\n const customLocations = Array.from(\n new Set(\n allDictionaries\n .map((dictionary) => dictionary.location)\n .filter(\n (location) =>\n location && !['remote', 'local', 'hybrid'].includes(location)\n )\n )\n ) as string[];\n\n // Include all custom locations automatically — no interactive prompt needed.\n const selectedCustomLocations: string[] = customLocations;\n\n let dictionaries: Dictionary[] = allDictionaries.filter((dictionary) => {\n const location =\n dictionary.location ?? config.dictionary?.location ?? 'local';\n\n return (\n location === 'remote' ||\n location === 'hybrid' ||\n selectedCustomLocations.includes(location)\n );\n });\n\n // Check if the dictionaries list is empty after filtering by location\n if (dictionaries.length === 0) {\n appLogger(\n `No dictionaries found to push. Only dictionaries with location ${colorize('remote', ANSIColors.BLUE, ANSIColors.RESET)}, ${colorize('hybrid', ANSIColors.BLUE, ANSIColors.RESET)} or selected custom locations are pushed.`,\n { level: 'warn' }\n );\n appLogger(\n `You can set the location in your dictionary file (e.g. ${colorize(\"{ key: 'my-key', location: 'hybrid', ... }\", ANSIColors.BLUE, ANSIColors.RESET)} or globally in your intlayer.config.ts file (e.g. ${colorize(\"{ dictionary: { location: 'hybrid' } }\", ANSIColors.BLUE, ANSIColors.RESET)}).`,\n { level: 'info' }\n );\n return;\n }\n\n const existingDictionariesKeys: string[] = Object.keys(\n unmergedDictionariesRecord\n );\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries?.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.system.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries ?? [];\n const newDictionaries = pushResult.data?.newDictionaries ?? [];\n const upToDateDictionaries =\n pushResult.data?.upToDateDictionaries ?? [];\n\n const allDictionaries = [\n ...updatedDictionaries,\n ...newDictionaries,\n ...upToDateDictionaries,\n ];\n\n for (const remoteDictionaryData of allDictionaries) {\n const localDictionary = unmergedDictionariesRecord[\n remoteDictionaryData.key\n ]?.find(\n (dictionary) => dictionary.localId === remoteDictionaryData.localId\n );\n\n if (!localDictionary) continue;\n\n await writeContentDeclaration(\n { ...localDictionary, id: remoteDictionaryData.id },\n config\n );\n }\n\n if (\n updatedDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (\n newDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else if (\n upToDateDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'up-to-date';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'up-to-date' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n for (const dictionaryStatus of dictionariesStatuses) {\n const { icon, color } = getIconAndColor(dictionaryStatus.status);\n appLogger(\n ` - ${colorizeKey(dictionaryStatus.dictionary.key)} ${ANSIColors.GREY}[${color}${icon} ${dictionaryStatus.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\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const remoteDictionaries = successfullyPushedDictionaries.filter(\n (dictionary) => dictionary.location === 'remote'\n );\n const remoteDictionariesKeys = remoteDictionaries.map(\n (dictionary) => dictionary.key\n );\n\n if (remoteDictionaries.length > 0) {\n const { confirm, isCancel } = await loadPrompts();\n\n const shouldDelete = await confirm({\n message: `Do you want to delete the local dictionaries that were successfully pushed? ${colorize('(Dictionaries:', ANSIColors.GREY, ANSIColors.RESET)} ${colorizeKey(remoteDictionariesKeys)}${colorize(')', ANSIColors.GREY, ANSIColors.RESET)}`,\n initialValue: false,\n });\n\n if (isCancel(shouldDelete)) {\n return;\n }\n\n if (shouldDelete) {\n await deleteLocalDictionaries(remoteDictionaries, options);\n }\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(\n `Dictionary ${colorizeKey(dictionary.key)} does not have a file path`,\n {\n level: 'error',\n }\n );\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AAiDA,MAAM,uBAAuB;CAC3B,QAAQ;EAAE,MAAM;EAAK,OAAO,WAAW;CAAM;CAC7C,UAAU;EAAE,MAAM;EAAK,OAAO,WAAW;CAAM;CAC/C,cAAc;EAAE,MAAM;EAAK,OAAO,WAAW;CAAK;CAClD,OAAO;EAAE,MAAM;EAAK,OAAO,WAAW;CAAI;CAC1C,SAAS;EAAE,MAAM;EAAK,OAAO,WAAW;CAAK;AAC/C;AAEA,MAAM,mBAAmB,WAAyC;CAChE,OACE,qBAAqB,WACrB,qBAAqB;AA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MAAM,OAAO,GAAG;GAClB,MAAM,WAAW,OAAO,QAAQ;GAChC,UAAU,gBAAgB,WAAW,QAAQ,KAAK,CAAC,CAAC;EACtD,OAAO,IAAI,MAAM,YAAY,GAC3B,UAAU,uBAAuB,WAAW,QAAQ,EAAE,cAAc,CAAC,CAAC;OAEtE,UACE,yBAAyB,WAAW,QAAQ,EAAE,cAC9C,CAAC,CACH;CAEJ,SAAS,KAAK;EACZ,UAAU,kBAAkB,WAAW,QAAQ,EAAE,IAAI,OAAO,EAC1D,OAAO,QACT,CAAC;CACH;AAEJ"}
@@ -1,9 +1,9 @@
1
1
  import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
2
2
  import { selectCmsEnvironment } from "./utils/selectCmsEnvironment.mjs";
3
+ import { logConfigDetails } from "@intlayer/engine/cli";
3
4
  import { CYAN, GREY_DARK } from "@intlayer/config/colors";
4
5
  import { colorize, colorizeObject, getAppLogger } from "@intlayer/config/logger";
5
6
  import { getConfiguration } from "@intlayer/config/node";
6
- import { logConfigDetails } from "@intlayer/engine/cli";
7
7
 
8
8
  //#region src/pushConfig.ts
9
9
  const pushConfig = async (options) => {
@@ -6,14 +6,14 @@ import { reviewFileBlockAware } from "./reviewDocBlockAware.mjs";
6
6
  import { buildFileReviewReport, logReviewFileBlocks } from "./reviewDocLog.mjs";
7
7
  import { createReviewProgressLogger } from "./reviewDocProgress.mjs";
8
8
  import { formatReviewSynthesis } from "./reviewDocSynthesis.mjs";
9
- import { existsSync } from "node:fs";
10
9
  import { join, relative } from "node:path";
10
+ import { listGitFiles, listGitLines, logConfigDetails } from "@intlayer/engine/cli";
11
+ import { existsSync } from "node:fs";
11
12
  import * as ANSIColors from "@intlayer/config/colors";
12
13
  import { colorize, colorizeNumber, getAppLogger, x } from "@intlayer/config/logger";
13
14
  import { getConfiguration } from "@intlayer/config/node";
14
- import { listGitFiles, listGitLines, logConfigDetails } from "@intlayer/engine/cli";
15
- import { formatLocale, formatPath, parallelize } from "@intlayer/engine/utils";
16
15
  import { readFile } from "node:fs/promises";
16
+ import { formatLocale, formatPath, parallelize } from "@intlayer/engine/utils";
17
17
  import { buildReviewReport } from "@intlayer/engine/docReview";
18
18
  import fg from "fast-glob";
19
19
 
@@ -2,14 +2,14 @@ import { readAsset } from "../_virtual/_utils_asset.mjs";
2
2
  import { sanitizeChunk, validateTranslation } from "../translateDoc/validation.mjs";
3
3
  import { chunkInference } from "../utils/chunkInference.mjs";
4
4
  import { fixChunkStartEndChars } from "../utils/fixChunkStartEndChars.mjs";
5
- import { mkdirSync, writeFileSync } from "node:fs";
6
5
  import { dirname } from "node:path";
6
+ import { mkdirSync, writeFileSync } from "node:fs";
7
7
  import * as ANSIColors from "@intlayer/config/colors";
8
8
  import { colon, colorize, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
9
9
  import { getConfiguration } from "@intlayer/config/node";
10
- import { retryManager } from "@intlayer/config/utils";
11
- import { formatLocale, formatPath } from "@intlayer/engine/utils";
12
10
  import { readFile } from "node:fs/promises";
11
+ import { formatLocale, formatPath } from "@intlayer/engine/utils";
12
+ import { retryManager } from "@intlayer/config/utils";
13
13
  import { buildAlignmentPlan, mergeReviewedSegments } from "@intlayer/engine/docReview";
14
14
  import { getLocaleName } from "@intlayer/core/localization";
15
15
  import { ENGLISH } from "@intlayer/types/locales";
@@ -1,8 +1,8 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { getAppLogger } from "@intlayer/config/logger";
3
3
  import { getConfiguration } from "@intlayer/config/node";
4
- import { formatLocale, formatPath } from "@intlayer/engine/utils";
5
4
  import { readFile } from "node:fs/promises";
5
+ import { formatLocale, formatPath } from "@intlayer/engine/utils";
6
6
  import { buildReviewReport, formatReviewReport } from "@intlayer/engine/docReview";
7
7
 
8
8
  //#region src/reviewDoc/reviewDocLog.ts
@@ -1,6 +1,6 @@
1
+ import { logConfigDetails } from "@intlayer/engine/cli";
1
2
  import { colorizeKey, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
2
3
  import { getConfiguration } from "@intlayer/config/node";
3
- import { logConfigDetails } from "@intlayer/engine/cli";
4
4
  import { getSearchAPI } from "@intlayer/api";
5
5
 
6
6
  //#region src/searchDoc.ts
@@ -1,6 +1,6 @@
1
+ import { logConfigDetails } from "@intlayer/engine/cli";
1
2
  import { getConfiguration } from "@intlayer/config/node";
2
3
  import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
3
- import { logConfigDetails } from "@intlayer/engine/cli";
4
4
  import { getMissingLocalesContentFromDictionary } from "@intlayer/core/plugins";
5
5
  import { getDictionaries } from "@intlayer/dictionaries-entry";
6
6
 
@@ -2,8 +2,8 @@ import { listMissingTranslations } from "./listMissingTranslations.mjs";
2
2
  import * as ANSIColors from "@intlayer/config/colors";
3
3
  import { colon, colorize, colorizeKey, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
4
4
  import { getConfiguration } from "@intlayer/config/node";
5
- import { prepareIntlayer } from "@intlayer/engine/build";
6
5
  import { formatLocale, formatPath } from "@intlayer/engine/utils";
6
+ import { prepareIntlayer } from "@intlayer/engine/build";
7
7
 
8
8
  //#region src/test/test.ts
9
9
  const testMissingTranslations = async (options) => {
@@ -2,12 +2,12 @@ import { setupAI } from "../utils/setupAI.mjs";
2
2
  import { getOutputFilePath } from "../utils/getOutputFilePath.mjs";
3
3
  import { checkFileModifiedRange } from "../utils/checkFileModifiedRange.mjs";
4
4
  import { translateFile } from "./translateFile.mjs";
5
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
6
5
  import { dirname, join } from "node:path";
6
+ import { listGitFiles, logConfigDetails } from "@intlayer/engine/cli";
7
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
7
8
  import * as ANSIColors from "@intlayer/config/colors";
8
9
  import { colorize, colorizeNumber, getAppLogger, x } from "@intlayer/config/logger";
9
10
  import { getConfiguration } from "@intlayer/config/node";
10
- import { listGitFiles, logConfigDetails } from "@intlayer/engine/cli";
11
11
  import { pLimit, parallelize } from "@intlayer/engine/utils";
12
12
  import fg from "fast-glob";
13
13
  import { performance } from "node:perf_hooks";
@@ -6,9 +6,9 @@ import { chunkText } from "../utils/calculateChunks.mjs";
6
6
  import { dirname, relative } from "node:path";
7
7
  import * as ANSIColors from "@intlayer/config/colors";
8
8
  import { colon, colorize, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
9
- import { retryManager } from "@intlayer/config/utils";
10
- import { formatLocale, formatPath } from "@intlayer/engine/utils";
11
9
  import { mkdir, readFile, writeFile } from "node:fs/promises";
10
+ import { formatLocale, formatPath } from "@intlayer/engine/utils";
11
+ import { retryManager } from "@intlayer/config/utils";
12
12
  import { performance } from "node:perf_hooks";
13
13
 
14
14
  //#region src/translateDoc/translateFile.ts
@@ -1,5 +1,5 @@
1
- import { parseStringPattern } from "@intlayer/config/utils";
2
1
  import { resolveRelativePath } from "@intlayer/engine/utils";
2
+ import { parseStringPattern } from "@intlayer/config/utils";
3
3
 
4
4
  //#region src/utils/getOutputFilePath.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
1
  import { dirname, resolve } from "node:path";
2
+ import { existsSync, readFileSync } from "node:fs";
3
3
 
4
4
  //#region src/utils/getParentPackageJSON.ts
5
5
  const getParentPackageJSON = (startDir) => {
@@ -1,6 +1,6 @@
1
+ import { logConfigDetails } from "@intlayer/engine/cli";
1
2
  import { getAppLogger } from "@intlayer/config/logger";
2
3
  import { getConfiguration } from "@intlayer/config/node";
3
- import { logConfigDetails } from "@intlayer/engine/cli";
4
4
  import { claimCliContentWatcher, reportRedundantContentWatcher, runParallel } from "@intlayer/engine/utils";
5
5
  import { watch } from "@intlayer/engine/watcher";
6
6
 
@@ -5,6 +5,7 @@ import { startEditor } from "./editor.js";
5
5
  import { extract } from "./extract.js";
6
6
  import { FillOptions, fill } from "./fill/fill.js";
7
7
  import { findProjectRoot, init } from "./init.js";
8
+ import { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, InfraMode, InitInfraOptions, initInfra, parseInfraMode } from "./initInfra.js";
8
9
  import { PLATFORM_OPTIONS, getDetectedPlatform, initSkills } from "./initSkills.js";
9
10
  import { listContentDeclaration, listContentDeclarationRows } from "./listContentDeclaration.js";
10
11
  import { ListProjectsCommandOptions, listProjectsCommand } from "./listProjects.js";
@@ -23,4 +24,4 @@ export type * from "@intlayer/engine/cli";
23
24
  export type * from "@intlayer/engine/build";
24
25
  export type * from "@intlayer/engine/utils";
25
26
  export type * from "@intlayer/engine/watcher";
26
- export { ConfigurationOptions, FillOptions, ListProjectsCommandOptions, PLATFORM_OPTIONS, ReviewDocMode, ScanCommandOptions, build, bundle, dirname, extract, fill, findProjectRoot, getDetectedPlatform, init, initSkills, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, listProjectsCommand, liveSync, pull, push, pushConfig, reviewDoc, scan, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
27
+ export { ConfigurationOptions, FillOptions, INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, InfraMode, InitInfraOptions, ListProjectsCommandOptions, PLATFORM_OPTIONS, ReviewDocMode, ScanCommandOptions, build, bundle, dirname, extract, fill, findProjectRoot, getDetectedPlatform, init, initInfra, initSkills, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, listProjectsCommand, liveSync, parseInfraMode, pull, push, pushConfig, reviewDoc, scan, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;qBAwBa,kBAAe;qBAyXf,OAAI,sBACK,UACV,aAAW,0BACA"}
1
+ {"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;qBAyBa,kBAAe;qBAkZf,OAAI,sBACK,UACV,aAAW,0BACA"}