skuba 14.0.0-migrate-to-inquirer-20251031055743 → 14.0.0-replace-global-vars-20251117052457
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/config/eslint.js +1 -1
- package/config/prettier.d.ts +8 -4
- package/config/prettier.js +10 -2
- package/lib/cli/adapter/eslint.js +11 -45
- package/lib/cli/adapter/eslint.js.map +3 -3
- package/lib/cli/adapter/prettier.js +39 -67
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/args.js +8 -42
- package/lib/cli/build/args.js.map +2 -2
- package/lib/cli/build/assets.d.ts +3 -2
- package/lib/cli/build/assets.js +28 -60
- package/lib/cli/build/assets.js.map +3 -3
- package/lib/cli/build/esbuild.js +21 -45
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +21 -55
- package/lib/cli/build/index.js.map +3 -3
- package/lib/cli/build/tsc.js +23 -61
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/buildPackage/index.js +8 -32
- package/lib/cli/buildPackage/index.js.map +1 -1
- package/lib/cli/configure/analyseConfiguration.js +16 -50
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.d.ts +1 -1
- package/lib/cli/configure/analyseDependencies.js +25 -59
- package/lib/cli/configure/analyseDependencies.js.map +3 -3
- package/lib/cli/configure/analysis/diff.js +5 -39
- package/lib/cli/configure/analysis/diff.js.map +3 -3
- package/lib/cli/configure/analysis/files.js +8 -42
- package/lib/cli/configure/analysis/files.js.map +2 -2
- package/lib/cli/configure/analysis/git.js +12 -46
- package/lib/cli/configure/analysis/git.js.map +2 -2
- package/lib/cli/configure/analysis/package.d.ts +2 -3
- package/lib/cli/configure/analysis/package.js +10 -45
- package/lib/cli/configure/analysis/package.js.map +3 -3
- package/lib/cli/configure/analysis/project.js +18 -50
- package/lib/cli/configure/analysis/project.js.map +2 -2
- package/lib/cli/configure/dependencies/index.js +7 -35
- package/lib/cli/configure/dependencies/index.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +4 -28
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js +4 -28
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js +4 -28
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +2 -26
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js +4 -29
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +35 -60
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.d.ts +1 -1
- package/lib/cli/configure/getEntryPoint.js +14 -48
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +14 -35
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +50 -84
- package/lib/cli/configure/index.js.map +3 -3
- package/lib/cli/configure/modules/eslint.js +10 -34
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/ignore.js +8 -32
- package/lib/cli/configure/modules/ignore.js.map +1 -1
- package/lib/cli/configure/modules/index.js +18 -44
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/nodemon.js +4 -28
- package/lib/cli/configure/modules/nodemon.js.map +1 -1
- package/lib/cli/configure/modules/package.js +10 -34
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +11 -35
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +17 -40
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/serverless.js +2 -26
- package/lib/cli/configure/modules/serverless.js.map +1 -1
- package/lib/cli/configure/modules/tslint.js +4 -28
- package/lib/cli/configure/modules/tslint.js.map +1 -1
- package/lib/cli/configure/processing/configFile.js +3 -39
- package/lib/cli/configure/processing/configFile.js.map +1 -1
- package/lib/cli/configure/processing/deleteFiles.js +2 -26
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +2 -27
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +6 -31
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +2 -26
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +4 -28
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.d.ts +1 -67
- package/lib/cli/configure/processing/package.js +8 -45
- package/lib/cli/configure/processing/package.js.map +3 -3
- package/lib/cli/configure/processing/prettier.js +4 -38
- package/lib/cli/configure/processing/prettier.js.map +2 -2
- package/lib/cli/configure/processing/record.js +5 -41
- package/lib/cli/configure/processing/record.js.map +2 -2
- package/lib/cli/configure/processing/typescript.js +26 -63
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/types.d.ts +15 -4
- package/lib/cli/configure/types.js +0 -16
- package/lib/cli/configure/types.js.map +3 -3
- package/lib/cli/format/index.js +20 -54
- package/lib/cli/format/index.js.map +3 -3
- package/lib/cli/help/index.js +6 -30
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.d.ts +1 -1
- package/lib/cli/init/getConfig.js +89 -118
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.js +16 -51
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.js +67 -98
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.js +21 -42
- package/lib/cli/init/prompts.js.map +1 -1
- package/lib/cli/init/types.js +7 -41
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +2 -30
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +8 -42
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js +3 -37
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +11 -45
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +3 -37
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +3 -37
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +3 -37
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +2 -26
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +11 -45
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +2 -26
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +2 -26
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +4 -28
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/index.js +6 -30
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.js +37 -73
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/eslint.js +16 -51
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/external.js +19 -51
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.js +26 -52
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +20 -52
- package/lib/cli/lint/internal.js.map +3 -3
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +8 -33
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +12 -48
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +21 -55
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +33 -66
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
- package/lib/cli/lint/internalLints/upgrade/index.js +23 -56
- package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +11 -45
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +6 -30
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +37 -65
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +11 -46
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +23 -59
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +11 -46
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +6 -30
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +11 -46
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +11 -46
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +11 -46
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +29 -67
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +10 -34
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +11 -45
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +4 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +18 -63
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +15 -50
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.d.ts +2 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +11 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +5 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +72 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +17 -51
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +10 -34
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +10 -44
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +12 -46
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +15 -49
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +11 -45
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +10 -39
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +11 -45
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +11 -45
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +13 -47
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +11 -45
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +8 -32
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
- package/lib/cli/lint/prettier.js +15 -50
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/lint/tsc.js +4 -28
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/lint/types.js +0 -16
- package/lib/cli/lint/types.js.map +3 -3
- package/lib/cli/migrate/index.js +10 -34
- package/lib/cli/migrate/index.js.map +1 -1
- package/lib/cli/migrate/nodeVersion/checks.js +24 -61
- package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/index.js +25 -55
- package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
- package/lib/cli/node/index.js +20 -57
- package/lib/cli/node/index.js.map +3 -3
- package/lib/cli/release/index.js +4 -28
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +16 -50
- package/lib/cli/start/index.js.map +3 -3
- package/lib/cli/test/index.js +4 -44
- package/lib/cli/test/index.js.map +2 -2
- package/lib/cli/version/index.js +6 -30
- package/lib/cli/version/index.js.map +1 -1
- package/lib/eslint.d.js +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +6 -46
- package/lib/index.js.map +2 -2
- package/lib/skuba.js +26 -45
- package/lib/skuba.js.map +3 -3
- package/lib/utils/args.js +6 -43
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/command.js +4 -42
- package/lib/utils/command.js.map +3 -3
- package/lib/utils/copy.js +20 -57
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.js +32 -72
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/env.js +2 -26
- package/lib/utils/env.js.map +1 -1
- package/lib/utils/error.js +10 -47
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.d.ts +3 -2
- package/lib/utils/exec.js +24 -62
- package/lib/utils/exec.js.map +3 -3
- package/lib/utils/fs.js +6 -40
- package/lib/utils/fs.js.map +3 -3
- package/lib/utils/help.js +6 -30
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/logging.d.ts +9 -10
- package/lib/utils/logging.js +11 -48
- package/lib/utils/logging.js.map +3 -3
- package/lib/utils/logo.js +28 -59
- package/lib/utils/logo.js.map +3 -3
- package/lib/utils/manifest.d.ts +3 -2
- package/lib/utils/manifest.js +8 -48
- package/lib/utils/manifest.js.map +3 -3
- package/lib/utils/npmrc.js +2 -26
- package/lib/utils/npmrc.js.map +1 -1
- package/lib/utils/packageManager.js +12 -49
- package/lib/utils/packageManager.js.map +2 -2
- package/lib/utils/port.js +4 -39
- package/lib/utils/port.js.map +2 -2
- package/lib/utils/sleep.js +2 -26
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/template.js +18 -55
- package/lib/utils/template.js.map +3 -3
- package/lib/utils/validation.js +2 -31
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +9 -46
- package/lib/utils/version.js.map +2 -2
- package/lib/utils/wait.js +7 -32
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.d.ts +3 -3
- package/lib/utils/worker.js +10 -35
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/function-arguments.d.js +0 -1
- package/lib/wrapper/functionHandler.js +18 -49
- package/lib/wrapper/functionHandler.js.map +2 -2
- package/lib/wrapper/http.d.ts +0 -6
- package/lib/wrapper/http.js +8 -51
- package/lib/wrapper/http.js.map +3 -3
- package/lib/wrapper/index.js +6 -7
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +8 -42
- package/lib/wrapper/main.js.map +3 -3
- package/lib/wrapper/requestListener.js +13 -46
- package/lib/wrapper/requestListener.js.map +3 -3
- package/lib/wrapper/server.d.ts +7 -0
- package/lib/wrapper/server.js +11 -0
- package/lib/wrapper/server.js.map +7 -0
- package/package.json +17 -24
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +3 -2
- package/template/base/vitest.config.ts +25 -0
- package/template/express-rest-api/package.json +2 -1
- package/template/express-rest-api/skuba.template.js +1 -1
- package/template/express-rest-api/src/app.test.ts +1 -0
- package/template/greeter/package.json +4 -3
- package/template/greeter/skuba.template.js +1 -1
- package/template/greeter/src/app.test.ts +3 -1
- package/template/koa-rest-api/package.json +2 -1
- package/template/koa-rest-api/skuba.template.js +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +2 -0
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +2 -0
- package/template/koa-rest-api/src/app.test.ts +2 -0
- package/template/koa-rest-api/src/framework/server.test.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +2 -0
- package/template/koa-rest-api/src/testing/metrics.ts +2 -0
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +15 -3
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +11 -9
- package/template/lambda-sqs-worker-cdk/package.json +6 -5
- package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -1
- package/template/lambda-sqs-worker-cdk/src/app.test.ts +22 -13
- package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +1 -0
- package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +33 -31
- package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +8 -2
- package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +3 -2
- package/template/lambda-sqs-worker-cdk/src/testing/services.ts +4 -3
- package/template/oss-npm-package/_package.json +1 -0
- package/template/oss-npm-package/skuba.template.js +1 -1
- package/template/oss-npm-package/src/index.test.ts +2 -0
- package/template/private-npm-package/_package.json +1 -0
- package/template/private-npm-package/skuba.template.js +1 -1
- package/template/private-npm-package/src/index.test.ts +2 -0
- package/config/jest.js +0 -1
- package/jest/moduleNameMapper.js +0 -64
- package/jest/transform.js +0 -62
- package/jest/tsConfig.js +0 -26
- package/jest-preset.js +0 -37
- package/lib/api/jest/index.d.ts +0 -15
- package/lib/api/jest/index.js +0 -59
- package/lib/api/jest/index.js.map +0 -7
- package/lib/cli/configure/modules/jest.d.ts +0 -2
- package/lib/cli/configure/modules/jest.js +0 -86
- package/lib/cli/configure/modules/jest.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
- package/lib/cli/test/reporters/github/annotations.d.ts +0 -9
- package/lib/cli/test/reporters/github/annotations.js +0 -102
- package/lib/cli/test/reporters/github/annotations.js.map +0 -7
- package/lib/cli/test/reporters/github/index.d.ts +0 -5
- package/lib/cli/test/reporters/github/index.js +0 -74
- package/lib/cli/test/reporters/github/index.js.map +0 -7
- package/template/base/jest.config.ts +0 -19
- package/template/base/jest.setup.ts +0 -3
|
@@ -1,48 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var configureTsConfigForESM_exports = {};
|
|
30
|
-
__export(configureTsConfigForESM_exports, {
|
|
31
|
-
addJestModuleNameMapper: () => addJestModuleNameMapper,
|
|
32
|
-
configureTsConfigForESM: () => configureTsConfigForESM,
|
|
33
|
-
parsePackageJson: () => parsePackageJson,
|
|
34
|
-
tryConfigureTsConfigForESM: () => tryConfigureTsConfigForESM,
|
|
35
|
-
updatePackageJson: () => updatePackageJson
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(configureTsConfigForESM_exports);
|
|
38
|
-
var import_path = __toESM(require("path"));
|
|
39
|
-
var import_util = require("util");
|
|
40
|
-
var import_fast_glob = require("fast-glob");
|
|
41
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
42
|
-
var import_typescript = __toESM(require("typescript"));
|
|
43
|
-
var z = __toESM(require("zod"));
|
|
44
|
-
var import__ = require("../../../../../../index.js");
|
|
45
|
-
var import_logging = require("../../../../../../utils/logging.js");
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { inspect } from "util";
|
|
3
|
+
import { glob } from "fast-glob";
|
|
4
|
+
import fs from "fs-extra";
|
|
5
|
+
import ts from "typescript";
|
|
6
|
+
import * as z from "zod";
|
|
7
|
+
import { Git } from "../../../../../../index.js";
|
|
8
|
+
import { log } from "../../../../../../utils/logging.js";
|
|
46
9
|
const packageJsonSchema = z.looseObject({
|
|
47
10
|
imports: z.record(z.string(), z.record(z.string(), z.string())).optional()
|
|
48
11
|
});
|
|
@@ -54,12 +17,12 @@ const tsConfigSchema = z.looseObject({
|
|
|
54
17
|
}).optional()
|
|
55
18
|
});
|
|
56
19
|
const fetchFiles = async (patterns) => {
|
|
57
|
-
const files = await
|
|
20
|
+
const files = await glob(patterns, {
|
|
58
21
|
ignore: ["**/.git", "**/node_modules"]
|
|
59
22
|
});
|
|
60
23
|
return Promise.all(
|
|
61
24
|
files.map(async (file) => {
|
|
62
|
-
const contents = await
|
|
25
|
+
const contents = await fs.promises.readFile(file, "utf8");
|
|
63
26
|
return {
|
|
64
27
|
file,
|
|
65
28
|
contents
|
|
@@ -114,7 +77,7 @@ const addJestModuleNameMapper = (contents, srcPaths) => {
|
|
|
114
77
|
const newContents = contents.slice(0, insertionIndex) + moduleNameMapperString + contents.slice(insertionIndex);
|
|
115
78
|
return newContents;
|
|
116
79
|
}
|
|
117
|
-
|
|
80
|
+
log.warn(
|
|
118
81
|
"Could not find a suitable place to insert moduleNameMapper in jest config"
|
|
119
82
|
);
|
|
120
83
|
return contents;
|
|
@@ -127,7 +90,7 @@ const parsePackageJson = (contents) => {
|
|
|
127
90
|
parsed: packageJsonSchema.parse(parsedJson)
|
|
128
91
|
};
|
|
129
92
|
} catch (error) {
|
|
130
|
-
|
|
93
|
+
log.warn(`Failed to parse package.json as JSON: ${String(error)}`);
|
|
131
94
|
return null;
|
|
132
95
|
}
|
|
133
96
|
};
|
|
@@ -146,7 +109,7 @@ const updatePackageJson = ({
|
|
|
146
109
|
};
|
|
147
110
|
const parseTsconfig = (file, contents) => {
|
|
148
111
|
try {
|
|
149
|
-
const parsedJson =
|
|
112
|
+
const parsedJson = ts.parseConfigFileTextToJson(file, contents);
|
|
150
113
|
const tsconfig = tsConfigSchema.parse(parsedJson.config);
|
|
151
114
|
return {
|
|
152
115
|
original: parsedJson.config,
|
|
@@ -154,7 +117,7 @@ const parseTsconfig = (file, contents) => {
|
|
|
154
117
|
srcPaths: tsconfig.compilerOptions?.paths?.["./src/*"] ?? []
|
|
155
118
|
};
|
|
156
119
|
} catch (error) {
|
|
157
|
-
|
|
120
|
+
log.warn(`Failed to parse root tsconfig.json as JSON: ${String(error)}`);
|
|
158
121
|
return null;
|
|
159
122
|
}
|
|
160
123
|
};
|
|
@@ -195,7 +158,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
195
158
|
}) => {
|
|
196
159
|
let customCondition;
|
|
197
160
|
try {
|
|
198
|
-
const { repo } = await
|
|
161
|
+
const { repo } = await Git.getOwnerAndRepo({ dir: process.cwd() });
|
|
199
162
|
customCondition = `@seek/${repo}/source`;
|
|
200
163
|
} catch {
|
|
201
164
|
return { result: "skip", reason: "no repository name found" };
|
|
@@ -238,10 +201,10 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
238
201
|
const match = regex.exec(p);
|
|
239
202
|
if (match?.[1] !== void 0) {
|
|
240
203
|
return [
|
|
241
|
-
|
|
204
|
+
path.join(path.dirname(file), match[1].replace(/\/?$/, ""))
|
|
242
205
|
];
|
|
243
206
|
}
|
|
244
|
-
|
|
207
|
+
log.warn(
|
|
245
208
|
`Unexpected src path format in ${file}: ${p}. Expected format like "apps/api/src/*"`
|
|
246
209
|
);
|
|
247
210
|
return [];
|
|
@@ -253,7 +216,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
253
216
|
return { result: "skip", reason: "no src paths found" };
|
|
254
217
|
}
|
|
255
218
|
const packageJsonPatterns = allSrcPaths.map(
|
|
256
|
-
(srcPath) =>
|
|
219
|
+
(srcPath) => path.join(srcPath, "package.json")
|
|
257
220
|
);
|
|
258
221
|
const packageJsonFiles = await fetchFiles(packageJsonPatterns);
|
|
259
222
|
const parsedPackageJsonFiles = packageJsonFiles.flatMap(
|
|
@@ -264,7 +227,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
264
227
|
);
|
|
265
228
|
parsedPackageJsonFiles.forEach(({ parsed, file }) => {
|
|
266
229
|
updatePackageJson({ parsed, customCondition });
|
|
267
|
-
const relativeTsconfigPath =
|
|
230
|
+
const relativeTsconfigPath = path.join(path.dirname(file), "tsconfig.json");
|
|
268
231
|
const relativeTsconfig = updatedTsconfigFiles.find(
|
|
269
232
|
(tsconfig) => tsconfig.file === relativeTsconfigPath
|
|
270
233
|
);
|
|
@@ -272,12 +235,12 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
272
235
|
relativeTsconfig.parsed.compilerOptions ??= {};
|
|
273
236
|
relativeTsconfig.parsed.compilerOptions.rootDir ??= ".";
|
|
274
237
|
} else {
|
|
275
|
-
|
|
238
|
+
log.warn(
|
|
276
239
|
`No corresponding tsconfig.json found for package.json at ${file}. Expected at ${relativeTsconfigPath}`
|
|
277
240
|
);
|
|
278
241
|
}
|
|
279
|
-
const relativeTsconfigBuildPath =
|
|
280
|
-
|
|
242
|
+
const relativeTsconfigBuildPath = path.join(
|
|
243
|
+
path.dirname(file),
|
|
281
244
|
"tsconfig.build.json"
|
|
282
245
|
);
|
|
283
246
|
const relativeTsconfigBuild = parsedTsconfigBuildFiles.find(
|
|
@@ -287,7 +250,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
287
250
|
relativeTsconfigBuild.parsed.compilerOptions ??= {};
|
|
288
251
|
relativeTsconfigBuild.parsed.compilerOptions.rootDir ??= "src";
|
|
289
252
|
} else {
|
|
290
|
-
|
|
253
|
+
log.warn(
|
|
291
254
|
`No corresponding tsconfig.build.json found for package.json at ${file}. Expected at ${relativeTsconfigBuildPath}`
|
|
292
255
|
);
|
|
293
256
|
}
|
|
@@ -324,7 +287,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
324
287
|
return;
|
|
325
288
|
}
|
|
326
289
|
const updatedContents = JSON.stringify(parsed, null, 2);
|
|
327
|
-
await
|
|
290
|
+
await fs.promises.writeFile(file, updatedContents);
|
|
328
291
|
})
|
|
329
292
|
);
|
|
330
293
|
const otherFilePromises = Promise.all(
|
|
@@ -332,7 +295,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
332
295
|
if (original === parsed) {
|
|
333
296
|
return;
|
|
334
297
|
}
|
|
335
|
-
await
|
|
298
|
+
await fs.promises.writeFile(file, parsed);
|
|
336
299
|
})
|
|
337
300
|
);
|
|
338
301
|
await Promise.all([jsonFilePromises, otherFilePromises]);
|
|
@@ -342,17 +305,16 @@ const configureTsConfigForESM = async (config) => {
|
|
|
342
305
|
try {
|
|
343
306
|
return await tryConfigureTsConfigForESM(config);
|
|
344
307
|
} catch (err) {
|
|
345
|
-
|
|
346
|
-
|
|
308
|
+
log.warn("Failed to write configure `tsconfig.json` and `package.json`");
|
|
309
|
+
log.subtle(inspect(err));
|
|
347
310
|
return { result: "skip", reason: "due to an error" };
|
|
348
311
|
}
|
|
349
312
|
};
|
|
350
|
-
|
|
351
|
-
0 && (module.exports = {
|
|
313
|
+
export {
|
|
352
314
|
addJestModuleNameMapper,
|
|
353
315
|
configureTsConfigForESM,
|
|
354
316
|
parsePackageJson,
|
|
355
317
|
tryConfigureTsConfigForESM,
|
|
356
318
|
updatePackageJson
|
|
357
|
-
}
|
|
319
|
+
};
|
|
358
320
|
//# sourceMappingURL=configureTsConfigForESM.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\nimport ts from 'typescript';\nimport * as z from 'zod';\n\nimport { Git } from '../../../../../../index.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst packageJsonSchema = z.looseObject({\n imports: z.record(z.string(), z.record(z.string(), z.string())).optional(),\n});\n\ntype PackageJson = z.infer<typeof packageJsonSchema>;\n\nconst tsConfigSchema = z.looseObject({\n compilerOptions: z\n .looseObject({\n customConditions: z.array(z.string()).optional(),\n rootDir: z.string().optional(),\n paths: z\n .record(z.string(), z.union([z.array(z.string()), z.null()]))\n .optional(),\n })\n .optional(),\n});\n\ntype TsConfig = z.infer<typeof tsConfigSchema>;\n\nconst fetchFiles = async (patterns: string[]) => {\n const files = await glob(patterns, {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n return Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n};\n\nexport const addJestModuleNameMapper = (\n contents: string,\n srcPaths: string[],\n) => {\n if (!srcPaths.length) {\n return contents;\n }\n const moduleNameRegex = /moduleNameMapper:\\s*\\{([\\s\\S]*?)\\}/;\n const match = moduleNameRegex.exec(contents);\n\n const srcPathArray = srcPaths.map((subfolderPath) =>\n subfolderPath === '.' || subfolderPath === './'\n ? '<rootDir>/src/$1'\n : `<rootDir>/${subfolderPath}/src/$1`,\n );\n\n const srcModuleMappers = JSON.stringify({\n '^#src/(.*)\\\\.js$': srcPathArray,\n '^#src/(.*)$': srcPathArray,\n });\n\n // strip the surrounding { } from the JSON stringify result\n const newModuleNameMapper = srcModuleMappers\n .replace(/^{/, '')\n .replace(/}$/, '');\n\n if (match?.[1] !== undefined) {\n // insert srcModuleMappers into existing moduleNameMapper\n const existingModuleMappers = match[1];\n\n const optionalComma = !/[,\\s]*$/.test(existingModuleMappers) ? '' : ',';\n const newContents = `${contents.slice(\n 0,\n match.index,\n )}moduleNameMapper: {${existingModuleMappers}${optionalComma}${newModuleNameMapper}}${contents.slice(\n match.index + match[0].length,\n )}`;\n\n return newContents;\n }\n\n // match against function calls\n\n // Match function calls like moduleNameMapper: getMapper()\n const moduleNameMapperFunctionRegex =\n /moduleNameMapper:\\s*([a-zA-Z_$][\\w$]*(?:\\([^)]*\\))?)/;\n const functionMatch = moduleNameMapperFunctionRegex.exec(contents);\n\n if (functionMatch?.[1] !== undefined) {\n const functionBody = functionMatch[1];\n const optionalComma = !/[,\\s]*$/.test(functionBody) ? '' : ',';\n const newContents = `${contents.slice(\n 0,\n functionMatch.index,\n )}moduleNameMapper: {...${functionBody}${optionalComma}${newModuleNameMapper}}${contents.slice(\n functionMatch.index + functionMatch[0].length,\n )}}`;\n\n return newContents;\n }\n\n // Add moduleNameMapper if not present\n\n const insertionPointRegex = /(\\b(jest|export\\s+default)\\b[\\s\\S]*?{)/;\n const insertionMatch = insertionPointRegex.exec(contents);\n\n if (insertionMatch?.[1] !== undefined) {\n const insertionIndex = insertionMatch.index + insertionMatch[0].length;\n const moduleNameMapperString = `\\n moduleNameMapper: {${newModuleNameMapper}},`;\n\n const newContents =\n contents.slice(0, insertionIndex) +\n moduleNameMapperString +\n contents.slice(insertionIndex);\n\n return newContents;\n }\n\n log.warn(\n 'Could not find a suitable place to insert moduleNameMapper in jest config',\n );\n return contents;\n};\n\nexport const parsePackageJson = (\n contents: string,\n): {\n original: PackageJson;\n parsed: PackageJson;\n} | null => {\n try {\n const parsedJson: unknown = JSON.parse(contents);\n return {\n original: parsedJson as PackageJson,\n parsed: packageJsonSchema.parse(parsedJson),\n };\n } catch (error) {\n log.warn(`Failed to parse package.json as JSON: ${String(error)}`);\n return null;\n }\n};\n\nexport const updatePackageJson = ({\n parsed,\n customCondition,\n}: {\n parsed: PackageJson;\n customCondition: string;\n}) => {\n parsed.imports ??= {};\n parsed.imports['#src/*'] ??= {\n [customCondition]: './src/*',\n default: './lib/*',\n };\n\n return {\n parsed,\n };\n};\n\nconst parseTsconfig = (\n file: string,\n contents: string,\n): {\n original: TsConfig;\n parsed: TsConfig;\n srcPaths: string[];\n} | null => {\n try {\n const parsedJson = ts.parseConfigFileTextToJson(file, contents);\n const tsconfig = tsConfigSchema.parse(parsedJson.config);\n\n return {\n original: parsedJson.config as TsConfig,\n parsed: tsconfig,\n srcPaths: tsconfig.compilerOptions?.paths?.['./src/*'] ?? [],\n };\n } catch (error) {\n log.warn(`Failed to parse root tsconfig.json as JSON: ${String(error)}`);\n return null;\n }\n};\n\nconst updateTsConfig = ({\n parsed,\n customCondition,\n file,\n}: {\n parsed: TsConfig;\n customCondition: string;\n file: string;\n}) => {\n if (file === 'tsconfig.json') {\n parsed.compilerOptions ??= {};\n parsed.compilerOptions.customConditions ??= [];\n\n if (\n parsed.compilerOptions.customConditions.includes(customCondition) &&\n customCondition !== '@seek/skuba/source'\n ) {\n throw new Error(\n `Custom condition ${customCondition} already exists in tsconfig.json`,\n );\n }\n\n if (!parsed.compilerOptions.customConditions.includes(customCondition)) {\n parsed.compilerOptions.customConditions.push(customCondition);\n }\n }\n\n let srcPaths: string[] = [];\n ['./src/*', 'src/*', 'src'].forEach((key) => {\n if (parsed.compilerOptions?.paths?.[key]) {\n srcPaths = parsed.compilerOptions.paths[key];\n delete parsed.compilerOptions.paths[key];\n }\n });\n\n if (\n parsed.compilerOptions?.paths &&\n Object.keys(parsed.compilerOptions.paths).length === 0\n ) {\n delete parsed.compilerOptions.paths;\n }\n\n return {\n parsed,\n srcPaths,\n };\n};\n\nexport const tryConfigureTsConfigForESM: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n let customCondition: string;\n try {\n const { repo } = await Git.getOwnerAndRepo({ dir: process.cwd() });\n customCondition = `@seek/${repo}/source`;\n } catch {\n return { result: 'skip', reason: 'no repository name found' };\n }\n\n const tsconfigJsonPatterns = ['**/tsconfig.json'];\n const tsconfigBuildJsonPatterns = ['**/tsconfig.build.json'];\n const jestConfigPatterns = ['**/jest.config.ts', '**/jest.config.*.ts'];\n\n const [tsconfigJsonFiles, tsconfigBuildJsonFiles, jestConfigFiles] =\n await Promise.all([\n fetchFiles(tsconfigJsonPatterns),\n fetchFiles(tsconfigBuildJsonPatterns),\n fetchFiles(jestConfigPatterns),\n ]);\n\n const parsedTsconfigFiles = tsconfigJsonFiles.flatMap(\n ({ file, contents }) => {\n const parsed = parseTsconfig(file, contents);\n return parsed ? [{ file, ...parsed }] : [];\n },\n );\n\n const parsedTsconfigBuildFiles = tsconfigBuildJsonFiles.flatMap(\n ({ file, contents }) => {\n const parsed = parseTsconfig(file, contents);\n return parsed ? [{ file, ...parsed }] : [];\n },\n );\n\n if (parsedTsconfigFiles.length === 0) {\n return { result: 'skip', reason: 'no valid tsconfig.json files found' };\n }\n\n const updatedTsconfigFiles = parsedTsconfigFiles.map(\n ({ file, parsed, original }) => ({\n file,\n original,\n ...updateTsConfig({ parsed, customCondition, file }),\n }),\n );\n\n const allSrcPaths = [\n ...new Set(\n updatedTsconfigFiles.flatMap(({ srcPaths, file }) =>\n srcPaths.flatMap((p) => {\n const regex = /(.*)src\\/?\\*?$/;\n const match = regex.exec(p);\n if (match?.[1] !== undefined) {\n return [\n path.join(path.dirname(file), match[1].replace(/\\/?$/, '')),\n ];\n }\n\n log.warn(\n `Unexpected src path format in ${file}: ${p}. Expected format like \"apps/api/src/*\"`,\n );\n return [];\n }),\n ),\n ),\n ];\n\n if (!allSrcPaths.length) {\n return { result: 'skip', reason: 'no src paths found' };\n }\n\n // Fetch all package.json paths which may be in allSrcPaths\n const packageJsonPatterns = allSrcPaths.map((srcPath) =>\n path.join(srcPath, 'package.json'),\n );\n\n const packageJsonFiles = await fetchFiles(packageJsonPatterns);\n\n const parsedPackageJsonFiles = packageJsonFiles.flatMap(\n ({ file, contents }) => {\n const parsed = parsePackageJson(contents);\n return parsed ? [{ file, ...parsed }] : [];\n },\n );\n\n parsedPackageJsonFiles.forEach(({ parsed, file }) => {\n updatePackageJson({ parsed, customCondition });\n\n const relativeTsconfigPath = path.join(path.dirname(file), 'tsconfig.json');\n\n const relativeTsconfig = updatedTsconfigFiles.find(\n (tsconfig) => tsconfig.file === relativeTsconfigPath,\n );\n\n if (relativeTsconfig) {\n relativeTsconfig.parsed.compilerOptions ??= {};\n relativeTsconfig.parsed.compilerOptions.rootDir ??= '.';\n } else {\n log.warn(\n `No corresponding tsconfig.json found for package.json at ${file}. Expected at ${relativeTsconfigPath}`,\n );\n }\n\n const relativeTsconfigBuildPath = path.join(\n path.dirname(file),\n 'tsconfig.build.json',\n );\n\n const relativeTsconfigBuild = parsedTsconfigBuildFiles.find(\n (tsconfig) => tsconfig.file === relativeTsconfigBuildPath,\n );\n\n if (relativeTsconfigBuild) {\n relativeTsconfigBuild.parsed.compilerOptions ??= {};\n relativeTsconfigBuild.parsed.compilerOptions.rootDir ??= 'src';\n } else {\n log.warn(\n `No corresponding tsconfig.build.json found for package.json at ${file}. Expected at ${relativeTsconfigBuildPath}`,\n );\n }\n });\n\n const updatedJestConfigFiles = jestConfigFiles.map(({ file, contents }) => {\n const parsed = addJestModuleNameMapper(contents, allSrcPaths);\n return { file, original: contents, parsed };\n });\n\n const hasJestConfigsChanged = updatedJestConfigFiles.some(\n ({ parsed, original }) => original !== parsed,\n );\n\n const hasRelativeTsconfigBuildsChanged = parsedTsconfigBuildFiles.some(\n ({ original, parsed }) =>\n JSON.stringify(original) !== JSON.stringify(parsed),\n );\n\n const hasPackageJsonsChanged = parsedPackageJsonFiles.some(\n ({ original, parsed }) =>\n JSON.stringify(original) !== JSON.stringify(parsed),\n );\n\n const hasRootTsconfigChanged = updatedTsconfigFiles.some(\n ({ original, parsed }) =>\n JSON.stringify(original) !== JSON.stringify(parsed),\n );\n\n if (\n mode === 'lint' &&\n (hasRootTsconfigChanged ||\n hasPackageJsonsChanged ||\n hasRelativeTsconfigBuildsChanged ||\n hasJestConfigsChanged)\n ) {\n return { result: 'apply' };\n }\n\n if (\n !hasRootTsconfigChanged &&\n !hasPackageJsonsChanged &&\n !hasRelativeTsconfigBuildsChanged &&\n !hasJestConfigsChanged\n ) {\n return { result: 'skip', reason: 'no changes required' };\n }\n\n const jsonFilePromises = Promise.all(\n [\n ...updatedTsconfigFiles,\n ...parsedTsconfigBuildFiles,\n ...parsedPackageJsonFiles,\n ].map(async ({ file, parsed, original }) => {\n if (JSON.stringify(original) === JSON.stringify(parsed)) {\n return;\n }\n const updatedContents = JSON.stringify(parsed, null, 2);\n await fs.promises.writeFile(file, updatedContents);\n }),\n );\n\n const otherFilePromises = Promise.all(\n updatedJestConfigFiles.map(async ({ file, parsed, original }) => {\n if (original === parsed) {\n return;\n }\n await fs.promises.writeFile(file, parsed);\n }),\n );\n\n await Promise.all([jsonFilePromises, otherFilePromises]);\n\n return { result: 'apply' };\n};\n\nexport const configureTsConfigForESM: PatchFunction = async (config) => {\n try {\n return await tryConfigureTsConfigForESM(config);\n } catch (err) {\n log.warn('Failed to write configure `tsconfig.json` and `package.json`');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,eAAe;AAExB,SAA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I,KAAK,8DAA8D;AACvE,QAAI,OAAO,QAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,50 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __exports = {};
|
|
20
|
-
__export(__exports, {
|
|
21
|
-
patches: () => patches
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(__exports);
|
|
24
|
-
var import_configureTsConfigForESM = require("./configureTsConfigForESM.js");
|
|
25
|
-
var import_patchApiDockerfiles = require("./patchApiDockerfiles.js");
|
|
26
|
-
var import_rewriteSrcImports = require("./rewriteSrcImports.js");
|
|
27
|
-
var import_updateLambdaConfigs = require("./updateLambdaConfigs.js");
|
|
1
|
+
import { configureTsConfigForESM } from "./configureTsConfigForESM.js";
|
|
2
|
+
import { patchApiDockerfiles } from "./patchApiDockerfiles.js";
|
|
3
|
+
import { rewriteSrcImports } from "./rewriteSrcImports.js";
|
|
4
|
+
import { updateLambdaConfigs } from "./updateLambdaConfigs.js";
|
|
28
5
|
const patches = [
|
|
29
6
|
{
|
|
30
|
-
apply:
|
|
7
|
+
apply: rewriteSrcImports,
|
|
31
8
|
description: "Rewrite all 'src' imports to be '#src'"
|
|
32
9
|
},
|
|
33
10
|
{
|
|
34
|
-
apply:
|
|
11
|
+
apply: configureTsConfigForESM,
|
|
35
12
|
description: "Configure `tsconfig.json`, `package.json` and `jest.config.ts` to support custom conditions"
|
|
36
13
|
},
|
|
37
14
|
{
|
|
38
|
-
apply:
|
|
15
|
+
apply: updateLambdaConfigs,
|
|
39
16
|
description: "Update lambda function configurations to support custom conditions"
|
|
40
17
|
},
|
|
41
18
|
{
|
|
42
|
-
apply:
|
|
19
|
+
apply: patchApiDockerfiles,
|
|
43
20
|
description: "Patch Dockerfiles to copy `package.json`"
|
|
44
21
|
}
|
|
45
22
|
];
|
|
46
|
-
|
|
47
|
-
0 && (module.exports = {
|
|
23
|
+
export {
|
|
48
24
|
patches
|
|
49
|
-
}
|
|
25
|
+
};
|
|
50
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/index.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { configureTsConfigForESM } from './configureTsConfigForESM.js';\nimport { patchApiDockerfiles } from './patchApiDockerfiles.js';\nimport { rewriteSrcImports } from './rewriteSrcImports.js';\nimport { updateLambdaConfigs } from './updateLambdaConfigs.js';\n\nexport const patches: Patches = [\n {\n apply: rewriteSrcImports,\n description: \"Rewrite all 'src' imports to be '#src'\",\n },\n {\n apply: configureTsConfigForESM,\n description:\n 'Configure `tsconfig.json`, `package.json` and `jest.config.ts` to support custom conditions',\n },\n {\n apply: updateLambdaConfigs,\n description:\n 'Update lambda function configurations to support custom conditions',\n },\n {\n apply: patchApiDockerfiles,\n description: 'Patch Dockerfiles to copy `package.json`',\n },\n];\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAEA,SAAS,+BAA+B;AACxC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAE7B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,43 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var patchApiDockerfiles_exports = {};
|
|
30
|
-
__export(patchApiDockerfiles_exports, {
|
|
31
|
-
patchApiDockerfiles: () => patchApiDockerfiles
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(patchApiDockerfiles_exports);
|
|
34
|
-
var import_util = require("util");
|
|
35
|
-
var import_fast_glob = require("fast-glob");
|
|
36
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
-
var import_logging = require("../../../../../../utils/logging.js");
|
|
1
|
+
import { inspect } from "util";
|
|
2
|
+
import { glob } from "fast-glob";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { log } from "../../../../../../utils/logging.js";
|
|
38
5
|
const fetchFiles = async (files) => Promise.all(
|
|
39
6
|
files.map(async (file) => {
|
|
40
|
-
const contents = await
|
|
7
|
+
const contents = await fs.promises.readFile(file, "utf8");
|
|
41
8
|
return {
|
|
42
9
|
file,
|
|
43
10
|
contents
|
|
@@ -94,7 +61,7 @@ ${packageJsonCopyLine}`
|
|
|
94
61
|
return newContents;
|
|
95
62
|
};
|
|
96
63
|
const tryPatchApiDockerfiles = async (config) => {
|
|
97
|
-
const dockerfilePaths = await
|
|
64
|
+
const dockerfilePaths = await glob(["**/Dockerfile*"], {
|
|
98
65
|
ignore: ["**/.git", "**/node_modules"]
|
|
99
66
|
});
|
|
100
67
|
if (dockerfilePaths.length === 0) {
|
|
@@ -129,7 +96,7 @@ const tryPatchApiDockerfiles = async (config) => {
|
|
|
129
96
|
}
|
|
130
97
|
await Promise.all(
|
|
131
98
|
dockerFilesToPatch.map(
|
|
132
|
-
({ file, contents }) =>
|
|
99
|
+
({ file, contents }) => fs.promises.writeFile(file, contents, "utf8")
|
|
133
100
|
)
|
|
134
101
|
);
|
|
135
102
|
return {
|
|
@@ -140,13 +107,12 @@ const patchApiDockerfiles = async (config) => {
|
|
|
140
107
|
try {
|
|
141
108
|
return await tryPatchApiDockerfiles(config);
|
|
142
109
|
} catch (err) {
|
|
143
|
-
|
|
144
|
-
|
|
110
|
+
log.warn("Failed to patch API dockerfiles");
|
|
111
|
+
log.subtle(inspect(err));
|
|
145
112
|
return { result: "skip", reason: "due to an error" };
|
|
146
113
|
}
|
|
147
114
|
};
|
|
148
|
-
|
|
149
|
-
0 && (module.exports = {
|
|
115
|
+
export {
|
|
150
116
|
patchApiDockerfiles
|
|
151
|
-
}
|
|
117
|
+
};
|
|
152
118
|
//# sourceMappingURL=patchApiDockerfiles.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst applyDockerfilePatch = (contents: string) => {\n const cmdLineRegex = /CMD\\s+\\[.*?\\]/ms;\n const cmdLineMatch = cmdLineRegex.exec(contents);\n const cmdLine = cmdLineMatch?.[0];\n\n if (!cmdLine) {\n return undefined;\n }\n\n // Extract the lib path from CMD line\n // Match patterns like \"./lib/\", \"apps/api/lib/\", \"lib/\"\n const libPathRegex = /\"([^\"]*\\/)?lib\\/[^\"]*\"/;\n const libPathMatch = libPathRegex.exec(cmdLine);\n\n if (!libPathMatch) {\n return undefined;\n }\n\n const fullPath = libPathMatch[1] || './';\n const libParentPath = fullPath.endsWith('/')\n ? fullPath.slice(0, -1)\n : fullPath;\n\n // If the path is empty or just './', the lib is in current directory\n const normalizedPath =\n libParentPath === '.' || libParentPath === '' ? '.' : libParentPath;\n\n // Try to find COPY with --from first\n const copyNodeModulesWithFromRegex =\n /^\\s*COPY\\s+--from=(\\S+)\\s+.*node_modules.*$/m;\n const copyNodeModulesWithFromMatch =\n copyNodeModulesWithFromRegex.exec(contents);\n\n // If no --from, try to find COPY without --from\n const copyNodeModulesWithoutFromRegex =\n /^\\s*COPY\\s+(?!--from).*node_modules.*$/m;\n const copyNodeModulesWithoutFromMatch =\n copyNodeModulesWithoutFromRegex.exec(contents);\n\n const copyNodeModulesMatch =\n copyNodeModulesWithFromMatch ?? copyNodeModulesWithoutFromMatch;\n const copyNodeModulesLine = copyNodeModulesMatch?.[0];\n const fromSource = copyNodeModulesWithFromMatch?.[1];\n\n if (!copyNodeModulesLine) {\n return undefined;\n }\n\n // Check if package.json is already being copied for this path\n const packageJsonPattern = normalizedPath === '.' ? '' : `${normalizedPath}/`;\n const packageJsonCopyPattern = fromSource\n ? new RegExp(\n `^\\\\s*COPY\\\\s+--from=${fromSource}\\\\s+.*${packageJsonPattern}package\\\\.json`,\n 'm',\n )\n : new RegExp(\n `^\\\\s*COPY\\\\s+(?!--from).*${packageJsonPattern}package\\\\.json`,\n 'm',\n );\n\n if (packageJsonCopyPattern.test(contents)) {\n return undefined;\n }\n\n let packageJsonCopyLine: string;\n if (fromSource) {\n packageJsonCopyLine =\n normalizedPath === '.'\n ? `COPY --from=${fromSource} /workdir/package.json package.json`\n : `COPY --from=${fromSource} /workdir/${normalizedPath}/package.json ${normalizedPath}/package.json`;\n } else {\n packageJsonCopyLine =\n normalizedPath === '.'\n ? 'COPY package.json package.json'\n : `COPY ${normalizedPath}/package.json ${normalizedPath}/package.json`;\n }\n\n const newContents = contents.replace(\n copyNodeModulesLine,\n `${copyNodeModulesLine}\\n${packageJsonCopyLine}`,\n );\n\n return newContents;\n};\n\nconst tryPatchApiDockerfiles = async (config: {\n mode: 'lint' | 'format';\n}): Promise<PatchReturnType> => {\n const dockerfilePaths = await glob(['**/Dockerfile*'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (dockerfilePaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no Dockerfiles found',\n };\n }\n\n const dockerfiles = await fetchFiles(dockerfilePaths);\n\n const dockerFilesToPatch = dockerfiles.flatMap(({ file, contents }) => {\n const newContents = applyDockerfilePatch(contents);\n if (!newContents || newContents === contents) {\n return [];\n }\n\n return [\n {\n file,\n contents: newContents,\n },\n ];\n });\n\n if (dockerFilesToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no Dockerfiles to patch',\n };\n }\n\n if (config.mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerFilesToPatch.map(({ file, contents }) =>\n fs.promises.writeFile(file, contents, 'utf8'),\n ),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const patchApiDockerfiles: PatchFunction = async (config) => {\n try {\n return await tryPatchApiDockerfiles(config);\n } catch (err) {\n log.warn('Failed to patch API dockerfiles');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AAExB,SAAS,YAAY;AACrB,OAAO,QAAQ;AAEf,SAAS,WAAW;AAGpB,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW,MAAM,GAAG,SAAS,SAAS,MAAM,MAAM;AAExD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEF,MAAM,uBAAuB,CAAC,aAAqB;AACjD,QAAM,eAAe;AACrB,QAAM,eAAe,aAAa,KAAK,QAAQ;AAC/C,QAAM,UAAU,eAAe,CAAC;AAEhC,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAIA,QAAM,eAAe;AACrB,QAAM,eAAe,aA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;AAED,MAAI,gBAAgB,WAAW,GAAG;AAChC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,WAAW,eAAe;AAEpD,QAAM,qBAAqB,YAAY,QAAQ,CAAC,EAAE,MAAM,SAAS,MAAM;AACrE,UAAM,cAAc,qBAAqB,QAAQ;AACjD,QAAI,CAAC,eAAe,gBAAgB,UAAU;AAC5C,aAAO,CAAC;AAAA,IACV;AAEA,WAAO;AAAA,MACL;AAAA,QACE;AAAA,QACA,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI,mBAAmB,WAAW,GAAG;AACnC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,QAAQ;AAC1B,WAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,mBAAmB;AAAA,MAAI,CAAC,EAAE,MAAM,SAAS,MACvC,GAAG,SAAS,UAAU,MAAM,UAAU,MAAM;AAAA,IAC9C;AAAA,EACF;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,sBAAqC,OAAO,WAAW;AAClE,MAAI;AACF,WAAO,MAAM,uBAAuB,MAAM;AAAA,EAC5C,SAAS,KAAK;AACZ,QAAI,KAAK,iCAAiC;AAC1C,QAAI,OAAO,QAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { PatchFunction } from '../../index.js';
|
|
2
|
+
export declare const fetchFiles: (files: string[]) => Promise<{
|
|
3
|
+
file: string;
|
|
4
|
+
contents: string;
|
|
5
|
+
}[]>;
|
|
2
6
|
export declare const hasSkubaDiveRegisterImportRegex: RegExp;
|
|
3
7
|
export declare const hasRelativeRegisterImportRegex: RegExp;
|
|
4
8
|
export declare const hasRelativeImportRegex: RegExp;
|
|
@@ -1,56 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var rewriteSrcImports_exports = {};
|
|
30
|
-
__export(rewriteSrcImports_exports, {
|
|
31
|
-
hasImportRegex: () => hasImportRegex,
|
|
32
|
-
hasJestMockRegex: () => hasJestMockRegex,
|
|
33
|
-
hasRelativeImportRegex: () => hasRelativeImportRegex,
|
|
34
|
-
hasRelativeRegisterImportRegex: () => hasRelativeRegisterImportRegex,
|
|
35
|
-
hasSkubaDiveRegisterImportRegex: () => hasSkubaDiveRegisterImportRegex,
|
|
36
|
-
hasSrcImportRegex: () => hasSrcImportRegex,
|
|
37
|
-
hasSrcSideEffectImportRegex: () => hasSrcSideEffectImportRegex,
|
|
38
|
-
isFileEmpty: () => isFileEmpty,
|
|
39
|
-
replaceSrcImport: () => replaceSrcImport,
|
|
40
|
-
replaceSrcImportWithConditionalRegisterRemoval: () => replaceSrcImportWithConditionalRegisterRemoval,
|
|
41
|
-
replaceSrcImportWithSelectiveRegisterRemoval: () => replaceSrcImportWithSelectiveRegisterRemoval,
|
|
42
|
-
rewriteSrcImports: () => rewriteSrcImports,
|
|
43
|
-
tryRewriteSrcImports: () => tryRewriteSrcImports
|
|
44
|
-
});
|
|
45
|
-
module.exports = __toCommonJS(rewriteSrcImports_exports);
|
|
46
|
-
var import_path = __toESM(require("path"));
|
|
47
|
-
var import_util = require("util");
|
|
48
|
-
var import_fast_glob = require("fast-glob");
|
|
49
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
50
|
-
var import_logging = require("../../../../../../utils/logging.js");
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { inspect } from "util";
|
|
3
|
+
import { glob } from "fast-glob";
|
|
4
|
+
import fs from "fs-extra";
|
|
5
|
+
import { log } from "../../../../../../utils/logging.js";
|
|
51
6
|
const fetchFiles = async (files) => Promise.all(
|
|
52
7
|
files.map(async (file) => {
|
|
53
|
-
const contents = await
|
|
8
|
+
const contents = await fs.promises.readFile(file, "utf8");
|
|
54
9
|
return {
|
|
55
10
|
file,
|
|
56
11
|
contents
|
|
@@ -73,9 +28,9 @@ const removeSelectiveRelativeImports = (contents, file, deletionSet) => contents
|
|
|
73
28
|
if (!relativePath) {
|
|
74
29
|
return match;
|
|
75
30
|
}
|
|
76
|
-
const fileDir =
|
|
77
|
-
const resolvedPath =
|
|
78
|
-
if (
|
|
31
|
+
const fileDir = path.dirname(file);
|
|
32
|
+
const resolvedPath = path.resolve(fileDir, relativePath);
|
|
33
|
+
if (path.extname(relativePath)) {
|
|
79
34
|
return deletionSet.has(resolvedPath) ? "" : match;
|
|
80
35
|
}
|
|
81
36
|
const possiblePaths = [`${resolvedPath}.ts`, `${resolvedPath}.js`];
|
|
@@ -142,7 +97,7 @@ const replaceSrcImportWithSelectiveRegisterRemoval = (contents, file, deletionSe
|
|
|
142
97
|
const tryRewriteSrcImports = async ({
|
|
143
98
|
mode
|
|
144
99
|
}) => {
|
|
145
|
-
const tsFileNames = await
|
|
100
|
+
const tsFileNames = await glob(["**/*.ts", "**/*.test.ts"], {
|
|
146
101
|
ignore: [
|
|
147
102
|
"**/.git",
|
|
148
103
|
"**/node_modules",
|
|
@@ -175,7 +130,7 @@ const tryRewriteSrcImports = async ({
|
|
|
175
130
|
)
|
|
176
131
|
}));
|
|
177
132
|
const filesToDelete = new Set(
|
|
178
|
-
filesWithSkubaDiveRemoved.filter(({ afterSkubaDiveRemoval }) => isFileEmpty(afterSkubaDiveRemoval)).map(({ file }) =>
|
|
133
|
+
filesWithSkubaDiveRemoved.filter(({ afterSkubaDiveRemoval }) => isFileEmpty(afterSkubaDiveRemoval)).map(({ file }) => path.resolve(file))
|
|
179
134
|
);
|
|
180
135
|
const mapped = tsFiles.map(({ file, contents }) => ({
|
|
181
136
|
file,
|
|
@@ -194,11 +149,11 @@ const tryRewriteSrcImports = async ({
|
|
|
194
149
|
await Promise.all(
|
|
195
150
|
mapped.map(async ({ file, before, after }) => {
|
|
196
151
|
if (isFileEmpty(after)) {
|
|
197
|
-
await
|
|
152
|
+
await fs.promises.unlink(file);
|
|
198
153
|
return;
|
|
199
154
|
}
|
|
200
155
|
if (before !== after) {
|
|
201
|
-
await
|
|
156
|
+
await fs.promises.writeFile(file, after);
|
|
202
157
|
}
|
|
203
158
|
})
|
|
204
159
|
);
|
|
@@ -208,13 +163,13 @@ const rewriteSrcImports = async (config) => {
|
|
|
208
163
|
try {
|
|
209
164
|
return await tryRewriteSrcImports(config);
|
|
210
165
|
} catch (err) {
|
|
211
|
-
|
|
212
|
-
|
|
166
|
+
log.warn("Failed to rewrite src imports to #src");
|
|
167
|
+
log.subtle(inspect(err));
|
|
213
168
|
return { result: "skip", reason: "due to an error" };
|
|
214
169
|
}
|
|
215
170
|
};
|
|
216
|
-
|
|
217
|
-
|
|
171
|
+
export {
|
|
172
|
+
fetchFiles,
|
|
218
173
|
hasImportRegex,
|
|
219
174
|
hasJestMockRegex,
|
|
220
175
|
hasRelativeImportRegex,
|
|
@@ -228,5 +183,5 @@ const rewriteSrcImports = async (config) => {
|
|
|
228
183
|
replaceSrcImportWithSelectiveRegisterRemoval,
|
|
229
184
|
rewriteSrcImports,
|
|
230
185
|
tryRewriteSrcImports
|
|
231
|
-
}
|
|
186
|
+
};
|
|
232
187
|
//# sourceMappingURL=rewriteSrcImports.js.map
|