skuba 14.0.0-migrate-to-inquirer-20251031060542 → 14.0.0-replace-global-vars-20251121010036
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 +76 -104
- 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/addTypeModuleToPackageJson.d.ts +6 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js +86 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js.map +7 -0
- 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 +16 -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 +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +76 -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 -5
- 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
package/lib/cli/lint/prettier.js
CHANGED
|
@@ -1,58 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 prettier_exports = {};
|
|
30
|
-
__export(prettier_exports, {
|
|
31
|
-
runPrettierInCurrentThread: () => runPrettierInCurrentThread,
|
|
32
|
-
runPrettierInWorkerThread: () => runPrettierInWorkerThread
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(prettier_exports);
|
|
35
|
-
var import_path = __toESM(require("path"));
|
|
36
|
-
var import_worker_threads = require("worker_threads");
|
|
37
|
-
var import_chalk = __toESM(require("chalk"));
|
|
38
|
-
var import_logging = require("../../utils/logging.js");
|
|
39
|
-
var import_worker = require("../../utils/worker.js");
|
|
40
|
-
var import_prettier = require("../adapter/prettier.js");
|
|
41
|
-
const LOG_PREFIX = import_chalk.default.cyan("Prettier \u2502");
|
|
42
|
-
const runPrettierInCurrentThread = ({ debug }) => (0, import_prettier.runPrettier)("lint", (0, import_logging.createLogger)({ debug, prefixes: [LOG_PREFIX] }));
|
|
43
|
-
const runPrettierInWorkerThread = (input) => (0, import_worker.execWorkerThread)(
|
|
44
|
-
import_path.default.posix.join(__dirname, "prettier.js"),
|
|
1
|
+
import { styleText } from "node:util";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { isMainThread } from "worker_threads";
|
|
4
|
+
import { createLogger } from "../../utils/logging.js";
|
|
5
|
+
import { execWorkerThread, postWorkerOutput } from "../../utils/worker.js";
|
|
6
|
+
import { runPrettier } from "../adapter/prettier.js";
|
|
7
|
+
const LOG_PREFIX = styleText("cyan", "Prettier \u2502");
|
|
8
|
+
const runPrettierInCurrentThread = ({ debug }) => runPrettier("lint", createLogger({ debug, prefixes: [LOG_PREFIX] }));
|
|
9
|
+
const runPrettierInWorkerThread = (input) => execWorkerThread(
|
|
10
|
+
path.posix.join(import.meta.dirname, "prettier.js"),
|
|
45
11
|
input
|
|
46
12
|
);
|
|
47
|
-
if (!
|
|
48
|
-
|
|
13
|
+
if (!isMainThread) {
|
|
14
|
+
postWorkerOutput(
|
|
49
15
|
runPrettierInCurrentThread,
|
|
50
|
-
|
|
16
|
+
createLogger({ debug: false, prefixes: [LOG_PREFIX] })
|
|
51
17
|
);
|
|
52
18
|
}
|
|
53
|
-
|
|
54
|
-
0 && (module.exports = {
|
|
19
|
+
export {
|
|
55
20
|
runPrettierInCurrentThread,
|
|
56
21
|
runPrettierInWorkerThread
|
|
57
|
-
}
|
|
22
|
+
};
|
|
58
23
|
//# sourceMappingURL=prettier.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/prettier.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type PrettierOutput, runPrettier } from '../adapter/prettier.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = styleText('cyan', 'Prettier \u2502');\n\nexport const runPrettierInCurrentThread = ({ debug }: Input) =>\n runPrettier('lint', createLogger({ debug, prefixes: [LOG_PREFIX] }));\n\nexport const runPrettierInWorkerThread = (input: Input) =>\n execWorkerThread<Input, PrettierOutput>(\n path.posix.join(import.meta.dirname, 'prettier.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runPrettierInCurrentThread,\n createLogger({ debug: false, prefixes: [LOG_PREFIX] }),\n );\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAE7B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,wBAAwB;AACnD,SAA8B,mBAAmB;AAIjD,MAAM,aAAa,UAAU,QAAQ,iBAAY;AAE1C,MAAM,6BAA6B,CAAC,EAAE,MAAM,MACjD,YAAY,QAAQ,aAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAE9D,MAAM,4BAA4B,CAAC,UACxC;AAAA,EACE,KAAK,MAAM,KAAK,YAAY,SAAS,aAAa;AAAA,EAClD;AACF;AAEF,IAAI,CAAC,cAAc;AACjB;AAAA,IACE;AAAA,IACA,aAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/tsc.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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 tsc_exports = {};
|
|
20
|
-
__export(tsc_exports, {
|
|
21
|
-
runTscInNewProcess: () => runTscInNewProcess
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(tsc_exports);
|
|
24
|
-
var import_exec = require("../../utils/exec.js");
|
|
1
|
+
import { execConcurrently } from "../../utils/exec.js";
|
|
25
2
|
const runTscInNewProcess = async ({
|
|
26
3
|
debug,
|
|
27
4
|
tscOutputStream
|
|
@@ -32,7 +9,7 @@ const runTscInNewProcess = async ({
|
|
|
32
9
|
"--noEmit"
|
|
33
10
|
].join(" ");
|
|
34
11
|
try {
|
|
35
|
-
await
|
|
12
|
+
await execConcurrently(
|
|
36
13
|
[
|
|
37
14
|
{
|
|
38
15
|
command,
|
|
@@ -51,8 +28,7 @@ const runTscInNewProcess = async ({
|
|
|
51
28
|
return false;
|
|
52
29
|
}
|
|
53
30
|
};
|
|
54
|
-
|
|
55
|
-
0 && (module.exports = {
|
|
31
|
+
export {
|
|
56
32
|
runTscInNewProcess
|
|
57
|
-
}
|
|
33
|
+
};
|
|
58
34
|
//# sourceMappingURL=tsc.js.map
|
package/lib/cli/lint/tsc.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/tsc.ts"],
|
|
4
4
|
"sourcesContent": ["import { execConcurrently } from '../../utils/exec.js';\n\nimport type { Input } from './types.js';\n\nexport const runTscInNewProcess = async ({\n debug,\n tscOutputStream,\n}: Input): Promise<boolean> => {\n const command = [\n 'tsc',\n ...(debug ? ['--extendedDiagnostics'] : []),\n '--noEmit',\n ].join(' ');\n\n try {\n // Misappropriate `concurrently` as a stdio prefixer.\n // We can use our regular console logger once we decide on an approach for\n // compiling in-process, whether by interacting with the TypeScript Compiler\n // API directly or using a higher-level tool like esbuild.\n await execConcurrently(\n [\n {\n command,\n name: 'tsc',\n prefixColor: 'blue',\n },\n ],\n {\n maxProcesses: 1,\n nameLength: 'Prettier'.length,\n outputStream: tscOutputStream,\n },\n );\n\n return true;\n } catch {\n return false;\n }\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,wBAAwB;AAI1B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA+B;AAC7B,QAAM,UAAU;AAAA,IACd;AAAA,IACA,GAAI,QAAQ,CAAC,uBAAuB,IAAI,CAAC;AAAA,IACzC;AAAA,EACF,EAAE,KAAK,GAAG;AAEV,MAAI;AAKF,UAAM;AAAA,MACJ;AAAA,QACE;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA;AAAA,QACE,cAAc;AAAA,QACd,YAAY,WAAW;AAAA,QACvB,cAAc;AAAA,MAChB;AAAA,IACF;AAEA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/types.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
17
1
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/migrate/index.js
CHANGED
|
@@ -1,47 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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 migrate_exports = {};
|
|
20
|
-
__export(migrate_exports, {
|
|
21
|
-
migrate: () => migrate
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(migrate_exports);
|
|
24
|
-
var import_logging = require("../../utils/logging.js");
|
|
25
|
-
var import_nodeVersion = require("./nodeVersion/index.js");
|
|
1
|
+
import { log } from "../../utils/logging.js";
|
|
2
|
+
import { nodeVersionMigration } from "./nodeVersion/index.js";
|
|
26
3
|
const migrations = {
|
|
27
|
-
node20: () =>
|
|
4
|
+
node20: () => nodeVersionMigration({
|
|
28
5
|
nodeVersion: 20,
|
|
29
6
|
ECMAScriptVersion: "ES2023"
|
|
30
7
|
}),
|
|
31
|
-
node22: () =>
|
|
8
|
+
node22: () => nodeVersionMigration({
|
|
32
9
|
nodeVersion: 22,
|
|
33
10
|
ECMAScriptVersion: "ES2024"
|
|
34
11
|
})
|
|
35
12
|
};
|
|
36
13
|
const logAvailableMigrations = () => {
|
|
37
|
-
|
|
14
|
+
log.ok("Available migrations:");
|
|
38
15
|
Object.keys(migrations).forEach((migration) => {
|
|
39
|
-
|
|
16
|
+
log.ok(`- ${migration}`);
|
|
40
17
|
});
|
|
41
18
|
};
|
|
42
19
|
const migrate = async (args = process.argv.slice(2)) => {
|
|
43
20
|
if (!args[0]) {
|
|
44
|
-
|
|
21
|
+
log.err("Provide a migration to run.");
|
|
45
22
|
logAvailableMigrations();
|
|
46
23
|
process.exitCode = 1;
|
|
47
24
|
return;
|
|
@@ -52,15 +29,14 @@ const migrate = async (args = process.argv.slice(2)) => {
|
|
|
52
29
|
}
|
|
53
30
|
const migration = migrations[args[0]];
|
|
54
31
|
if (!migration) {
|
|
55
|
-
|
|
32
|
+
log.err(`Migration "${args[0]}" is not a valid option.`);
|
|
56
33
|
logAvailableMigrations();
|
|
57
34
|
process.exitCode = 1;
|
|
58
35
|
return;
|
|
59
36
|
}
|
|
60
37
|
await migration();
|
|
61
38
|
};
|
|
62
|
-
|
|
63
|
-
0 && (module.exports = {
|
|
39
|
+
export {
|
|
64
40
|
migrate
|
|
65
|
-
}
|
|
41
|
+
};
|
|
66
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/migrate/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { log } from '../../utils/logging.js';\n\nimport { nodeVersionMigration } from './nodeVersion/index.js';\n\nconst migrations: Record<string, () => Promise<void>> = {\n node20: () =>\n nodeVersionMigration({\n nodeVersion: 20,\n ECMAScriptVersion: 'ES2023',\n }),\n node22: () =>\n nodeVersionMigration({\n nodeVersion: 22,\n ECMAScriptVersion: 'ES2024',\n }),\n};\n\nconst logAvailableMigrations = () => {\n log.ok('Available migrations:');\n Object.keys(migrations).forEach((migration) => {\n log.ok(`- ${migration}`);\n });\n};\n\nexport const migrate = async (args = process.argv.slice(2)) => {\n if (!args[0]) {\n log.err('Provide a migration to run.');\n logAvailableMigrations();\n process.exitCode = 1;\n return;\n }\n\n if (args.includes('--help') || args.includes('-h') || args[0] === 'help') {\n logAvailableMigrations();\n return;\n }\n\n const migration = migrations[args[0]];\n\n if (!migration) {\n log.err(`Migration \"${args[0]}\" is not a valid option.`);\n logAvailableMigrations();\n process.exitCode = 1;\n return;\n }\n\n await migration();\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAEpB,SAAS,4BAA4B;AAErC,MAAM,aAAkD;AAAA,EACtD,QAAQ,MACN,qBAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,EACrB,CAAC;AAAA,EACH,QAAQ,MACN,qBAAqB;AAAA,IACnB,aAAa;AAAA,IACb,mBAAmB;AAAA,EACrB,CAAC;AACL;AAEA,MAAM,yBAAyB,MAAM;AACnC,MAAI,GAAG,uBAAuB;AAC9B,SAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,cAAc;AAC7C,QAAI,GAAG,KAAK,SAAS,EAAE;AAAA,EACzB,CAAC;AACH;AAEO,MAAM,UAAU,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAC7D,MAAI,CAAC,KAAK,CAAC,GAAG;AACZ,QAAI,IAAI,6BAA6B;AACrC,2BAAuB;AACvB,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,MAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC,MAAM,QAAQ;AACxE,2BAAuB;AACvB;AAAA,EACF;AAEA,QAAM,YAAY,WAAW,KAAK,CAAC,CAAC;AAEpC,MAAI,CAAC,WAAW;AACd,QAAI,IAAI,cAAc,KAAK,CAAC,CAAC,0BAA0B;AACvD,2BAAuB;AACvB,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,UAAU;AAClB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,51 +1,15 @@
|
|
|
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 checks_exports = {};
|
|
30
|
-
__export(checks_exports, {
|
|
31
|
-
extractFromParentPackageJson: () => extractFromParentPackageJson,
|
|
32
|
-
isPatchableNodeVersion: () => isPatchableNodeVersion,
|
|
33
|
-
isPatchableServerlessVersion: () => isPatchableServerlessVersion,
|
|
34
|
-
isPatchableSkubaType: () => isPatchableSkubaType
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(checks_exports);
|
|
37
|
-
var import_find_up = __toESM(require("find-up"));
|
|
38
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
39
|
-
var import_semver = require("semver");
|
|
40
|
-
var z = __toESM(require("zod/v4"));
|
|
41
|
-
var import_logging = require("../../../utils/logging.js");
|
|
1
|
+
import findUp from "find-up";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { coerce, lte, satisfies } from "semver";
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { log } from "../../../utils/logging.js";
|
|
42
6
|
const getParentFile = async (file, cwd = process.cwd()) => {
|
|
43
|
-
const path = await (
|
|
7
|
+
const path = await findUp(file, { cwd });
|
|
44
8
|
if (!path) {
|
|
45
9
|
return void 0;
|
|
46
10
|
}
|
|
47
11
|
return {
|
|
48
|
-
fileContent: await
|
|
12
|
+
fileContent: await fs.readFile(path, "utf-8"),
|
|
49
13
|
path
|
|
50
14
|
};
|
|
51
15
|
};
|
|
@@ -77,23 +41,23 @@ const isPatchableServerlessVersion = async (currentPath) => {
|
|
|
77
41
|
currentPath
|
|
78
42
|
);
|
|
79
43
|
if (!packageJson) {
|
|
80
|
-
|
|
44
|
+
log.warn("package.json not found, ensure it is in the correct location");
|
|
81
45
|
return false;
|
|
82
46
|
}
|
|
83
47
|
const serverlessVersion = packageJson?.devDependencies.serverless;
|
|
84
48
|
if (!serverlessVersion) {
|
|
85
|
-
|
|
49
|
+
log.subtle(
|
|
86
50
|
`Serverless version not found in ${packageJsonRelativePath}, assuming it is not a dependency`
|
|
87
51
|
);
|
|
88
52
|
return true;
|
|
89
53
|
}
|
|
90
|
-
if (!
|
|
91
|
-
|
|
54
|
+
if (!satisfies(serverlessVersion, "4.x.x")) {
|
|
55
|
+
log.warn(
|
|
92
56
|
`Serverless version ${serverlessVersion} cannot be migrated; use Serverless 4.x to automatically migrate Serverless files`
|
|
93
57
|
);
|
|
94
58
|
return false;
|
|
95
59
|
}
|
|
96
|
-
|
|
60
|
+
log.ok(
|
|
97
61
|
`Proceeding with migration of Serverless version ${serverlessVersion}`
|
|
98
62
|
);
|
|
99
63
|
return true;
|
|
@@ -109,29 +73,29 @@ const isPatchableSkubaType = async (currentPath) => {
|
|
|
109
73
|
currentPath
|
|
110
74
|
);
|
|
111
75
|
if (!packageJson) {
|
|
112
|
-
|
|
76
|
+
log.warn("package.json not found, ensure it is in the correct location");
|
|
113
77
|
return false;
|
|
114
78
|
}
|
|
115
79
|
if (packageJson.files) {
|
|
116
|
-
|
|
80
|
+
log.warn(
|
|
117
81
|
"Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
|
|
118
82
|
);
|
|
119
83
|
return false;
|
|
120
84
|
}
|
|
121
85
|
const type = packageJson?.skuba?.type;
|
|
122
86
|
if (!type) {
|
|
123
|
-
|
|
87
|
+
log.warn(
|
|
124
88
|
`skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`
|
|
125
89
|
);
|
|
126
90
|
return false;
|
|
127
91
|
}
|
|
128
92
|
if (type === "package") {
|
|
129
|
-
|
|
93
|
+
log.warn(
|
|
130
94
|
"Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
|
|
131
95
|
);
|
|
132
96
|
return false;
|
|
133
97
|
}
|
|
134
|
-
|
|
98
|
+
log.ok(`Proceeding with migration of skuba project type ${type}`);
|
|
135
99
|
return true;
|
|
136
100
|
};
|
|
137
101
|
const isPatchableNodeVersion = async (targetNodeVersion, currentPath) => {
|
|
@@ -149,25 +113,24 @@ const isPatchableNodeVersion = async (targetNodeVersion, currentPath) => {
|
|
|
149
113
|
const nodeVersion = nodeVersionFile?.fileContent;
|
|
150
114
|
const engineVersion = packageJson?.engines.node;
|
|
151
115
|
const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;
|
|
152
|
-
const coercedTargetVersion =
|
|
153
|
-
const coercedCurrentVersion =
|
|
154
|
-
const isNodeVersionValid = coercedTargetVersion && coercedCurrentVersion &&
|
|
116
|
+
const coercedTargetVersion = coerce(targetNodeVersion.toString())?.version;
|
|
117
|
+
const coercedCurrentVersion = coerce(currentNodeVersion)?.version;
|
|
118
|
+
const isNodeVersionValid = coercedTargetVersion && coercedCurrentVersion && lte(coercedCurrentVersion, coercedTargetVersion);
|
|
155
119
|
if (!isNodeVersionValid) {
|
|
156
|
-
|
|
120
|
+
log.warn(
|
|
157
121
|
`Node.js version ${coercedCurrentVersion ?? "unknown"} cannot be migrated to ${coercedTargetVersion}`
|
|
158
122
|
);
|
|
159
123
|
return false;
|
|
160
124
|
}
|
|
161
|
-
|
|
125
|
+
log.ok(
|
|
162
126
|
`Proceeding with migration from Node.js ${coercedCurrentVersion} to ${coercedTargetVersion}`
|
|
163
127
|
);
|
|
164
128
|
return true;
|
|
165
129
|
};
|
|
166
|
-
|
|
167
|
-
0 && (module.exports = {
|
|
130
|
+
export {
|
|
168
131
|
extractFromParentPackageJson,
|
|
169
132
|
isPatchableNodeVersion,
|
|
170
133
|
isPatchableServerlessVersion,
|
|
171
134
|
isPatchableSkubaType
|
|
172
|
-
}
|
|
135
|
+
};
|
|
173
136
|
//# sourceMappingURL=checks.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/migrate/nodeVersion/checks.ts"],
|
|
4
4
|
"sourcesContent": ["import findUp from 'find-up';\nimport fs from 'fs-extra';\nimport { coerce, lte, satisfies } from 'semver';\nimport * as z from 'zod/v4';\n\nimport { log } from '../../../utils/logging.js';\n\nconst getParentFile = async (file: string, cwd: string = process.cwd()) => {\n const path = await findUp(file, { cwd });\n if (!path) {\n return undefined;\n }\n return {\n fileContent: await fs.readFile(path, 'utf-8'),\n path,\n };\n};\n\nexport const extractFromParentPackageJson = async <T extends z.ZodRawShape>(\n schema: z.ZodObject<T>,\n currentPath: string,\n) => {\n const file = await getParentFile('package.json', currentPath);\n if (!file) {\n return { packageJson: undefined, packageJsonRelativePath: undefined };\n }\n const { fileContent: packageJson, path } = file;\n let rawJSON;\n try {\n rawJSON = JSON.parse(packageJson) as unknown;\n } catch {\n throw new Error(`${path} is not valid JSON`);\n }\n const result = schema.safeParse(rawJSON);\n if (!result.success) {\n return { packageJson: undefined, packageJsonRelativePath: path };\n }\n\n return { packageJson: result.data, packageJsonRelativePath: path };\n};\n\nexport const isPatchableServerlessVersion = async (\n currentPath: string,\n): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n devDependencies: z.object({\n serverless: z.string().optional(),\n }),\n }),\n currentPath,\n );\n if (!packageJson) {\n log.warn('package.json not found, ensure it is in the correct location');\n return false;\n }\n\n const serverlessVersion = packageJson?.devDependencies.serverless;\n\n if (!serverlessVersion) {\n log.subtle(\n `Serverless version not found in ${packageJsonRelativePath}, assuming it is not a dependency`,\n );\n return true;\n }\n\n if (!satisfies(serverlessVersion, '4.x.x')) {\n log.warn(\n `Serverless version ${serverlessVersion} cannot be migrated; use Serverless 4.x to automatically migrate Serverless files`,\n );\n return false;\n }\n\n log.ok(\n `Proceeding with migration of Serverless version ${serverlessVersion}`,\n );\n return true;\n};\n\nexport const isPatchableSkubaType = async (\n currentPath: string,\n): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n skuba: z\n .object({\n type: z.string().optional(),\n })\n .optional(),\n files: z.string().array().optional(),\n }),\n currentPath,\n );\n\n if (!packageJson) {\n log.warn('package.json not found, ensure it is in the correct location');\n return false;\n }\n\n if (packageJson.files) {\n log.warn(\n 'Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended',\n );\n return false;\n }\n\n const type = packageJson?.skuba?.type;\n\n if (!type) {\n log.warn(\n `skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`,\n );\n return false;\n }\n if (type === 'package') {\n log.warn(\n 'Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended',\n );\n return false;\n }\n\n log.ok(`Proceeding with migration of skuba project type ${type}`);\n return true;\n};\n\nexport const isPatchableNodeVersion = async (\n targetNodeVersion: number,\n currentPath: string,\n): Promise<boolean> => {\n const nvmrcFile = await getParentFile('.nvmrc');\n const nodeVersionFile = await getParentFile('.node-version');\n const { packageJson } = await extractFromParentPackageJson(\n z.object({\n engines: z.object({\n node: z.string(),\n }),\n }),\n currentPath,\n );\n\n const nvmrcNodeVersion = nvmrcFile?.fileContent;\n const nodeVersion = nodeVersionFile?.fileContent;\n const engineVersion = packageJson?.engines.node;\n\n const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;\n\n const coercedTargetVersion = coerce(targetNodeVersion.toString())?.version;\n const coercedCurrentVersion = coerce(currentNodeVersion)?.version;\n\n const isNodeVersionValid =\n coercedTargetVersion &&\n coercedCurrentVersion &&\n lte(coercedCurrentVersion, coercedTargetVersion);\n\n if (!isNodeVersionValid) {\n log.warn(\n `Node.js version ${coercedCurrentVersion ?? 'unknown'} cannot be migrated to ${coercedTargetVersion}`,\n );\n return false;\n }\n\n log.ok(\n `Proceeding with migration from Node.js ${coercedCurrentVersion} to ${coercedTargetVersion}`,\n );\n return true;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,OAAO,QAAQ;AACf,SAAS,QAAQ,KAAK,iBAAiB;AACvC,YAAY,OAAO;AAEnB,SAAS,WAAW;AAEpB,MAAM,gBAAgB,OAAO,MAAc,MAAc,QAAQ,IAAI,MAAM;AACzE,QAAM,OAAO,MAAM,OAAO,MAAM,EAAE,IAAI,CAAC;AACvC,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,aAAa,MAAM,GAAG,SAAS,MAAM,OAAO;AAAA,IAC5C;AAAA,EACF;AAC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AAAA,MACF,mBAAmB,yBAAyB,SAAS,0BAA0B,oBAAoB;AAAA,IACrG;AACA,WAAO;AAAA,EACT;AAEA,MAAI;AAAA,IACF,0CAA0C,qBAAqB,OAAO,oBAAoB;AAAA,EAC5F;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,42 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 nodeVersion_exports = {};
|
|
30
|
-
__export(nodeVersion_exports, {
|
|
31
|
-
nodeVersionMigration: () => nodeVersionMigration
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(nodeVersion_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");
|
|
38
|
-
var import_project = require("../../configure/analysis/project.js");
|
|
39
|
-
var import_checks = require("./checks.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";
|
|
5
|
+
import { createDestinationFileReader } from "../../configure/analysis/project.js";
|
|
6
|
+
import {
|
|
7
|
+
isPatchableNodeVersion,
|
|
8
|
+
isPatchableServerlessVersion,
|
|
9
|
+
isPatchableSkubaType
|
|
10
|
+
} from "./checks.js";
|
|
40
11
|
const subPatches = ({
|
|
41
12
|
nodeVersion,
|
|
42
13
|
ECMAScriptVersion
|
|
@@ -56,13 +27,13 @@ const subPatches = ({
|
|
|
56
27
|
{
|
|
57
28
|
files: "**/serverless*.y*ml",
|
|
58
29
|
regex: () => /\bnodejs\d+.x\b/gm,
|
|
59
|
-
tests: [
|
|
30
|
+
tests: [isPatchableServerlessVersion],
|
|
60
31
|
replace: `nodejs${nodeVersion}.x`
|
|
61
32
|
},
|
|
62
33
|
{
|
|
63
34
|
files: "**/serverless*.y*ml",
|
|
64
35
|
regex: () => /\bnode\d+\b/gm,
|
|
65
|
-
tests: [
|
|
36
|
+
tests: [isPatchableServerlessVersion],
|
|
66
37
|
replace: `node${nodeVersion}`
|
|
67
38
|
},
|
|
68
39
|
{
|
|
@@ -88,19 +59,19 @@ const subPatches = ({
|
|
|
88
59
|
{
|
|
89
60
|
files: "**/package.json",
|
|
90
61
|
regex: () => /(["']engines["']:\s*{[\s\S]*?["']node["']:\s*["']>=)(\d+(?:\.\d+)*)(['"]\s*})/gm,
|
|
91
|
-
tests: [
|
|
62
|
+
tests: [isPatchableServerlessVersion, isPatchableSkubaType],
|
|
92
63
|
replace: `$1${nodeVersion}$3`
|
|
93
64
|
},
|
|
94
65
|
{
|
|
95
66
|
files: "**/tsconfig*.json",
|
|
96
67
|
regex: () => /("target":\s*")(ES\d+)"/gim,
|
|
97
|
-
tests: [
|
|
68
|
+
tests: [isPatchableServerlessVersion, isPatchableSkubaType],
|
|
98
69
|
replace: `$1${ECMAScriptVersion}"`
|
|
99
70
|
},
|
|
100
71
|
{
|
|
101
72
|
files: "**/tsconfig*.json",
|
|
102
73
|
regex: () => /("lib":\s*\[)([\S\s]*?)(ES\d+)([\S\s]*?)(\])/gim,
|
|
103
|
-
tests: [
|
|
74
|
+
tests: [isPatchableServerlessVersion, isPatchableSkubaType],
|
|
104
75
|
replace: `$1$2${ECMAScriptVersion}$4$5`
|
|
105
76
|
},
|
|
106
77
|
{
|
|
@@ -110,8 +81,8 @@ const subPatches = ({
|
|
|
110
81
|
}
|
|
111
82
|
];
|
|
112
83
|
const runSubPatch = async (dir, patch) => {
|
|
113
|
-
const readFile =
|
|
114
|
-
const paths = patch.file ? [patch.file] : await
|
|
84
|
+
const readFile = createDestinationFileReader(dir);
|
|
85
|
+
const paths = patch.file ? [patch.file] : await glob(patch.files ?? [], {
|
|
115
86
|
cwd: dir,
|
|
116
87
|
ignore: ["**/node_modules/**"]
|
|
117
88
|
});
|
|
@@ -146,7 +117,7 @@ const writePatchedContents = async ({
|
|
|
146
117
|
contents,
|
|
147
118
|
templated,
|
|
148
119
|
regex
|
|
149
|
-
}) => await
|
|
120
|
+
}) => await fs.promises.writeFile(
|
|
150
121
|
path,
|
|
151
122
|
regex ? contents.replaceAll(regex(), templated) : templated
|
|
152
123
|
);
|
|
@@ -159,21 +130,20 @@ const nodeVersionMigration = async ({
|
|
|
159
130
|
nodeVersion,
|
|
160
131
|
ECMAScriptVersion
|
|
161
132
|
}, dir = process.cwd()) => {
|
|
162
|
-
|
|
133
|
+
log.ok(`Upgrading to Node.js ${nodeVersion}`);
|
|
163
134
|
try {
|
|
164
|
-
if (!await
|
|
135
|
+
if (!await isPatchableNodeVersion(nodeVersion, dir)) {
|
|
165
136
|
throw new Error("Node.js version is not patchable");
|
|
166
137
|
}
|
|
167
138
|
await upgrade({ nodeVersion, ECMAScriptVersion }, dir);
|
|
168
|
-
|
|
139
|
+
log.ok("Upgraded to Node.js", nodeVersion);
|
|
169
140
|
} catch (error) {
|
|
170
|
-
|
|
171
|
-
|
|
141
|
+
log.err("Failed to upgrade");
|
|
142
|
+
log.subtle(inspect(error));
|
|
172
143
|
process.exitCode = 1;
|
|
173
144
|
}
|
|
174
145
|
};
|
|
175
|
-
|
|
176
|
-
0 && (module.exports = {
|
|
146
|
+
export {
|
|
177
147
|
nodeVersionMigration
|
|
178
|
-
}
|
|
148
|
+
};
|
|
179
149
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/migrate/nodeVersion/index.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 { createDestinationFileReader } from '../../configure/analysis/project.js';\n\nimport {\n isPatchableNodeVersion,\n isPatchableServerlessVersion,\n isPatchableSkubaType,\n} from './checks.js';\n\ntype FileSelector =\n | { files: string; file?: never }\n | { file: string; files?: never };\n\ntype SubPatch = FileSelector & {\n tests?: Array<(path: string) => Promise<boolean>>;\n regex?: () => RegExp;\n replace: string;\n};\n\nconst subPatches = ({\n nodeVersion,\n ECMAScriptVersion,\n}: Versions): SubPatch[] => [\n { file: '.nvmrc', replace: `${nodeVersion}\\n` },\n {\n files: '**/Dockerfile*',\n\n regex: () =>\n /^FROM(.*) (public.ecr.aws\\/docker\\/library\\/)?node:([0-9]+(?:\\.[0-9]+(?:\\.[0-9]+)?)?)(-[a-z0-9]+)?(@sha256:[a-f0-9]{64})?( .*)?$/gm,\n replace: `FROM$1 $2node:${nodeVersion}$4$6`,\n },\n {\n files: '**/Dockerfile*',\n regex: () =>\n /^FROM(.*) gcr.io\\/distroless\\/nodejs\\d+-debian(\\d+)(@sha256:[a-f0-9]{64})?(\\.[^- \\n]+)?(-[^ \\n]+)?( .+|)$/gm,\n replace: `FROM$1 gcr.io/distroless/nodejs${nodeVersion}-debian$2$4$5$6`,\n },\n\n {\n files: '**/serverless*.y*ml',\n regex: () => /\\bnodejs\\d+.x\\b/gm,\n tests: [isPatchableServerlessVersion],\n replace: `nodejs${nodeVersion}.x`,\n },\n {\n files: '**/serverless*.y*ml',\n regex: () => /\\bnode\\d+\\b/gm,\n tests: [isPatchableServerlessVersion],\n replace: `node${nodeVersion}`,\n },\n\n {\n files: '**/infra/**/*.ts',\n regex: () => /NODEJS_\\d+_X/g,\n replace: `NODEJS_${nodeVersion}_X`,\n },\n {\n files: '**/infra/**/*.ts',\n regex: () => /(target:\\s*'node)(\\d+)(.+)$/gm,\n replace: `$1${nodeVersion}$3`,\n },\n\n {\n files: '**/.buildkite/*',\n regex: () =>\n /(image: )(public.ecr.aws\\/docker\\/library\\/)?(node:)[0-9.]+(\\.[^- \\n]+)?(-[^ \\n]+)?$/gm,\n replace: `$1$2$3${nodeVersion}$5`,\n },\n {\n files: '.node-version*',\n regex: () => /(\\d+(?:\\.\\d+)*)/g,\n replace: `${nodeVersion}`,\n },\n\n {\n files: '**/package.json',\n regex: () =>\n /([\"']engines[\"']:\\s*{[\\s\\S]*?[\"']node[\"']:\\s*[\"']>=)(\\d+(?:\\.\\d+)*)(['\"]\\s*})/gm,\n tests: [isPatchableServerlessVersion, isPatchableSkubaType],\n replace: `$1${nodeVersion}$3`,\n },\n\n {\n files: '**/tsconfig*.json',\n regex: () => /(\"target\":\\s*\")(ES\\d+)\"/gim,\n tests: [isPatchableServerlessVersion, isPatchableSkubaType],\n replace: `$1${ECMAScriptVersion}\"`,\n },\n {\n files: '**/tsconfig*.json',\n regex: () => /(\"lib\":\\s*\\[)([\\S\\s]*?)(ES\\d+)([\\S\\s]*?)(\\])/gim,\n tests: [isPatchableServerlessVersion, isPatchableSkubaType],\n replace: `$1$2${ECMAScriptVersion}$4$5`,\n },\n\n {\n files: '**/docker-compose*.y*ml',\n regex: () =>\n /(image: )(public.ecr.aws\\/docker\\/library\\/)?(node:)[0-9.]+(\\.[^- \\n]+)?(-[^ \\n]+)?$/gm,\n\n replace: `$1$2$3${nodeVersion}$5`,\n },\n];\n\ntype Versions = {\n nodeVersion: number;\n ECMAScriptVersion: string;\n};\n\nconst runSubPatch = async (dir: string, patch: SubPatch) => {\n const readFile = createDestinationFileReader(dir);\n const paths = patch.file\n ? [patch.file]\n : await glob(patch.files ?? [], {\n cwd: dir,\n ignore: ['**/node_modules/**'],\n });\n\n await Promise.all(\n paths.map(async (path) => {\n const contents = await readFile(path);\n if (!contents) {\n return;\n }\n\n if (patch.regex && !patch.regex().test(contents)) {\n return;\n }\n\n if (patch.tests) {\n const results = await Promise.all(\n patch.tests.map((test) => test(path)),\n );\n if (!results.every(Boolean)) {\n return;\n }\n }\n\n await writePatchedContents({\n path,\n contents,\n templated: patch.replace,\n regex: patch.regex,\n });\n }),\n );\n};\n\nconst writePatchedContents = async ({\n path,\n contents,\n templated,\n regex,\n}: {\n path: string;\n contents: string;\n templated: string;\n regex?: () => RegExp;\n}) =>\n await fs.promises.writeFile(\n path,\n regex ? contents.replaceAll(regex(), templated) : templated,\n );\n\nconst upgrade = async (versions: Versions, dir: string) => {\n for (const subPatch of subPatches(versions)) {\n await runSubPatch(dir, subPatch);\n }\n};\n\nexport const nodeVersionMigration = async (\n {\n nodeVersion,\n ECMAScriptVersion,\n }: {\n nodeVersion: number;\n ECMAScriptVersion: string;\n },\n dir = process.cwd(),\n) => {\n log.ok(`Upgrading to Node.js ${nodeVersion}`);\n try {\n if (!(await isPatchableNodeVersion(nodeVersion, dir))) {\n throw new Error('Node.js version is not patchable');\n }\n\n await upgrade({ nodeVersion, ECMAScriptVersion }, dir);\n\n log.ok('Upgraded to Node.js', nodeVersion);\n } catch (error) {\n log.err('Failed to upgrade');\n log.subtle(inspect(error));\n process.exitC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