skuba 14.0.0-replace-global-vars-20251121010036 → 14.0.0-test-private-templates-20260103062459
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/jest.js +1 -0
- package/config/prettier.d.ts +4 -8
- package/config/prettier.js +2 -10
- package/jest/moduleNameMapper.js +64 -0
- package/jest/transform.js +62 -0
- package/jest/tsConfig.js +26 -0
- package/jest-preset.js +37 -0
- package/lib/api/jest/index.d.ts +15 -0
- package/lib/api/jest/index.js +59 -0
- package/lib/api/jest/index.js.map +7 -0
- package/lib/cli/adapter/eslint.js +45 -11
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/adapter/prettier.js +67 -39
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/args.js +42 -8
- package/lib/cli/build/args.js.map +2 -2
- package/lib/cli/build/assets.js +60 -28
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/build/esbuild.js +45 -21
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +45 -21
- package/lib/cli/build/index.js.map +1 -1
- package/lib/cli/build/tsc.js +59 -22
- package/lib/cli/build/tsc.js.map +2 -2
- package/lib/cli/buildPackage/index.js +32 -8
- package/lib/cli/buildPackage/index.js.map +1 -1
- package/lib/cli/configure/analyseConfiguration.js +50 -16
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.d.ts +1 -1
- package/lib/cli/configure/analyseDependencies.js +59 -25
- package/lib/cli/configure/analyseDependencies.js.map +3 -3
- package/lib/cli/configure/analysis/diff.js +29 -5
- package/lib/cli/configure/analysis/diff.js.map +1 -1
- package/lib/cli/configure/analysis/files.js +42 -8
- package/lib/cli/configure/analysis/files.js.map +2 -2
- package/lib/cli/configure/analysis/git.js +46 -12
- package/lib/cli/configure/analysis/git.js.map +2 -2
- package/lib/cli/configure/analysis/package.d.ts +3 -2
- package/lib/cli/configure/analysis/package.js +45 -10
- package/lib/cli/configure/analysis/package.js.map +3 -3
- package/lib/cli/configure/analysis/project.js +50 -18
- package/lib/cli/configure/analysis/project.js.map +2 -2
- package/lib/cli/configure/dependencies/index.js +35 -7
- package/lib/cli/configure/dependencies/index.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +28 -4
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js +28 -4
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js +28 -4
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +26 -2
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js +29 -4
- 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 +61 -33
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.d.ts +1 -1
- package/lib/cli/configure/getEntryPoint.js +48 -14
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +35 -14
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +84 -50
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/configure/modules/eslint.js +34 -10
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/ignore.js +32 -8
- package/lib/cli/configure/modules/ignore.js.map +1 -1
- package/lib/cli/configure/modules/index.js +44 -18
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/jest.d.ts +2 -0
- package/lib/cli/configure/modules/jest.js +86 -0
- package/lib/cli/configure/modules/jest.js.map +7 -0
- package/lib/cli/configure/modules/nodemon.js +28 -4
- package/lib/cli/configure/modules/nodemon.js.map +1 -1
- package/lib/cli/configure/modules/package.js +34 -10
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +35 -11
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +40 -17
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/serverless.js +26 -2
- package/lib/cli/configure/modules/serverless.js.map +1 -1
- package/lib/cli/configure/modules/tslint.js +28 -4
- package/lib/cli/configure/modules/tslint.js.map +1 -1
- package/lib/cli/configure/processing/configFile.js +39 -3
- package/lib/cli/configure/processing/configFile.js.map +1 -1
- package/lib/cli/configure/processing/deleteFiles.js +26 -2
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +27 -2
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +31 -6
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +26 -2
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +28 -4
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.d.ts +67 -1
- package/lib/cli/configure/processing/package.js +45 -8
- package/lib/cli/configure/processing/package.js.map +3 -3
- package/lib/cli/configure/processing/prettier.js +38 -4
- package/lib/cli/configure/processing/prettier.js.map +2 -2
- package/lib/cli/configure/processing/record.js +41 -5
- package/lib/cli/configure/processing/record.js.map +2 -2
- package/lib/cli/configure/processing/typescript.js +63 -26
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/types.d.ts +4 -15
- package/lib/cli/configure/types.js +16 -0
- package/lib/cli/configure/types.js.map +3 -3
- package/lib/cli/format/index.js +44 -20
- package/lib/cli/format/index.js.map +1 -1
- package/lib/cli/help/index.js +30 -6
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.d.ts +1 -1
- package/lib/cli/init/getConfig.js +111 -76
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.d.ts +1 -0
- package/lib/cli/init/git.js +88 -16
- package/lib/cli/init/git.js.map +3 -3
- package/lib/cli/init/index.js +98 -67
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +6 -5
- package/lib/cli/init/prompts.js +54 -27
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.js +41 -7
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +30 -2
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +42 -8
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +45 -11
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +26 -2
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +45 -11
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +26 -2
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +26 -2
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +28 -4
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/index.js +30 -6
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.js +73 -37
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/eslint.js +51 -16
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/external.js +51 -19
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.js +49 -25
- package/lib/cli/lint/index.js.map +1 -1
- package/lib/cli/lint/internal.js +42 -18
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +45 -11
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +63 -32
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
- package/lib/cli/lint/internalLints/upgrade/index.js +53 -22
- package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
- 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 +45 -11
- 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 +30 -6
- 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 +65 -34
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
- 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 +28 -4
- 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 +59 -23
- 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 +28 -4
- 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 +46 -11
- 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 +30 -6
- 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 +46 -11
- 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 +46 -11
- 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 +28 -4
- 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 +46 -11
- 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 +67 -29
- 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 +34 -10
- 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 +45 -11
- 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 +0 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -18
- 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 +50 -15
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +133 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
- 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 +34 -10
- 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 +44 -10
- 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 +46 -12
- 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 +28 -4
- 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 +49 -15
- 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 +45 -11
- 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 +34 -10
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
- 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 +45 -11
- 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 +47 -13
- 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 +28 -4
- 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 +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
- package/lib/cli/lint/prettier.js +50 -15
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/lint/tsc.js +28 -4
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/lint/types.js +16 -0
- package/lib/cli/lint/types.js.map +3 -3
- package/lib/cli/migrate/index.d.ts +5 -0
- package/lib/cli/migrate/index.js +79 -15
- package/lib/cli/migrate/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
- package/lib/cli/migrate/nodeVersion/checks.js +51 -120
- package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
- package/lib/cli/migrate/nodeVersion/index.js +239 -65
- package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
- package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
- package/lib/cli/node/index.js +57 -20
- package/lib/cli/node/index.js.map +3 -3
- package/lib/cli/release/index.js +28 -4
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +50 -16
- package/lib/cli/start/index.js.map +3 -3
- package/lib/cli/test/index.js +44 -4
- package/lib/cli/test/index.js.map +2 -2
- package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
- package/lib/cli/test/reporters/github/annotations.js +102 -0
- package/lib/cli/test/reporters/github/annotations.js.map +7 -0
- package/lib/cli/test/reporters/github/index.d.ts +5 -0
- package/lib/cli/test/reporters/github/index.js +74 -0
- package/lib/cli/test/reporters/github/index.js.map +7 -0
- package/lib/cli/version/index.js +30 -6
- package/lib/cli/version/index.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +46 -6
- package/lib/index.js.map +2 -2
- package/lib/skuba.js +45 -26
- package/lib/skuba.js.map +3 -3
- package/lib/utils/args.js +43 -6
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/command.js +42 -4
- package/lib/utils/command.js.map +3 -3
- package/lib/utils/copy.js +57 -20
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.js +72 -32
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/env.js +26 -2
- package/lib/utils/env.js.map +1 -1
- package/lib/utils/error.js +47 -10
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.js +61 -23
- package/lib/utils/exec.js.map +3 -3
- package/lib/utils/fs.js +40 -6
- package/lib/utils/fs.js.map +2 -2
- package/lib/utils/help.js +30 -6
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/logging.js +38 -11
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/logo.js +48 -24
- package/lib/utils/logo.js.map +1 -1
- package/lib/utils/manifest.d.ts +2 -3
- package/lib/utils/manifest.js +48 -8
- package/lib/utils/manifest.js.map +3 -3
- package/lib/utils/npmrc.js +26 -2
- package/lib/utils/npmrc.js.map +1 -1
- package/lib/utils/packageManager.js +49 -12
- package/lib/utils/packageManager.js.map +2 -2
- package/lib/utils/port.js +39 -4
- package/lib/utils/port.js.map +2 -2
- package/lib/utils/sleep.js +26 -2
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/template.d.ts +1 -1
- package/lib/utils/template.js +60 -19
- package/lib/utils/template.js.map +3 -3
- package/lib/utils/validation.js +31 -2
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +46 -9
- package/lib/utils/version.js.map +2 -2
- package/lib/utils/wait.js +32 -7
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.js +35 -10
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/function-arguments.d.js +1 -0
- package/lib/wrapper/functionHandler.js +49 -18
- package/lib/wrapper/functionHandler.js.map +2 -2
- package/lib/wrapper/http.js +43 -8
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js +7 -6
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +42 -8
- package/lib/wrapper/main.js.map +3 -3
- package/lib/wrapper/requestListener.js +47 -13
- package/lib/wrapper/requestListener.js.map +2 -2
- package/lib/wrapper/server.js +28 -4
- package/lib/wrapper/server.js.map +1 -1
- package/package.json +42 -43
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +4 -3
- package/template/base/jest.config.ts +19 -0
- package/template/base/jest.setup.ts +3 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/package.json +8 -9
- package/template/express-rest-api/skuba.template.js +1 -1
- package/template/express-rest-api/src/app.test.ts +0 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/package.json +4 -5
- package/template/greeter/skuba.template.js +1 -1
- package/template/greeter/src/app.test.ts +1 -3
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/package.json +9 -11
- package/template/koa-rest-api/skuba.template.js +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
- package/template/koa-rest-api/src/app.test.ts +0 -2
- package/template/koa-rest-api/src/framework/server.test.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
- package/template/koa-rest-api/src/testing/metrics.ts +0 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -19
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
- package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
- package/template/lambda-sqs-worker-cdk/package.json +9 -9
- package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
- package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
- package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
- package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
- package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
- package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
- package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
- package/template/oss-npm-package/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/_package.json +0 -1
- package/template/oss-npm-package/skuba.template.js +1 -1
- package/template/oss-npm-package/src/index.test.ts +0 -2
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +1 -2
- package/template/private-npm-package/skuba.template.js +2 -2
- package/template/private-npm-package/src/index.test.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.d.ts +0 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js +0 -86
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +0 -16
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +0 -76
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
- package/lib/eslint.d.js +0 -1
- package/lib/eslint.d.js.map +0 -7
- package/template/base/vitest.config.ts +0 -25
- /package/lib/cli/lint/internalLints/upgrade/patches/{12.5.0 → 13.1.1}/index.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
|
@@ -1,136 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return void 0;
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
fileContent: await fs.readFile(path, "utf-8"),
|
|
13
|
-
path
|
|
14
|
-
};
|
|
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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { fileContent: packageJson, path } = file;
|
|
22
|
-
let rawJSON;
|
|
23
|
-
try {
|
|
24
|
-
rawJSON = JSON.parse(packageJson);
|
|
25
|
-
} catch {
|
|
26
|
-
throw new Error(`${path} is not valid JSON`);
|
|
27
|
-
}
|
|
28
|
-
const result = schema.safeParse(rawJSON);
|
|
29
|
-
if (!result.success) {
|
|
30
|
-
return { packageJson: void 0, packageJsonRelativePath: path };
|
|
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 });
|
|
31
15
|
}
|
|
32
|
-
return
|
|
16
|
+
return to;
|
|
33
17
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var checks_exports = {};
|
|
20
|
+
__export(checks_exports, {
|
|
21
|
+
isLikelyPackage: () => isLikelyPackage
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(checks_exports);
|
|
24
|
+
var import_logging = require("../../../utils/logging.js");
|
|
25
|
+
var import_manifest = require("../../../utils/manifest.js");
|
|
26
|
+
const isLikelyPackage = async (currentPath) => {
|
|
27
|
+
const nearestPackageJsonResult = await (0, import_manifest.getConsumerManifest)(currentPath);
|
|
28
|
+
if (!nearestPackageJsonResult) {
|
|
29
|
+
import_logging.log.warn("package.json not found");
|
|
45
30
|
return false;
|
|
46
31
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
const { packageJson } = nearestPackageJsonResult;
|
|
33
|
+
const type = packageJson.skuba?.type;
|
|
34
|
+
if (type === "application") {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (type === "package") {
|
|
52
38
|
return true;
|
|
53
39
|
}
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
`Serverless version ${serverlessVersion} cannot be migrated; use Serverless 4.x to automatically migrate Serverless files`
|
|
57
|
-
);
|
|
58
|
-
return false;
|
|
40
|
+
if (typeof packageJson.sideEffects === "boolean") {
|
|
41
|
+
return true;
|
|
59
42
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
63
|
-
return true;
|
|
64
|
-
};
|
|
65
|
-
const isPatchableSkubaType = async (currentPath) => {
|
|
66
|
-
const { packageJson, packageJsonRelativePath } = await extractFromParentPackageJson(
|
|
67
|
-
z.object({
|
|
68
|
-
skuba: z.object({
|
|
69
|
-
type: z.string().optional()
|
|
70
|
-
}).optional(),
|
|
71
|
-
files: z.string().array().optional()
|
|
72
|
-
}),
|
|
73
|
-
currentPath
|
|
74
|
-
);
|
|
75
|
-
if (!packageJson) {
|
|
76
|
-
log.warn("package.json not found, ensure it is in the correct location");
|
|
77
|
-
return false;
|
|
43
|
+
if (typeof packageJson.types === "string" && typeof packageJson.module === "string" && typeof packageJson.main === "string") {
|
|
44
|
+
return true;
|
|
78
45
|
}
|
|
79
|
-
if (packageJson.
|
|
80
|
-
|
|
81
|
-
"Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
|
|
82
|
-
);
|
|
83
|
-
return false;
|
|
46
|
+
if (typeof packageJson.exports === "object") {
|
|
47
|
+
return true;
|
|
84
48
|
}
|
|
85
|
-
|
|
86
|
-
if (!type) {
|
|
87
|
-
log.warn(
|
|
88
|
-
`skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`
|
|
89
|
-
);
|
|
49
|
+
if (packageJson.private === true) {
|
|
90
50
|
return false;
|
|
91
51
|
}
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
"Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
|
|
95
|
-
);
|
|
96
|
-
return false;
|
|
52
|
+
if (packageJson.publishConfig) {
|
|
53
|
+
return true;
|
|
97
54
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
101
|
-
const isPatchableNodeVersion = async (targetNodeVersion, currentPath) => {
|
|
102
|
-
const nvmrcFile = await getParentFile(".nvmrc");
|
|
103
|
-
const nodeVersionFile = await getParentFile(".node-version");
|
|
104
|
-
const { packageJson } = await extractFromParentPackageJson(
|
|
105
|
-
z.object({
|
|
106
|
-
engines: z.object({
|
|
107
|
-
node: z.string()
|
|
108
|
-
})
|
|
109
|
-
}),
|
|
110
|
-
currentPath
|
|
111
|
-
);
|
|
112
|
-
const nvmrcNodeVersion = nvmrcFile?.fileContent;
|
|
113
|
-
const nodeVersion = nodeVersionFile?.fileContent;
|
|
114
|
-
const engineVersion = packageJson?.engines.node;
|
|
115
|
-
const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;
|
|
116
|
-
const coercedTargetVersion = coerce(targetNodeVersion.toString())?.version;
|
|
117
|
-
const coercedCurrentVersion = coerce(currentNodeVersion)?.version;
|
|
118
|
-
const isNodeVersionValid = coercedTargetVersion && coercedCurrentVersion && lte(coercedCurrentVersion, coercedTargetVersion);
|
|
119
|
-
if (!isNodeVersionValid) {
|
|
120
|
-
log.warn(
|
|
121
|
-
`Node.js version ${coercedCurrentVersion ?? "unknown"} cannot be migrated to ${coercedTargetVersion}`
|
|
122
|
-
);
|
|
123
|
-
return false;
|
|
55
|
+
if (typeof packageJson.types === "string") {
|
|
56
|
+
return true;
|
|
124
57
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return
|
|
129
|
-
};
|
|
130
|
-
export {
|
|
131
|
-
extractFromParentPackageJson,
|
|
132
|
-
isPatchableNodeVersion,
|
|
133
|
-
isPatchableServerlessVersion,
|
|
134
|
-
isPatchableSkubaType
|
|
58
|
+
if (typeof packageJson.module === "string") {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
135
62
|
};
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
isLikelyPackage
|
|
66
|
+
});
|
|
136
67
|
//# sourceMappingURL=checks.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/migrate/nodeVersion/checks.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA
|
|
4
|
+
"sourcesContent": ["import { log } from '../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../utils/manifest.js';\nimport type { SkubaPackageJson } from '../../init/writePackageJson.js';\n\nexport const isLikelyPackage = async (\n currentPath: string,\n): Promise<boolean> => {\n const nearestPackageJsonResult = await getConsumerManifest(currentPath);\n if (!nearestPackageJsonResult) {\n log.warn('package.json not found');\n return false;\n }\n\n const { packageJson } = nearestPackageJsonResult;\n\n const type = (packageJson.skuba as SkubaPackageJson)?.type;\n\n if (type === 'application') {\n return false;\n }\n\n if (type === 'package') {\n return true;\n }\n\n if (typeof packageJson.sideEffects === 'boolean') {\n return true;\n }\n\n if (\n typeof packageJson.types === 'string' &&\n typeof packageJson.module === 'string' &&\n typeof packageJson.main === 'string'\n ) {\n return true;\n }\n\n if (typeof packageJson.exports === 'object') {\n return true;\n }\n\n // private true would imply this is either an internal package or application\n if (packageJson.private === true) {\n return false;\n }\n\n if (packageJson.publishConfig) {\n return true;\n }\n\n if (typeof packageJson.types === 'string') {\n return true;\n }\n\n if (typeof packageJson.module === 'string') {\n return true;\n }\n\n return false;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAAoC;AAG7B,MAAM,kBAAkB,OAC7B,gBACqB;AACrB,QAAM,2BAA2B,UAAM,qCAAoB,WAAW;AACtE,MAAI,CAAC,0BAA0B;AAC7B,uBAAI,KAAK,wBAAwB;AACjC,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,YAAY,IAAI;AAExB,QAAM,OAAQ,YAAY,OAA4B;AAEtD,MAAI,SAAS,eAAe;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,WAAW;AACtB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,gBAAgB,WAAW;AAChD,WAAO;AAAA,EACT;AAEA,MACE,OAAO,YAAY,UAAU,YAC7B,OAAO,YAAY,WAAW,YAC9B,OAAO,YAAY,SAAS,UAC5B;AACA,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,YAAY,UAAU;AAC3C,WAAO;AAAA,EACT;AAGA,MAAI,YAAY,YAAY,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,eAAe;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,UAAU,UAAU;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,WAAW,UAAU;AAC1C,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export declare const nodeVersionMigration: ({ nodeVersion, ECMAScriptVersion, }: {
|
|
2
|
-
nodeVersion:
|
|
1
|
+
export declare const nodeVersionMigration: ({ nodeVersion, ECMAScriptVersion, packageNodeVersion, packageECMAScriptVersion, infraPackages, }: {
|
|
2
|
+
nodeVersion: string;
|
|
3
3
|
ECMAScriptVersion: string;
|
|
4
|
+
packageNodeVersion: string;
|
|
5
|
+
packageECMAScriptVersion: string;
|
|
6
|
+
infraPackages: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
}>;
|
|
4
10
|
}, dir?: string) => Promise<void>;
|
|
@@ -1,88 +1,235 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
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 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_semver = require("semver");
|
|
38
|
+
var import_logging = require("../../../utils/logging.js");
|
|
39
|
+
var import_project = require("../../configure/analysis/project.js");
|
|
40
|
+
var import_checks = require("./checks.js");
|
|
41
|
+
var import_upgrade = require("./upgrade.js");
|
|
11
42
|
const subPatches = ({
|
|
12
43
|
nodeVersion,
|
|
13
|
-
ECMAScriptVersion
|
|
44
|
+
ECMAScriptVersion,
|
|
45
|
+
packageECMAScriptVersion,
|
|
46
|
+
packageNodeVersion
|
|
14
47
|
}) => [
|
|
15
|
-
{ file: ".nvmrc", replace: `${nodeVersion}
|
|
16
|
-
` },
|
|
17
48
|
{
|
|
49
|
+
type: "nodejs",
|
|
50
|
+
file: ".nvmrc",
|
|
51
|
+
regex: () => /.*([0-9.]+).*/gm,
|
|
52
|
+
replace: {
|
|
53
|
+
default: {
|
|
54
|
+
captureGroup: 1,
|
|
55
|
+
string: nodeVersion,
|
|
56
|
+
version: nodeVersion
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: "nodejs",
|
|
18
62
|
files: "**/Dockerfile*",
|
|
19
63
|
regex: () => /^FROM(.*) (public.ecr.aws\/docker\/library\/)?node:([0-9]+(?:\.[0-9]+(?:\.[0-9]+)?)?)(-[a-z0-9]+)?(@sha256:[a-f0-9]{64})?( .*)?$/gm,
|
|
20
|
-
replace:
|
|
64
|
+
replace: {
|
|
65
|
+
default: {
|
|
66
|
+
captureGroup: 3,
|
|
67
|
+
string: `FROM$1 $2node:${nodeVersion}$4$6`,
|
|
68
|
+
version: nodeVersion
|
|
69
|
+
}
|
|
70
|
+
}
|
|
21
71
|
},
|
|
22
72
|
{
|
|
73
|
+
type: "nodejs",
|
|
23
74
|
files: "**/Dockerfile*",
|
|
24
|
-
regex: () => /^FROM(.*) gcr.io\/distroless\/nodejs\d
|
|
25
|
-
replace:
|
|
75
|
+
regex: () => /^FROM(.*) gcr.io\/distroless\/nodejs(\d+)-debian(\d+)(@sha256:[a-f0-9]{64})?(\.[^- \n]+)?(-[^ \n]+)?( .+|)$/gm,
|
|
76
|
+
replace: {
|
|
77
|
+
default: {
|
|
78
|
+
captureGroup: 2,
|
|
79
|
+
string: `FROM$1 gcr.io/distroless/nodejs${nodeVersion}-debian$3$6$7`,
|
|
80
|
+
version: nodeVersion
|
|
81
|
+
}
|
|
82
|
+
}
|
|
26
83
|
},
|
|
27
84
|
{
|
|
85
|
+
type: "nodejs",
|
|
28
86
|
files: "**/serverless*.y*ml",
|
|
29
|
-
regex: () => /\bnodejs\d
|
|
30
|
-
|
|
31
|
-
|
|
87
|
+
regex: () => /\bnodejs(\d+).x\b/gm,
|
|
88
|
+
replace: {
|
|
89
|
+
default: {
|
|
90
|
+
captureGroup: 1,
|
|
91
|
+
string: `nodejs${nodeVersion}.x`,
|
|
92
|
+
version: nodeVersion
|
|
93
|
+
}
|
|
94
|
+
}
|
|
32
95
|
},
|
|
33
96
|
{
|
|
97
|
+
type: "nodejs",
|
|
34
98
|
files: "**/serverless*.y*ml",
|
|
35
|
-
regex: () => /\bnode\d
|
|
36
|
-
|
|
37
|
-
|
|
99
|
+
regex: () => /\bnode(\d+)\b/gm,
|
|
100
|
+
replace: {
|
|
101
|
+
default: {
|
|
102
|
+
captureGroup: 1,
|
|
103
|
+
string: `node${nodeVersion}`,
|
|
104
|
+
version: nodeVersion
|
|
105
|
+
}
|
|
106
|
+
}
|
|
38
107
|
},
|
|
39
108
|
{
|
|
109
|
+
type: "nodejs",
|
|
40
110
|
files: "**/infra/**/*.ts",
|
|
41
|
-
regex: () => /NODEJS_\d+_X/g,
|
|
42
|
-
replace:
|
|
111
|
+
regex: () => /NODEJS_(\d+)_X/g,
|
|
112
|
+
replace: {
|
|
113
|
+
default: {
|
|
114
|
+
captureGroup: 1,
|
|
115
|
+
string: `NODEJS_${nodeVersion}_X`,
|
|
116
|
+
version: nodeVersion
|
|
117
|
+
}
|
|
118
|
+
}
|
|
43
119
|
},
|
|
44
120
|
{
|
|
121
|
+
type: "nodejs",
|
|
45
122
|
files: "**/infra/**/*.ts",
|
|
46
123
|
regex: () => /(target:\s*'node)(\d+)(.+)$/gm,
|
|
47
|
-
replace:
|
|
124
|
+
replace: {
|
|
125
|
+
default: {
|
|
126
|
+
captureGroup: 2,
|
|
127
|
+
string: `$1${nodeVersion}$3`,
|
|
128
|
+
version: nodeVersion
|
|
129
|
+
}
|
|
130
|
+
}
|
|
48
131
|
},
|
|
49
132
|
{
|
|
133
|
+
type: "nodejs",
|
|
50
134
|
files: "**/.buildkite/*",
|
|
51
|
-
regex: () => /(image: )(public.ecr.aws\/docker\/library\/)?(node:)[0-9.]+(\.[^- \n]+)?(-[^ \n]+)?$/gm,
|
|
52
|
-
replace:
|
|
135
|
+
regex: () => /(image: )(public.ecr.aws\/docker\/library\/)?(node:)([0-9.]+)(\.[^- \n]+)?(-[^ \n]+)?$/gm,
|
|
136
|
+
replace: {
|
|
137
|
+
default: {
|
|
138
|
+
captureGroup: 4,
|
|
139
|
+
string: `$1$2$3${nodeVersion}$5$6`,
|
|
140
|
+
version: nodeVersion
|
|
141
|
+
}
|
|
142
|
+
}
|
|
53
143
|
},
|
|
54
144
|
{
|
|
145
|
+
type: "nodejs",
|
|
55
146
|
files: ".node-version*",
|
|
56
147
|
regex: () => /(\d+(?:\.\d+)*)/g,
|
|
57
|
-
replace:
|
|
148
|
+
replace: {
|
|
149
|
+
default: {
|
|
150
|
+
captureGroup: 1,
|
|
151
|
+
string: `${nodeVersion}`,
|
|
152
|
+
version: nodeVersion
|
|
153
|
+
}
|
|
154
|
+
}
|
|
58
155
|
},
|
|
59
156
|
{
|
|
157
|
+
type: "nodejs",
|
|
60
158
|
files: "**/package.json",
|
|
61
159
|
regex: () => /(["']engines["']:\s*{[\s\S]*?["']node["']:\s*["']>=)(\d+(?:\.\d+)*)(['"]\s*})/gm,
|
|
62
|
-
|
|
63
|
-
|
|
160
|
+
replace: {
|
|
161
|
+
package: {
|
|
162
|
+
string: `$1${packageNodeVersion}$3`,
|
|
163
|
+
version: packageNodeVersion,
|
|
164
|
+
captureGroup: 2
|
|
165
|
+
},
|
|
166
|
+
default: {
|
|
167
|
+
string: `$1${nodeVersion}$3`,
|
|
168
|
+
version: nodeVersion,
|
|
169
|
+
captureGroup: 2
|
|
170
|
+
}
|
|
171
|
+
}
|
|
64
172
|
},
|
|
65
173
|
{
|
|
174
|
+
type: "nodejs",
|
|
175
|
+
files: "**/docker-compose*.y*ml",
|
|
176
|
+
regex: () => /(image: )(public.ecr.aws\/docker\/library\/)?(node:)([0-9.]+)(\.[^- \n]+)?(-[^ \n]+)?$/gm,
|
|
177
|
+
replace: {
|
|
178
|
+
default: {
|
|
179
|
+
captureGroup: 4,
|
|
180
|
+
string: `$1$2$3${nodeVersion}$5$6`,
|
|
181
|
+
version: nodeVersion
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
type: "ecmascript",
|
|
66
187
|
files: "**/tsconfig*.json",
|
|
67
188
|
regex: () => /("target":\s*")(ES\d+)"/gim,
|
|
68
|
-
|
|
69
|
-
|
|
189
|
+
replace: {
|
|
190
|
+
package: {
|
|
191
|
+
string: `$1${packageECMAScriptVersion}"`,
|
|
192
|
+
version: packageECMAScriptVersion,
|
|
193
|
+
captureGroup: 2
|
|
194
|
+
},
|
|
195
|
+
default: {
|
|
196
|
+
string: `$1${ECMAScriptVersion}"`,
|
|
197
|
+
version: ECMAScriptVersion,
|
|
198
|
+
captureGroup: 2
|
|
199
|
+
}
|
|
200
|
+
}
|
|
70
201
|
},
|
|
71
202
|
{
|
|
203
|
+
type: "ecmascript",
|
|
72
204
|
files: "**/tsconfig*.json",
|
|
73
205
|
regex: () => /("lib":\s*\[)([\S\s]*?)(ES\d+)([\S\s]*?)(\])/gim,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
206
|
+
replace: {
|
|
207
|
+
package: {
|
|
208
|
+
string: `$1$2${packageECMAScriptVersion}$4$5`,
|
|
209
|
+
version: packageECMAScriptVersion,
|
|
210
|
+
captureGroup: 3
|
|
211
|
+
},
|
|
212
|
+
default: {
|
|
213
|
+
string: `$1$2${ECMAScriptVersion}$4$5`,
|
|
214
|
+
version: ECMAScriptVersion,
|
|
215
|
+
captureGroup: 3
|
|
216
|
+
}
|
|
217
|
+
}
|
|
81
218
|
}
|
|
82
219
|
];
|
|
220
|
+
const getTemplatedReplace = async (path, replace) => {
|
|
221
|
+
if (!replace.package) {
|
|
222
|
+
return replace.default;
|
|
223
|
+
}
|
|
224
|
+
const isPackage = await (0, import_checks.isLikelyPackage)(path);
|
|
225
|
+
if (isPackage) {
|
|
226
|
+
return replace.package;
|
|
227
|
+
}
|
|
228
|
+
return replace.default;
|
|
229
|
+
};
|
|
83
230
|
const runSubPatch = async (dir, patch) => {
|
|
84
|
-
const readFile = createDestinationFileReader(dir);
|
|
85
|
-
const paths = patch.file ? [patch.file] : await glob(patch.files ?? [], {
|
|
231
|
+
const readFile = (0, import_project.createDestinationFileReader)(dir);
|
|
232
|
+
const paths = patch.file ? [patch.file] : await (0, import_fast_glob.glob)(patch.files ?? [], {
|
|
86
233
|
cwd: dir,
|
|
87
234
|
ignore: ["**/node_modules/**"]
|
|
88
235
|
});
|
|
@@ -92,35 +239,48 @@ const runSubPatch = async (dir, patch) => {
|
|
|
92
239
|
if (!contents) {
|
|
93
240
|
return;
|
|
94
241
|
}
|
|
95
|
-
|
|
242
|
+
const regexResult = patch.regex().exec(contents);
|
|
243
|
+
if (!regexResult) {
|
|
96
244
|
return;
|
|
97
245
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
246
|
+
const templateReplace = await getTemplatedReplace(path, patch.replace);
|
|
247
|
+
if (!lessThan(
|
|
248
|
+
regexResult[templateReplace.captureGroup],
|
|
249
|
+
templateReplace.version
|
|
250
|
+
)) {
|
|
251
|
+
return;
|
|
105
252
|
}
|
|
106
253
|
await writePatchedContents({
|
|
107
254
|
path,
|
|
108
255
|
contents,
|
|
109
|
-
templated:
|
|
256
|
+
templated: templateReplace.string,
|
|
110
257
|
regex: patch.regex
|
|
111
258
|
});
|
|
112
259
|
})
|
|
113
260
|
);
|
|
114
261
|
};
|
|
262
|
+
const lessThan = (versionA, versionB) => {
|
|
263
|
+
if (versionA.toLowerCase().startsWith("es")) {
|
|
264
|
+
return Number(versionA.slice(2)) < Number(versionB.slice(2));
|
|
265
|
+
}
|
|
266
|
+
const coersedA = (0, import_semver.coerce)(versionA);
|
|
267
|
+
const coersedB = (0, import_semver.coerce)(versionB);
|
|
268
|
+
if (!coersedA || !coersedB) {
|
|
269
|
+
throw new Error(
|
|
270
|
+
`Unable to coerce versions for comparison: "${versionA}" and "${versionB}"`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
return (0, import_semver.lt)(coersedA, coersedB);
|
|
274
|
+
};
|
|
115
275
|
const writePatchedContents = async ({
|
|
116
276
|
path,
|
|
117
277
|
contents,
|
|
118
278
|
templated,
|
|
119
279
|
regex
|
|
120
|
-
}) =>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
280
|
+
}) => {
|
|
281
|
+
const modified = contents.replaceAll(regex(), templated);
|
|
282
|
+
await import_fs_extra.default.promises.writeFile(path, modified);
|
|
283
|
+
};
|
|
124
284
|
const upgrade = async (versions, dir) => {
|
|
125
285
|
for (const subPatch of subPatches(versions)) {
|
|
126
286
|
await runSubPatch(dir, subPatch);
|
|
@@ -128,22 +288,36 @@ const upgrade = async (versions, dir) => {
|
|
|
128
288
|
};
|
|
129
289
|
const nodeVersionMigration = async ({
|
|
130
290
|
nodeVersion,
|
|
131
|
-
ECMAScriptVersion
|
|
291
|
+
ECMAScriptVersion,
|
|
292
|
+
packageNodeVersion,
|
|
293
|
+
packageECMAScriptVersion,
|
|
294
|
+
infraPackages
|
|
132
295
|
}, dir = process.cwd()) => {
|
|
133
|
-
log.ok(
|
|
296
|
+
import_logging.log.ok(
|
|
297
|
+
`Upgrading project to Node.js ${nodeVersion} and package targets to Node.js ${packageNodeVersion}`
|
|
298
|
+
);
|
|
134
299
|
try {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
300
|
+
await (0, import_upgrade.tryUpgradeInfraPackages)("format", infraPackages);
|
|
301
|
+
await upgrade(
|
|
302
|
+
{
|
|
303
|
+
nodeVersion,
|
|
304
|
+
ECMAScriptVersion,
|
|
305
|
+
packageNodeVersion,
|
|
306
|
+
packageECMAScriptVersion
|
|
307
|
+
},
|
|
308
|
+
dir
|
|
309
|
+
);
|
|
310
|
+
import_logging.log.ok(
|
|
311
|
+
`Upgraded project to Node.js ${nodeVersion} and package targets to Node.js ${packageNodeVersion}`
|
|
312
|
+
);
|
|
140
313
|
} catch (error) {
|
|
141
|
-
log.err("Failed to upgrade");
|
|
142
|
-
log.subtle(inspect(error));
|
|
314
|
+
import_logging.log.err("Failed to upgrade");
|
|
315
|
+
import_logging.log.subtle((0, import_util.inspect)(error));
|
|
143
316
|
process.exitCode = 1;
|
|
144
317
|
}
|
|
145
318
|
};
|
|
146
|
-
export
|
|
319
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
320
|
+
0 && (module.exports = {
|
|
147
321
|
nodeVersionMigration
|
|
148
|
-
};
|
|
322
|
+
});
|
|
149
323
|
//# sourceMappingURL=index.js.map
|