@inlang/paraglide-js 2.27.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/bundler-plugins/per-locale-build/index.js +14 -7
- package/dist/bundler-plugins/per-locale-build/index.js.map +1 -1
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js +235 -2
- package/dist/bundler-plugins/per-locale-build/vite-environments.test.js.map +1 -1
- package/dist/bundler-plugins/unplugin.d.ts +4 -1
- package/dist/bundler-plugins/unplugin.js +134 -22
- package/dist/bundler-plugins/unplugin.js.map +1 -1
- package/dist/bundler-plugins/unplugin.test.js +490 -1
- package/dist/bundler-plugins/unplugin.test.js.map +1 -1
- package/dist/bundler-plugins/vite-error-response.test.d.ts +1 -0
- package/dist/bundler-plugins/vite-error-response.test.js +171 -0
- package/dist/bundler-plugins/vite-error-response.test.js.map +1 -0
- package/dist/bundler-plugins/vite.d.ts +8 -0
- package/dist/bundler-plugins/vite.js +14 -4
- package/dist/bundler-plugins/vite.js.map +1 -1
- package/dist/bundler-plugins/vite.test.js +1 -1
- package/dist/bundler-plugins/vite.test.js.map +1 -1
- package/dist/cli/commands/compile/command.js +13 -0
- package/dist/cli/commands/compile/command.js.map +1 -1
- package/dist/cli/commands/compile/command.test.js +87 -3
- package/dist/cli/commands/compile/command.test.js.map +1 -1
- package/dist/cli/commands/init/command.d.ts +5 -0
- package/dist/cli/commands/init/command.js +213 -59
- package/dist/cli/commands/init/command.js.map +1 -1
- package/dist/cli/commands/init/command.test.d.ts +1 -0
- package/dist/cli/commands/init/command.test.js +123 -0
- package/dist/cli/commands/init/command.test.js.map +1 -0
- package/dist/cli/init-options.d.ts +11 -0
- package/dist/cli/init-options.js +2 -0
- package/dist/cli/init-options.js.map +1 -0
- package/dist/cli/steps/add-inlang-check.js +2 -2
- package/dist/cli/steps/add-inlang-check.js.map +1 -1
- package/dist/cli/steps/add-message-lint.d.ts +34 -0
- package/dist/cli/steps/add-message-lint.js +105 -0
- package/dist/cli/steps/add-message-lint.js.map +1 -0
- package/dist/cli/steps/add-message-lint.test.d.ts +1 -0
- package/dist/cli/steps/add-message-lint.test.js +74 -0
- package/dist/cli/steps/add-message-lint.test.js.map +1 -0
- package/dist/cli/steps/add-vite-plugin.d.ts +18 -0
- package/dist/cli/steps/add-vite-plugin.js +34 -6
- package/dist/cli/steps/add-vite-plugin.js.map +1 -1
- package/dist/cli/steps/add-vite-plugin.test.js +25 -9
- package/dist/cli/steps/add-vite-plugin.test.js.map +1 -1
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts +3 -0
- package/dist/cli/steps/check-for-uncomitted-changes.js +15 -3
- package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -1
- package/dist/cli/steps/detect-bundler.d.ts +1 -0
- package/dist/cli/steps/detect-bundler.js +7 -1
- package/dist/cli/steps/detect-bundler.js.map +1 -1
- package/dist/cli/steps/initialize-inlang-project.d.ts +4 -3
- package/dist/cli/steps/initialize-inlang-project.js +60 -157
- package/dist/cli/steps/initialize-inlang-project.js.map +1 -1
- package/dist/cli/steps/maybe-add-machine-translation.d.ts +4 -0
- package/dist/cli/steps/maybe-add-machine-translation.js +11 -6
- package/dist/cli/steps/maybe-add-machine-translation.js.map +1 -1
- package/dist/cli/steps/maybe-add-sherlock.d.ts +2 -0
- package/dist/cli/steps/maybe-add-sherlock.js +12 -6
- package/dist/cli/steps/maybe-add-sherlock.js.map +1 -1
- package/dist/cli/steps/maybe-add-sherlock.test.d.ts +1 -0
- package/dist/cli/steps/maybe-add-sherlock.test.js +44 -0
- package/dist/cli/steps/maybe-add-sherlock.test.js.map +1 -0
- package/dist/cli/steps/prompt-for-outdir.d.ts +2 -0
- package/dist/cli/steps/prompt-for-outdir.js +4 -0
- package/dist/cli/steps/prompt-for-outdir.js.map +1 -1
- package/dist/cli/steps/update-package-json.js +8 -13
- package/dist/cli/steps/update-package-json.js.map +1 -1
- package/dist/cli/steps/update-ts-config.d.ts +6 -0
- package/dist/cli/steps/update-ts-config.js +27 -4
- package/dist/cli/steps/update-ts-config.js.map +1 -1
- package/dist/cli/utils.d.ts +2 -0
- package/dist/cli/utils.js +6 -0
- package/dist/cli/utils.js.map +1 -1
- package/dist/cli/utils.test.d.ts +1 -0
- package/dist/cli/utils.test.js +16 -0
- package/dist/cli/utils.test.js.map +1 -0
- package/dist/compiler/compile-annotation.js +6 -1
- package/dist/compiler/compile-annotation.js.map +1 -1
- package/dist/compiler/compile-bundle.d.ts +4 -0
- package/dist/compiler/compile-bundle.js +67 -2
- package/dist/compiler/compile-bundle.js.map +1 -1
- package/dist/compiler/compile-bundle.test.js +214 -1
- package/dist/compiler/compile-bundle.test.js.map +1 -1
- package/dist/compiler/compile-lifecycle.test.d.ts +1 -0
- package/dist/compiler/compile-lifecycle.test.js +69 -0
- package/dist/compiler/compile-lifecycle.test.js.map +1 -0
- package/dist/compiler/compile-local-variable.test.js +14 -14
- package/dist/compiler/compile-local-variable.test.js.map +1 -1
- package/dist/compiler/compile-message.exact-number.test.js +1 -1
- package/dist/compiler/compile-message.exact-number.test.js.map +1 -1
- package/dist/compiler/compile-message.locals.test.js +1 -1
- package/dist/compiler/compile-message.locals.test.js.map +1 -1
- package/dist/compiler/compile-message.test.js +2 -2
- package/dist/compiler/compile-message.test.js.map +1 -1
- package/dist/compiler/compile-pattern.test.js +5 -5
- package/dist/compiler/compile-pattern.test.js.map +1 -1
- package/dist/compiler/compile-project.js +1 -0
- package/dist/compiler/compile-project.js.map +1 -1
- package/dist/compiler/compile-project.test.js +94 -1
- package/dist/compiler/compile-project.test.js.map +1 -1
- package/dist/compiler/compile.js +36 -17
- package/dist/compiler/compile.js.map +1 -1
- package/dist/compiler/compile.test.js +70 -0
- package/dist/compiler/compile.test.js.map +1 -1
- package/dist/compiler/compiler-options.d.ts +41 -0
- package/dist/compiler/compiler-options.js.map +1 -1
- package/dist/compiler/output-structure/message-modules.js +1 -1
- package/dist/compiler/output-structure/message-modules.js.map +1 -1
- package/dist/compiler/registry.js +71 -13
- package/dist/compiler/registry.js.map +1 -1
- package/dist/compiler/registry.test.d.ts +1 -0
- package/dist/compiler/registry.test.js +291 -0
- package/dist/compiler/registry.test.js.map +1 -0
- package/dist/compiler/runtime/create-runtime.d.ts +2 -0
- package/dist/compiler/runtime/create-runtime.js +9 -0
- package/dist/compiler/runtime/create-runtime.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.js +8 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-cookie.test.js +26 -0
- package/dist/compiler/runtime/extract-locale-from-cookie.test.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-header.js +47 -5
- package/dist/compiler/runtime/extract-locale-from-header.js.map +1 -1
- package/dist/compiler/runtime/extract-locale-from-header.test.js +58 -0
- package/dist/compiler/runtime/extract-locale-from-header.test.js.map +1 -1
- package/dist/compiler/runtime/get-locale.js +7 -1
- package/dist/compiler/runtime/get-locale.js.map +1 -1
- package/dist/compiler/runtime/get-locale.test.js +95 -0
- package/dist/compiler/runtime/get-locale.test.js.map +1 -1
- package/dist/compiler/runtime/localize-href.d.ts +8 -0
- package/dist/compiler/runtime/localize-href.js +60 -0
- package/dist/compiler/runtime/localize-href.js.map +1 -1
- package/dist/compiler/runtime/localize-href.test.js +227 -1
- package/dist/compiler/runtime/localize-href.test.js.map +1 -1
- package/dist/compiler/runtime/localize-url.d.ts +8 -4
- package/dist/compiler/runtime/localize-url.js +12 -8
- package/dist/compiler/runtime/localize-url.js.map +1 -1
- package/dist/compiler/runtime/localize-url.test.js +45 -0
- package/dist/compiler/runtime/localize-url.test.js.map +1 -1
- package/dist/compiler/runtime/set-locale.js +24 -6
- package/dist/compiler/runtime/set-locale.js.map +1 -1
- package/dist/compiler/runtime/set-locale.test.js +182 -0
- package/dist/compiler/runtime/set-locale.test.js.map +1 -1
- package/dist/compiler/runtime/type.d.ts +2 -0
- package/dist/compiler/runtime/type.js.map +1 -1
- package/dist/compiler/runtime/type.test.js +75 -0
- package/dist/compiler/runtime/type.test.js.map +1 -1
- package/dist/compiler/runtime/variables.d.ts +2 -0
- package/dist/compiler/runtime/variables.js +7 -0
- package/dist/compiler/runtime/variables.js.map +1 -1
- package/dist/compiler/server/middleware.d.ts +8 -2
- package/dist/compiler/server/middleware.js +175 -7
- package/dist/compiler/server/middleware.js.map +1 -1
- package/dist/compiler/server/middleware.test.js +750 -3
- package/dist/compiler/server/middleware.test.js.map +1 -1
- package/dist/eslint/index.d.ts +4 -0
- package/dist/eslint/index.js +8 -0
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/no-dynamic-message-access.d.ts +3 -0
- package/dist/eslint/no-dynamic-message-access.js +150 -0
- package/dist/eslint/no-dynamic-message-access.js.map +1 -0
- package/dist/eslint/no-dynamic-message-access.test.d.ts +1 -0
- package/dist/eslint/no-dynamic-message-access.test.js +126 -0
- package/dist/eslint/no-dynamic-message-access.test.js.map +1 -0
- package/dist/eslint/oxlint.test.d.ts +1 -0
- package/dist/eslint/oxlint.test.js +64 -0
- package/dist/eslint/oxlint.test.js.map +1 -0
- package/dist/services/config/config-schema.d.ts +2 -0
- package/dist/services/config/config-schema.js +2 -0
- package/dist/services/config/config-schema.js.map +1 -1
- package/dist/services/config/load-paraglide-config.test.js +12 -0
- package/dist/services/config/load-paraglide-config.test.js.map +1 -1
- package/dist/services/env-variables/index.js +1 -1
- package/dist/services/env-variables/index.js.map +1 -1
- package/dist/services/file-handling/write-output.bench.js +51 -11
- package/dist/services/file-handling/write-output.bench.js.map +1 -1
- package/dist/services/file-handling/write-output.js +60 -20
- package/dist/services/file-handling/write-output.js.map +1 -1
- package/dist/services/file-handling/write-output.test.js +175 -0
- package/dist/services/file-handling/write-output.test.js.map +1 -1
- package/package.json +14 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.test.js","sourceRoot":"","sources":["../../../../src/cli/commands/compile/command.test.ts"],"names":[],"mappings":"AA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AAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { mkdtemp, rm, writeFile, mkdir } from \"node:fs/promises\";\nimport * as nodeFs from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport consola from \"consola\";\nimport path, { resolve } from \"node:path\";\nimport { afterEach, beforeEach, describe, expect, test, vi } from \"vitest\";\n\nlet testDirectories: string[] = [];\nlet initialSigintListeners: NodeJS.SignalsListener[] = [];\n\nbeforeEach(() => {\n\tvi.resetModules();\n\ttestDirectories = [];\n\tinitialSigintListeners = process.listeners(\"SIGINT\");\n});\n\nafterEach(async () => {\n\tvi.restoreAllMocks();\n\tfor (const listener of process.listeners(\"SIGINT\")) {\n\t\tif (!initialSigintListeners.includes(listener)) {\n\t\t\tprocess.removeListener(\"SIGINT\", listener);\n\t\t}\n\t}\n\tfor (const directory of testDirectories) {\n\t\tawait rm(directory, { recursive: true, force: true });\n\t}\n});\n\n/**\n * Creates `<dir>/project.inlang/paraglide.config.ts` with the given\n * outdir — the layout of the new config-in-project model.\n */\nasync function writeConfig(\n\tprojectDir: string,\n\toutdir: string,\n\tfileName = \"paraglide.config.ts\"\n) {\n\tawait mkdir(projectDir, { recursive: true });\n\tawait writeFile(\n\t\tpath.join(projectDir, fileName),\n\t\t[\"export default {\", ` outdir: ${JSON.stringify(outdir)},`, \"}\"].join(\"\\n\")\n\t);\n}\n\nasync function createWorkspace() {\n\tconst workspace = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(workspace);\n\tconst projectDir = path.join(workspace, \"project.inlang\");\n\treturn { workspace, projectDir };\n}\n\ntest(\"compile seeds existing outdir and disables cleaning (#743)\", async () => {\n\tconst { workspace } = await createWorkspace();\n\tconst outdir = path.join(workspace, \"output\");\n\tconst { writeOutput } =\n\t\tawait import(\"../../../services/file-handling/write-output.js\");\n\tawait writeOutput({\n\t\tdirectory: outdir,\n\t\toutput: {\n\t\t\t\"runtime.js\": \"export const runtime = true;\",\n\t\t},\n\t\tfs: nodeFs,\n\t});\n\n\tconst compileMock = vi.fn().mockResolvedValue({\n\t\toutputHashes: {\n\t\t\t\"runtime.js\": \"next-hash\",\n\t\t},\n\t});\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\tconst exitError = new Error(\"process.exit\");\n\tconst exitMock = vi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\tthrow exitError;\n\t});\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\n\tawait expect(\n\t\tcompileCommand.parseAsync(\n\t\t\t[\n\t\t\t\t\"--project\",\n\t\t\t\tpath.join(workspace, \"project.inlang\"),\n\t\t\t\t\"--outdir\",\n\t\t\t\toutdir,\n\t\t\t\t\"--silent\",\n\t\t\t],\n\t\t\t{ from: \"user\" }\n\t\t)\n\t).rejects.toBe(exitError);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\toutdir,\n\t\t\tcleanOutdir: false,\n\t\t\tpreviousCompilation: {\n\t\t\t\toutputHashes: {\n\t\t\t\t\t\"runtime.js\": expect.any(String),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t);\n\texpect(exitMock).toHaveBeenCalledWith(0);\n});\n\ntest(\"compile exposes and forwards compiler options missing from the CLI (#757)\", async () => {\n\tconst testDirectory = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(testDirectory);\n\tconst outdir = path.join(testDirectory, \"output\");\n\tawait nodeFs.mkdir(outdir, { recursive: true });\n\tawait nodeFs.writeFile(path.join(outdir, \"custom.txt\"), \"keep me\");\n\n\tconst compileMock = vi.fn().mockResolvedValue({ outputHashes: {} });\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\tconst exitError = new Error(\"process.exit\");\n\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\tthrow exitError;\n\t});\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\tconst help = compileCommand.helpInformation();\n\n\texpect(help).toContain(\"--clean-outdir\");\n\texpect(help).toContain(\"--no-clean-outdir\");\n\texpect(help).toContain(\"--experimental-static-locale <expression>\");\n\texpect(help).toContain(\"--disable-async-local-storage\");\n\n\tawait expect(\n\t\tcompileCommand.parseAsync(\n\t\t\t[\n\t\t\t\t\"--project\",\n\t\t\t\tpath.join(testDirectory, \"project.inlang\"),\n\t\t\t\t\"--outdir\",\n\t\t\t\toutdir,\n\t\t\t\t\"--no-clean-outdir\",\n\t\t\t\t\"--experimental-static-locale\",\n\t\t\t\t'import.meta.env.PARAGLIDE_LOCALE ?? \"en\"',\n\t\t\t\t\"--disable-async-local-storage\",\n\t\t\t\t\"--silent\",\n\t\t\t],\n\t\t\t{ from: \"user\" }\n\t\t)\n\t).rejects.toBe(exitError);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\tcleanOutdir: false,\n\t\t\tdisableAsyncLocalStorage: true,\n\t\t\texperimentalStaticLocale: 'import.meta.env.PARAGLIDE_LOCALE ?? \"en\"',\n\t\t\tpreviousCompilation: undefined,\n\t\t})\n\t);\n});\n\ntest(\"compile --watch seeds existing outdir and disables cleaning on first compile (#688)\", async () => {\n\tconst testDirectory = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(testDirectory);\n\tconst outdir = path.join(testDirectory, \"output\");\n\tconst { writeOutput } = await import(\n\t\t\"../../../services/file-handling/write-output.js\"\n\t);\n\tawait writeOutput({\n\t\tdirectory: outdir,\n\t\toutput: {\n\t\t\t\"runtime.js\": \"export const runtime = true;\",\n\t\t},\n\t\tfs: nodeFs,\n\t});\n\n\tconst compileMock = vi.fn().mockResolvedValue({\n\t\toutputHashes: {\n\t\t\t\"runtime.js\": \"next-hash\",\n\t\t},\n\t});\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\n\tawait compileCommand.parseAsync(\n\t\t[\n\t\t\t\"--project\",\n\t\t\tpath.join(testDirectory, \"project.inlang\"),\n\t\t\t\"--outdir\",\n\t\t\toutdir,\n\t\t\t\"--watch\",\n\t\t\t\"--silent\",\n\t\t],\n\t\t{ from: \"user\" }\n\t);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\toutdir,\n\t\t\tcleanOutdir: false,\n\t\t\tpreviousCompilation: {\n\t\t\t\toutputHashes: {\n\t\t\t\t\t\"runtime.js\": expect.any(String),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t);\n});\n\ndescribe(\"config file integration\", () => {\n\ttest(\"compile reads options from a config file inside --project\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait expect(\n\t\t\tcompileCommand.parseAsync([\"--project\", projectDir, \"--silent\"], {\n\t\t\t\tfrom: \"user\",\n\t\t\t})\n\t\t).rejects.toBe(exitError);\n\n\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\texpect.objectContaining({\n\t\t\t\tproject: projectDir,\n\t\t\t\toutdir,\n\t\t\t\tstrategy: [\"cookie\", \"globalVariable\", \"baseLocale\"],\n\t\t\t\temitReadme: true,\n\t\t\t})\n\t\t);\n\t});\n\n\ttest(\"discovers the conventional ./project.inlang without flags\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\t\tconst cwdMock = vi.spyOn(process, \"cwd\").mockReturnValue(workspace);\n\n\t\ttry {\n\t\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\t\tawait expect(\n\t\t\t\tcompileCommand.parseAsync([\"--silent\"], { from: \"user\" })\n\t\t\t).rejects.toBe(exitError);\n\n\t\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\t\texpect.objectContaining({\n\t\t\t\t\tproject: projectDir,\n\t\t\t\t\toutdir,\n\t\t\t\t})\n\t\t\t);\n\t\t} finally {\n\t\t\tcwdMock.mockRestore();\n\t\t}\n\t});\n\n\ttest(\"announces the conventional project default when --project is omitted\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\t\tconst infoSpy = vi.spyOn(consola, \"info\").mockImplementation(() => {});\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\t\tconst cwdMock = vi.spyOn(process, \"cwd\").mockReturnValue(workspace);\n\n\t\ttry {\n\t\t\tawait expect(\n\t\t\t\tcompileCommand.parseAsync(\n\t\t\t\t\t[\"--outdir\", outdir], // no --project, no --silent\n\t\t\t\t\t{ from: \"user\" }\n\t\t\t\t)\n\t\t\t).rejects.toBe(exitError);\n\n\t\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\t\texpect.objectContaining({\n\t\t\t\t\tproject: projectDir,\n\t\t\t\t\toutdir,\n\t\t\t\t})\n\t\t\t);\n\t\t\texpect(\n\t\t\t\tinfoSpy.mock.calls.some((call) =>\n\t\t\t\t\tString(call[0]).includes(\"--project was not provided\")\n\t\t\t\t)\n\t\t\t).toBe(true);\n\t\t} finally {\n\t\t\tcwdMock.mockRestore();\n\t\t}\n\t});\n\n\ttest(\"command line flags override config file values\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tawait writeConfig(projectDir, path.join(workspace, \"from-config\"));\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait expect(\n\t\t\tcompileCommand.parseAsync(\n\t\t\t\t[\n\t\t\t\t\t\"--project\",\n\t\t\t\t\tprojectDir,\n\t\t\t\t\t\"--outdir\",\n\t\t\t\t\t\"./from-flag\",\n\t\t\t\t\t\"--strategy\",\n\t\t\t\t\t\"cookie\",\n\t\t\t\t\t\"baseLocale\",\n\t\t\t\t\t\"--silent\",\n\t\t\t\t],\n\t\t\t\t{ from: \"user\" }\n\t\t\t)\n\t\t).rejects.toBe(exitError);\n\n\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\texpect.objectContaining({\n\t\t\t\tproject: projectDir,\n\t\t\t\toutdir: resolve(process.cwd(), \"./from-flag\"),\n\t\t\t\tstrategy: [\"cookie\", \"baseLocale\"],\n\t\t\t})\n\t\t);\n\t});\n\n\t// Deleting the config file mid-watch falls back to the built-in\n\t// defaults (same as never having a config); recreating it is picked up.\n\ttest(\"watch falls back to defaults when the config is deleted\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst configPath = path.join(projectDir, \"paraglide.config.ts\");\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait compileCommand.parseAsync(\n\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t{ from: \"user\" }\n\t\t);\n\t\texpect(compileMock).toHaveBeenCalledTimes(1);\n\t\texpect(compileMock.mock.calls[0]![0].outdir).toBe(outdir);\n\n\t\tawait rm(configPath);\n\n\t\tconst deadline = Date.now() + 10_000;\n\t\twhile (compileMock.mock.calls.length < 2 && Date.now() < deadline) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\n\t\texpect(compileMock.mock.calls.length).toBeGreaterThanOrEqual(2);\n\t\tfor (const call of compileMock.mock.calls.slice(1)) {\n\t\t\t// Default outdir, resolved against the working directory.\n\t\t\texpect(\n\t\t\t\tString(call[0].outdir).endsWith(path.join(\"src\", \"paraglide\"))\n\t\t\t).toBe(true);\n\t\t\texpect(call[0].project).toBe(projectDir);\n\t\t}\n\n\t\t// Recreating the config with a different outdir is picked up again.\n\t\tawait writeConfig(projectDir, path.join(workspace, \"recreated\"));\n\t\tconst recreateDeadline = Date.now() + 10_000;\n\t\twhile (\n\t\t\tDate.now() < recreateDeadline &&\n\t\t\t!compileMock.mock.calls.some((c) =>\n\t\t\t\tString(c[0].outdir).endsWith(\"recreated\")\n\t\t\t)\n\t\t) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\t\texpect(\n\t\t\tcompileMock.mock.calls.some((c) =>\n\t\t\t\tString(c[0].outdir).endsWith(\"recreated\")\n\t\t\t)\n\t\t).toBe(true);\n\t});\n\n\t// Renaming the config between formats switches to the new winner.\n\t// A NEW non-config file appearing directly in the project directory (e.g.\n\t// a locale JSON for a freshly added locale) must schedule a rebuild even\n\t// though no per-file watcher exists for it yet.\n\ttest(\"watch recompiles when a new input appears in the project directory\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tawait writeConfig(projectDir, path.join(workspace, \"from-config\"));\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait compileCommand.parseAsync(\n\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t{ from: \"user\" }\n\t\t);\n\t\texpect(compileMock).toHaveBeenCalledTimes(1);\n\n\t\tawait writeFile(path.join(projectDir, \"es.json\"), \"{}\");\n\n\t\tconst deadline = Date.now() + 10_000;\n\t\twhile (compileMock.mock.calls.length < 2 && Date.now() < deadline) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\t\texpect(compileMock.mock.calls.length).toBeGreaterThanOrEqual(2);\n\t});\n\n\ttest(\"watch follows config renames between formats\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst tsPath = path.join(projectDir, \"paraglide.config.ts\");\n\t\tconst jsPath = path.join(projectDir, \"paraglide.config.js\");\n\t\tconst outdirA = path.join(workspace, \"out-ts\");\n\t\tconst outdirB = path.join(workspace, \"out-js\");\n\t\tawait writeConfig(projectDir, outdirA);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait compileCommand.parseAsync(\n\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t{ from: \"user\" }\n\t\t);\n\t\texpect(compileMock.mock.calls[0]![0].outdir).toBe(outdirA);\n\n\t\t// Format switch: delete .ts, add .js.\n\t\tawait rm(tsPath);\n\t\tawait writeFile(\n\t\t\tjsPath,\n\t\t\t[\"export default {\", ` outdir: ${JSON.stringify(outdirB)},`, \"}\"].join(\n\t\t\t\t\"\\n\"\n\t\t\t)\n\t\t);\n\n\t\tconst deadline = Date.now() + 10_000;\n\t\twhile (\n\t\t\tDate.now() < deadline &&\n\t\t\t!compileMock.mock.calls.some((c) => c[0].outdir === outdirB)\n\t\t) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\t\texpect(compileMock.mock.calls.some((c) => c[0].outdir === outdirB)).toBe(\n\t\t\ttrue\n\t\t);\n\t});\n\n\t// Non-config changes inside the project directory DO rebuild (new\n\t// inputs can appear there) but must NOT reload the config.\n\ttest(\"watch recompiles without reloading config for non-config changes\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tawait writeConfig(projectDir, path.join(workspace, \"from-config\"));\n\n\t\tlet loadCount = 0;\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: vi.fn().mockResolvedValue({}),\n\t\t}));\n\t\tvi.doMock(\"../../../services/config/index.js\", async (importActual) => {\n\t\t\tconst actual =\n\t\t\t\tawait importActual<\n\t\t\t\t\ttypeof import(\"../../../services/config/index.js\")\n\t\t\t\t>();\n\t\t\treturn {\n\t\t\t\t...actual,\n\t\t\t\tloadParaglideConfig: (\n\t\t\t\t\t...args: Parameters<typeof actual.loadParaglideConfig>\n\t\t\t\t) => {\n\t\t\t\t\tloadCount++;\n\t\t\t\t\treturn actual.loadParaglideConfig(...args);\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\n\t\ttry {\n\t\t\tconst { compileCommand } = await import(\"./command.js\");\n\t\t\tconst compileModule = (await import(\"../../../compiler/compile.js\")) as {\n\t\t\t\tcompile: ReturnType<typeof vi.fn>;\n\t\t\t};\n\n\t\t\tawait compileCommand.parseAsync(\n\t\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t\t{ from: \"user\" }\n\t\t\t);\n\t\t\texpect(compileModule.compile).toHaveBeenCalledTimes(1);\n\t\t\texpect(loadCount).toBe(1);\n\n\t\t\tawait writeFile(path.join(projectDir, \"README.md\"), \"hello\");\n\t\t\tawait new Promise((r) => setTimeout(r, 1_000));\n\t\t\tawait writeFile(path.join(projectDir, \"notes.txt\"), \"world\");\n\t\t\tawait new Promise((r) => setTimeout(r, 1_500));\n\n\t\t\texpect(compileModule.compile.mock.calls.length).toBeGreaterThanOrEqual(3);\n\t\t\texpect(loadCount).toBe(1);\n\t\t} finally {\n\t\t\tvi.doUnmock(\"../../../services/config/index.js\");\n\t\t}\n\t});\n});\n\ntest(\"compile --watch forwards the newly exposed compiler options (#757)\", async () => {\n\tconst testDirectory = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(testDirectory);\n\tconst outdir = path.join(testDirectory, \"output\");\n\n\tconst compileMock = vi.fn().mockResolvedValue({ outputHashes: {} });\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\n\tawait compileCommand.parseAsync(\n\t\t[\n\t\t\t\"--project\",\n\t\t\tpath.join(testDirectory, \"project.inlang\"),\n\t\t\t\"--outdir\",\n\t\t\toutdir,\n\t\t\t\"--watch\",\n\t\t\t\"--no-clean-outdir\",\n\t\t\t\"--experimental-static-locale\",\n\t\t\t'\"de\"',\n\t\t\t\"--disable-async-local-storage\",\n\t\t\t\"--silent\",\n\t\t],\n\t\t{ from: \"user\" }\n\t);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\tcleanOutdir: false,\n\t\t\tdisableAsyncLocalStorage: true,\n\t\t\texperimentalStaticLocale: '\"de\"',\n\t\t\tpreviousCompilation: undefined,\n\t\t})\n\t);\n});\n"]}
|
|
1
|
+
{"version":3,"file":"command.test.js","sourceRoot":"","sources":["../../../../src/cli/commands/compile/command.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE3E,IAAI,eAAe,GAAa,EAAE,CAAC;AACnC,IAAI,sBAAsB,GAA6B,EAAE,CAAC;AAC1D,IAAI,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;AAEnD,gFAAgF;AAChF,+EAA+E;AAC/E,MAAM,WAAY,SAAQ,YAAY;IACR,OAAO;IAApC,YAA6B,OAAmB;QAC/C,KAAK,EAAE,CAAC;uBADoB,OAAO;IAEpC,CAAC;IACD,KAAK;QACJ,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC3B,CAAC;IACD,GAAG;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,KAAK;QACJ,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAED,SAAS,YAAY,CACpB,SAAiB,EACjB,QAAuB,EACvB,KAAK,GAAwB,QAAQ;IAErC,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,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AAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAC3E,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;IACpE,EAAE,CAAC,MAAM,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,CAAC;QAChD,OAAO,EAAE,WAAW;KACpB,CAAC,CAAC,CAAC;IAEJ,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;IAExD,MAAM,cAAc,CAAC,UAAU,CAC9B;QACC,WAAW;QACX,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC;QAC1C,UAAU;QACV,MAAM;QACN,SAAS;QACT,mBAAmB;QACnB,8BAA8B;QAC9B,MAAM;QACN,+BAA+B;QAC/B,UAAU;KACV,EACD,EAAE,IAAI,EAAE,MAAM,EAAE,CAChB,CAAC;IAEF,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACvC,MAAM,CAAC,gBAAgB,CAAC;QACvB,WAAW,EAAE,KAAK;QAClB,wBAAwB,EAAE,IAAI;QAC9B,wBAAwB,EAAE,MAAM;QAChC,mBAAmB,EAAE,SAAS;KAC9B,CAAC,CACF,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { mkdtemp, rm, writeFile, mkdir } from \"node:fs/promises\";\nimport * as nodeFs from \"node:fs/promises\";\nimport fs from \"node:fs\";\nimport { EventEmitter } from \"node:events\";\nimport { tmpdir } from \"node:os\";\nimport consola from \"consola\";\nimport path, { resolve } from \"node:path\";\nimport { afterEach, beforeEach, describe, expect, test, vi } from \"vitest\";\n\nlet testDirectories: string[] = [];\nlet initialSigintListeners: NodeJS.SignalsListener[] = [];\nlet watchers = new Map<string, Set<TestWatcher>>();\n\n// Test CLI event handling with real config files and controlled watch delivery.\n// fs.watch does not guarantee event timing, filenames, or one event per write.\nclass TestWatcher extends EventEmitter implements fs.FSWatcher {\n\tconstructor(private readonly onClose: () => void) {\n\t\tsuper();\n\t}\n\tclose() {\n\t\tthis.onClose();\n\t\tthis.removeAllListeners();\n\t}\n\tref() {\n\t\treturn this;\n\t}\n\tunref() {\n\t\treturn this;\n\t}\n}\n\nfunction notifyChange(\n\tdirectory: string,\n\tfilename: string | null,\n\tevent: \"change\" | \"rename\" = \"change\"\n) {\n\tconst current = watchers.get(path.resolve(directory));\n\texpect(current?.size).toBeGreaterThan(0);\n\tfor (const watcher of current ?? []) watcher.emit(\"change\", event, filename);\n}\n\nbeforeEach(() => {\n\tvi.resetModules();\n\ttestDirectories = [];\n\tinitialSigintListeners = process.listeners(\"SIGINT\");\n\twatchers = new Map();\n\tvi.spyOn(fs, \"watch\").mockImplementation(\n\t\t(\n\t\t\tfilename: fs.PathLike,\n\t\t\toptions?:\n\t\t\t\t| fs.WatchOptions\n\t\t\t\t| BufferEncoding\n\t\t\t\t| fs.WatchListener<string>\n\t\t\t\t| fs.WatchListener<Buffer>\n\t\t\t\t| null,\n\t\t\tlistener?: fs.WatchListener<string> | fs.WatchListener<Buffer>\n\t\t) => {\n\t\t\tconst target = path.resolve(String(filename));\n\t\t\tconst current = watchers.get(target) ?? new Set<TestWatcher>();\n\t\t\twatchers.set(target, current);\n\t\t\tconst watcher = new TestWatcher(() => current.delete(watcher));\n\t\t\tconst callback = typeof options === \"function\" ? options : listener;\n\t\t\tif (callback) watcher.on(\"change\", callback);\n\t\t\tcurrent.add(watcher);\n\t\t\treturn watcher;\n\t\t}\n\t);\n});\n\nafterEach(async () => {\n\t// Stop each CLI instance before deleting fixtures or restoring its mocks.\n\tvi.spyOn(process, \"exit\").mockImplementation(() => undefined as never);\n\tfor (const listener of process.listeners(\"SIGINT\")) {\n\t\tif (!initialSigintListeners.includes(listener)) {\n\t\t\tlistener(\"SIGINT\");\n\t\t\tprocess.removeListener(\"SIGINT\", listener);\n\t\t}\n\t}\n\tfor (const current of watchers.values()) {\n\t\tfor (const watcher of current) watcher.close();\n\t}\n\tvi.useRealTimers();\n\tvi.restoreAllMocks();\n\tfor (const directory of testDirectories) {\n\t\tawait rm(directory, { recursive: true, force: true });\n\t}\n});\n\n/**\n * Creates `<dir>/project.inlang/paraglide.config.ts` with the given\n * outdir — the layout of the new config-in-project model.\n */\nasync function writeConfig(\n\tprojectDir: string,\n\toutdir: string,\n\tfileName = \"paraglide.config.ts\"\n) {\n\tawait mkdir(projectDir, { recursive: true });\n\tawait writeFile(\n\t\tpath.join(projectDir, fileName),\n\t\t[\"export default {\", ` outdir: ${JSON.stringify(outdir)},`, \"}\"].join(\"\\n\")\n\t);\n}\n\nasync function createWorkspace() {\n\tconst workspace = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(workspace);\n\tconst projectDir = path.join(workspace, \"project.inlang\");\n\treturn { workspace, projectDir };\n}\n\ntest(\"compile seeds existing outdir and disables cleaning (#743)\", async () => {\n\tconst { workspace } = await createWorkspace();\n\tconst outdir = path.join(workspace, \"output\");\n\tconst { writeOutput } =\n\t\tawait import(\"../../../services/file-handling/write-output.js\");\n\tawait writeOutput({\n\t\tdirectory: outdir,\n\t\toutput: {\n\t\t\t\"runtime.js\": \"export const runtime = true;\",\n\t\t},\n\t\tfs: nodeFs,\n\t});\n\n\tconst compileMock = vi.fn().mockResolvedValue({\n\t\toutputHashes: {\n\t\t\t\"runtime.js\": \"next-hash\",\n\t\t},\n\t});\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\tconst exitError = new Error(\"process.exit\");\n\tconst exitMock = vi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\tthrow exitError;\n\t});\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\n\tawait expect(\n\t\tcompileCommand.parseAsync(\n\t\t\t[\n\t\t\t\t\"--project\",\n\t\t\t\tpath.join(workspace, \"project.inlang\"),\n\t\t\t\t\"--outdir\",\n\t\t\t\toutdir,\n\t\t\t\t\"--silent\",\n\t\t\t],\n\t\t\t{ from: \"user\" }\n\t\t)\n\t).rejects.toBe(exitError);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\toutdir,\n\t\t\tcleanOutdir: false,\n\t\t\tpreviousCompilation: {\n\t\t\t\toutputHashes: {\n\t\t\t\t\t\"runtime.js\": expect.any(String),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t);\n\texpect(exitMock).toHaveBeenCalledWith(0);\n});\n\ntest(\"compile exposes and forwards compiler options missing from the CLI (#757)\", async () => {\n\tconst testDirectory = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(testDirectory);\n\tconst outdir = path.join(testDirectory, \"output\");\n\tawait nodeFs.mkdir(outdir, { recursive: true });\n\tawait nodeFs.writeFile(path.join(outdir, \"custom.txt\"), \"keep me\");\n\n\tconst compileMock = vi.fn().mockResolvedValue({ outputHashes: {} });\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\tconst exitError = new Error(\"process.exit\");\n\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\tthrow exitError;\n\t});\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\tconst help = compileCommand.helpInformation();\n\n\texpect(help).toContain(\"--clean-outdir\");\n\texpect(help).toContain(\"--no-clean-outdir\");\n\texpect(help).toContain(\"--experimental-static-locale <expression>\");\n\texpect(help).toContain(\"--disable-async-local-storage\");\n\n\tawait expect(\n\t\tcompileCommand.parseAsync(\n\t\t\t[\n\t\t\t\t\"--project\",\n\t\t\t\tpath.join(testDirectory, \"project.inlang\"),\n\t\t\t\t\"--outdir\",\n\t\t\t\toutdir,\n\t\t\t\t\"--no-clean-outdir\",\n\t\t\t\t\"--experimental-static-locale\",\n\t\t\t\t'import.meta.env.PARAGLIDE_LOCALE ?? \"en\"',\n\t\t\t\t\"--disable-async-local-storage\",\n\t\t\t\t\"--silent\",\n\t\t\t],\n\t\t\t{ from: \"user\" }\n\t\t)\n\t).rejects.toBe(exitError);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\tcleanOutdir: false,\n\t\t\tdisableAsyncLocalStorage: true,\n\t\t\texperimentalStaticLocale: 'import.meta.env.PARAGLIDE_LOCALE ?? \"en\"',\n\t\t\tpreviousCompilation: undefined,\n\t\t})\n\t);\n});\n\ntest(\"compile --watch seeds existing outdir and disables cleaning on first compile (#688)\", async () => {\n\tconst testDirectory = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(testDirectory);\n\tconst outdir = path.join(testDirectory, \"output\");\n\tconst { writeOutput } =\n\t\tawait import(\"../../../services/file-handling/write-output.js\");\n\tawait writeOutput({\n\t\tdirectory: outdir,\n\t\toutput: {\n\t\t\t\"runtime.js\": \"export const runtime = true;\",\n\t\t},\n\t\tfs: nodeFs,\n\t});\n\n\tconst compileMock = vi.fn().mockResolvedValue({\n\t\toutputHashes: {\n\t\t\t\"runtime.js\": \"next-hash\",\n\t\t},\n\t});\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\n\tawait compileCommand.parseAsync(\n\t\t[\n\t\t\t\"--project\",\n\t\t\tpath.join(testDirectory, \"project.inlang\"),\n\t\t\t\"--outdir\",\n\t\t\toutdir,\n\t\t\t\"--watch\",\n\t\t\t\"--silent\",\n\t\t],\n\t\t{ from: \"user\" }\n\t);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\toutdir,\n\t\t\tcleanOutdir: false,\n\t\t\tpreviousCompilation: {\n\t\t\t\toutputHashes: {\n\t\t\t\t\t\"runtime.js\": expect.any(String),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t);\n});\n\ndescribe(\"config file integration\", () => {\n\ttest(\"compile reads options from a config file inside --project\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait expect(\n\t\t\tcompileCommand.parseAsync([\"--project\", projectDir, \"--silent\"], {\n\t\t\t\tfrom: \"user\",\n\t\t\t})\n\t\t).rejects.toBe(exitError);\n\n\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\texpect.objectContaining({\n\t\t\t\tproject: projectDir,\n\t\t\t\toutdir,\n\t\t\t\tstrategy: [\"cookie\", \"globalVariable\", \"baseLocale\"],\n\t\t\t\temitReadme: true,\n\t\t\t})\n\t\t);\n\t});\n\n\ttest(\"discovers the conventional ./project.inlang without flags\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\t\tconst cwdMock = vi.spyOn(process, \"cwd\").mockReturnValue(workspace);\n\n\t\ttry {\n\t\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\t\tawait expect(\n\t\t\t\tcompileCommand.parseAsync([\"--silent\"], { from: \"user\" })\n\t\t\t).rejects.toBe(exitError);\n\n\t\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\t\texpect.objectContaining({\n\t\t\t\t\tproject: projectDir,\n\t\t\t\t\toutdir,\n\t\t\t\t})\n\t\t\t);\n\t\t} finally {\n\t\t\tcwdMock.mockRestore();\n\t\t}\n\t});\n\n\ttest(\"announces the conventional project default when --project is omitted\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\t\tconst infoSpy = vi.spyOn(consola, \"info\").mockImplementation(() => {});\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\t\tconst cwdMock = vi.spyOn(process, \"cwd\").mockReturnValue(workspace);\n\n\t\ttry {\n\t\t\tawait expect(\n\t\t\t\tcompileCommand.parseAsync(\n\t\t\t\t\t[\"--outdir\", outdir], // no --project, no --silent\n\t\t\t\t\t{ from: \"user\" }\n\t\t\t\t)\n\t\t\t).rejects.toBe(exitError);\n\n\t\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\t\texpect.objectContaining({\n\t\t\t\t\tproject: projectDir,\n\t\t\t\t\toutdir,\n\t\t\t\t})\n\t\t\t);\n\t\t\texpect(\n\t\t\t\tinfoSpy.mock.calls.some((call) =>\n\t\t\t\t\tString(call[0]).includes(\"--project was not provided\")\n\t\t\t\t)\n\t\t\t).toBe(true);\n\t\t} finally {\n\t\t\tcwdMock.mockRestore();\n\t\t}\n\t});\n\n\ttest(\"command line flags override config file values\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tawait writeConfig(projectDir, path.join(workspace, \"from-config\"));\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\t\tconst exitError = new Error(\"process.exit\");\n\t\tvi.spyOn(process, \"exit\").mockImplementation(() => {\n\t\t\tthrow exitError;\n\t\t});\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait expect(\n\t\t\tcompileCommand.parseAsync(\n\t\t\t\t[\n\t\t\t\t\t\"--project\",\n\t\t\t\t\tprojectDir,\n\t\t\t\t\t\"--outdir\",\n\t\t\t\t\t\"./from-flag\",\n\t\t\t\t\t\"--strategy\",\n\t\t\t\t\t\"cookie\",\n\t\t\t\t\t\"baseLocale\",\n\t\t\t\t\t\"--silent\",\n\t\t\t\t],\n\t\t\t\t{ from: \"user\" }\n\t\t\t)\n\t\t).rejects.toBe(exitError);\n\n\t\texpect(compileMock).toHaveBeenCalledWith(\n\t\t\texpect.objectContaining({\n\t\t\t\tproject: projectDir,\n\t\t\t\toutdir: resolve(process.cwd(), \"./from-flag\"),\n\t\t\t\tstrategy: [\"cookie\", \"baseLocale\"],\n\t\t\t})\n\t\t);\n\t});\n\n\t// Deleting the config file mid-watch falls back to the built-in\n\t// defaults (same as never having a config); recreating it is picked up.\n\ttest(\"watch falls back to defaults when the config is deleted\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst configPath = path.join(projectDir, \"paraglide.config.ts\");\n\t\tconst outdir = path.join(workspace, \"from-config\");\n\t\tawait writeConfig(projectDir, outdir);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait compileCommand.parseAsync(\n\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t{ from: \"user\" }\n\t\t);\n\t\texpect(compileMock).toHaveBeenCalledTimes(1);\n\t\texpect(compileMock.mock.calls[0]![0].outdir).toBe(outdir);\n\n\t\tawait rm(configPath);\n\t\tnotifyChange(projectDir, \"paraglide.config.ts\", \"rename\");\n\n\t\tconst deadline = Date.now() + 10_000;\n\t\twhile (compileMock.mock.calls.length < 2 && Date.now() < deadline) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\n\t\texpect(compileMock.mock.calls.length).toBeGreaterThanOrEqual(2);\n\t\tfor (const call of compileMock.mock.calls.slice(1)) {\n\t\t\t// Default outdir, resolved against the working directory.\n\t\t\texpect(\n\t\t\t\tString(call[0].outdir).endsWith(path.join(\"src\", \"paraglide\"))\n\t\t\t).toBe(true);\n\t\t\texpect(call[0].project).toBe(projectDir);\n\t\t}\n\n\t\t// Recreating the config with a different outdir is picked up again.\n\t\tawait writeConfig(projectDir, path.join(workspace, \"recreated\"));\n\t\tnotifyChange(projectDir, \"paraglide.config.ts\", \"rename\");\n\t\tconst recreateDeadline = Date.now() + 10_000;\n\t\twhile (\n\t\t\tDate.now() < recreateDeadline &&\n\t\t\t!compileMock.mock.calls.some((c) =>\n\t\t\t\tString(c[0].outdir).endsWith(\"recreated\")\n\t\t\t)\n\t\t) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\t\texpect(\n\t\t\tcompileMock.mock.calls.some((c) =>\n\t\t\t\tString(c[0].outdir).endsWith(\"recreated\")\n\t\t\t)\n\t\t).toBe(true);\n\t});\n\n\t// Renaming the config between formats switches to the new winner.\n\t// A NEW non-config file appearing directly in the project directory (e.g.\n\t// a locale JSON for a freshly added locale) must schedule a rebuild even\n\t// though no per-file watcher exists for it yet.\n\ttest(\"watch recompiles when a new input appears in the project directory\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tawait writeConfig(projectDir, path.join(workspace, \"from-config\"));\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait compileCommand.parseAsync(\n\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t{ from: \"user\" }\n\t\t);\n\t\texpect(compileMock).toHaveBeenCalledTimes(1);\n\n\t\tawait writeFile(path.join(projectDir, \"es.json\"), \"{}\");\n\t\tnotifyChange(projectDir, \"es.json\", \"rename\");\n\n\t\tconst deadline = Date.now() + 10_000;\n\t\twhile (compileMock.mock.calls.length < 2 && Date.now() < deadline) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\t\texpect(compileMock.mock.calls.length).toBeGreaterThanOrEqual(2);\n\t});\n\n\ttest(\"watch follows config renames between formats\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tconst tsPath = path.join(projectDir, \"paraglide.config.ts\");\n\t\tconst jsPath = path.join(projectDir, \"paraglide.config.js\");\n\t\tconst outdirA = path.join(workspace, \"out-ts\");\n\t\tconst outdirB = path.join(workspace, \"out-js\");\n\t\tawait writeConfig(projectDir, outdirA);\n\n\t\tconst compileMock = vi.fn().mockResolvedValue({});\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: compileMock,\n\t\t}));\n\n\t\tconst { compileCommand } = await import(\"./command.js\");\n\n\t\tawait compileCommand.parseAsync(\n\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t{ from: \"user\" }\n\t\t);\n\t\texpect(compileMock.mock.calls[0]![0].outdir).toBe(outdirA);\n\n\t\t// Format switch: delete .ts, add .js.\n\t\tawait rm(tsPath);\n\t\tawait writeFile(\n\t\t\tjsPath,\n\t\t\t[\"export default {\", ` outdir: ${JSON.stringify(outdirB)},`, \"}\"].join(\n\t\t\t\t\"\\n\"\n\t\t\t)\n\t\t);\n\t\tnotifyChange(projectDir, \"paraglide.config.ts\", \"rename\");\n\t\tnotifyChange(projectDir, \"paraglide.config.js\", \"rename\");\n\n\t\tconst deadline = Date.now() + 10_000;\n\t\twhile (\n\t\t\tDate.now() < deadline &&\n\t\t\t!compileMock.mock.calls.some((c) => c[0].outdir === outdirB)\n\t\t) {\n\t\t\tawait new Promise((r) => setTimeout(r, 50));\n\t\t}\n\t\texpect(compileMock.mock.calls.some((c) => c[0].outdir === outdirB)).toBe(\n\t\t\ttrue\n\t\t);\n\t});\n\n\t// Non-config changes inside the project directory DO rebuild (new\n\t// inputs can appear there) but must NOT reload the config.\n\ttest(\"watch recompiles without reloading config for non-config changes\", async () => {\n\t\tconst { workspace, projectDir } = await createWorkspace();\n\t\tawait writeConfig(projectDir, path.join(workspace, \"from-config\"));\n\n\t\tlet loadCount = 0;\n\t\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\t\tcompile: vi.fn().mockResolvedValue({}),\n\t\t}));\n\t\tvi.doMock(\"../../../services/config/index.js\", async (importActual) => {\n\t\t\tconst actual =\n\t\t\t\tawait importActual<\n\t\t\t\t\ttypeof import(\"../../../services/config/index.js\")\n\t\t\t\t>();\n\t\t\treturn {\n\t\t\t\t...actual,\n\t\t\t\tloadParaglideConfig: (\n\t\t\t\t\t...args: Parameters<typeof actual.loadParaglideConfig>\n\t\t\t\t) => {\n\t\t\t\t\tloadCount++;\n\t\t\t\t\treturn actual.loadParaglideConfig(...args);\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\n\t\ttry {\n\t\t\tconst { compileCommand } = await import(\"./command.js\");\n\t\t\tconst compileModule = (await import(\"../../../compiler/compile.js\")) as {\n\t\t\t\tcompile: ReturnType<typeof vi.fn>;\n\t\t\t};\n\n\t\t\tawait compileCommand.parseAsync(\n\t\t\t\t[\"--project\", projectDir, \"--watch\", \"--silent\"],\n\t\t\t\t{ from: \"user\" }\n\t\t\t);\n\t\t\texpect(compileModule.compile).toHaveBeenCalledTimes(1);\n\t\t\texpect(loadCount).toBe(1);\n\n\t\t\tawait writeFile(path.join(projectDir, \"README.md\"), \"hello\");\n\t\t\tnotifyChange(projectDir, \"README.md\");\n\t\t\tawait vi.waitFor(() =>\n\t\t\t\texpect(compileModule.compile).toHaveBeenCalledTimes(2)\n\t\t\t);\n\t\t\tawait writeFile(path.join(projectDir, \"notes.txt\"), \"world\");\n\t\t\tnotifyChange(projectDir, \"notes.txt\");\n\t\t\tawait vi.waitFor(() =>\n\t\t\t\texpect(compileModule.compile).toHaveBeenCalledTimes(3)\n\t\t\t);\n\n\t\t\texpect(compileModule.compile.mock.calls.length).toBeGreaterThanOrEqual(3);\n\t\t\texpect(loadCount).toBe(1);\n\n\t\t\t// A missing filename is ambiguous and must conservatively refresh config.\n\t\t\tnotifyChange(projectDir, null);\n\t\t\tawait vi.waitFor(() =>\n\t\t\t\texpect(compileModule.compile).toHaveBeenCalledTimes(4)\n\t\t\t);\n\t\t\texpect(loadCount).toBe(2);\n\t\t} finally {\n\t\t\tvi.doUnmock(\"../../../services/config/index.js\");\n\t\t}\n\t});\n});\n\ntest(\"watch shutdown cancels queued rebuilds and ignores late events\", async () => {\n\tconst { workspace, projectDir } = await createWorkspace();\n\tawait writeConfig(projectDir, path.join(workspace, \"output\"));\n\tconst compileMock = vi.fn().mockResolvedValue({ outputHashes: {} });\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({ compile: compileMock }));\n\tconst { compileCommand } = await import(\"./command.js\");\n\tawait compileCommand.parseAsync(\n\t\t[\"--project\", projectDir, \"--watch\", \"--silent\", \"--no-clean-outdir\"],\n\t\t{ from: \"user\" }\n\t);\n\tconst watcher = [...watchers.get(path.resolve(projectDir))!][0]!;\n\tconst lateEvent = watcher.listeners(\"change\")[0]!;\n\tvi.useFakeTimers();\n\tnotifyChange(projectDir, \"notes.txt\");\n\tconst exit = vi\n\t\t.spyOn(process, \"exit\")\n\t\t.mockImplementation(() => undefined as never);\n\tconst stop = process\n\t\t.listeners(\"SIGINT\")\n\t\t.find((listener) => !initialSigintListeners.includes(listener));\n\texpect(stop).toBeDefined();\n\tstop!(\"SIGINT\");\n\tlateEvent(\"change\", \"notes.txt\");\n\tawait vi.advanceTimersByTimeAsync(500);\n\texpect(exit).toHaveBeenCalledWith(0);\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect([...watchers.values()].every((current) => current.size === 0)).toBe(\n\t\ttrue\n\t);\n});\n\ntest(\"compile --watch forwards the newly exposed compiler options (#757)\", async () => {\n\tconst testDirectory = await mkdtemp(path.join(tmpdir(), \"paraglide-cli-\"));\n\ttestDirectories.push(testDirectory);\n\tconst outdir = path.join(testDirectory, \"output\");\n\n\tconst compileMock = vi.fn().mockResolvedValue({ outputHashes: {} });\n\tvi.doMock(\"../../../compiler/compile.js\", () => ({\n\t\tcompile: compileMock,\n\t}));\n\n\tconst { compileCommand } = await import(\"./command.js\");\n\n\tawait compileCommand.parseAsync(\n\t\t[\n\t\t\t\"--project\",\n\t\t\tpath.join(testDirectory, \"project.inlang\"),\n\t\t\t\"--outdir\",\n\t\t\toutdir,\n\t\t\t\"--watch\",\n\t\t\t\"--no-clean-outdir\",\n\t\t\t\"--experimental-static-locale\",\n\t\t\t'\"de\"',\n\t\t\t\"--disable-async-local-storage\",\n\t\t\t\"--silent\",\n\t\t],\n\t\t{ from: \"user\" }\n\t);\n\n\texpect(compileMock).toHaveBeenCalledTimes(1);\n\texpect(compileMock).toHaveBeenCalledWith(\n\t\texpect.objectContaining({\n\t\t\tcleanOutdir: false,\n\t\t\tdisableAsyncLocalStorage: true,\n\t\t\texperimentalStaticLocale: '\"de\"',\n\t\t\tpreviousCompilation: undefined,\n\t\t})\n\t);\n});\n"]}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import type { InitOptions } from "../../init-options.js";
|
|
3
|
+
export declare function createInitCommand(): Command;
|
|
2
4
|
export declare const initCommand: Command;
|
|
5
|
+
export declare function runInit(options: InitOptions & {
|
|
6
|
+
compile?: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
1
|
+
import { Command, Option } from "commander";
|
|
2
2
|
import * as nodePath from "node:path";
|
|
3
3
|
import { Logger } from "../../../services/logger/index.js";
|
|
4
4
|
import { findPackageJson } from "../../../services/environment/package.js";
|
|
5
5
|
import { checkForUncommittedChanges } from "../../steps/check-for-uncomitted-changes.js";
|
|
6
6
|
import { initializeInlangProject } from "../../steps/initialize-inlang-project.js";
|
|
7
7
|
import { maybeAddSherlock } from "../../steps/maybe-add-sherlock.js";
|
|
8
|
-
import { maybeUpdateTsConfig } from "../../steps/update-ts-config.js";
|
|
8
|
+
import { maybeUpdateTsConfig, enableAllowJs, } from "../../steps/update-ts-config.js";
|
|
9
9
|
import { promptForOutdir } from "../../steps/prompt-for-outdir.js";
|
|
10
10
|
import { updatePackageJson } from "../../steps/update-package-json.js";
|
|
11
|
+
import { shellArgument } from "../../utils.js";
|
|
11
12
|
import nodeFs from "node:fs";
|
|
12
13
|
import { ENV_VARIABLES } from "../../../services/env-variables/index.js";
|
|
13
14
|
import { detectBundler } from "../../steps/detect-bundler.js";
|
|
@@ -17,74 +18,227 @@ import { maybeAddMachineTranslation } from "../../steps/maybe-add-machine-transl
|
|
|
17
18
|
import { addInlangCheck } from "../../steps/add-inlang-check.js";
|
|
18
19
|
import { agentsMdSuggestion } from "../../steps/agents-md-suggestion.js";
|
|
19
20
|
import { getNewProjectTemplate } from "../../defaults.js";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
import { addMessageLint, chooseMessageLint, preflightMessageLint, } from "../../steps/add-message-lint.js";
|
|
22
|
+
import { DEFAULT_PROJECT_PATH, DEFAULT_OUTDIR, } from "../../../services/config/defaults.js";
|
|
23
|
+
import { updateViteConfig } from "../../steps/add-vite-plugin.js";
|
|
24
|
+
export function createInitCommand() {
|
|
25
|
+
return new Command()
|
|
26
|
+
.name("init")
|
|
27
|
+
.summary("Initializes Paraglide-JS.")
|
|
28
|
+
.option("-y, --yes", "Use defaults without prompts; optional editor, translation and lint tools are skipped")
|
|
29
|
+
.option("--non-interactive", "Alias for --yes; never open terminal prompts")
|
|
30
|
+
.option("--allow-dirty", "Continue with uncommitted changes")
|
|
31
|
+
.option("--project <path>", "Inlang project to create or reuse", DEFAULT_PROJECT_PATH)
|
|
32
|
+
.option("--outdir <path>", "Directory for generated messages")
|
|
33
|
+
.addOption(new Option("--lint <tool>", "Optional message lint setup").choices([
|
|
34
|
+
"none",
|
|
35
|
+
"eslint",
|
|
36
|
+
"oxlint",
|
|
37
|
+
]))
|
|
38
|
+
.option("--no-check", "Skip adding inlang check")
|
|
39
|
+
.option("--sherlock", "Add the editor recommendation")
|
|
40
|
+
.option("--no-sherlock", "Skip the editor recommendation")
|
|
41
|
+
.option("--machine-translation", "Add a machine-translate script")
|
|
42
|
+
.option("--no-machine-translation", "Skip the machine-translate script")
|
|
43
|
+
.option("--no-compile", "Skip the initial compilation; compile after installing dependencies")
|
|
44
|
+
.action(async (options, command) => {
|
|
45
|
+
try {
|
|
46
|
+
await runInit({
|
|
47
|
+
...options,
|
|
48
|
+
sherlock: command.getOptionValueSource("sherlock") === "cli"
|
|
49
|
+
? options.sherlock
|
|
50
|
+
: undefined,
|
|
51
|
+
machineTranslation: command.getOptionValueSource("machineTranslation") === "cli"
|
|
52
|
+
? options.machineTranslation
|
|
53
|
+
: undefined,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
new Logger({ silent: false, prefix: false }).error(error instanceof Error ? error.message : String(error));
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export const initCommand = createInitCommand();
|
|
63
|
+
export async function runInit(options) {
|
|
64
|
+
const interactive = !(options.yes || options.nonInteractive);
|
|
65
|
+
if (interactive && (!process.stdin.isTTY || !process.stdout.isTTY))
|
|
66
|
+
throw new Error("init needs a terminal. Use --yes (or --non-interactive) for unattended setup; no files were changed.");
|
|
24
67
|
const logger = new Logger({ silent: false, prefix: false });
|
|
25
|
-
|
|
68
|
+
const root = process.cwd();
|
|
69
|
+
const projectPath = nodePath.resolve(root, options.project ?? DEFAULT_PROJECT_PATH);
|
|
70
|
+
const outdir = nodePath.resolve(root, options.outdir ?? DEFAULT_OUTDIR);
|
|
71
|
+
const contains = (parent, child) => {
|
|
72
|
+
const relative = nodePath.relative(parent, child);
|
|
73
|
+
return (relative === "" ||
|
|
74
|
+
(!relative.startsWith(".." + nodePath.sep) &&
|
|
75
|
+
relative !== ".." &&
|
|
76
|
+
!nodePath.isAbsolute(relative)));
|
|
77
|
+
};
|
|
78
|
+
if (!options.project?.trim() && options.project !== undefined)
|
|
79
|
+
throw new Error("--project must not be empty.");
|
|
80
|
+
if (!options.outdir?.trim() && options.outdir !== undefined)
|
|
81
|
+
throw new Error("--outdir must not be empty.");
|
|
82
|
+
if (contains(outdir, root) ||
|
|
83
|
+
contains(projectPath, root) ||
|
|
84
|
+
contains(outdir, projectPath) ||
|
|
85
|
+
contains(projectPath, outdir))
|
|
86
|
+
throw new Error("Project and output directories must be distinct and must not contain the package root or each other.");
|
|
26
87
|
const ctx = {
|
|
27
88
|
logger,
|
|
28
89
|
fs: nodeFs.promises,
|
|
29
90
|
syncFs: nodeFs,
|
|
30
|
-
root
|
|
91
|
+
root,
|
|
92
|
+
interactive,
|
|
93
|
+
allowDirty: options.allowDirty,
|
|
94
|
+
projectPath,
|
|
95
|
+
outdir: options.outdir
|
|
96
|
+
? "./" + nodePath.relative(root, outdir).split(nodePath.sep).join("/")
|
|
97
|
+
: undefined,
|
|
98
|
+
sherlock: options.sherlock,
|
|
99
|
+
machineTranslation: options.machineTranslation,
|
|
31
100
|
};
|
|
32
|
-
|
|
33
|
-
const ctx2 = await enforcePackageJsonExists(
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
101
|
+
await checkForUncommittedChanges(ctx);
|
|
102
|
+
const ctx2 = await enforcePackageJsonExists(ctx);
|
|
103
|
+
const pkg = JSON.parse(await ctx.fs.readFile(ctx2.packageJsonPath, "utf8"));
|
|
104
|
+
if (!pkg || typeof pkg !== "object" || Array.isArray(pkg))
|
|
105
|
+
throw new Error("package.json must contain a JSON object.");
|
|
106
|
+
for (const field of ["scripts", "dependencies", "devDependencies"])
|
|
107
|
+
if (pkg[field] !== undefined &&
|
|
108
|
+
(!pkg[field] ||
|
|
109
|
+
typeof pkg[field] !== "object" ||
|
|
110
|
+
Array.isArray(pkg[field])))
|
|
111
|
+
throw new Error(`package.json ${field} must be an object.`);
|
|
112
|
+
// Validate collisions before creating projects or changing dependencies.
|
|
113
|
+
const settingsExist = await nodeFs.promises
|
|
114
|
+
.access(nodePath.join(projectPath, "settings.json"))
|
|
115
|
+
.then(() => true, () => false);
|
|
116
|
+
if (!settingsExist) {
|
|
117
|
+
const contents = await nodeFs.promises
|
|
118
|
+
.readdir(projectPath)
|
|
119
|
+
.catch((error) => {
|
|
120
|
+
if (error.code === "ENOENT")
|
|
121
|
+
return [];
|
|
122
|
+
throw error;
|
|
123
|
+
});
|
|
124
|
+
if (contents.length)
|
|
125
|
+
throw new Error("The selected project directory is nonempty and has no settings.json; it will not be overwritten.");
|
|
40
126
|
}
|
|
41
|
-
|
|
42
|
-
await
|
|
127
|
+
if (!interactive) {
|
|
128
|
+
const text = await nodeFs.promises
|
|
129
|
+
.readFile(nodePath.join(root, "tsconfig.json"), "utf8")
|
|
130
|
+
.catch((error) => {
|
|
131
|
+
if (error.code === "ENOENT")
|
|
132
|
+
return undefined;
|
|
133
|
+
throw error;
|
|
134
|
+
});
|
|
135
|
+
if (text !== undefined)
|
|
136
|
+
enableAllowJs(text);
|
|
137
|
+
}
|
|
138
|
+
const ctx4 = await promptForOutdir(ctx2);
|
|
139
|
+
const normalizedOutput = "./" +
|
|
140
|
+
nodePath
|
|
141
|
+
.relative(root, nodePath.resolve(root, ctx4.outdir))
|
|
142
|
+
.split(nodePath.sep)
|
|
143
|
+
.join("/");
|
|
144
|
+
const chosenOutput = nodePath.resolve(root, ctx4.outdir);
|
|
145
|
+
if (contains(chosenOutput, root) ||
|
|
146
|
+
contains(chosenOutput, projectPath) ||
|
|
147
|
+
contains(projectPath, chosenOutput))
|
|
148
|
+
throw new Error("Output must not contain the package root or overlap the inlang project.");
|
|
149
|
+
const lint = await chooseMessageLint({ ...ctx4, lint: options.lint });
|
|
150
|
+
await preflightMessageLint({ ...ctx4, outdir: normalizedOutput, lint });
|
|
151
|
+
const detected = await detectBundler(ctx4);
|
|
152
|
+
if (!interactive && detected.bundler === "vite") {
|
|
153
|
+
const config = await ctx.fs.readFile(detected.configPath, "utf8");
|
|
154
|
+
const result = updateViteConfig({
|
|
155
|
+
config,
|
|
156
|
+
projectPath: "./" +
|
|
157
|
+
nodePath.relative(root, projectPath).split(nodePath.sep).join("/"),
|
|
158
|
+
outdir: normalizedOutput,
|
|
159
|
+
});
|
|
160
|
+
if (!result.ok && result.reason !== "Already present")
|
|
161
|
+
throw new Error("Vite configuration cannot be updated automatically: " +
|
|
162
|
+
result.reason +
|
|
163
|
+
". Add the plugin manually before rerunning init.");
|
|
43
164
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
await
|
|
47
|
-
|
|
165
|
+
if (interactive)
|
|
166
|
+
logger.box("Welcome to Paraglide JS 🪂");
|
|
167
|
+
const initialized = await initializeInlangProject({
|
|
168
|
+
...ctx4,
|
|
169
|
+
outdir: normalizedOutput,
|
|
170
|
+
});
|
|
171
|
+
const portable = {
|
|
172
|
+
...initialized,
|
|
173
|
+
projectPath: "./" +
|
|
174
|
+
nodePath
|
|
175
|
+
.relative(root, initialized.projectPath)
|
|
176
|
+
.split(nodePath.sep)
|
|
177
|
+
.join("/"),
|
|
178
|
+
lint,
|
|
179
|
+
};
|
|
48
180
|
try {
|
|
49
|
-
await
|
|
50
|
-
|
|
181
|
+
const ctx5 = await addParaglideJsToDevDependencies(portable);
|
|
182
|
+
const ctx6 = await detectBundler(ctx5);
|
|
183
|
+
if (ctx6.bundler === "vite")
|
|
184
|
+
await addVitePlugin(ctx6);
|
|
185
|
+
else
|
|
186
|
+
await addCompileStepToPackageJSON(ctx6);
|
|
187
|
+
const ctx7 = await maybeUpdateTsConfig(ctx6);
|
|
188
|
+
const ctx8 = await maybeAddSherlock(ctx7);
|
|
189
|
+
if (options.check !== false)
|
|
190
|
+
await addInlangCheck(ctx8);
|
|
191
|
+
const ctx9 = await maybeAddMachineTranslation(ctx8);
|
|
192
|
+
await addMessageLint({ ...ctx9, lint });
|
|
193
|
+
if (options.compile !== false) {
|
|
194
|
+
try {
|
|
195
|
+
await compile({
|
|
196
|
+
project: ctx9.projectPath,
|
|
197
|
+
outdir: ctx9.outdir,
|
|
198
|
+
cleanOutdir: false,
|
|
199
|
+
});
|
|
200
|
+
logger.success("Ran the paraglide compiler");
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
if (!interactive)
|
|
204
|
+
throw new Error("Setup files were written, but compilation failed. Install dependencies and rerun init or compile. Cause: " +
|
|
205
|
+
(error instanceof Error ? error.message : String(error)));
|
|
206
|
+
logger.warn("Failed to compile automatically. Install dependencies and run the compiler manually.");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
logger.success("Setup complete! Install dependencies, then run your build" +
|
|
210
|
+
(lint !== "none" ? " and lint:i18n." : "."));
|
|
211
|
+
const settings = await ctx9.project.settings.get();
|
|
212
|
+
const pattern = settings["plugin.inlang.messageFormat"]?.pathPattern;
|
|
213
|
+
process.stdout.write(agentsMdSuggestion({
|
|
214
|
+
root,
|
|
215
|
+
projectPath: ctx9.projectPath,
|
|
51
216
|
outdir: ctx9.outdir,
|
|
52
|
-
|
|
53
|
-
|
|
217
|
+
pathPattern: typeof pattern === "string"
|
|
218
|
+
? nodePath
|
|
219
|
+
.relative(root, nodePath.resolve(nodePath.dirname(nodePath.resolve(root, ctx9.projectPath)), pattern))
|
|
220
|
+
.split(nodePath.sep)
|
|
221
|
+
.join("/")
|
|
222
|
+
: getNewProjectTemplate()["plugin.inlang.messageFormat"]
|
|
223
|
+
.pathPattern,
|
|
224
|
+
}) + "\n");
|
|
54
225
|
}
|
|
55
|
-
|
|
56
|
-
|
|
226
|
+
finally {
|
|
227
|
+
await initialized.project.close();
|
|
57
228
|
}
|
|
58
|
-
|
|
59
|
-
"Setup complete! Run `npm install` and then `npm run build`.",
|
|
60
|
-
`Docs: https://paraglidejs.com/basics`,
|
|
61
|
-
"\n",
|
|
62
|
-
"For questions and feedback, visit",
|
|
63
|
-
"https://github.com/opral/paraglide-js/issues",
|
|
64
|
-
].join("\n");
|
|
65
|
-
ctx.logger.box(successMessage);
|
|
66
|
-
const settings = await ctx9.project.settings.get();
|
|
67
|
-
const pathPattern = settings["plugin.inlang.messageFormat"]?.pathPattern;
|
|
68
|
-
// Written directly: the logger renders `code` spans and drops the
|
|
69
|
-
// backticks, which the AGENTS.md snippet needs when copied.
|
|
70
|
-
process.stdout.write(agentsMdSuggestion({
|
|
71
|
-
root: ctx9.root,
|
|
72
|
-
projectPath: ctx9.projectPath,
|
|
73
|
-
pathPattern: typeof pathPattern === "string"
|
|
74
|
-
? pathPattern
|
|
75
|
-
: getNewProjectTemplate()["plugin.inlang.messageFormat"]
|
|
76
|
-
.pathPattern,
|
|
77
|
-
outdir: ctx9.outdir,
|
|
78
|
-
}) + "\n\n",
|
|
79
|
-
// exit once the write is flushed, stdout to a pipe is async
|
|
80
|
-
() => process.exit(0));
|
|
81
|
-
});
|
|
229
|
+
}
|
|
82
230
|
const addParaglideJsToDevDependencies = async (ctx) => {
|
|
83
231
|
const ctx1 = await updatePackageJson({
|
|
84
|
-
devDependencies: async (devDeps) =>
|
|
85
|
-
|
|
86
|
-
"@inlang/paraglide-js"
|
|
87
|
-
|
|
232
|
+
devDependencies: async (devDeps) => {
|
|
233
|
+
const pkg = JSON.parse(await ctx.fs.readFile(ctx.packageJsonPath, "utf8"));
|
|
234
|
+
if (pkg.dependencies?.["@inlang/paraglide-js"] ||
|
|
235
|
+
devDeps["@inlang/paraglide-js"])
|
|
236
|
+
return devDeps;
|
|
237
|
+
return {
|
|
238
|
+
...devDeps,
|
|
239
|
+
"@inlang/paraglide-js": `^${ENV_VARIABLES.PARJS_PACKAGE_VERSION}`,
|
|
240
|
+
};
|
|
241
|
+
},
|
|
88
242
|
})(ctx);
|
|
89
243
|
ctx.logger.success("Added @inlang/paraglide-js to the devDependencies in package.json.");
|
|
90
244
|
return ctx1;
|
|
@@ -93,13 +247,13 @@ const enforcePackageJsonExists = async (ctx) => {
|
|
|
93
247
|
const packageJsonPath = await findPackageJson(ctx.fs, process.cwd());
|
|
94
248
|
if (!packageJsonPath) {
|
|
95
249
|
ctx.logger.warn("No package.json found in the current working directory. Please change the working directory to the directory with a package.json file.");
|
|
96
|
-
|
|
250
|
+
throw new Error("No package.json found in the current working directory.");
|
|
97
251
|
}
|
|
98
252
|
return { ...ctx, packageJsonPath };
|
|
99
253
|
};
|
|
100
254
|
const addCompileStepToPackageJSON = async (ctx) => {
|
|
101
|
-
const projectPath = "./" + nodePath.relative(process.cwd(), ctx.projectPath);
|
|
102
|
-
const outdir = "./" + nodePath.relative(process.cwd(), ctx.outdir);
|
|
255
|
+
const projectPath = shellArgument("./" + nodePath.relative(process.cwd(), nodePath.resolve(ctx.projectPath)));
|
|
256
|
+
const outdir = shellArgument("./" + nodePath.relative(process.cwd(), nodePath.resolve(ctx.outdir)));
|
|
103
257
|
ctx = await updatePackageJson({
|
|
104
258
|
scripts: async (scripts) => {
|
|
105
259
|
if (scripts.build === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":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CAAC,OAAO,CACjB,8DAA8D,CAC9D,CAAC;YACF,GAAG,CAAC,MAAM,CAAC,IAAI,CACd,wEAAwE,CACxE,CAAC;YACF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC,CAAC,GAAG,CAAC,CAAC;IAER,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC","sourcesContent":["import { Command } from \"commander\";\nimport * as nodePath from \"node:path\";\nimport { Logger } from \"../../../services/logger/index.js\";\nimport { findPackageJson } from \"../../../services/environment/package.js\";\nimport { checkForUncommittedChanges } from \"../../steps/check-for-uncomitted-changes.js\";\nimport { initializeInlangProject } from \"../../steps/initialize-inlang-project.js\";\nimport { maybeAddSherlock } from \"../../steps/maybe-add-sherlock.js\";\nimport { maybeUpdateTsConfig } from \"../../steps/update-ts-config.js\";\nimport { promptForOutdir } from \"../../steps/prompt-for-outdir.js\";\nimport { updatePackageJson } from \"../../steps/update-package-json.js\";\nimport type { CliStep } from \"../../utils.js\";\nimport nodeFs from \"node:fs\";\nimport { ENV_VARIABLES } from \"../../../services/env-variables/index.js\";\nimport { detectBundler } from \"../../steps/detect-bundler.js\";\nimport { addVitePlugin } from \"../../steps/add-vite-plugin.js\";\nimport { compile } from \"../../../compiler/compile.js\";\nimport { maybeAddMachineTranslation } from \"../../steps/maybe-add-machine-translation.js\";\nimport { addInlangCheck } from \"../../steps/add-inlang-check.js\";\nimport { agentsMdSuggestion } from \"../../steps/agents-md-suggestion.js\";\nimport { getNewProjectTemplate } from \"../../defaults.js\";\n\nexport const initCommand = new Command()\n\t.name(\"init\")\n\t.summary(\"Initializes Paraglide-JS.\")\n\t.action(async () => {\n\t\tconst logger = new Logger({ silent: false, prefix: false });\n\n\t\tlogger.box(\"Welcome to Paraglide JS 🪂\");\n\n\t\tconst ctx = {\n\t\t\tlogger,\n\t\t\tfs: nodeFs.promises,\n\t\t\tsyncFs: nodeFs,\n\t\t\troot: process.cwd(),\n\t\t} as const;\n\n\t\tconst ctx1 = await checkForUncommittedChanges(ctx);\n\t\tconst ctx2 = await enforcePackageJsonExists(ctx1);\n\t\tconst ctx3 = await initializeInlangProject(ctx2);\n\t\tconst ctx4 = await promptForOutdir(ctx3);\n\t\tconst ctx5 = await addParaglideJsToDevDependencies(ctx4);\n\t\tconst ctx6 = await detectBundler(ctx5);\n\n\t\tif (ctx6.bundler === \"vite\") {\n\t\t\tawait addVitePlugin(ctx6);\n\t\t} else {\n\t\t\tawait addCompileStepToPackageJSON(ctx6);\n\t\t}\n\n\t\tconst ctx7 = await maybeUpdateTsConfig(ctx6);\n\t\tconst ctx8 = await maybeAddSherlock(ctx7);\n\t\tawait addInlangCheck(ctx8);\n\t\tconst ctx9 = await maybeAddMachineTranslation(ctx8);\n\n\t\ttry {\n\t\t\tawait compile({\n\t\t\t\tproject: ctx9.projectPath,\n\t\t\t\toutdir: ctx9.outdir,\n\t\t\t});\n\t\t\tctx.logger.success(\"Ran the paraglide compiler\");\n\t\t} catch {\n\t\t\tctx.logger.warn(\n\t\t\t\t\"Failed to compile project automatically. You will need to run the compiler manually\"\n\t\t\t);\n\t\t}\n\n\t\tconst successMessage = [\n\t\t\t\"Setup complete! Run `npm install` and then `npm run build`.\",\n\t\t\t`Docs: https://paraglidejs.com/basics`,\n\t\t\t\"\\n\",\n\t\t\t\"For questions and feedback, visit\",\n\t\t\t\"https://github.com/opral/paraglide-js/issues\",\n\t\t].join(\"\\n\");\n\t\tctx.logger.box(successMessage);\n\n\t\tconst settings = await ctx9.project.settings.get();\n\t\tconst pathPattern = settings[\"plugin.inlang.messageFormat\"]?.pathPattern;\n\t\t// Written directly: the logger renders `code` spans and drops the\n\t\t// backticks, which the AGENTS.md snippet needs when copied.\n\t\tprocess.stdout.write(\n\t\t\tagentsMdSuggestion({\n\t\t\t\troot: ctx9.root,\n\t\t\t\tprojectPath: ctx9.projectPath,\n\t\t\t\tpathPattern:\n\t\t\t\t\ttypeof pathPattern === \"string\"\n\t\t\t\t\t\t? pathPattern\n\t\t\t\t\t\t: getNewProjectTemplate()[\"plugin.inlang.messageFormat\"]\n\t\t\t\t\t\t\t\t.pathPattern,\n\t\t\t\toutdir: ctx9.outdir,\n\t\t\t}) + \"\\n\\n\",\n\t\t\t// exit once the write is flushed, stdout to a pipe is async\n\t\t\t() => process.exit(0)\n\t\t);\n\t});\n\nconst addParaglideJsToDevDependencies: CliStep<\n\t{\n\t\tfs: typeof import(\"node:fs/promises\");\n\t\tlogger: Logger;\n\t\tpackageJsonPath: string;\n\t},\n\tunknown\n> = async (ctx) => {\n\tconst ctx1 = await updatePackageJson({\n\t\tdevDependencies: async (devDeps) => ({\n\t\t\t...devDeps,\n\t\t\t\"@inlang/paraglide-js\": `^${ENV_VARIABLES.PARJS_PACKAGE_VERSION}`,\n\t\t}),\n\t})(ctx);\n\tctx.logger.success(\n\t\t\"Added @inlang/paraglide-js to the devDependencies in package.json.\"\n\t);\n\treturn ctx1;\n};\n\nconst enforcePackageJsonExists: CliStep<\n\t{ logger: Logger; fs: typeof import(\"node:fs/promises\") },\n\t{ packageJsonPath: string }\n> = async (ctx) => {\n\tconst packageJsonPath = await findPackageJson(ctx.fs, process.cwd());\n\tif (!packageJsonPath) {\n\t\tctx.logger.warn(\n\t\t\t\"No package.json found in the current working directory. Please change the working directory to the directory with a package.json file.\"\n\t\t);\n\t\treturn process.exit(0);\n\t}\n\treturn { ...ctx, packageJsonPath };\n};\n\nconst addCompileStepToPackageJSON: CliStep<\n\t{\n\t\tfs: typeof import(\"node:fs/promises\");\n\t\tlogger: Logger;\n\t\tprojectPath: string;\n\t\toutdir: string;\n\t\tpackageJsonPath: string;\n\t},\n\tunknown\n> = async (ctx) => {\n\tconst projectPath = \"./\" + nodePath.relative(process.cwd(), ctx.projectPath);\n\tconst outdir = \"./\" + nodePath.relative(process.cwd(), ctx.outdir);\n\n\tctx = await updatePackageJson({\n\t\tscripts: async (scripts) => {\n\t\t\tif (scripts.build === undefined) {\n\t\t\t\tscripts.build = `paraglide-js compile --project ${projectPath} --outdir ${outdir}`;\n\t\t\t} else if (scripts.build.includes(\"paraglide-js compile\") === false) {\n\t\t\t\tscripts.build = `paraglide-js compile --project ${projectPath} --outdir ${outdir} && ${scripts.build}`;\n\t\t\t} else {\n\t\t\t\treturn scripts;\n\t\t\t}\n\n\t\t\tctx.logger.success(\n\t\t\t\t\"Added the compile command to the build step in package.json.\"\n\t\t\t);\n\t\t\tctx.logger.info(\n\t\t\t\t`Visit https://paraglidejs.com/compiling-messages for more information.`\n\t\t\t);\n\t\t\treturn scripts;\n\t\t},\n\t})(ctx);\n\n\treturn ctx;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/cli/commands/init/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACN,mBAAmB,EACnB,aAAa,GACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAgB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAA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AG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CACrE,CAAC;IAEF,GAAG,GAAG,MAAM,iBAAiB,CAAC;QAC7B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1B,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO,CAAC,KAAK,GAAG,kCAAkC,WAAW,aAAa,MAAM,EAAE,CAAC;YACpF,CAAC;iBAAM,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,KAAK,KAAK,EAAE,CAAC;gBACrE,OAAO,CAAC,KAAK,GAAG,kCAAkC,WAAW,aAAa,MAAM,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;YACxG,CAAC;iBAAM,CAAC;gBACP,OAAO,OAAO,CAAC;YAChB,CAAC;YAED,GAAG,CAAC,MAAM,CAAC,OAAO,CACjB,8DAA8D,CAC9D,CAAC;YACF,GAAG,CAAC,MAAM,CAAC,IAAI,CACd,wEAAwE,CACxE,CAAC;YACF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC,CAAC,GAAG,CAAC,CAAC;IAER,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC","sourcesContent":["import { Command, Option } from \"commander\";\nimport * as nodePath from \"node:path\";\nimport { Logger } from \"../../../services/logger/index.js\";\nimport { findPackageJson } from \"../../../services/environment/package.js\";\nimport { checkForUncommittedChanges } from \"../../steps/check-for-uncomitted-changes.js\";\nimport { initializeInlangProject } from \"../../steps/initialize-inlang-project.js\";\nimport { maybeAddSherlock } from \"../../steps/maybe-add-sherlock.js\";\nimport {\n\tmaybeUpdateTsConfig,\n\tenableAllowJs,\n} from \"../../steps/update-ts-config.js\";\nimport { promptForOutdir } from \"../../steps/prompt-for-outdir.js\";\nimport { updatePackageJson } from \"../../steps/update-package-json.js\";\nimport { shellArgument, type CliStep } from \"../../utils.js\";\nimport nodeFs from \"node:fs\";\nimport { ENV_VARIABLES } from \"../../../services/env-variables/index.js\";\nimport { detectBundler } from \"../../steps/detect-bundler.js\";\nimport { addVitePlugin } from \"../../steps/add-vite-plugin.js\";\nimport { compile } from \"../../../compiler/compile.js\";\nimport { maybeAddMachineTranslation } from \"../../steps/maybe-add-machine-translation.js\";\nimport { addInlangCheck } from \"../../steps/add-inlang-check.js\";\nimport { agentsMdSuggestion } from \"../../steps/agents-md-suggestion.js\";\nimport { getNewProjectTemplate } from \"../../defaults.js\";\n\nimport type { InitOptions } from \"../../init-options.js\";\nimport {\n\taddMessageLint,\n\tchooseMessageLint,\n\tpreflightMessageLint,\n} from \"../../steps/add-message-lint.js\";\nimport {\n\tDEFAULT_PROJECT_PATH,\n\tDEFAULT_OUTDIR,\n} from \"../../../services/config/defaults.js\";\nimport { updateViteConfig } from \"../../steps/add-vite-plugin.js\";\n\nexport function createInitCommand() {\n\treturn new Command()\n\t\t.name(\"init\")\n\t\t.summary(\"Initializes Paraglide-JS.\")\n\t\t.option(\n\t\t\t\"-y, --yes\",\n\t\t\t\"Use defaults without prompts; optional editor, translation and lint tools are skipped\"\n\t\t)\n\t\t.option(\"--non-interactive\", \"Alias for --yes; never open terminal prompts\")\n\t\t.option(\"--allow-dirty\", \"Continue with uncommitted changes\")\n\t\t.option(\n\t\t\t\"--project <path>\",\n\t\t\t\"Inlang project to create or reuse\",\n\t\t\tDEFAULT_PROJECT_PATH\n\t\t)\n\t\t.option(\"--outdir <path>\", \"Directory for generated messages\")\n\t\t.addOption(\n\t\t\tnew Option(\"--lint <tool>\", \"Optional message lint setup\").choices([\n\t\t\t\t\"none\",\n\t\t\t\t\"eslint\",\n\t\t\t\t\"oxlint\",\n\t\t\t])\n\t\t)\n\t\t.option(\"--no-check\", \"Skip adding inlang check\")\n\t\t.option(\"--sherlock\", \"Add the editor recommendation\")\n\t\t.option(\"--no-sherlock\", \"Skip the editor recommendation\")\n\t\t.option(\"--machine-translation\", \"Add a machine-translate script\")\n\t\t.option(\"--no-machine-translation\", \"Skip the machine-translate script\")\n\t\t.option(\n\t\t\t\"--no-compile\",\n\t\t\t\"Skip the initial compilation; compile after installing dependencies\"\n\t\t)\n\t\t.action(\n\t\t\tasync (options: InitOptions & { compile: boolean }, command: Command) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait runInit({\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tsherlock:\n\t\t\t\t\t\t\tcommand.getOptionValueSource(\"sherlock\") === \"cli\"\n\t\t\t\t\t\t\t\t? options.sherlock\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tmachineTranslation:\n\t\t\t\t\t\t\tcommand.getOptionValueSource(\"machineTranslation\") === \"cli\"\n\t\t\t\t\t\t\t\t? options.machineTranslation\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tnew Logger({ silent: false, prefix: false }).error(\n\t\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t\t);\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n}\n\nexport const initCommand = createInitCommand();\n\nexport async function runInit(options: InitOptions & { compile?: boolean }) {\n\tconst interactive = !(options.yes || options.nonInteractive);\n\tif (interactive && (!process.stdin.isTTY || !process.stdout.isTTY))\n\t\tthrow new Error(\n\t\t\t\"init needs a terminal. Use --yes (or --non-interactive) for unattended setup; no files were changed.\"\n\t\t);\n\tconst logger = new Logger({ silent: false, prefix: false });\n\tconst root = process.cwd();\n\tconst projectPath = nodePath.resolve(\n\t\troot,\n\t\toptions.project ?? DEFAULT_PROJECT_PATH\n\t);\n\tconst outdir = nodePath.resolve(root, options.outdir ?? DEFAULT_OUTDIR);\n\tconst contains = (parent: string, child: string) => {\n\t\tconst relative = nodePath.relative(parent, child);\n\t\treturn (\n\t\t\trelative === \"\" ||\n\t\t\t(!relative.startsWith(\"..\" + nodePath.sep) &&\n\t\t\t\trelative !== \"..\" &&\n\t\t\t\t!nodePath.isAbsolute(relative))\n\t\t);\n\t};\n\tif (!options.project?.trim() && options.project !== undefined)\n\t\tthrow new Error(\"--project must not be empty.\");\n\tif (!options.outdir?.trim() && options.outdir !== undefined)\n\t\tthrow new Error(\"--outdir must not be empty.\");\n\tif (\n\t\tcontains(outdir, root) ||\n\t\tcontains(projectPath, root) ||\n\t\tcontains(outdir, projectPath) ||\n\t\tcontains(projectPath, outdir)\n\t)\n\t\tthrow new Error(\n\t\t\t\"Project and output directories must be distinct and must not contain the package root or each other.\"\n\t\t);\n\tconst ctx = {\n\t\tlogger,\n\t\tfs: nodeFs.promises,\n\t\tsyncFs: nodeFs,\n\t\troot,\n\t\tinteractive,\n\t\tallowDirty: options.allowDirty,\n\t\tprojectPath,\n\t\toutdir: options.outdir\n\t\t\t? \"./\" + nodePath.relative(root, outdir).split(nodePath.sep).join(\"/\")\n\t\t\t: undefined,\n\t\tsherlock: options.sherlock,\n\t\tmachineTranslation: options.machineTranslation,\n\t};\n\tawait checkForUncommittedChanges(ctx);\n\tconst ctx2 = await enforcePackageJsonExists(ctx);\n\tconst pkg = JSON.parse(await ctx.fs.readFile(ctx2.packageJsonPath, \"utf8\"));\n\tif (!pkg || typeof pkg !== \"object\" || Array.isArray(pkg))\n\t\tthrow new Error(\"package.json must contain a JSON object.\");\n\tfor (const field of [\"scripts\", \"dependencies\", \"devDependencies\"])\n\t\tif (\n\t\t\tpkg[field] !== undefined &&\n\t\t\t(!pkg[field] ||\n\t\t\t\ttypeof pkg[field] !== \"object\" ||\n\t\t\t\tArray.isArray(pkg[field]))\n\t\t)\n\t\t\tthrow new Error(`package.json ${field} must be an object.`);\n\t// Validate collisions before creating projects or changing dependencies.\n\tconst settingsExist = await nodeFs.promises\n\t\t.access(nodePath.join(projectPath, \"settings.json\"))\n\t\t.then(\n\t\t\t() => true,\n\t\t\t() => false\n\t\t);\n\tif (!settingsExist) {\n\t\tconst contents = await nodeFs.promises\n\t\t\t.readdir(projectPath)\n\t\t\t.catch((error: NodeJS.ErrnoException) => {\n\t\t\t\tif (error.code === \"ENOENT\") return [];\n\t\t\t\tthrow error;\n\t\t\t});\n\t\tif (contents.length)\n\t\t\tthrow new Error(\n\t\t\t\t\"The selected project directory is nonempty and has no settings.json; it will not be overwritten.\"\n\t\t\t);\n\t}\n\tif (!interactive) {\n\t\tconst text = await nodeFs.promises\n\t\t\t.readFile(nodePath.join(root, \"tsconfig.json\"), \"utf8\")\n\t\t\t.catch((error: NodeJS.ErrnoException) => {\n\t\t\t\tif (error.code === \"ENOENT\") return undefined;\n\t\t\t\tthrow error;\n\t\t\t});\n\t\tif (text !== undefined) enableAllowJs(text);\n\t}\n\tconst ctx4 = await promptForOutdir(ctx2);\n\tconst normalizedOutput =\n\t\t\"./\" +\n\t\tnodePath\n\t\t\t.relative(root, nodePath.resolve(root, ctx4.outdir))\n\t\t\t.split(nodePath.sep)\n\t\t\t.join(\"/\");\n\tconst chosenOutput = nodePath.resolve(root, ctx4.outdir);\n\tif (\n\t\tcontains(chosenOutput, root) ||\n\t\tcontains(chosenOutput, projectPath) ||\n\t\tcontains(projectPath, chosenOutput)\n\t)\n\t\tthrow new Error(\n\t\t\t\"Output must not contain the package root or overlap the inlang project.\"\n\t\t);\n\tconst lint = await chooseMessageLint({ ...ctx4, lint: options.lint });\n\tawait preflightMessageLint({ ...ctx4, outdir: normalizedOutput, lint });\n\tconst detected = await detectBundler(ctx4);\n\tif (!interactive && detected.bundler === \"vite\") {\n\t\tconst config = await ctx.fs.readFile(detected.configPath, \"utf8\");\n\t\tconst result = updateViteConfig({\n\t\t\tconfig,\n\t\t\tprojectPath:\n\t\t\t\t\"./\" +\n\t\t\t\tnodePath.relative(root, projectPath).split(nodePath.sep).join(\"/\"),\n\t\t\toutdir: normalizedOutput,\n\t\t});\n\t\tif (!result.ok && result.reason !== \"Already present\")\n\t\t\tthrow new Error(\n\t\t\t\t\"Vite configuration cannot be updated automatically: \" +\n\t\t\t\t\tresult.reason +\n\t\t\t\t\t\". Add the plugin manually before rerunning init.\"\n\t\t\t);\n\t}\n\tif (interactive) logger.box(\"Welcome to Paraglide JS 🪂\");\n\tconst initialized = await initializeInlangProject({\n\t\t...ctx4,\n\t\toutdir: normalizedOutput,\n\t});\n\tconst portable = {\n\t\t...initialized,\n\t\tprojectPath:\n\t\t\t\"./\" +\n\t\t\tnodePath\n\t\t\t\t.relative(root, initialized.projectPath)\n\t\t\t\t.split(nodePath.sep)\n\t\t\t\t.join(\"/\"),\n\t\tlint,\n\t};\n\ttry {\n\t\tconst ctx5 = await addParaglideJsToDevDependencies(portable);\n\t\tconst ctx6 = await detectBundler(ctx5);\n\t\tif (ctx6.bundler === \"vite\") await addVitePlugin(ctx6);\n\t\telse await addCompileStepToPackageJSON(ctx6);\n\t\tconst ctx7 = await maybeUpdateTsConfig(ctx6);\n\t\tconst ctx8 = await maybeAddSherlock(ctx7);\n\t\tif (options.check !== false) await addInlangCheck(ctx8);\n\t\tconst ctx9 = await maybeAddMachineTranslation(ctx8);\n\t\tawait addMessageLint({ ...ctx9, lint });\n\t\tif (options.compile !== false) {\n\t\t\ttry {\n\t\t\t\tawait compile({\n\t\t\t\t\tproject: ctx9.projectPath,\n\t\t\t\t\toutdir: ctx9.outdir,\n\t\t\t\t\tcleanOutdir: false,\n\t\t\t\t});\n\t\t\t\tlogger.success(\"Ran the paraglide compiler\");\n\t\t\t} catch (error) {\n\t\t\t\tif (!interactive)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Setup files were written, but compilation failed. Install dependencies and rerun init or compile. Cause: \" +\n\t\t\t\t\t\t\t(error instanceof Error ? error.message : String(error))\n\t\t\t\t\t);\n\t\t\t\tlogger.warn(\n\t\t\t\t\t\"Failed to compile automatically. Install dependencies and run the compiler manually.\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tlogger.success(\n\t\t\t\"Setup complete! Install dependencies, then run your build\" +\n\t\t\t\t(lint !== \"none\" ? \" and lint:i18n.\" : \".\")\n\t\t);\n\t\tconst settings = await ctx9.project.settings.get();\n\t\tconst pattern = settings[\"plugin.inlang.messageFormat\"]?.pathPattern;\n\t\tprocess.stdout.write(\n\t\t\tagentsMdSuggestion({\n\t\t\t\troot,\n\t\t\t\tprojectPath: ctx9.projectPath,\n\t\t\t\toutdir: ctx9.outdir,\n\t\t\t\tpathPattern:\n\t\t\t\t\ttypeof pattern === \"string\"\n\t\t\t\t\t\t? nodePath\n\t\t\t\t\t\t\t\t.relative(\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\tnodePath.resolve(\n\t\t\t\t\t\t\t\t\t\tnodePath.dirname(nodePath.resolve(root, ctx9.projectPath)),\n\t\t\t\t\t\t\t\t\t\tpattern\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.split(nodePath.sep)\n\t\t\t\t\t\t\t\t.join(\"/\")\n\t\t\t\t\t\t: getNewProjectTemplate()[\"plugin.inlang.messageFormat\"]\n\t\t\t\t\t\t\t\t.pathPattern,\n\t\t\t}) + \"\\n\"\n\t\t);\n\t} finally {\n\t\tawait initialized.project.close();\n\t}\n}\n\nconst addParaglideJsToDevDependencies: CliStep<\n\t{\n\t\tfs: typeof import(\"node:fs/promises\");\n\t\tlogger: Logger;\n\t\tpackageJsonPath: string;\n\t},\n\tunknown\n> = async (ctx) => {\n\tconst ctx1 = await updatePackageJson({\n\t\tdevDependencies: async (devDeps) => {\n\t\t\tconst pkg = JSON.parse(\n\t\t\t\tawait ctx.fs.readFile(ctx.packageJsonPath, \"utf8\")\n\t\t\t);\n\t\t\tif (\n\t\t\t\tpkg.dependencies?.[\"@inlang/paraglide-js\"] ||\n\t\t\t\tdevDeps[\"@inlang/paraglide-js\"]\n\t\t\t)\n\t\t\t\treturn devDeps;\n\t\t\treturn {\n\t\t\t\t...devDeps,\n\t\t\t\t\"@inlang/paraglide-js\": `^${ENV_VARIABLES.PARJS_PACKAGE_VERSION}`,\n\t\t\t};\n\t\t},\n\t})(ctx);\n\tctx.logger.success(\n\t\t\"Added @inlang/paraglide-js to the devDependencies in package.json.\"\n\t);\n\treturn ctx1;\n};\n\nconst enforcePackageJsonExists: CliStep<\n\t{ logger: Logger; fs: typeof import(\"node:fs/promises\") },\n\t{ packageJsonPath: string }\n> = async (ctx) => {\n\tconst packageJsonPath = await findPackageJson(ctx.fs, process.cwd());\n\tif (!packageJsonPath) {\n\t\tctx.logger.warn(\n\t\t\t\"No package.json found in the current working directory. Please change the working directory to the directory with a package.json file.\"\n\t\t);\n\t\tthrow new Error(\"No package.json found in the current working directory.\");\n\t}\n\treturn { ...ctx, packageJsonPath };\n};\n\nconst addCompileStepToPackageJSON: CliStep<\n\t{\n\t\tfs: typeof import(\"node:fs/promises\");\n\t\tlogger: Logger;\n\t\tprojectPath: string;\n\t\toutdir: string;\n\t\tpackageJsonPath: string;\n\t},\n\tunknown\n> = async (ctx) => {\n\tconst projectPath = shellArgument(\n\t\t\"./\" + nodePath.relative(process.cwd(), nodePath.resolve(ctx.projectPath))\n\t);\n\tconst outdir = shellArgument(\n\t\t\"./\" + nodePath.relative(process.cwd(), nodePath.resolve(ctx.outdir))\n\t);\n\n\tctx = await updatePackageJson({\n\t\tscripts: async (scripts) => {\n\t\t\tif (scripts.build === undefined) {\n\t\t\t\tscripts.build = `paraglide-js compile --project ${projectPath} --outdir ${outdir}`;\n\t\t\t} else if (scripts.build.includes(\"paraglide-js compile\") === false) {\n\t\t\t\tscripts.build = `paraglide-js compile --project ${projectPath} --outdir ${outdir} && ${scripts.build}`;\n\t\t\t} else {\n\t\t\t\treturn scripts;\n\t\t\t}\n\n\t\t\tctx.logger.success(\n\t\t\t\t\"Added the compile command to the build step in package.json.\"\n\t\t\t);\n\t\t\tctx.logger.info(\n\t\t\t\t`Visit https://paraglidejs.com/compiling-messages for more information.`\n\t\t\t);\n\t\t\treturn scripts;\n\t\t},\n\t})(ctx);\n\n\treturn ctx;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|