gt 0.10.0 → 2.7.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/CHANGELOG.md +1275 -0
- package/LICENSE.md +105 -0
- package/README.md +26 -198
- package/dist/api/collectUserEditDiffs.d.ts +9 -0
- package/dist/api/collectUserEditDiffs.js +159 -0
- package/dist/api/downloadFileBatch.d.ts +23 -0
- package/dist/api/downloadFileBatch.js +190 -0
- package/dist/api/saveLocalEdits.d.ts +6 -0
- package/dist/api/saveLocalEdits.js +38 -0
- package/dist/bin/bin-entry.d.ts +1 -0
- package/dist/bin/bin-entry.js +9 -0
- package/dist/bin/bin-main.d.ts +2 -0
- package/dist/bin/bin-main.js +67 -0
- package/dist/cli/base.d.ts +59 -0
- package/dist/cli/base.js +529 -0
- package/dist/cli/commands/download.d.ts +8 -0
- package/dist/cli/commands/download.js +51 -0
- package/dist/cli/commands/enqueue.d.ts +9 -0
- package/dist/cli/commands/enqueue.js +27 -0
- package/dist/cli/commands/setupProject.d.ts +7 -0
- package/dist/cli/commands/setupProject.js +37 -0
- package/dist/cli/commands/stage.d.ts +9 -0
- package/dist/cli/commands/stage.js +59 -0
- package/dist/cli/commands/translate.d.ts +7 -0
- package/dist/cli/commands/translate.js +70 -0
- package/dist/cli/commands/upload.d.ts +13 -0
- package/dist/cli/commands/upload.js +142 -0
- package/dist/cli/commands/utils/validation.d.ts +13 -0
- package/dist/cli/commands/utils/validation.js +38 -0
- package/dist/cli/flags.d.ts +15 -0
- package/dist/cli/flags.js +70 -0
- package/dist/cli/inline.d.ts +17 -0
- package/dist/cli/inline.js +135 -0
- package/dist/cli/next.d.ts +10 -0
- package/dist/cli/next.js +12 -0
- package/dist/cli/node.d.ts +10 -0
- package/dist/cli/node.js +9 -0
- package/dist/cli/react.d.ts +12 -0
- package/dist/cli/react.js +72 -0
- package/dist/config/generateSettings.d.ts +9 -0
- package/dist/config/generateSettings.js +214 -0
- package/dist/config/optionPresets.d.ts +3 -0
- package/dist/config/optionPresets.js +65 -0
- package/dist/config/resolveConfig.d.ts +4 -0
- package/dist/config/resolveConfig.js +33 -0
- package/dist/config/utils.d.ts +2 -0
- package/dist/config/utils.js +4 -0
- package/dist/config/validateSettings.d.ts +3 -0
- package/dist/config/validateSettings.js +32 -0
- package/dist/console/colors.d.ts +6 -0
- package/dist/console/colors.js +19 -0
- package/dist/console/displayTranslateSummary.d.ts +1 -0
- package/dist/console/displayTranslateSummary.js +42 -0
- package/dist/console/formatting.d.ts +1 -0
- package/dist/console/formatting.js +7 -0
- package/dist/console/index.d.ts +34 -0
- package/dist/console/index.js +46 -0
- package/dist/console/logger.d.ts +35 -0
- package/dist/console/logger.js +250 -0
- package/dist/console/logging.d.ts +52 -0
- package/dist/console/logging.js +175 -0
- package/dist/formats/files/aggregateFiles.d.ts +4 -0
- package/dist/formats/files/aggregateFiles.js +156 -0
- package/dist/formats/files/collectFiles.d.ts +6 -0
- package/dist/formats/files/collectFiles.js +49 -0
- package/dist/formats/files/convertToFileTranslationData.d.ts +15 -0
- package/dist/formats/files/convertToFileTranslationData.js +21 -0
- package/dist/formats/files/fileMapping.d.ts +11 -0
- package/dist/formats/files/fileMapping.js +115 -0
- package/dist/formats/files/preprocess/mdx.d.ts +6 -0
- package/dist/formats/files/preprocess/mdx.js +14 -0
- package/dist/formats/files/preprocess/mintlify.d.ts +5 -0
- package/dist/formats/files/preprocess/mintlify.js +15 -0
- package/dist/formats/files/preprocessContent.d.ts +8 -0
- package/dist/formats/files/preprocessContent.js +23 -0
- package/dist/formats/files/save.d.ts +5 -0
- package/dist/formats/files/save.js +17 -0
- package/dist/formats/files/supportedFiles.d.ts +11 -0
- package/dist/formats/files/supportedFiles.js +20 -0
- package/dist/formats/json/extractJson.d.ts +15 -0
- package/dist/formats/json/extractJson.js +101 -0
- package/dist/formats/json/flattenJson.d.ts +14 -0
- package/dist/formats/json/flattenJson.js +64 -0
- package/dist/formats/json/mergeJson.d.ts +13 -0
- package/dist/formats/json/mergeJson.js +367 -0
- package/dist/formats/json/parseJson.d.ts +2 -0
- package/dist/formats/json/parseJson.js +109 -0
- package/dist/formats/json/utils.d.ts +47 -0
- package/dist/formats/json/utils.js +150 -0
- package/dist/formats/utils.d.ts +2 -0
- package/dist/formats/utils.js +24 -0
- package/dist/formats/yaml/mergeYaml.d.ts +5 -0
- package/dist/formats/yaml/mergeYaml.js +61 -0
- package/dist/formats/yaml/parseYaml.d.ts +5 -0
- package/dist/formats/yaml/parseYaml.js +24 -0
- package/dist/formats/yaml/utils.d.ts +2 -0
- package/dist/formats/yaml/utils.js +23 -0
- package/dist/fs/clearLocaleDirs.d.ts +8 -0
- package/dist/fs/clearLocaleDirs.js +126 -0
- package/dist/fs/config/downloadedVersions.d.ts +21 -0
- package/dist/fs/config/downloadedVersions.js +50 -0
- package/dist/fs/config/loadConfig.d.ts +1 -0
- package/dist/fs/config/loadConfig.js +9 -0
- package/dist/fs/config/parseFilesConfig.d.ts +27 -0
- package/dist/fs/config/parseFilesConfig.js +150 -0
- package/dist/fs/config/setupConfig.d.ts +17 -0
- package/dist/fs/config/setupConfig.js +50 -0
- package/dist/fs/config/updateConfig.d.ts +21 -0
- package/dist/fs/config/updateConfig.js +57 -0
- package/dist/fs/config/updateVersions.d.ts +11 -0
- package/dist/fs/config/updateVersions.js +30 -0
- package/dist/fs/copyFile.d.ts +7 -0
- package/dist/fs/copyFile.js +39 -0
- package/dist/fs/createLoadTranslationsFile.d.ts +1 -0
- package/dist/fs/createLoadTranslationsFile.js +49 -0
- package/dist/fs/determineFramework.d.ts +5 -0
- package/dist/fs/determineFramework.js +53 -0
- package/dist/fs/findFilepath.d.ts +36 -0
- package/dist/fs/findFilepath.js +90 -0
- package/dist/fs/index.d.ts +1 -0
- package/dist/fs/index.js +1 -0
- package/dist/fs/loadJSON.d.ts +6 -0
- package/dist/fs/loadJSON.js +17 -0
- package/dist/fs/matchFiles.d.ts +1 -0
- package/dist/fs/matchFiles.js +8 -0
- package/dist/fs/saveJSON.d.ts +1 -0
- package/dist/fs/saveJSON.js +7 -0
- package/dist/fs/utils.d.ts +1 -0
- package/dist/fs/utils.js +16 -0
- package/dist/functions.d.ts +7 -0
- package/dist/functions.js +6 -0
- package/dist/generated/version.d.ts +1 -0
- package/dist/generated/version.js +2 -0
- package/dist/git/branches.d.ts +7 -0
- package/dist/git/branches.js +88 -0
- package/dist/hooks/postProcess.d.ts +4 -0
- package/dist/hooks/postProcess.js +110 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +27 -0
- package/dist/locadex/setupFlow.d.ts +2 -0
- package/dist/locadex/setupFlow.js +9 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +10 -0
- package/dist/next/config/parseNextConfig.d.ts +10 -0
- package/dist/next/config/parseNextConfig.js +53 -0
- package/dist/next/jsx/utils.d.ts +7 -0
- package/dist/next/jsx/utils.js +42 -0
- package/dist/next/parse/handleInitGT.d.ts +7 -0
- package/dist/next/parse/handleInitGT.js +157 -0
- package/dist/next/parse/wrapContent.d.ts +12 -0
- package/dist/next/parse/wrapContent.js +164 -0
- package/dist/react/config/createESBuildConfig.d.ts +2 -0
- package/dist/react/config/createESBuildConfig.js +119 -0
- package/dist/react/jsx/evaluateJsx.d.ts +24 -0
- package/dist/react/jsx/evaluateJsx.js +123 -0
- package/dist/react/jsx/utils/buildImportMap.d.ts +9 -0
- package/dist/react/jsx/utils/buildImportMap.js +30 -0
- package/dist/react/jsx/utils/constants.d.ts +15 -0
- package/dist/react/jsx/utils/constants.js +49 -0
- package/dist/react/jsx/utils/getCalleeNameFromExpression.d.ts +9 -0
- package/dist/react/jsx/utils/getCalleeNameFromExpression.js +32 -0
- package/dist/react/jsx/utils/getPathsAndAliases.d.ts +21 -0
- package/dist/react/jsx/utils/getPathsAndAliases.js +91 -0
- package/dist/react/jsx/utils/isNumberLiteral.d.ts +7 -0
- package/dist/react/jsx/utils/isNumberLiteral.js +13 -0
- package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.d.ts +9 -0
- package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +138 -0
- package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.d.ts +6 -0
- package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js +197 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.d.ts +13 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js +42 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.d.ts +5 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js +69 -0
- package/dist/react/jsx/utils/jsxParsing/parseJsx.d.ts +33 -0
- package/dist/react/jsx/utils/jsxParsing/parseJsx.js +918 -0
- package/dist/react/jsx/utils/jsxParsing/parseTProps.d.ts +8 -0
- package/dist/react/jsx/utils/jsxParsing/parseTProps.js +65 -0
- package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.d.ts +2 -0
- package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js +61 -0
- package/dist/react/jsx/utils/jsxParsing/types.d.ts +48 -0
- package/dist/react/jsx/utils/jsxParsing/types.js +34 -0
- package/dist/react/jsx/utils/mapAttributeName.d.ts +11 -0
- package/dist/react/jsx/utils/mapAttributeName.js +12 -0
- package/dist/react/jsx/utils/parseAst.d.ts +31 -0
- package/dist/react/jsx/utils/parseAst.js +278 -0
- package/dist/react/jsx/utils/parseDeclareStatic.d.ts +15 -0
- package/dist/react/jsx/utils/parseDeclareStatic.js +540 -0
- package/dist/react/jsx/utils/parseString.d.ts +25 -0
- package/dist/react/jsx/utils/parseString.js +540 -0
- package/dist/react/jsx/utils/parseStringFunction.d.ts +30 -0
- package/dist/react/jsx/utils/parseStringFunction.js +348 -0
- package/dist/react/jsx/utils/resolveImportPath.d.ts +11 -0
- package/dist/react/jsx/utils/resolveImportPath.js +111 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.d.ts +29 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js +86 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.d.ts +14 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js +24 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.d.ts +19 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js +31 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleStaticTranslationCall.d.ts +22 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleStaticTranslationCall.js +51 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.d.ts +18 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js +39 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.d.ts +24 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +68 -0
- package/dist/react/jsx/utils/stringParsing/types.d.ts +41 -0
- package/dist/react/jsx/utils/stringParsing/types.js +1 -0
- package/dist/react/jsx/utils/types.d.ts +14 -0
- package/dist/react/jsx/utils/types.js +1 -0
- package/dist/react/jsx/utils/validateStringFunction.d.ts +7 -0
- package/dist/react/jsx/utils/validateStringFunction.js +31 -0
- package/dist/react/jsx/wrapJsx.d.ts +51 -0
- package/dist/react/jsx/wrapJsx.js +387 -0
- package/dist/react/parse/addVitePlugin/index.d.ts +22 -0
- package/dist/react/parse/addVitePlugin/index.js +41 -0
- package/dist/react/parse/addVitePlugin/installCompiler.d.ts +8 -0
- package/dist/react/parse/addVitePlugin/installCompiler.js +22 -0
- package/dist/react/parse/addVitePlugin/updateViteConfig.d.ts +19 -0
- package/dist/react/parse/addVitePlugin/updateViteConfig.js +120 -0
- package/dist/react/parse/addVitePlugin/utils/addCompilerImport.d.ts +9 -0
- package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js +34 -0
- package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.d.ts +11 -0
- package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js +48 -0
- package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.d.ts +15 -0
- package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js +113 -0
- package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.d.ts +12 -0
- package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js +32 -0
- package/dist/react/parse/createDictionaryUpdates.d.ts +3 -0
- package/dist/react/parse/createDictionaryUpdates.js +187 -0
- package/dist/react/parse/createInlineUpdates.d.ts +13 -0
- package/dist/react/parse/createInlineUpdates.js +161 -0
- package/dist/react/parse/wrapContent.d.ts +12 -0
- package/dist/react/parse/wrapContent.js +162 -0
- package/dist/react/utils/flattenDictionary.d.ts +20 -0
- package/dist/react/utils/flattenDictionary.js +75 -0
- package/dist/react/utils/getEntryAndMetadata.d.ts +5 -0
- package/dist/react/utils/getEntryAndMetadata.js +11 -0
- package/dist/react/utils/getVariableName.d.ts +25 -0
- package/dist/react/utils/getVariableName.js +37 -0
- package/dist/setup/agentInstructions.d.ts +24 -0
- package/dist/setup/agentInstructions.js +138 -0
- package/dist/setup/detectFramework.d.ts +31 -0
- package/dist/setup/detectFramework.js +106 -0
- package/dist/setup/frameworkUtils.d.ts +3 -0
- package/dist/setup/frameworkUtils.js +30 -0
- package/dist/setup/instructions/base.md +29 -0
- package/dist/setup/instructions/gt-next.md +107 -0
- package/dist/setup/instructions/gt-react.md +98 -0
- package/dist/setup/userInput.d.ts +4 -0
- package/dist/setup/userInput.js +32 -0
- package/dist/setup/wizard.d.ts +3 -0
- package/dist/setup/wizard.js +147 -0
- package/dist/state/recentDownloads.d.ts +12 -0
- package/dist/state/recentDownloads.js +18 -0
- package/dist/state/translateWarnings.d.ts +10 -0
- package/dist/state/translateWarnings.js +13 -0
- package/dist/translation/parse.d.ts +17 -0
- package/dist/translation/parse.js +77 -0
- package/dist/translation/stage.d.ts +3 -0
- package/dist/translation/stage.js +44 -0
- package/dist/translation/validate.d.ts +14 -0
- package/dist/translation/validate.js +100 -0
- package/dist/types/branch.d.ts +14 -0
- package/dist/types/branch.js +1 -0
- package/dist/types/data/json.d.ts +6 -0
- package/dist/types/data/json.js +1 -0
- package/dist/types/data.d.ts +37 -0
- package/dist/types/data.js +1 -0
- package/dist/types/files.d.ts +8 -0
- package/dist/types/files.js +1 -0
- package/dist/types/index.d.ts +243 -0
- package/dist/types/index.js +1 -0
- package/dist/types/libraries.d.ts +31 -0
- package/dist/types/libraries.js +72 -0
- package/dist/types/parsing.d.ts +3 -0
- package/dist/types/parsing.js +1 -0
- package/dist/utils/addExplicitAnchorIds.d.ts +24 -0
- package/dist/utils/addExplicitAnchorIds.js +416 -0
- package/dist/utils/constants.d.ts +5 -0
- package/dist/utils/constants.js +6 -0
- package/dist/utils/credentials.d.ts +12 -0
- package/dist/utils/credentials.js +120 -0
- package/dist/utils/flattenJsonFiles.d.ts +2 -0
- package/dist/utils/flattenJsonFiles.js +36 -0
- package/dist/utils/gitDiff.d.ts +8 -0
- package/dist/utils/gitDiff.js +34 -0
- package/dist/utils/gt.d.ts +2 -0
- package/dist/utils/gt.js +2 -0
- package/dist/utils/hash.d.ts +6 -0
- package/dist/utils/hash.js +11 -0
- package/dist/utils/headers.d.ts +1 -0
- package/dist/utils/headers.js +14 -0
- package/dist/utils/installPackage.d.ts +3 -0
- package/dist/utils/installPackage.js +77 -0
- package/dist/utils/localizeRelativeAssets.d.ts +8 -0
- package/dist/utils/localizeRelativeAssets.js +166 -0
- package/dist/utils/localizeStaticImports.d.ts +15 -0
- package/dist/utils/localizeStaticImports.js +397 -0
- package/dist/utils/localizeStaticUrls.d.ts +19 -0
- package/dist/utils/localizeStaticUrls.js +450 -0
- package/dist/utils/mintlifyTitleFallback.d.ts +6 -0
- package/dist/utils/mintlifyTitleFallback.js +80 -0
- package/dist/utils/packageInfo.d.ts +3 -0
- package/dist/utils/packageInfo.js +17 -0
- package/dist/utils/packageJson.d.ts +6 -0
- package/dist/utils/packageJson.js +68 -0
- package/dist/utils/packageManager.d.ts +28 -0
- package/dist/utils/packageManager.js +269 -0
- package/dist/utils/parse/needsCJS.d.ts +20 -0
- package/dist/utils/parse/needsCJS.js +72 -0
- package/dist/utils/persistPostprocessHashes.d.ts +12 -0
- package/dist/utils/persistPostprocessHashes.js +39 -0
- package/dist/utils/processAnchorIds.d.ts +6 -0
- package/dist/utils/processAnchorIds.js +56 -0
- package/dist/utils/processOpenApi.d.ts +8 -0
- package/dist/utils/processOpenApi.js +651 -0
- package/dist/utils/sanitizeFileContent.d.ts +6 -0
- package/dist/utils/sanitizeFileContent.js +29 -0
- package/dist/utils/sharedStaticAssets.d.ts +9 -0
- package/dist/utils/sharedStaticAssets.js +384 -0
- package/dist/utils/validateMdx.d.ts +10 -0
- package/dist/utils/validateMdx.js +25 -0
- package/dist/utils/wrapPlainUrls.d.ts +8 -0
- package/dist/utils/wrapPlainUrls.js +72 -0
- package/dist/workflows/download.d.ts +32 -0
- package/dist/workflows/download.js +131 -0
- package/dist/workflows/enqueue.d.ts +17 -0
- package/dist/workflows/enqueue.js +59 -0
- package/dist/workflows/setupProject.d.ts +13 -0
- package/dist/workflows/setupProject.js +48 -0
- package/dist/workflows/stage.d.ts +18 -0
- package/dist/workflows/stage.js +59 -0
- package/dist/workflows/steps/BranchStep.d.ts +13 -0
- package/dist/workflows/steps/BranchStep.js +161 -0
- package/dist/workflows/steps/DownloadStep.d.ts +19 -0
- package/dist/workflows/steps/DownloadStep.js +131 -0
- package/dist/workflows/steps/EnqueueStep.d.ts +15 -0
- package/dist/workflows/steps/EnqueueStep.js +33 -0
- package/dist/workflows/steps/PollJobsStep.d.ts +31 -0
- package/dist/workflows/steps/PollJobsStep.js +288 -0
- package/dist/workflows/steps/SetupStep.d.ts +16 -0
- package/dist/workflows/steps/SetupStep.js +72 -0
- package/dist/workflows/steps/UploadSourcesStep.d.ts +27 -0
- package/dist/workflows/steps/UploadSourcesStep.js +131 -0
- package/dist/workflows/steps/UploadTranslationsStep.d.ts +22 -0
- package/dist/workflows/steps/UploadTranslationsStep.js +71 -0
- package/dist/workflows/steps/UserEditDiffsStep.d.ts +11 -0
- package/dist/workflows/steps/UserEditDiffsStep.js +30 -0
- package/dist/workflows/steps/WorkflowStep.d.ts +4 -0
- package/dist/workflows/steps/WorkflowStep.js +2 -0
- package/dist/workflows/upload.d.ts +15 -0
- package/dist/workflows/upload.js +47 -0
- package/package.json +149 -112
- package/.dont-break +0 -6
- package/.jshintrc +0 -76
- package/.npmignore +0 -9
- package/.travis.yml +0 -21
- package/Gruntfile.js +0 -65
- package/History.md +0 -90
- package/MIT-License.txt +0 -21
- package/bin/gt.js +0 -58
- package/complexity.json +0 -17
- package/doc/RequireJsExample.md +0 -10
- package/examples/all.js +0 -72
- package/examples/altAsserrionSyntax/tests.js +0 -32
- package/examples/amd/bar.js +0 -4
- package/examples/amd/foo.js +0 -15
- package/examples/amd/fooTests.js +0 -8
- package/examples/arrays/test.js +0 -15
- package/examples/assert/test-assert-object.js +0 -15
- package/examples/assert/test-assert-require.js +0 -17
- package/examples/async/asyncAll.js +0 -37
- package/examples/async/asyncSetup.js +0 -29
- package/examples/async/asyncSetupOnce.js +0 -25
- package/examples/async/asyncTeardown.js +0 -27
- package/examples/async/stopStart.js +0 -22
- package/examples/async/test.js +0 -43
- package/examples/async/timeoutTests.js +0 -19
- package/examples/basic/code.js +0 -50
- package/examples/basic/code2.js +0 -9
- package/examples/basic/default.js +0 -26
- package/examples/basic/definedUndefined.js +0 -28
- package/examples/basic/empty.js +0 -24
- package/examples/basic/exceptionTests.js +0 -55
- package/examples/basic/fullMessage.js +0 -28
- package/examples/basic/functions.js +0 -18
- package/examples/basic/incomplete.js +0 -16
- package/examples/basic/null.js +0 -17
- package/examples/basic/optional.js +0 -45
- package/examples/basic/tests.js +0 -147
- package/examples/bdd/spec.js +0 -67
- package/examples/browser/code_coverage_report.json +0 -1
- package/examples/browser/index.html +0 -50
- package/examples/browser/packages.js +0 -12
- package/examples/browser/packagesDefault.js +0 -12
- package/examples/browser/qunit/qunit-1.10.0.css +0 -235
- package/examples/browser/qunit/qunit-1.10.0.js +0 -1977
- package/examples/browser/runTestsWithCoverage.bat +0 -19
- package/examples/browser/runner.js +0 -178
- package/examples/browser/src/Foo.js +0 -14
- package/examples/browser/srcInstrumented/Foo.js +0 -6
- package/examples/browser/test/FooTest.js +0 -31
- package/examples/browser/testDojo.js +0 -63
- package/examples/browser/testInstrumented/FooTest.js +0 -6
- package/examples/coffee/coffeeTestsCoffee/foo.coffee +0 -4
- package/examples/coffee/coffeeTestsCoffee/tests.coffee +0 -7
- package/examples/coffee/coffeeTestsJs/foo.js +0 -9
- package/examples/coffee/coffeeTestsJs/tests.coffee +0 -9
- package/examples/coffee/jsTestsCoffee/foo.coffee +0 -4
- package/examples/coffee/jsTestsCoffee/tests.js +0 -8
- package/examples/coverage.png +0 -0
- package/examples/crash/foo.js +0 -8
- package/examples/crashOnLoading/foo.js +0 -3
- package/examples/crashStackSize/foo.js +0 -8
- package/examples/crashStackSize/test.js +0 -7
- package/examples/doh/foo.js +0 -15
- package/examples/doh/fooTests.js +0 -28
- package/examples/dohDefine/foo.js +0 -14
- package/examples/dohDefine/fooTests.js +0 -24
- package/examples/dojo/src/Foo.js +0 -12
- package/examples/dojo/test/FooTest.js +0 -9
- package/examples/dojo/testDojo.js +0 -69
- package/examples/equiv/equiv.js +0 -22
- package/examples/example.png +0 -0
- package/examples/exec/foo.js +0 -5
- package/examples/exec/tests.js +0 -50
- package/examples/expect/test.js +0 -53
- package/examples/extend/extend-through-api.js +0 -40
- package/examples/extend/test.js +0 -18
- package/examples/faster/fibonacci.js +0 -18
- package/examples/faster/test.js +0 -89
- package/examples/fluent/foo.js +0 -38
- package/examples/funcAndArity/test.js +0 -15
- package/examples/gtAndQUnit/gtTests.js +0 -6
- package/examples/gtAndQUnit/qunitTests.js +0 -5
- package/examples/jsUnity/foo.js +0 -10
- package/examples/jsUnity/fooTests.js +0 -19
- package/examples/lodash/totalLength.js +0 -19
- package/examples/longStrings/test.js +0 -27
- package/examples/moduleSetupTeardown/test.js +0 -115
- package/examples/namedTest/foo.js +0 -9
- package/examples/overrideGt/test.js +0 -11
- package/examples/quickFail/test.js +0 -22
- package/examples/qunit/foo.js +0 -13
- package/examples/reporting/tests.coffee +0 -9
- package/examples/requirejs/lib/Foo.js +0 -11
- package/examples/requirejs/lib/Rectangle.js +0 -13
- package/examples/requirejs/runTests.js +0 -5
- package/examples/requirejs/test/RectangleTest.js +0 -22
- package/examples/silent/foo.js +0 -7
- package/examples/silent/fooTest.js +0 -18
- package/examples/skipTest/tests.js +0 -15
- package/examples/testsFromOtherTests/parentTests.js +0 -7
- package/examples/testsFromOtherTests/tests.js +0 -5
- package/examples/throws/test.js +0 -17
- package/examples/use-gt-as-module/fooTest.js +0 -8
- package/examples/use-gt-as-module/test-code.js +0 -7
- package/gt.js +0 -11
- package/lib/coverage.js +0 -234
- package/src/JUnitReporter.js +0 -30
- package/src/QUnitBrowserAdapter.js +0 -15
- package/src/Reporter.js +0 -127
- package/src/TestRunInfo.js +0 -25
- package/src/TestRunner.js +0 -223
- package/src/UnitTest/CollectionMethods.js +0 -97
- package/src/UnitTest/ModuleTests.js +0 -104
- package/src/UnitTest/Test.js +0 -85
- package/src/UnitTest/TestAsync.js +0 -78
- package/src/UnitTest/TestBaseInfo.js +0 -21
- package/src/UnitTest/TestCollection.js +0 -206
- package/src/UnitTest/TestInfo.js +0 -30
- package/src/UnitTest/TestReport.js +0 -27
- package/src/assertions/PrimaryAssertions.js +0 -163
- package/src/assertions/SecondaryAssertions.js +0 -262
- package/src/assertions/TertiaryAssertions.js +0 -99
- package/src/bddInterface.js +0 -39
- package/src/covered.js +0 -156
- package/src/dohAdapter.js +0 -79
- package/src/dohInterface.js +0 -20
- package/src/equiv.js +0 -11
- package/src/jsunityAdapter.js +0 -66
- package/src/jsunityInterface.js +0 -13
- package/src/options.js +0 -116
- package/src/shiv.js +0 -16
- package/src/sure.js +0 -226
- package/src/test/ConsoleHider.js +0 -26
- package/src/test/JUnitReporter.js +0 -12
- package/src/test/ModuleTests.js +0 -37
- package/src/test/Test.js +0 -18
- package/src/test/TestCollection.js +0 -21
- package/src/test/TestRunInfo.js +0 -15
- package/src/test/TestRunner.js +0 -9
- package/src/test/utils.js +0 -43
- package/src/utils/ConsoleHider.js +0 -27
- package/src/utils/WatchFiles.js +0 -13
- package/src/utils/discoverFiles.js +0 -18
- package/src/utils/joinArguments.js +0 -13
- package/src/utils/not.js +0 -14
- package/src/utils/pluckFunction.js +0 -15
- package/src/utils/test/joinArgumentsTest.js +0 -24
- package/src/utils/test/not.js +0 -70
- package/src/utils/test/pluckFunctionLoDashTest.js +0 -51
- package/src/utils/test/pluckFunctionTest.js +0 -41
- package/src/utils/test/pluckObjects.js +0 -20
- package/src/utils/utils.js +0 -146
- package/tests/all.js +0 -24
- package/tests/large/bddTest.js +0 -9
- package/tests/large/expectedCrash.js +0 -3
- package/tests/large/expectedCrashTest.js +0 -9
- package/tests/large/filterCLI.js +0 -10
- package/tests/large/filterCLITest.js +0 -18
- package/tests/large/loadingCrash.js +0 -1
- package/tests/large/loadingCrashTest.js +0 -9
- package/tests/large/skip.js +0 -11
- package/tests/large/skipTest.js +0 -9
- package/tests/large/twoFailing.js +0 -9
- package/tests/large/twoFailingTest.js +0 -9
- package/tests/mocha/.npmignore +0 -1
- package/tests/mocha/basic.js +0 -12
- package/tests/mocha/gt-as-module.js +0 -65
- package/tests/mocha/test-collection.js +0 -67
- package/tests/small/errorInAsync.js +0 -6
- package/tests/small/errorInAsyncTest.js +0 -14
- package/tests/small/oneFails.js +0 -7
- package/tests/small/oneFailsTest.js +0 -18
- package/tests/small/pluckObjects.js +0 -20
- package/tests/small/pluckTest.js +0 -51
- package/tests/small/setupException.js +0 -8
- package/tests/small/setupExceptionTest.js +0 -9
- package/tests/small/teardownException.js +0 -8
- package/tests/small/teardownExceptionTest.js +0 -9
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { logger } from '../console/logger.js';
|
|
4
|
+
import { gt } from '../utils/gt.js';
|
|
5
|
+
import { validateJsonSchema } from '../formats/json/utils.js';
|
|
6
|
+
import { validateYamlSchema } from '../formats/yaml/utils.js';
|
|
7
|
+
import { mergeJson } from '../formats/json/mergeJson.js';
|
|
8
|
+
import mergeYaml from '../formats/yaml/mergeYaml.js';
|
|
9
|
+
import { getDownloadedVersions, saveDownloadedVersions, ensureNestedObject, } from '../fs/config/downloadedVersions.js';
|
|
10
|
+
import { recordDownloaded } from '../state/recentDownloads.js';
|
|
11
|
+
import { recordWarning } from '../state/translateWarnings.js';
|
|
12
|
+
import { hashStringSync } from '../utils/hash.js';
|
|
13
|
+
import stringify from 'fast-json-stable-stringify';
|
|
14
|
+
/**
|
|
15
|
+
* Downloads multiple translation files in a single batch request
|
|
16
|
+
* @param files - Array of files to download with their output paths
|
|
17
|
+
* @param maxRetries - Maximum number of retry attempts
|
|
18
|
+
* @param retryDelay - Delay between retries in milliseconds
|
|
19
|
+
* @returns Object containing successful and failed file IDs
|
|
20
|
+
*/
|
|
21
|
+
export async function downloadFileBatch(fileTracker, files, options, forceDownload = false) {
|
|
22
|
+
// Local record of what version was last downloaded for each fileName:locale
|
|
23
|
+
const downloadedVersions = getDownloadedVersions(options.configDirectory);
|
|
24
|
+
let didUpdateDownloadedLock = false;
|
|
25
|
+
// Create a map of requested file keys to the file object
|
|
26
|
+
const requestedFileMap = new Map(files.map((file) => [
|
|
27
|
+
`${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`,
|
|
28
|
+
file,
|
|
29
|
+
]));
|
|
30
|
+
const result = {
|
|
31
|
+
successful: [],
|
|
32
|
+
failed: [],
|
|
33
|
+
skipped: [],
|
|
34
|
+
};
|
|
35
|
+
// Create a map of translationId to outputPath for easier lookup
|
|
36
|
+
const outputPathMap = new Map(files.map((file) => [
|
|
37
|
+
`${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`,
|
|
38
|
+
file.outputPath,
|
|
39
|
+
]));
|
|
40
|
+
try {
|
|
41
|
+
// Download the files
|
|
42
|
+
const responseData = await gt.downloadFileBatch(files.map((file) => ({
|
|
43
|
+
fileId: file.fileId,
|
|
44
|
+
branchId: file.branchId,
|
|
45
|
+
versionId: file.versionId,
|
|
46
|
+
locale: file.locale,
|
|
47
|
+
})));
|
|
48
|
+
const downloadedFiles = responseData.files || [];
|
|
49
|
+
// Process each file in the response
|
|
50
|
+
for (const file of downloadedFiles) {
|
|
51
|
+
const fileKey = `${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`;
|
|
52
|
+
const requestedFile = requestedFileMap.get(fileKey);
|
|
53
|
+
if (!requestedFile) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const outputPath = outputPathMap.get(fileKey);
|
|
58
|
+
const fileProperties = fileTracker.completed.get(fileKey);
|
|
59
|
+
if (!outputPath || !fileProperties) {
|
|
60
|
+
logger.warn(`No input/output path found for file: ${fileKey}`);
|
|
61
|
+
recordWarning('failed_download', fileKey, 'No input/output path found');
|
|
62
|
+
result.failed.push(requestedFile);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const { fileId, versionId, locale, branchId, fileName: inputPath, } = fileProperties;
|
|
66
|
+
// Ensure the directory exists
|
|
67
|
+
const dir = path.dirname(outputPath);
|
|
68
|
+
if (!fs.existsSync(dir)) {
|
|
69
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
// If a local translation already exists for the same source version, skip overwrite
|
|
72
|
+
const downloadedVersion = downloadedVersions.entries[branchId]?.[fileId]?.[versionId]?.[locale];
|
|
73
|
+
const fileExists = fs.existsSync(outputPath);
|
|
74
|
+
let sourceChanged = false;
|
|
75
|
+
if (downloadedVersion?.sourceHash) {
|
|
76
|
+
try {
|
|
77
|
+
const currentSourceContent = fs.readFileSync(inputPath, 'utf8');
|
|
78
|
+
const currentSourceHash = hashStringSync(currentSourceContent);
|
|
79
|
+
sourceChanged = currentSourceHash !== downloadedVersion.sourceHash;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
sourceChanged = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!forceDownload &&
|
|
86
|
+
!sourceChanged &&
|
|
87
|
+
fileExists &&
|
|
88
|
+
downloadedVersion) {
|
|
89
|
+
result.skipped.push(requestedFile);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
let data = file.data;
|
|
93
|
+
let sourceContentHash;
|
|
94
|
+
if (options.options?.jsonSchema && locale) {
|
|
95
|
+
const jsonSchema = validateJsonSchema(options.options, inputPath);
|
|
96
|
+
if (jsonSchema) {
|
|
97
|
+
const originalContent = fs.readFileSync(inputPath, 'utf8');
|
|
98
|
+
if (originalContent) {
|
|
99
|
+
sourceContentHash = hashStringSync(originalContent);
|
|
100
|
+
data = mergeJson(originalContent, inputPath, options.options, [
|
|
101
|
+
{
|
|
102
|
+
translatedContent: file.data,
|
|
103
|
+
targetLocale: locale,
|
|
104
|
+
},
|
|
105
|
+
], options.defaultLocale, options.locales)[0];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (options.options?.yamlSchema && locale) {
|
|
110
|
+
const yamlSchema = validateYamlSchema(options.options, inputPath);
|
|
111
|
+
if (yamlSchema) {
|
|
112
|
+
const originalContent = fs.readFileSync(inputPath, 'utf8');
|
|
113
|
+
if (originalContent) {
|
|
114
|
+
sourceContentHash = hashStringSync(originalContent);
|
|
115
|
+
data = mergeYaml(originalContent, inputPath, options.options, [
|
|
116
|
+
{
|
|
117
|
+
translatedContent: file.data,
|
|
118
|
+
targetLocale: locale,
|
|
119
|
+
},
|
|
120
|
+
], options.defaultLocale)[0];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// If the file is a GTJSON file, stable sort the order and format the data
|
|
125
|
+
if (file.fileFormat === 'GTJSON') {
|
|
126
|
+
try {
|
|
127
|
+
const jsonData = JSON.parse(data);
|
|
128
|
+
const sortedData = stringify(jsonData); // stably sort with fast-json-stable-stringify
|
|
129
|
+
const sortedJsonData = JSON.parse(sortedData);
|
|
130
|
+
data = JSON.stringify(sortedJsonData, null, 2); // format the data
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
logger.warn(`Failed to sort GTJson file: ${file.id}: ` + error);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Write the file to disk
|
|
137
|
+
await fs.promises.writeFile(outputPath, data);
|
|
138
|
+
// Track as downloaded with metadata for downstream postprocessing
|
|
139
|
+
recordDownloaded(outputPath, {
|
|
140
|
+
branchId,
|
|
141
|
+
fileId,
|
|
142
|
+
versionId,
|
|
143
|
+
locale,
|
|
144
|
+
inputPath,
|
|
145
|
+
});
|
|
146
|
+
result.successful.push(requestedFile);
|
|
147
|
+
if (branchId && fileId && versionId && locale) {
|
|
148
|
+
ensureNestedObject(downloadedVersions.entries, [
|
|
149
|
+
branchId,
|
|
150
|
+
fileId,
|
|
151
|
+
versionId,
|
|
152
|
+
locale,
|
|
153
|
+
]);
|
|
154
|
+
downloadedVersions.entries[branchId][fileId][versionId][locale] = {
|
|
155
|
+
updatedAt: new Date().toISOString(),
|
|
156
|
+
...(sourceContentHash ? { sourceHash: sourceContentHash } : {}),
|
|
157
|
+
};
|
|
158
|
+
didUpdateDownloadedLock = true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
logger.error(`Error saving file ${fileKey}: ` + error);
|
|
163
|
+
recordWarning('failed_download', fileKey, `Error saving file: ${error}`);
|
|
164
|
+
result.failed.push(requestedFile);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Add any files that weren't in the response to the failed list
|
|
168
|
+
const downloadedFileKeys = new Set(downloadedFiles.map((file) => `${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`));
|
|
169
|
+
for (const [fileKey, requestedFile] of requestedFileMap.entries()) {
|
|
170
|
+
if (!downloadedFileKeys.has(fileKey)) {
|
|
171
|
+
result.failed.push(requestedFile);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Persist any updates to the downloaded map at the end of a successful cycle
|
|
175
|
+
if (didUpdateDownloadedLock) {
|
|
176
|
+
saveDownloadedVersions(options.configDirectory, downloadedVersions);
|
|
177
|
+
didUpdateDownloadedLock = false;
|
|
178
|
+
}
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
logger.error(`An unexpected error occurred while downloading files: ` + error);
|
|
183
|
+
}
|
|
184
|
+
// Mark all files as failed if we get here
|
|
185
|
+
result.failed = [...requestedFileMap.values()];
|
|
186
|
+
if (didUpdateDownloadedLock) {
|
|
187
|
+
saveDownloadedVersions(options.configDirectory, downloadedVersions);
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Settings } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Uploads current source files to obtain file references, then collects and sends
|
|
4
|
+
* diffs for all locales based on last downloaded versions. Does not enqueue translations.
|
|
5
|
+
*/
|
|
6
|
+
export declare function saveLocalEdits(settings: Settings): Promise<void>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { aggregateFiles } from '../formats/files/aggregateFiles.js';
|
|
2
|
+
import { collectAndSendUserEditDiffs } from './collectUserEditDiffs.js';
|
|
3
|
+
import { gt } from '../utils/gt.js';
|
|
4
|
+
import { BranchStep } from '../workflows/steps/BranchStep.js';
|
|
5
|
+
import { logErrorAndExit } from '../console/logging.js';
|
|
6
|
+
import { logger } from '../console/logger.js';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
/**
|
|
9
|
+
* Uploads current source files to obtain file references, then collects and sends
|
|
10
|
+
* diffs for all locales based on last downloaded versions. Does not enqueue translations.
|
|
11
|
+
*/
|
|
12
|
+
export async function saveLocalEdits(settings) {
|
|
13
|
+
if (!settings.files)
|
|
14
|
+
return;
|
|
15
|
+
// Collect current files from config
|
|
16
|
+
const files = await aggregateFiles(settings);
|
|
17
|
+
if (!files.length)
|
|
18
|
+
return;
|
|
19
|
+
// run branch query to get branch id
|
|
20
|
+
// Run the branch step
|
|
21
|
+
const branchStep = new BranchStep(gt, settings);
|
|
22
|
+
const branchResult = await branchStep.run();
|
|
23
|
+
await branchStep.wait();
|
|
24
|
+
if (!branchResult) {
|
|
25
|
+
return logErrorAndExit('Failed to resolve git branch information.');
|
|
26
|
+
}
|
|
27
|
+
const uploads = files.map((file) => ({
|
|
28
|
+
fileName: file.fileName,
|
|
29
|
+
fileFormat: file.fileFormat,
|
|
30
|
+
branchId: branchResult.currentBranch.id,
|
|
31
|
+
fileId: file.fileId,
|
|
32
|
+
versionId: file.versionId,
|
|
33
|
+
}));
|
|
34
|
+
const spinner = logger.createSpinner('dots');
|
|
35
|
+
spinner.start('Saving local edits...');
|
|
36
|
+
await collectAndSendUserEditDiffs(uploads, settings);
|
|
37
|
+
spinner.stop(chalk.green('Local edits saved successfully'));
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Entry point for binaries
|
|
2
|
+
import { main } from '../index.js';
|
|
3
|
+
import dotenv from 'dotenv';
|
|
4
|
+
import { program } from 'commander';
|
|
5
|
+
dotenv.config({ path: '.env' });
|
|
6
|
+
dotenv.config({ path: '.env.local', override: true });
|
|
7
|
+
dotenv.config({ path: '.env.production', override: true });
|
|
8
|
+
main(program);
|
|
9
|
+
program.parse();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Routes to proper binary based on platform
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
import { existsSync, chmodSync, statSync } from 'fs';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
function detectPlatform() {
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
const arch = process.arch;
|
|
12
|
+
// Map Node.js platform/arch to our binary names
|
|
13
|
+
const platformMap = {
|
|
14
|
+
darwin: {
|
|
15
|
+
x64: 'gt-darwin-x64',
|
|
16
|
+
arm64: 'gt-darwin-arm64',
|
|
17
|
+
},
|
|
18
|
+
linux: {
|
|
19
|
+
x64: 'gt-linux-x64',
|
|
20
|
+
arm64: 'gt-linux-arm64',
|
|
21
|
+
},
|
|
22
|
+
win32: {
|
|
23
|
+
x64: 'gt-win32-x64.exe',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return platformMap[platform]?.[arch] || null;
|
|
27
|
+
}
|
|
28
|
+
function routeToBinary() {
|
|
29
|
+
const binaryName = detectPlatform();
|
|
30
|
+
if (!binaryName) {
|
|
31
|
+
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const binaryPath = join(__dirname, '..', '..', 'binaries', binaryName);
|
|
35
|
+
if (!existsSync(binaryPath)) {
|
|
36
|
+
console.error(`Binary not found at: ${binaryPath}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
// Check and fix execute permissions if needed (Unix-like systems only)
|
|
40
|
+
if (process.platform !== 'win32') {
|
|
41
|
+
try {
|
|
42
|
+
const stats = statSync(binaryPath);
|
|
43
|
+
const isExecutable = !!(stats.mode & parseInt('100', 8)); // Check owner execute bit
|
|
44
|
+
if (!isExecutable) {
|
|
45
|
+
chmodSync(binaryPath, 0o755); // Make executable
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
// If we can't check/fix permissions, continue anyway
|
|
50
|
+
// The spawn might still work or give a more meaningful error
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Spawn the appropriate binary with all arguments
|
|
54
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
55
|
+
stdio: 'inherit',
|
|
56
|
+
});
|
|
57
|
+
child.on('close', (code) => {
|
|
58
|
+
// code might be null
|
|
59
|
+
process.exit(code ?? 1);
|
|
60
|
+
});
|
|
61
|
+
child.on('error', () => {
|
|
62
|
+
process.exit(1);
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// Entry point
|
|
67
|
+
routeToBinary();
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Settings, SupportedLibraries, TranslateFlags } from '../types/index.js';
|
|
3
|
+
export type UploadOptions = {
|
|
4
|
+
config?: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
projectId?: string;
|
|
7
|
+
defaultLocale?: string;
|
|
8
|
+
};
|
|
9
|
+
export type LoginOptions = {
|
|
10
|
+
keyType?: 'development' | 'production';
|
|
11
|
+
};
|
|
12
|
+
export declare class BaseCLI {
|
|
13
|
+
protected library: SupportedLibraries;
|
|
14
|
+
protected additionalModules: SupportedLibraries[];
|
|
15
|
+
protected program: Command;
|
|
16
|
+
constructor(program: Command, library: SupportedLibraries, additionalModules?: SupportedLibraries[]);
|
|
17
|
+
init(): void;
|
|
18
|
+
execute(): void;
|
|
19
|
+
protected setupSetupProjectCommand(): void;
|
|
20
|
+
protected setupStageCommand(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Enqueues translations for a given set of files
|
|
23
|
+
* @param initOptions - The options for the command
|
|
24
|
+
* @returns The results of the command
|
|
25
|
+
*/
|
|
26
|
+
protected setupEnqueueCommand(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Downloads translations that were originally staged
|
|
29
|
+
* @param initOptions - The options for the command
|
|
30
|
+
* @returns The results of the command
|
|
31
|
+
*/
|
|
32
|
+
protected setupDownloadCommand(): void;
|
|
33
|
+
protected setupTranslateCommand(): void;
|
|
34
|
+
protected setupSendDiffsCommand(): void;
|
|
35
|
+
protected handleSetupProject(initOptions: TranslateFlags): Promise<void>;
|
|
36
|
+
protected handleStage(initOptions: TranslateFlags): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Enqueues translations for a given set of files
|
|
39
|
+
* @param initOptions - The options for the command
|
|
40
|
+
* @returns The results of the command
|
|
41
|
+
*/
|
|
42
|
+
protected handleEnqueue(initOptions: TranslateFlags): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Downloads translations that were originally staged
|
|
45
|
+
* @param initOptions - The options for the command
|
|
46
|
+
* @returns The results of the command
|
|
47
|
+
*/
|
|
48
|
+
protected handleDownload(initOptions: TranslateFlags): Promise<void>;
|
|
49
|
+
protected handleTranslate(initOptions: TranslateFlags): Promise<void>;
|
|
50
|
+
protected setupUploadCommand(): void;
|
|
51
|
+
protected setupLoginCommand(): void;
|
|
52
|
+
protected setupInitCommand(): void;
|
|
53
|
+
protected setupConfigureCommand(): void;
|
|
54
|
+
protected handleUploadCommand(settings: Settings & UploadOptions): Promise<void>;
|
|
55
|
+
protected handleInitCommand(ranReactSetup: boolean, useDefaults?: boolean): Promise<void>;
|
|
56
|
+
protected handleLoginCommand(options: LoginOptions): Promise<void>;
|
|
57
|
+
protected setupUpdateInstructionsCommand(): void;
|
|
58
|
+
protected promptAgentInstructions(useDefaults?: boolean): Promise<void>;
|
|
59
|
+
}
|