@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.cjs","names":["resolve","existsSync","join","readFileSync","loadPrompts","detectCompatI18nLibraries","initIntlayer","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","initSkills","initMCP","initCompiler","initBuildOptimization","login","setupCmsCredentials"],"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,mBAAeA,mBAAQ,YAAY,IAAI,GAAG;EAC/C,QAAIC,wBAAWC,gBAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,iBAAaF,mBAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAeA,MAAM,yBAID;CACH;EACE,O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AS,cAAc,GAAG;EAC9B,EAAE,OAAO,sBAAsB;EAC/B;CACF;CAEA,IAAI,gBAAgB;EAClB,EAAE,IAAI,KAAK,uDAAuD;EAGlE,MAAMC,yBAAM;GACV,WAAW;GACX,gBAAgB,oBAAgBC,0CAAoB,MAAM,WAAW;EACvE,CAAC;CACH;CAEA,EAAE,MAAM,kCAAkC;AAC5C;AAEA,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,oBAAgBf,mBAAQ,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,UAAMM,mCAAa,MAAM,OAAO;AAClC"}
1
+ {"version":3,"file":"init.cjs","names":["resolve","existsSync","join","readFileSync","loadPrompts","detectCompatI18nLibraries","initIntlayer","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","initSkills","initMCP","initCompiler","initBuildOptimization","initInfra","login","setupCmsCredentials"],"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,mBAAeA,mBAAQ,YAAY,IAAI,GAAG;EAC/C,QAAIC,wBAAWC,gBAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,iBAAaF,mBAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAgBA,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;CACR;CACA;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;CACR;AACF;;;;;;AAOA,MAAM,2BAID,CACH;CACE,OAAO;CACP,OAAO;CACP,MAAM;AACR,CACF;;AAGA,MAAM,uBAID;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;CACR;AACF;;;;;;AAOA,MAAM,2BAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;;AAGA,MAAM,0BAA0B,SAAyC;CACvE,IAAI;EACF,MAAM,sBAAkBE,gBAAK,MAAM,cAAc;EACjD,IAAI,KAACD,oBAAW,eAAe,GAAG,OAAO,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AAS,IAAI;KACb,MAAM,IAAI;IACZ,EAAE;GACJ,CAAC,EACwB,CAAC;EAC5B,QAAQ;GACN,EAAE,OAAO,sBAAsB;GAC/B;EACF;CACF;CAEA,IAAI,MAAM,SAAS,QAAQ,GACzB,MAAMC,8BAAW,MAAM,cAAc;CAGvC,IAAI,MAAM,SAAS,KAAK,GACtB,MAAMC,wBAAQ,MAAM,cAAc;CAGpC,IAAI,MAAM,SAAS,UAAU,GAC3B,MAAMC,kCAAa,IAAI;CAGzB,IAAI,MAAM,SAAS,mBAAmB,GACpC,MAAMC,oDAAsB,IAAI;CAIlC,IAAI,MAAM,SAAS,OAAO,GACxB,MAAMC,4BAAU;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,MAAMC,yBAAM;GACV,WAAW;GACX,gBAAgB,oBAAgBC,0CAAoB,MAAM,WAAW;EACvE,CAAC;CACH;CAEA,EAAE,MAAM,kCAAkC;AAC5C;AAEA,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,oBAAgBhB,mBAAQ,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,UAAMM,mCAAa,MAAM,OAAO;AAClC"}
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_loadPrompts = require('./loadPrompts.cjs');
3
3
  const require_init = require('./init.cjs');
4
- let node_fs = require("node:fs");
5
4
  let node_path = require("node:path");
6
5
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
6
+ let node_fs = require("node:fs");
7
7
 
8
8
  //#region src/initBuildOptimization.ts
9
9
  /** Babel config filenames Next.js picks up, ordered by preference. */
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_loadPrompts = require('./loadPrompts.cjs');
3
3
  const require_init = require('./init.cjs');
