skuba 14.0.0-replace-global-vars-20251121010036 → 14.0.0-rfc-upgrade-on-test-20251217012156
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 +100 -74
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.js +51 -16
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.js +98 -67
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +4 -4
- package/lib/cli/init/prompts.js +48 -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 +6 -2
- package/lib/cli/lint/internalLints/upgrade/index.js +55 -23
- 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 +65 -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.js +55 -18
- 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 +7 -8
- 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 +8 -10
- 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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.ts"],
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { migrations } from '../../../../../migrate/index.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst upgradeNode: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n if (process.env.SKIP_NODE_UPGRADE) {\n return {\n result: 'skip',\n reason: 'SKIP_NODE_UPGRADE environment variable set',\n };\n }\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await migrations.node24();\n\n return { result: 'apply' };\n};\n\nexport const tryUpgradeNode: PatchFunction = async (config) => {\n try {\n return await upgradeNode(config);\n } catch (err) {\n log.warn('Failed to upgrade node version');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,qBAAoB;AACpB,qBAA2B;AAG3B,MAAM,cAA6B,OAAO;AAAA,EACxC;AACF,MAAgC;AAC9B,MAAI,QAAQ,IAAI,mBAAmB;AACjC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AACA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,QAAM,0BAAW,OAAO;AAExB,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,iBAAgC,OAAO,WAAW;AAC7D,MAAI;AACF,WAAO,MAAM,YAAY,MAAM;AAAA,EACjC,SAAS,KAAK;AACZ,uBAAI,KAAK,gCAAgC;AACzC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,15 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 addEmptyExports_exports = {};
|
|
30
|
+
__export(addEmptyExports_exports, {
|
|
31
|
+
tryAddEmptyExports: () => tryAddEmptyExports
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(addEmptyExports_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_util = require("util");
|
|
36
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
+
var import_logging = require("../../../../../../utils/logging.js");
|
|
38
|
+
var import_package = require("../../../../../configure/analysis/package.js");
|
|
39
|
+
var import_project = require("../../../../../configure/analysis/project.js");
|
|
40
|
+
var import_prettier = require("../../../../../configure/processing/prettier.js");
|
|
8
41
|
const JEST_SETUP_FILES = ["jest.setup.ts", "jest.setup.int.ts"];
|
|
9
42
|
const addEmptyExports = async (mode) => {
|
|
10
|
-
const manifest = await getDestinationManifest();
|
|
11
|
-
const destinationRoot =
|
|
12
|
-
const readDestinationFile = createDestinationFileReader(destinationRoot);
|
|
43
|
+
const manifest = await (0, import_package.getDestinationManifest)();
|
|
44
|
+
const destinationRoot = import_path.default.dirname(manifest.path);
|
|
45
|
+
const readDestinationFile = (0, import_project.createDestinationFileReader)(destinationRoot);
|
|
13
46
|
const addEmptyExport = async (filename) => {
|
|
14
47
|
const inputFile = await readDestinationFile(filename);
|
|
15
48
|
if (!inputFile || // The file appears to have an import or export so it should be compatible
|
|
@@ -21,11 +54,11 @@ const addEmptyExports = async (mode) => {
|
|
|
21
54
|
if (mode === "lint") {
|
|
22
55
|
return "apply";
|
|
23
56
|
}
|
|
24
|
-
const data = await formatPrettier([inputFile, "export {}"].join("\n\n"), {
|
|
57
|
+
const data = await (0, import_prettier.formatPrettier)([inputFile, "export {}"].join("\n\n"), {
|
|
25
58
|
parser: "typescript"
|
|
26
59
|
});
|
|
27
|
-
const filepath =
|
|
28
|
-
await
|
|
60
|
+
const filepath = import_path.default.join(destinationRoot, filename);
|
|
61
|
+
await import_fs_extra.default.promises.writeFile(filepath, data);
|
|
29
62
|
return "apply";
|
|
30
63
|
};
|
|
31
64
|
const results = await Promise.all(JEST_SETUP_FILES.map(addEmptyExport));
|
|
@@ -35,12 +68,13 @@ const tryAddEmptyExports = async ({ mode }) => {
|
|
|
35
68
|
try {
|
|
36
69
|
return { result: await addEmptyExports(mode) };
|
|
37
70
|
} catch (err) {
|
|
38
|
-
log.warn("Failed to convert Jest setup files to isolated modules.");
|
|
39
|
-
log.subtle(inspect(err));
|
|
71
|
+
import_logging.log.warn("Failed to convert Jest setup files to isolated modules.");
|
|
72
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
40
73
|
return { result: "skip", reason: "due to an error" };
|
|
41
74
|
}
|
|
42
75
|
};
|
|
43
|
-
export
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
44
78
|
tryAddEmptyExports
|
|
45
|
-
};
|
|
79
|
+
});
|
|
46
80
|
//# sourceMappingURL=addEmptyExports.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { getDestinationManifest } from '../../../../../configure/analysis/package.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction } from '../../index.js';\n\nconst JEST_SETUP_FILES = ['jest.setup.ts', 'jest.setup.int.ts'];\n\nconst addEmptyExports = async (mode: 'format' | 'lint') => {\n const manifest = await getDestinationManifest();\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const addEmptyExport = async (filename: string) => {\n const inputFile = await readDestinationFile(filename);\n\n if (\n !inputFile ||\n // The file appears to have an import or export so it should be compatible\n // with isolated modules. This is a very naive check that we don't want to\n // overcomplicate because it is invoked before many skuba commands.\n inputFile.includes('import ') ||\n inputFile.includes('export ')\n ) {\n return 'skip';\n }\n\n if (mode === 'lint') {\n return 'apply';\n }\n\n const data = await formatPrettier([inputFile, 'export {}'].join('\\n\\n'), {\n parser: 'typescript',\n });\n\n const filepath = path.join(destinationRoot, filename);\n\n await fs.promises.writeFile(filepath, data);\n\n return 'apply';\n };\n\n const results = await Promise.all(JEST_SETUP_FILES.map(addEmptyExport));\n return results.every((result) => result === 'skip') ? 'skip' : 'apply';\n};\n\n/**\n * Tries to add an empty `export {}` statement to the bottom of Jest setup files\n * for compliance with TypeScript isolated modules.\n */\nexport const tryAddEmptyExports: PatchFunction = async ({ mode }) => {\n try {\n return { result: await addEmptyExports(mode) };\n } catch (err) {\n log.warn('Failed to convert Jest setup files to isolated modules.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AAEf,qBAAoB;AACpB,qBAAuC;AACvC,qBAA4C;AAC5C,sBAA+B;AAG/B,MAAM,mBAAmB,CAAC,iBAAiB,mBAAmB;AAE9D,MAAM,kBAAkB,OAAO,SAA4B;AACzD,QAAM,WAAW,UAAM,uCAAuB;AAE9C,QAAM,kBAAkB,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAElD,QAAM,0BAAsB,4CAA4B,eAAe;AAEvE,QAAM,iBAAiB,OAAO,aAAqB;AACjD,UAAM,YAAY,MAAM,oBAAoB,QAAQ;AAEpD,QACE,CAAC;AAAA;AAAA;AAAA,IAID,UAAU,SAAS,SAAS,KAC5B,UAAU,SAAS,SAAS,GAC5B;AACA,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,QAAQ;AACnB,aAAO;AAAA,IACT;AAEA,UAAM,OAAO,UAAM,gCAAe,CAAC,WAAW,WAAW,EAAE,KAAK,MAAM,GAAG;AAAA,MACvE,QAAQ;AAAA,IACV,CAAC;AAED,UAAM,WAAW,YAAAA,QAAK,KAAK,iBAAiB,QAAQ;AAEpD,UAAM,gBAAAC,QAAG,SAAS,UAAU,UAAU,IAAI;AAE1C,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,MAAM,QAAQ,IAAI,iBAAiB,IAAI,cAAc,CAAC;AACtE,SAAO,QAAQ,MAAM,CAAC,WAAW,WAAW,MAAM,IAAI,SAAS;AACjE;AAMO,MAAM,qBAAoC,OAAO,EAAE,KAAK,MAAM;AACnE,MAAI;AACF,WAAO,EAAE,QAAQ,MAAM,gBAAgB,IAAI,EAAE;AAAA,EAC/C,SAAS,KAAK;AACZ,uBAAI,KAAK,yDAAyD;AAClE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["path", "fs"]
|
|
7
7
|
}
|
|
@@ -1,26 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __exports = {};
|
|
20
|
+
__export(__exports, {
|
|
21
|
+
patches: () => patches
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(__exports);
|
|
24
|
+
var import_patchRenovateConfig = require("../../../patchRenovateConfig.js");
|
|
25
|
+
var import_addEmptyExports = require("./addEmptyExports.js");
|
|
26
|
+
var import_patchDockerfile = require("./patchDockerfile.js");
|
|
27
|
+
var import_patchServerListener = require("./patchServerListener.js");
|
|
5
28
|
const patches = [
|
|
6
29
|
{
|
|
7
|
-
apply: tryAddEmptyExports,
|
|
30
|
+
apply: import_addEmptyExports.tryAddEmptyExports,
|
|
8
31
|
description: "Add empty exports to Jest files for compliance with TypeScript isolated modules"
|
|
9
32
|
},
|
|
10
33
|
{
|
|
11
|
-
apply: tryPatchRenovateConfig,
|
|
34
|
+
apply: import_patchRenovateConfig.tryPatchRenovateConfig,
|
|
12
35
|
description: "Update Renovate config to support private SEEK packages"
|
|
13
36
|
},
|
|
14
37
|
{
|
|
15
|
-
apply: tryPatchDockerfile,
|
|
38
|
+
apply: import_patchDockerfile.tryPatchDockerfile,
|
|
16
39
|
description: "Upgrade Node.js Distroless Docker image to -debian12 variant"
|
|
17
40
|
},
|
|
18
41
|
{
|
|
19
|
-
apply: tryPatchServerListener,
|
|
42
|
+
apply: import_patchServerListener.tryPatchServerListener,
|
|
20
43
|
description: "Add keepAliveTimeout to server listener"
|
|
21
44
|
}
|
|
22
45
|
];
|
|
23
|
-
export
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
24
48
|
patches
|
|
25
|
-
};
|
|
49
|
+
});
|
|
26
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { tryPatchRenovateConfig } from '../../../patchRenovateConfig.js';\nimport type { Patches } from '../../index.js';\n\nimport { tryAddEmptyExports } from './addEmptyExports.js';\nimport { tryPatchDockerfile } from './patchDockerfile.js';\nimport { tryPatchServerListener } from './patchServerListener.js';\n\nexport const patches: Patches = [\n {\n apply: tryAddEmptyExports,\n description:\n 'Add empty exports to Jest files for compliance with TypeScript isolated modules',\n },\n {\n apply: tryPatchRenovateConfig,\n description: 'Update Renovate config to support private SEEK packages',\n },\n {\n apply: tryPatchDockerfile,\n description: 'Upgrade Node.js Distroless Docker image to -debian12 variant',\n },\n {\n apply: tryPatchServerListener,\n description: 'Add keepAliveTimeout to server listener',\n },\n];\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAuC;AAGvC,6BAAmC;AACnC,6BAAmC;AACnC,iCAAuC;AAEhC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 patchDockerfile_exports = {};
|
|
30
|
+
__export(patchDockerfile_exports, {
|
|
31
|
+
tryPatchDockerfile: () => tryPatchDockerfile
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(patchDockerfile_exports);
|
|
34
|
+
var import_util = require("util");
|
|
35
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
|
+
var import_logging = require("../../../../../../utils/logging.js");
|
|
37
|
+
var import_project = require("../../../../../configure/analysis/project.js");
|
|
5
38
|
const DOCKERFILE_FILENAME = "Dockerfile";
|
|
6
39
|
const NON_DEBIAN_REGEX = /gcr.io\/distroless\/nodejs:(18|20)/g;
|
|
7
40
|
const DEBIAN_REGEX = /gcr.io\/distroless\/nodejs(18|20)-debian11/g;
|
|
8
41
|
const VERSION_DEBIAN_REPLACE = "gcr.io/distroless/nodejs$1-debian12";
|
|
9
42
|
const patchDockerfile = async (mode, dir) => {
|
|
10
|
-
const readFile = createDestinationFileReader(dir);
|
|
43
|
+
const readFile = (0, import_project.createDestinationFileReader)(dir);
|
|
11
44
|
const maybeDockerfile = await readFile(DOCKERFILE_FILENAME);
|
|
12
45
|
if (!maybeDockerfile) {
|
|
13
46
|
return { result: "skip", reason: "no Dockerfile found" };
|
|
@@ -19,7 +52,7 @@ const patchDockerfile = async (mode, dir) => {
|
|
|
19
52
|
if (mode === "lint") {
|
|
20
53
|
return { result: "apply" };
|
|
21
54
|
}
|
|
22
|
-
await
|
|
55
|
+
await import_fs_extra.default.promises.writeFile(DOCKERFILE_FILENAME, patched);
|
|
23
56
|
return { result: "apply" };
|
|
24
57
|
};
|
|
25
58
|
const tryPatchDockerfile = async ({
|
|
@@ -29,12 +62,13 @@ const tryPatchDockerfile = async ({
|
|
|
29
62
|
try {
|
|
30
63
|
return await patchDockerfile(mode, dir);
|
|
31
64
|
} catch (err) {
|
|
32
|
-
log.warn("Failed to patch Dockerfile.");
|
|
33
|
-
log.subtle(inspect(err));
|
|
65
|
+
import_logging.log.warn("Failed to patch Dockerfile.");
|
|
66
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
34
67
|
return { result: "skip", reason: "due to an error" };
|
|
35
68
|
}
|
|
36
69
|
};
|
|
37
|
-
export
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
38
72
|
tryPatchDockerfile
|
|
39
|
-
};
|
|
73
|
+
});
|
|
40
74
|
//# sourceMappingURL=patchDockerfile.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst DOCKERFILE_FILENAME = 'Dockerfile';\n\nconst NON_DEBIAN_REGEX = /gcr.io\\/distroless\\/nodejs:(18|20)/g;\nconst DEBIAN_REGEX = /gcr.io\\/distroless\\/nodejs(18|20)-debian11/g;\nconst VERSION_DEBIAN_REPLACE = 'gcr.io/distroless/nodejs$1-debian12';\n\nconst patchDockerfile = async (\n mode: 'format' | 'lint',\n dir: string,\n): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(dir);\n\n const maybeDockerfile = await readFile(DOCKERFILE_FILENAME);\n\n if (!maybeDockerfile) {\n return { result: 'skip', reason: 'no Dockerfile found' };\n }\n\n const patched = maybeDockerfile\n .replaceAll(NON_DEBIAN_REGEX, VERSION_DEBIAN_REPLACE)\n .replaceAll(DEBIAN_REGEX, VERSION_DEBIAN_REPLACE);\n\n if (patched === maybeDockerfile) {\n return { result: 'skip' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await fs.promises.writeFile(DOCKERFILE_FILENAME, patched);\n\n return { result: 'apply' };\n};\n\nexport const tryPatchDockerfile: PatchFunction = async ({\n mode,\n dir = process.cwd(),\n}) => {\n try {\n return await patchDockerfile(mode, dir);\n } catch (err) {\n log.warn('Failed to patch Dockerfile.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,sBAAe;AAEf,qBAAoB;AACpB,qBAA4C;AAG5C,MAAM,sBAAsB;AAE5B,MAAM,mBAAmB;AACzB,MAAM,eAAe;AACrB,MAAM,yBAAyB;AAE/B,MAAM,kBAAkB,OACtB,MACA,QAC6B;AAC7B,QAAM,eAAW,4CAA4B,GAAG;AAEhD,QAAM,kBAAkB,MAAM,SAAS,mBAAmB;AAE1D,MAAI,CAAC,iBAAiB;AACpB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,sBAAsB;AAAA,EACzD;AAEA,QAAM,UAAU,gBACb,WAAW,kBAAkB,sBAAsB,EACnD,WAAW,cAAc,sBAAsB;AAElD,MAAI,YAAY,iBAAiB;AAC/B,WAAO,EAAE,QAAQ,OAAO;AAAA,EAC1B;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,QAAM,gBAAAA,QAAG,SAAS,UAAU,qBAAqB,OAAO;AAExD,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,qBAAoC,OAAO;AAAA,EACtD;AAAA,EACA,MAAM,QAAQ,IAAI;AACpB,MAAM;AACJ,MAAI;AACF,WAAO,MAAM,gBAAgB,MAAM,GAAG;AAAA,EACxC,SAAS,KAAK;AACZ,uBAAI,KAAK,6BAA6B;AACtC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["fs"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 patchServerListener_exports = {};
|
|
30
|
+
__export(patchServerListener_exports, {
|
|
31
|
+
tryPatchServerListener: () => tryPatchServerListener
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(patchServerListener_exports);
|
|
34
|
+
var import_util = require("util");
|
|
35
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
|
+
var import_logging = require("../../../../../../utils/logging.js");
|
|
37
|
+
var import_project = require("../../../../../configure/analysis/project.js");
|
|
38
|
+
var import_prettier = require("../../../../../configure/processing/prettier.js");
|
|
6
39
|
const SERVER_LISTENER_FILENAME = "src/listen.ts";
|
|
7
40
|
const KEEP_ALIVE_CODE = `
|
|
8
41
|
// Gantry ALB default idle timeout is 30 seconds
|
|
@@ -13,7 +46,7 @@ const KEEP_ALIVE_CODE = `
|
|
|
13
46
|
listener.keepAliveTimeout = 31000;
|
|
14
47
|
`;
|
|
15
48
|
const patchServerListener = async (mode, dir) => {
|
|
16
|
-
const readFile = createDestinationFileReader(dir);
|
|
49
|
+
const readFile = (0, import_project.createDestinationFileReader)(dir);
|
|
17
50
|
let listener = await readFile(SERVER_LISTENER_FILENAME);
|
|
18
51
|
if (!listener) {
|
|
19
52
|
return { result: "skip", reason: "no listener file found" };
|
|
@@ -34,9 +67,9 @@ const patchServerListener = async (mode, dir) => {
|
|
|
34
67
|
return { result: "apply" };
|
|
35
68
|
}
|
|
36
69
|
listener = `${listener}${KEEP_ALIVE_CODE}`;
|
|
37
|
-
await
|
|
70
|
+
await import_fs_extra.default.promises.writeFile(
|
|
38
71
|
SERVER_LISTENER_FILENAME,
|
|
39
|
-
await formatPrettier(listener, {
|
|
72
|
+
await (0, import_prettier.formatPrettier)(listener, {
|
|
40
73
|
parser: "typescript"
|
|
41
74
|
})
|
|
42
75
|
);
|
|
@@ -49,12 +82,13 @@ const tryPatchServerListener = async ({
|
|
|
49
82
|
try {
|
|
50
83
|
return await patchServerListener(mode, dir);
|
|
51
84
|
} catch (err) {
|
|
52
|
-
log.warn("Failed to patch server listener.");
|
|
53
|
-
log.subtle(inspect(err));
|
|
85
|
+
import_logging.log.warn("Failed to patch server listener.");
|
|
86
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
54
87
|
return { result: "skip", reason: "due to an error" };
|
|
55
88
|
}
|
|
56
89
|
};
|
|
57
|
-
export
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
58
92
|
tryPatchServerListener
|
|
59
|
-
};
|
|
93
|
+
});
|
|
60
94
|
//# sourceMappingURL=patchServerListener.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst SERVER_LISTENER_FILENAME = 'src/listen.ts';\n\nconst KEEP_ALIVE_CODE = `\n// Gantry ALB default idle timeout is 30 seconds\n// https://nodejs.org/docs/latest-v20.x/api/http.html#serverkeepalivetimeout\n// Node default is 5 seconds\n// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#connection-idle-timeout\n// AWS recommends setting an application timeout larger than the load balancer\nlistener.keepAliveTimeout = 31000;\n`;\n\nconst patchServerListener = async (\n mode: 'format' | 'lint',\n dir: string,\n): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(dir);\n\n let listener = await readFile(SERVER_LISTENER_FILENAME);\n if (!listener) {\n return { result: 'skip', reason: 'no listener file found' };\n }\n\n if (listener.includes('keepAliveTimeout')) {\n return { result: 'skip', reason: 'keepAliveTimeout already configured' };\n }\n\n if (listener.includes('\\napp.listen(')) {\n listener = listener.replace(\n '\\napp.listen(',\n '\\nconst listener = app.listen(',\n );\n }\n\n if (!listener.includes('\\nconst listener = app.listen(')) {\n return { result: 'skip', reason: 'no server listener found' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n listener = `${listener}${KEEP_ALIVE_CODE}`;\n\n await fs.promises.writeFile(\n SERVER_LISTENER_FILENAME,\n await formatPrettier(listener, {\n parser: 'typescript',\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const tryPatchServerListener: PatchFunction = async ({\n mode,\n dir = process.cwd(),\n}) => {\n try {\n return await patchServerListener(mode, dir);\n } catch (err) {\n log.warn('Failed to patch server listener.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,sBAAe;AAEf,qBAAoB;AACpB,qBAA4C;AAC5C,sBAA+B;AAG/B,MAAM,2BAA2B;AAEjC,MAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASxB,MAAM,sBAAsB,OAC1B,MACA,QAC6B;AAC7B,QAAM,eAAW,4CAA4B,GAAG;AAEhD,MAAI,WAAW,MAAM,SAAS,wBAAwB;AACtD,MAAI,CAAC,UAAU;AACb,WAAO,EAAE,QAAQ,QAAQ,QAAQ,yBAAyB;AAAA,EAC5D;AAEA,MAAI,SAAS,SAAS,kBAAkB,GAAG;AACzC,WAAO,EAAE,QAAQ,QAAQ,QAAQ,sCAAsC;AAAA,EACzE;AAEA,MAAI,SAAS,SAAS,eAAe,GAAG;AACtC,eAAW,SAAS;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,SAAS,SAAS,gCAAgC,GAAG;AACxD,WAAO,EAAE,QAAQ,QAAQ,QAAQ,2BAA2B;AAAA,EAC9D;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,aAAW,GAAG,QAAQ,GAAG,eAAe;AAExC,QAAM,gBAAAA,QAAG,SAAS;AAAA,IAChB;AAAA,IACA,UAAM,gCAAe,UAAU;AAAA,MAC7B,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,yBAAwC,OAAO;AAAA,EAC1D;AAAA,EACA,MAAM,QAAQ,IAAI;AACpB,MAAM;AACJ,MAAI;AACF,WAAO,MAAM,oBAAoB,MAAM,GAAG;AAAA,EAC5C,SAAS,KAAK;AACZ,uBAAI,KAAK,kCAAkC;AAC3C,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["fs"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,35 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __exports = {};
|
|
20
|
+
__export(__exports, {
|
|
21
|
+
patches: () => patches
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(__exports);
|
|
24
|
+
var import_patchPnpmPackageManager = require("./patchPnpmPackageManager.js");
|
|
2
25
|
const patches = [
|
|
3
26
|
{
|
|
4
|
-
apply: tryPatchPnpmPackageManager,
|
|
27
|
+
apply: import_patchPnpmPackageManager.tryPatchPnpmPackageManager,
|
|
5
28
|
description: "Ensure the pnpm package manager version specified in package.json is used in Dockerfiles"
|
|
6
29
|
}
|
|
7
30
|
];
|
|
8
|
-
export
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
9
33
|
patches
|
|
10
|
-
};
|
|
34
|
+
});
|
|
11
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.0.0/index.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchPnpmPackageManager } from './patchPnpmPackageManager.js';\n\nexport const patches: Patches = [\n {\n apply: tryPatchPnpmPackageManager,\n description:\n 'Ensure the pnpm package manager version specified in package.json is used in Dockerfiles',\n },\n];\n"],
|
|
5
|
-
"mappings": "AAEA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qCAA2C;AAEpC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 patchPnpmPackageManager_exports = {};
|
|
30
|
+
__export(patchPnpmPackageManager_exports, {
|
|
31
|
+
tryPatchPnpmPackageManager: () => tryPatchPnpmPackageManager
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(patchPnpmPackageManager_exports);
|
|
34
|
+
var import_util = require("util");
|
|
35
|
+
var import_fast_glob = __toESM(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");
|
|
6
39
|
const DOCKERFILE_COREPACK_COMMAND = "RUN corepack enable pnpm";
|
|
7
40
|
const PACKAGE_JSON_MOUNT = `RUN --mount=type=bind,source=package.json,target=package.json \\
|
|
8
41
|
corepack enable pnpm && corepack install`;
|
|
@@ -11,7 +44,7 @@ const BEFORE_PIPELINE_REGEX = /(\s*cache-on:\s*\n\s*-\s*\.npmrc\s*\n)((\s*)-\s*p
|
|
|
11
44
|
const ECR_REGEX = /seek-oss\/docker-ecr-cache#v([\d\.]+)/gm;
|
|
12
45
|
const fetchFiles = async (files) => Promise.all(
|
|
13
46
|
files.map(async (file) => {
|
|
14
|
-
const contents = await
|
|
47
|
+
const contents = await import_fs_extra.default.readFile(file, "utf8");
|
|
15
48
|
return {
|
|
16
49
|
file,
|
|
17
50
|
contents
|
|
@@ -36,8 +69,8 @@ const patchPnpmPackageManager = async ({
|
|
|
36
69
|
};
|
|
37
70
|
}
|
|
38
71
|
const [maybeDockerfiles, maybePipelines] = await Promise.all([
|
|
39
|
-
|
|
40
|
-
|
|
72
|
+
(0, import_fast_glob.default)(["Dockerfile*"]),
|
|
73
|
+
(0, import_fast_glob.default)([".buildkite/*.yml"])
|
|
41
74
|
]);
|
|
42
75
|
if (!maybeDockerfiles.length || !maybePipelines.length) {
|
|
43
76
|
return {
|
|
@@ -71,7 +104,7 @@ const patchPnpmPackageManager = async ({
|
|
|
71
104
|
DOCKERFILE_COREPACK_COMMAND,
|
|
72
105
|
PACKAGE_JSON_MOUNT
|
|
73
106
|
);
|
|
74
|
-
await
|
|
107
|
+
await import_fs_extra.default.writeFile(file, patchedContent);
|
|
75
108
|
})
|
|
76
109
|
);
|
|
77
110
|
}
|
|
@@ -86,13 +119,13 @@ $2`
|
|
|
86
119
|
const patchedEcrContent = patchedContent.replace(
|
|
87
120
|
ECR_REGEX,
|
|
88
121
|
(match, version) => {
|
|
89
|
-
if (typeof version === "string" && lt(version, "2.2.0")) {
|
|
122
|
+
if (typeof version === "string" && (0, import_semver.lt)(version, "2.2.0")) {
|
|
90
123
|
return "seek-oss/docker-ecr-cache#v2.2.0";
|
|
91
124
|
}
|
|
92
125
|
return match;
|
|
93
126
|
}
|
|
94
127
|
);
|
|
95
|
-
await
|
|
128
|
+
await import_fs_extra.default.writeFile(file, patchedEcrContent);
|
|
96
129
|
})
|
|
97
130
|
);
|
|
98
131
|
}
|
|
@@ -102,12 +135,13 @@ const tryPatchPnpmPackageManager = async (config) => {
|
|
|
102
135
|
try {
|
|
103
136
|
return await patchPnpmPackageManager(config);
|
|
104
137
|
} catch (err) {
|
|
105
|
-
log.warn("Failed to patch pnpm packageManager CI configuration.");
|
|
106
|
-
log.subtle(inspect(err));
|
|
138
|
+
import_logging.log.warn("Failed to patch pnpm packageManager CI configuration.");
|
|
139
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
107
140
|
return { result: "skip", reason: "due to an error" };
|
|
108
141
|
}
|
|
109
142
|
};
|
|
110
|
-
export
|
|
143
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
144
|
+
0 && (module.exports = {
|
|
111
145
|
tryPatchPnpmPackageManager
|
|
112
|
-
};
|
|
146
|
+
});
|
|
113
147
|
//# sourceMappingURL=patchPnpmPackageManager.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\nimport { lt } from 'semver';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst DOCKERFILE_COREPACK_COMMAND = 'RUN corepack enable pnpm';\nconst PACKAGE_JSON_MOUNT = `RUN --mount=type=bind,source=package.json,target=package.json \\\\\n corepack enable pnpm && corepack install`;\nconst PACKAGE_JSON_CACHE = '- package.json#.packageManager';\n\nconst BEFORE_PIPELINE_REGEX =\n /(\\s*cache-on:\\s*\\n\\s*-\\s*\\.npmrc\\s*\\n)((\\s*)-\\s*pnpm-lock\\.yaml)/gm;\nconst ECR_REGEX = /seek-oss\\/docker-ecr-cache#v([\\d\\.]+)/gm;\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst patchPnpmPackageManager: PatchFunction = async ({\n mode,\n manifest,\n packageManager,\n}): Promise<PatchReturnType> => {\n if (packageManager.command !== 'pnpm') {\n return {\n result: 'skip',\n reason: 'not using pnpm',\n };\n }\n\n if (\n !(\n manifest.packageJson as { packageManager?: string }\n ).packageManager?.includes('pnpm')\n ) {\n return {\n result: 'skip',\n reason: 'no packageManager declaration in package.json found',\n };\n }\n\n const [maybeDockerfiles, maybePipelines] = await Promise.all([\n fg(['Dockerfile*']),\n fg(['.buildkite/*.yml']),\n ]);\n\n if (!maybeDockerfiles.length || !maybePipelines.length) {\n return {\n result: 'skip',\n reason: 'Either dockerfiles or pipelines were not found',\n };\n }\n\n const [dockerfiles, pipelines] = await Promise.all([\n fetchFiles(maybeDockerfiles),\n fetchFiles(maybePipelines),\n ]);\n\n const dockerFilesToPatch = dockerfiles.filter(\n ({ contents }) =>\n contents.includes(DOCKERFILE_COREPACK_COMMAND) &&\n !contents.includes('target=package.json'),\n );\n\n const pipelinesToPatch = pipelines.filter(({ contents }) =>\n Boolean(BEFORE_PIPELINE_REGEX.exec(contents)),\n );\n\n if (!dockerFilesToPatch.length && !pipelinesToPatch.length) {\n return {\n result: 'skip',\n reason: 'no pipeline or dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n if (dockerFilesToPatch.length) {\n await Promise.all(\n dockerFilesToPatch.map(async ({ file, contents }) => {\n const patchedContent = contents.replace(\n DOCKERFILE_COREPACK_COMMAND,\n PACKAGE_JSON_MOUNT,\n );\n await fs.writeFile(file, patchedContent);\n }),\n );\n }\n\n if (pipelinesToPatch.length) {\n await Promise.all(\n pipelinesToPatch.map(async ({ file, contents }) => {\n const patchedContent = contents.replace(\n BEFORE_PIPELINE_REGEX,\n `$1$3${PACKAGE_JSON_CACHE}\\n$2`,\n );\n\n const patchedEcrContent = patchedContent.replace(\n ECR_REGEX,\n (match, version) => {\n if (typeof version === 'string' && lt(version, '2.2.0')) {\n return 'seek-oss/docker-ecr-cache#v2.2.0';\n }\n return match;\n },\n );\n\n await fs.writeFile(file, patchedEcrContent);\n }),\n );\n }\n\n return { result: 'apply' };\n};\n\nexport const tryPatchPnpmPackageManager: PatchFunction = async (config) => {\n try {\n return await patchPnpmPackageManager(config);\n } catch (err) {\n log.warn('Failed to patch pnpm packageManager CI configuration.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAe;AACf,sBAAe;AACf,oBAAmB;AAEnB,qBAAoB;AAGpB,MAAM,8BAA8B;AACpC,MAAM,qBAAqB;AAAA;AAE3B,MAAM,qBAAqB;AAE3B,MAAM,wBACJ;AACF,MAAM,YAAY;AAElB,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW,MAAM,gBAAAA,QAAG,SAAS,MAAM,MAAM;AAE/C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEF,MAAM,0BAAyC,OAAO;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,MAAgC;AAC9B,MAAI,eAAe,YAAY,QAAQ;AACrC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MACE,CACE,SAAS,YACT,gBAAgB,SAAS,MAAM,GACjC;AACA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,CAAC,kBAAkB,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC3D,iBAAAC,SAAG,CAAC,aAAa,CAAC;AAAA,QAClB,iBAAAA,SAAG,CAAC,kBAAkB,CAAC;AAAA,EACzB,CAAC;AAED,MAAI,CAAC,iBAAiB,UAAU,CAAC,eAAe,QAAQ;AACtD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,CAAC,aAAa,SAAS,IAAI,MAAM,QAAQ,IAAI;AAAA,IACjD,WAAW,gBAAgB;AAAA,IAC3B,WAAW,cAAc;AAAA,EAC3B,CAAC;AAED,QAAM,qBAAqB,YAAY;AAAA,IACrC,CAAC,EAAE,SAAS,MACV,SAAS,SAAS,2BAA2B,KAC7C,CAAC,SAAS,SAAS,qBAAqB;AAAA,EAC5C;AAEA,QAAM,mBAAmB,UAAU;AAAA,IAAO,CAAC,EAAE,SAAS,MACpD,QAAQ,sBAAsB,KAAK,QAAQ,CAAC;AAAA,EAC9C;AAEA,MAAI,CAAC,mBAAmB,UAAU,CAAC,iBAAiB,QAAQ;AAC1D,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,MAAI,mBAAmB,QAAQ;AAC7B,UAAM,QAAQ;AAAA,MACZ,mBAAmB,IAAI,OAAO,EAAE,MAAM,SAAS,MAAM;AACnD,cAAM,iBAAiB,SAAS;AAAA,UAC9B;AAAA,UACA;AAAA,QACF;AACA,cAAM,gBAAAD,QAAG,UAAU,MAAM,cAAc;AAAA,MACzC,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,iBAAiB,QAAQ;AAC3B,UAAM,QAAQ;AAAA,MACZ,iBAAiB,IAAI,OAAO,EAAE,MAAM,SAAS,MAAM;AACjD,cAAM,iBAAiB,SAAS;AAAA,UAC9B;AAAA,UACA,OAAO,kBAAkB;AAAA;AAAA,QAC3B;AAEA,cAAM,oBAAoB,eAAe;AAAA,UACvC;AAAA,UACA,CAAC,OAAO,YAAY;AAClB,gBAAI,OAAO,YAAY,gBAAY,kBAAG,SAAS,OAAO,GAAG;AACvD,qBAAO;AAAA,YACT;AACA,mBAAO;AAAA,UACT;AAAA,QACF;AAEA,cAAM,gBAAAA,QAAG,UAAU,MAAM,iBAAiB;AAAA,MAC5C,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,6BAA4C,OAAO,WAAW;AACzE,MAAI;AACF,WAAO,MAAM,wBAAwB,MAAM;AAAA,EAC7C,SAAS,KAAK;AACZ,uBAAI,KAAK,uDAAuD;AAChE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["fs", "fg"]
|
|
7
7
|
}
|