4
- let node_fs = require("node:fs");
5
4
  let node_path = require("node:path");
6
5
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
6
+ let node_fs = require("node:fs");
7
7
 
8
8
  //#region src/initCompiler.ts
9
9
  /**
@@ -0,0 +1,105 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_loadPrompts = require('./loadPrompts.cjs');
3
+ let node_path = require("node:path");
4
+ let node_child_process = require("node:child_process");
5
+ let node_os = require("node:os");
6
+ let node_fs_promises = require("node:fs/promises");
7
+
8
+ //#region src/initInfra.ts
9
+ /** Setup modes understood by the hosted installer. */
10
+ const INFRA_MODES = [
11
+ "desktop",
12
+ "docker",
13
+ "compose"
14
+ ];
15
+ /**
16
+ * The hosted installers are the single source of truth for the infrastructure
17
+ * setup flow (desktop app, all-in-one container, Compose stack). The CLI runs
18
+ * them rather than re-implementing the same steps in JavaScript.
19
+ */
20
+ const INSTALL_SCRIPT_URL = "https://intlayer.org/install.sh";
21
+ const INSTALL_SCRIPT_URL_WINDOWS = "https://intlayer.org/install.ps1";
22
+ const POSIX_RUNNER = {
23
+ url: INSTALL_SCRIPT_URL,
24
+ fileName: "install.sh",
25
+ command: (scriptPath, mode) => ["sh", [scriptPath, ...mode ? ["--mode", mode] : []]]
26
+ };
27
+ const WINDOWS_RUNNER = {
28
+ url: INSTALL_SCRIPT_URL_WINDOWS,
29
+ fileName: "install.ps1",
30
+ command: (scriptPath, mode) => ["powershell", [
31
+ "-NoProfile",
32
+ "-ExecutionPolicy",
33
+ "Bypass",
34
+ "-File",
35
+ scriptPath,
36
+ ...mode ? ["-Mode", mode] : []
37
+ ]]
38
+ };
39
+ const getInstallerRunner = () => process.platform === "win32" ? WINDOWS_RUNNER : POSIX_RUNNER;
40
+ /**
41
+ * Validates a user-provided mode against {@link INFRA_MODES}.
42
+ *
43
+ * @throws When the value is not a known mode.
44
+ */
45
+ const parseInfraMode = (value) => {
46
+ if (INFRA_MODES.includes(value)) return value;
47
+ throw new Error(`Unknown infra mode "${value}". Expected one of: ${INFRA_MODES.join(", ")}`);
48
+ };
49
+ /**
50
+ * Runs the installer with the terminal attached, so its own prompts and
51
+ * progress bars reach the user unchanged.
52
+ *
53
+ * @returns The script's exit code.
54
+ */
55
+ const runInstaller = (command, args) => new Promise((resolve, reject) => {
56
+ const child = (0, node_child_process.spawn)(command, args, { stdio: "inherit" });
57
+ child.on("error", reject);
58
+ child.on("close", (code) => resolve(code ?? 1));
59
+ });
60
+ /**
61
+ * Downloads the hosted installer and runs it: desktop app, all-in-one Docker
62
+ * container or Docker Compose stack, chosen interactively unless `mode` is set.
63
+ *
64
+ * Exposed as `intlayer init infra` and as a step of `intlayer init --interactive`.
65
+ */
66
+ const initInfra = async (options = {}) => {
67
+ const p = await require_loadPrompts.loadPrompts();
68
+ const runner = getInstallerRunner();
69
+ const scriptUrl = options.scriptUrl ?? runner.url;
70
+ const spinner = p.spinner();
71
+ spinner.start(`Fetching ${scriptUrl}`);
72
+ let script;
73
+ try {
74
+ const response = await fetch(scriptUrl);
75
+ if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
76
+ script = await response.text();
77
+ } catch (error) {
78
+ spinner.stop("Could not download the installer", 1);
79
+ p.log.error(`${error.message}\nRun it directly: ${process.platform === "win32" ? `irm ${scriptUrl} | iex` : `curl -fsSL ${scriptUrl} | sh`}`);
80
+ process.exitCode = 1;
81
+ return;
82
+ }
83
+ spinner.stop("Installer downloaded");
84
+ const directory = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "intlayer-install-"));
85
+ const scriptPath = (0, node_path.join)(directory, runner.fileName);
86
+ try {
87
+ await (0, node_fs_promises.writeFile)(scriptPath, script, { mode: 448 });
88
+ const [command, args] = runner.command(scriptPath, options.mode);
89
+ const exitCode = await runInstaller(command, args);
90
+ if (exitCode !== 0) process.exitCode = exitCode;
91
+ } finally {
92
+ await (0, node_fs_promises.rm)(directory, {
93
+ recursive: true,
94
+ force: true
95
+ });
96
+ }
97
+ };
98
+
99
+ //#endregion
100
+ exports.INFRA_MODES = INFRA_MODES;
101
+ exports.INSTALL_SCRIPT_URL = INSTALL_SCRIPT_URL;
102
+ exports.INSTALL_SCRIPT_URL_WINDOWS = INSTALL_SCRIPT_URL_WINDOWS;
103
+ exports.initInfra = initInfra;
104
+ exports.parseInfraMode = parseInfraMode;
105
+ //# sourceMappingURL=initInfra.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initInfra.cjs","names":["spawn","loadPrompts","mkdtemp","join","tmpdir","writeFile","rm"],"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,IAAI,IAAI,CAAC,CAAE,CAChD;AACF;AAEA,MAAM,iBAAkC;CACtC,KAAK;CACL,UAAU;CACV,UAAU,YAAY,SAAS,CAC7B,cACA;EACE;EACA;EACA;EACA;EACA;EACA,GAAI,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;CAChC,CACF;AACF;AAEA,MAAM,2BACJ,QAAQ,aAAa,UAAU,iBAAiB;;;;;;AAOlD,MAAa,kBAAkB,UAA6B;CAC1D,IAAK,YAAkC,SAAS,KAAK,GACnD,OAAO;CAGT,MAAM,IAAI,MACR,uBAAuB,MAAM,sBAAsB,YAAY,KAAK,IAAI,GAC1E;AACF;;;;;;;AAQA,MAAM,gBAAgB,SAAiB,SACrC,IAAI,SAAS,SAAS,WAAW;CAC/B,MAAM,YAAQA,0BAAM,SAAS,MAAM,EAAE,OAAO,UAAU,CAAC;CAEvD,MAAM,GAAG,SAAS,MAAM;CACxB,MAAM,GAAG,UAAU,SAAS,QAAQ,QAAQ,CAAC,CAAC;AAChD,CAAC;;;;;;;AAQH,MAAa,YAAY,OACvB,UAA4B,CAAC,MACX;CAClB,MAAM,IAAI,MAAMC,gCAAY;CAC5B,MAAM,SAAS,mBAAmB;CAClC,MAAM,YAAY,QAAQ,aAAa,OAAO;CAE9C,MAAM,UAAU,EAAE,QAAQ;CAC1B,QAAQ,MAAM,YAAY,WAAW;CAErC,IAAI;CAEJ,IAAI;EACF,MAAM,WAAW,MAAM,MAAM,SAAS;EAEtC,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,GAAG,SAAS,OAAO,GAAG,SAAS,YAAY;EAG7D,SAAS,MAAM,SAAS,KAAK;CAC/B,SAAS,OAAO;EACd,QAAQ,KAAK,oCAAoC,CAAC;EAClD,EAAE,IAAI,MACJ,GAAI,MAAgB,QAAQ,qBAC1B,QAAQ,aAAa,UACjB,OAAO,UAAU,UACjB,cAAc,UAAU,QAEhC;EACA,QAAQ,WAAW;EACnB;CACF;CAEA,QAAQ,KAAK,sBAAsB;CAEnC,MAAM,YAAY,UAAMC,8BAAQC,oBAAKC,gBAAO,GAAG,mBAAmB,CAAC;CACnE,MAAM,iBAAaD,gBAAK,WAAW,OAAO,QAAQ;CAElD,IAAI;EACF,UAAME,4BAAU,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,UAAMC,qBAAG,WAAW;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;CACtD;AACF"}
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_loadPrompts = require('./loadPrompts.cjs');
4
4
  const require_init = require('./init.cjs');
5
- let node_fs = require("node:fs");
6
5
  let node_path = require("node:path");
7
6
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
8
7
  let enquirer = require("enquirer");
9
8
  enquirer = require_runtime.__toESM(enquirer);
9
+ let node_fs = require("node:fs");
10
10
 
11
11
  //#region src/initSkills.ts
12
12
  const PLATFORM_CHECKS = _intlayer_engine_cli.PLATFORMS.filter((platform) => _intlayer_engine_cli.PLATFORMS_METADATA[platform]?.check).map((platform) => ({
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let node_path = require("node:path");
3
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
3
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
4
5
  let _intlayer_config_node = require("@intlayer/config/node");
5
- let _intlayer_dictionaries_entry_unmerged = require("@intlayer/dictionaries-entry/unmerged");
6
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
6
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
7
+ let _intlayer_dictionaries_entry_unmerged = require("@intlayer/dictionaries-entry/unmerged");
8
8
 
9
9
  //#region src/listContentDeclaration.ts
10
10
  const listContentDeclarationRows = async (options) => {
@@ -1,18 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_IntlayerEventListener = require('./IntlayerEventListener.cjs');
4
+ let node_http = require("node:http");
4
5
  let _intlayer_config_colors = require("@intlayer/config/colors");
5
6
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
6
7
  let _intlayer_config_logger = require("@intlayer/config/logger");
7
8
  let _intlayer_config_node = require("@intlayer/config/node");
9
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
8
10
  let _intlayer_dictionaries_entry_unmerged = require("@intlayer/dictionaries-entry/unmerged");
9
11
  let _intlayer_engine_build = require("@intlayer/engine/build");
10
- let _intlayer_engine_utils = require("@intlayer/engine/utils");
11
- let node_http = require("node:http");
12
- let _intlayer_config_package_json = require("@intlayer/config/package.json");
13
- _intlayer_config_package_json = require_runtime.__toESM(_intlayer_config_package_json);
14
12
  let _intlayer_core_plugins = require("@intlayer/core/plugins");
15
13
  let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
14
+ let _intlayer_config_package_json = require("@intlayer/config/package.json");
15
+ _intlayer_config_package_json = require_runtime.__toESM(_intlayer_config_package_json);
16
16
 
17
17
  //#region src/liveSync.ts
18
18
  const writeDictionary = async (dictionary, configuration) => {
package/dist/cjs/pull.cjs CHANGED
@@ -1,19 +1,19 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_push_pullLog = require('./push/pullLog.cjs');
4
3
  const require_utils_checkAccess = require('./utils/checkAccess.cjs');
4
+ const require_push_pullLog = require('./push/pullLog.cjs');
5
5
  const require_utils_selectCmsEnvironment = require('./utils/selectCmsEnvironment.cjs');
6
- let node_fs = require("node:fs");
7
6
  let node_path = require("node:path");
7
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
8
+ let node_fs = require("node:fs");
8
9
  let _intlayer_config_colors = require("@intlayer/config/colors");
9
10
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
10
11
  let _intlayer_config_logger = require("@intlayer/config/logger");
11
12
  let _intlayer_config_node = require("@intlayer/config/node");
13
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
12
14
  let _intlayer_config_utils = require("@intlayer/config/utils");
13
15
  let _intlayer_dictionaries_entry_unmerged = require("@intlayer/dictionaries-entry/unmerged");
14
16
  let _intlayer_engine_build = require("@intlayer/engine/build");
15
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
16
- let _intlayer_engine_utils = require("@intlayer/engine/utils");
17
17
 
18
18
  //#region src/pull.ts
19
19
  /**
@@ -1,20 +1,20 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_loadPrompts = require('../loadPrompts.cjs');
3
4
  const require_utils_checkAccess = require('../utils/checkAccess.cjs');
4
5
  const require_utils_selectCmsEnvironment = require('../utils/selectCmsEnvironment.cjs');
5
6
  const require_pushLog = require('../pushLog.cjs');
6
- const require_loadPrompts = require('../loadPrompts.cjs');
7
7
  let node_path = require("node:path");
8
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
8
9
  let _intlayer_config_colors = require("@intlayer/config/colors");
9
10
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
10
11
  let _intlayer_config_logger = require("@intlayer/config/logger");
11
12
  let _intlayer_config_node = require("@intlayer/config/node");
12
- let _intlayer_dictionaries_entry_unmerged = require("@intlayer/dictionaries-entry/unmerged");
13
- let _intlayer_engine_build = require("@intlayer/engine/build");
14
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
15
- let _intlayer_engine_utils = require("@intlayer/engine/utils");
16
13
  let node_fs_promises = require("node:fs/promises");
17
14
  node_fs_promises = require_runtime.__toESM(node_fs_promises);
15
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
16
+ let _intlayer_dictionaries_entry_unmerged = require("@intlayer/dictionaries-entry/unmerged");
17
+ let _intlayer_engine_build = require("@intlayer/engine/build");
18
18
 
19
19
  //#region src/push/push.ts
20
20
  const statusIconsAndColors = {
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils_checkAccess = require('./utils/checkAccess.cjs');
3
3
  const require_utils_selectCmsEnvironment = require('./utils/selectCmsEnvironment.cjs');
4
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
4
5
  let _intlayer_config_colors = require("@intlayer/config/colors");
5
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
6
7
  let _intlayer_config_node = require("@intlayer/config/node");
7
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
8
8
 
9
9
  //#region src/pushConfig.ts
10
10
  const pushConfig = async (options) => {
@@ -8,15 +8,15 @@ const require_reviewDoc_reviewDocBlockAware = require('./reviewDocBlockAware.cjs
8
8
  const require_reviewDoc_reviewDocLog = require('./reviewDocLog.cjs');
9
9
  const require_reviewDoc_reviewDocProgress = require('./reviewDocProgress.cjs');
10
10
  const require_reviewDoc_reviewDocSynthesis = require('./reviewDocSynthesis.cjs');
11
- let node_fs = require("node:fs");
12
11
  let node_path = require("node:path");
12
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
13
+ let node_fs = require("node:fs");
13
14
  let _intlayer_config_colors = require("@intlayer/config/colors");
14
15
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
15
16
  let _intlayer_config_logger = require("@intlayer/config/logger");
16
17
  let _intlayer_config_node = require("@intlayer/config/node");
17
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
18
- let _intlayer_engine_utils = require("@intlayer/engine/utils");
19
18
  let node_fs_promises = require("node:fs/promises");
19
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
20
20
  let _intlayer_engine_docReview = require("@intlayer/engine/docReview");
21
21
  let fast_glob = require("fast-glob");
22
22
  fast_glob = require_runtime.__toESM(fast_glob);
@@ -4,15 +4,15 @@ const require__utils_asset = require('../_virtual/_utils_asset.cjs');
4
4
  const require_translateDoc_validation = require('../translateDoc/validation.cjs');
5
5
  const require_utils_chunkInference = require('../utils/chunkInference.cjs');
6
6
  const require_utils_fixChunkStartEndChars = require('../utils/fixChunkStartEndChars.cjs');
7
- let node_fs = require("node:fs");
8
7
  let node_path = require("node:path");
8
+ let node_fs = require("node:fs");
9
9
  let _intlayer_config_colors = require("@intlayer/config/colors");
10
10
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
11
11
  let _intlayer_config_logger = require("@intlayer/config/logger");
12
12
  let _intlayer_config_node = require("@intlayer/config/node");
13
- let _intlayer_config_utils = require("@intlayer/config/utils");
14
- let _intlayer_engine_utils = require("@intlayer/engine/utils");
15
13
  let node_fs_promises = require("node:fs/promises");
14
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
15
+ let _intlayer_config_utils = require("@intlayer/config/utils");
16
16
  let _intlayer_engine_docReview = require("@intlayer/engine/docReview");
17
17
  let _intlayer_core_localization = require("@intlayer/core/localization");
18
18
  let _intlayer_types_locales = require("@intlayer/types/locales");
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let node_fs = require("node:fs");
3
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
4
4
  let _intlayer_config_node = require("@intlayer/config/node");
5
- let _intlayer_engine_utils = require("@intlayer/engine/utils");
6
5
  let node_fs_promises = require("node:fs/promises");
6
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
7
7
  let _intlayer_engine_docReview = require("@intlayer/engine/docReview");
8
8
 
9
9
  //#region src/reviewDoc/reviewDocLog.ts
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
2
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
3
4
  let _intlayer_config_node = require("@intlayer/config/node");
4
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
5
5
  let _intlayer_api = require("@intlayer/api");
6
6
 
7
7
  //#region src/searchDoc.ts
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
2
3
  let _intlayer_config_node = require("@intlayer/config/node");
3
4
  let _intlayer_dictionaries_entry_unmerged = require("@intlayer/dictionaries-entry/unmerged");
4
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
5
5
  let _intlayer_core_plugins = require("@intlayer/core/plugins");
6
6
  let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
7
7
 
@@ -5,8 +5,8 @@ let _intlayer_config_colors = require("@intlayer/config/colors");
5
5
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
6
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
7
7
  let _intlayer_config_node = require("@intlayer/config/node");
8
- let _intlayer_engine_build = require("@intlayer/engine/build");
9
8
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
9
+ let _intlayer_engine_build = require("@intlayer/engine/build");
10
10
 
11
11
  //#region src/test/test.ts
12
12
  const testMissingTranslations = async (options) => {
@@ -4,13 +4,13 @@ const require_utils_setupAI = require('../utils/setupAI.cjs');
4
4
  const require_utils_getOutputFilePath = require('../utils/getOutputFilePath.cjs');
5
5
  const require_utils_checkFileModifiedRange = require('../utils/checkFileModifiedRange.cjs');
6
6
  const require_translateDoc_translateFile = require('./translateFile.cjs');
7
- let node_fs = require("node:fs");
8
7
  let node_path = require("node:path");
8
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
9
+ let node_fs = require("node:fs");
9
10
  let _intlayer_config_colors = require("@intlayer/config/colors");
10
11
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
11
12
  let _intlayer_config_logger = require("@intlayer/config/logger");
12
13
  let _intlayer_config_node = require("@intlayer/config/node");
13
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
14
14
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
15
15
  let fast_glob = require("fast-glob");
16
16
  fast_glob = require_runtime.__toESM(fast_glob);
@@ -9,9 +9,9 @@ let node_path = require("node:path");
9
9
  let _intlayer_config_colors = require("@intlayer/config/colors");
10
10
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
11
11
  let _intlayer_config_logger = require("@intlayer/config/logger");
12
- let _intlayer_config_utils = require("@intlayer/config/utils");
13
- let _intlayer_engine_utils = require("@intlayer/engine/utils");
14
12
  let node_fs_promises = require("node:fs/promises");
13
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
14
+ let _intlayer_config_utils = require("@intlayer/config/utils");
15
15
  let node_perf_hooks = require("node:perf_hooks");
16
16
 
17
17
  //#region src/translateDoc/translateFile.ts
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- let _intlayer_config_utils = require("@intlayer/config/utils");
3
2
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
3
+ let _intlayer_config_utils = require("@intlayer/config/utils");
4
4
 
5
5
  //#region src/utils/getOutputFilePath.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- let node_fs = require("node:fs");
3
2
  let node_path = require("node:path");
3
+ let node_fs = require("node:fs");
4
4
 
5
5
  //#region src/utils/getParentPackageJSON.ts
6
6
  const getParentPackageJSON = (startDir) => {
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
2
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
3
4
  let _intlayer_config_node = require("@intlayer/config/node");
4
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
5
5
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
6
6
  let _intlayer_engine_watcher = require("@intlayer/engine/watcher");
7
7
 
@@ -1,5 +1,5 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
1
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
2
+ import { existsSync, readFileSync } from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
4
 
5
5
  //#region \0utils:asset
@@ -1,11 +1,11 @@
1
1
  import { openBrowser } from "../utils/openBrowser.mjs";
2
2
  import { writeCliSessionToken } from "./sessionToken.mjs";
3
- import * as ANSIColors from "@intlayer/config/colors";
4
- import { colorize, colorizePath, getAppLogger } from "@intlayer/config/logger";
5
- import { getConfiguration } from "@intlayer/config/node";
6
3
  import { logConfigDetails } from "@intlayer/engine/cli";
7
4
  import http from "node:http";
8
5
  import { URL } from "node:url";
6
+ import * as ANSIColors from "@intlayer/config/colors";
7
+ import { colorize, colorizePath, getAppLogger } from "@intlayer/config/logger";
8
+ import { getConfiguration } from "@intlayer/config/node";
9
9
 
10
10
  //#region src/auth/login.ts
11
11
  const buildSuccessHtml = (message) => `
@@ -1,5 +1,5 @@
1
- import { getConfiguration } from "@intlayer/config/node";
2
1
  import { logConfigDetails } from "@intlayer/engine/cli";
2
+ import { getConfiguration } from "@intlayer/config/node";
3
3
  import { claimCliContentWatcher, reportRedundantContentWatcher, runParallel } from "@intlayer/engine/utils";
4
4
  import { buildAndWatchIntlayer } from "@intlayer/engine/watcher";
5
5
 
package/dist/esm/ci.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve, sep } from "node:path";
2
- import { logger } from "@intlayer/config/logger";
3
2
  import { detectPackageManager, listProjects } from "@intlayer/engine/cli";
3
+ import { logger } from "@intlayer/config/logger";
4
4
  import { spawnSync } from "node:child_process";
5
5
 
6
6
  //#region src/ci.ts
package/dist/esm/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { getParentPackageJSON } from "./utils/getParentPackageJSON.mjs";
2
2
  import { dirname as dirname$1 } from "node:path";
3
+ import { fileURLToPath } from "node:url";
3
4
  import { logger, setPrefix } from "@intlayer/config/logger";
4
5
  import { getConfiguration } from "@intlayer/config/node";
5
- import { fileURLToPath } from "node:url";
6
6
  import { Command } from "commander";
7
7
 
8
8
  //#region src/cli.ts
@@ -165,6 +165,10 @@ const setAPI = () => {
165
165
  const { initMCP } = await import("./initMCP.mjs");
166
166
  return initMCP(options.projectRoot);
167
167
  });
168
+ initCmd.command("infra").description("Set up the Intlayer infrastructure: desktop app, all-in-one Docker container or Docker Compose stack (runs https://intlayer.org/install.sh, or install.ps1 on Windows)").option("-m, --mode <mode>", "Skip the menu: desktop | docker | compose").action(async (options) => {
169
+ const { initInfra, parseInfraMode } = await import("./initInfra.mjs");
170
+ return initInfra({ mode: options.mode ? parseInfraMode(options.mode) : void 0 });
171
+ });
168
172
  initCmd.command("build-optimization").description("Configure build optimization for Next.js (@intlayer/swc or @intlayer/babel)").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
169
173
  const { initBuildOptimization } = await import("./initBuildOptimization.mjs");
170
174
  return initBuildOptimization(options.projectRoot);