skuba 14.0.0-replace-global-vars-20251117052457 → 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 -21
- 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/index.js +0 -11
- 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 -5
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +0 -72
- 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,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_patchDockerfileCIVariable = require("./patchDockerfileCIVariable.js");
|
|
2
25
|
const patches = [
|
|
3
26
|
{
|
|
4
|
-
apply: tryPatchDockerfileCIVariable,
|
|
27
|
+
apply: import_patchDockerfileCIVariable.tryPatchDockerfileCIVariable,
|
|
5
28
|
description: "Remove Dockerfile syntax directives"
|
|
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/12.4.0/index.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchDockerfileCIVariable } from './patchDockerfileCIVariable.js';\n\nexport const patches: Patches = [\n {\n apply: tryPatchDockerfileCIVariable,\n description: 'Remove Dockerfile syntax directives',\n },\n];\n"],
|
|
5
|
-
"mappings": "AAEA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uCAA6C;AAEtC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,45 @@
|
|
|
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 patchDockerfileCIVariable_exports = {};
|
|
30
|
+
__export(patchDockerfileCIVariable_exports, {
|
|
31
|
+
patchDockerfileCIVariable: () => patchDockerfileCIVariable,
|
|
32
|
+
tryPatchDockerfileCIVariable: () => tryPatchDockerfileCIVariable
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(patchDockerfileCIVariable_exports);
|
|
35
|
+
var import_util = require("util");
|
|
36
|
+
var import_fast_glob = __toESM(require("fast-glob"));
|
|
37
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
|
+
var import_logging = require("../../../../../../utils/logging.js");
|
|
5
39
|
const pnpmInstallTestRegex = /^RUN pnpm install.*--prod/m;
|
|
6
40
|
const pnpmInstallReplaceRegex = /^RUN pnpm install.*--prod/gm;
|
|
7
41
|
const patchDockerfileCIVariable = async (mode) => {
|
|
8
|
-
const dockerfilePaths = await
|
|
42
|
+
const dockerfilePaths = await (0, import_fast_glob.default)(["**/Dockerfile*"], {
|
|
9
43
|
ignore: ["**/.git", "**/node_modules"]
|
|
10
44
|
});
|
|
11
45
|
if (dockerfilePaths.length === 0) {
|
|
@@ -16,7 +50,7 @@ const patchDockerfileCIVariable = async (mode) => {
|
|
|
16
50
|
}
|
|
17
51
|
const dockerfiles = await Promise.all(
|
|
18
52
|
dockerfilePaths.map(async (file) => {
|
|
19
|
-
const contents = await
|
|
53
|
+
const contents = await import_fs_extra.default.readFile(file, "utf8");
|
|
20
54
|
return {
|
|
21
55
|
file,
|
|
22
56
|
contents
|
|
@@ -43,7 +77,7 @@ const patchDockerfileCIVariable = async (mode) => {
|
|
|
43
77
|
pnpmInstallReplaceRegex,
|
|
44
78
|
(match) => match.replace("RUN pnpm", "RUN CI=true pnpm")
|
|
45
79
|
);
|
|
46
|
-
await
|
|
80
|
+
await import_fs_extra.default.writeFile(file, updatedContents, "utf8");
|
|
47
81
|
})
|
|
48
82
|
);
|
|
49
83
|
return {
|
|
@@ -54,13 +88,14 @@ const tryPatchDockerfileCIVariable = async ({ mode }) => {
|
|
|
54
88
|
try {
|
|
55
89
|
return await patchDockerfileCIVariable(mode);
|
|
56
90
|
} catch (err) {
|
|
57
|
-
log.warn("Failed to apply Dockerfile CI variable patch.");
|
|
58
|
-
log.subtle(inspect(err));
|
|
91
|
+
import_logging.log.warn("Failed to apply Dockerfile CI variable patch.");
|
|
92
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
59
93
|
return { result: "skip", reason: "due to an error" };
|
|
60
94
|
}
|
|
61
95
|
};
|
|
62
|
-
export
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
63
98
|
patchDockerfileCIVariable,
|
|
64
99
|
tryPatchDockerfileCIVariable
|
|
65
|
-
};
|
|
100
|
+
});
|
|
66
101
|
//# sourceMappingURL=patchDockerfileCIVariable.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst pnpmInstallTestRegex = /^RUN pnpm install.*--prod/m;\nconst pnpmInstallReplaceRegex = /^RUN pnpm install.*--prod/gm;\n\nexport const patchDockerfileCIVariable = async (\n mode: 'lint' | 'format',\n): Promise<PatchReturnType> => {\n const dockerfilePaths = await fg(['**/Dockerfile*'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (dockerfilePaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles found',\n };\n }\n\n const dockerfiles = await Promise.all(\n dockerfilePaths.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n const dockerfilesToPatch = dockerfiles.filter(({ contents }) =>\n pnpmInstallTestRegex.test(contents),\n );\n\n if (dockerfilesToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerfilesToPatch.map(async ({ file, contents }) => {\n const updatedContents = contents.replace(\n pnpmInstallReplaceRegex,\n (match) => match.replace('RUN pnpm', 'RUN CI=true pnpm'),\n );\n await fs.writeFile(file, updatedContents, 'utf8');\n }),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const tryPatchDockerfileCIVariable: PatchFunction = async ({ mode }) => {\n try {\n return await patchDockerfileCIVariable(mode);\n } catch (err) {\n log.warn('Failed to apply Dockerfile CI variable patch.');\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;AAAA,kBAAwB;AAExB,uBAAe;AACf,sBAAe;AAEf,qBAAoB;AAGpB,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAEzB,MAAM,4BAA4B,OACvC,SAC6B;AAC7B,QAAM,kBAAkB,UAAM,iBAAAA,SAAG,CAAC,gBAAgB,GAAG;AAAA,IACnD,QAAQ,CA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
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 configureTsConfigForESM_exports = {};
|
|
30
|
+
__export(configureTsConfigForESM_exports, {
|
|
31
|
+
addJestModuleNameMapper: () => addJestModuleNameMapper,
|
|
32
|
+
configureTsConfigForESM: () => configureTsConfigForESM,
|
|
33
|
+
parsePackageJson: () => parsePackageJson,
|
|
34
|
+
tryConfigureTsConfigForESM: () => tryConfigureTsConfigForESM,
|
|
35
|
+
updatePackageJson: () => updatePackageJson
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(configureTsConfigForESM_exports);
|
|
38
|
+
var import_path = __toESM(require("path"));
|
|
39
|
+
var import_util = require("util");
|
|
40
|
+
var import_fast_glob = require("fast-glob");
|
|
41
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
42
|
+
var import_typescript = __toESM(require("typescript"));
|
|
43
|
+
var z = __toESM(require("zod"));
|
|
44
|
+
var import__ = require("../../../../../../index.js");
|
|
45
|
+
var import_logging = require("../../../../../../utils/logging.js");
|
|
9
46
|
const packageJsonSchema = z.looseObject({
|
|
10
47
|
imports: z.record(z.string(), z.record(z.string(), z.string())).optional()
|
|
11
48
|
});
|
|
@@ -17,12 +54,12 @@ const tsConfigSchema = z.looseObject({
|
|
|
17
54
|
}).optional()
|
|
18
55
|
});
|
|
19
56
|
const fetchFiles = async (patterns) => {
|
|
20
|
-
const files = await glob(patterns, {
|
|
57
|
+
const files = await (0, import_fast_glob.glob)(patterns, {
|
|
21
58
|
ignore: ["**/.git", "**/node_modules"]
|
|
22
59
|
});
|
|
23
60
|
return Promise.all(
|
|
24
61
|
files.map(async (file) => {
|
|
25
|
-
const contents = await
|
|
62
|
+
const contents = await import_fs_extra.default.promises.readFile(file, "utf8");
|
|
26
63
|
return {
|
|
27
64
|
file,
|
|
28
65
|
contents
|
|
@@ -77,7 +114,7 @@ const addJestModuleNameMapper = (contents, srcPaths) => {
|
|
|
77
114
|
const newContents = contents.slice(0, insertionIndex) + moduleNameMapperString + contents.slice(insertionIndex);
|
|
78
115
|
return newContents;
|
|
79
116
|
}
|
|
80
|
-
log.warn(
|
|
117
|
+
import_logging.log.warn(
|
|
81
118
|
"Could not find a suitable place to insert moduleNameMapper in jest config"
|
|
82
119
|
);
|
|
83
120
|
return contents;
|
|
@@ -90,7 +127,7 @@ const parsePackageJson = (contents) => {
|
|
|
90
127
|
parsed: packageJsonSchema.parse(parsedJson)
|
|
91
128
|
};
|
|
92
129
|
} catch (error) {
|
|
93
|
-
log.warn(`Failed to parse package.json as JSON: ${String(error)}`);
|
|
130
|
+
import_logging.log.warn(`Failed to parse package.json as JSON: ${String(error)}`);
|
|
94
131
|
return null;
|
|
95
132
|
}
|
|
96
133
|
};
|
|
@@ -109,7 +146,7 @@ const updatePackageJson = ({
|
|
|
109
146
|
};
|
|
110
147
|
const parseTsconfig = (file, contents) => {
|
|
111
148
|
try {
|
|
112
|
-
const parsedJson =
|
|
149
|
+
const parsedJson = import_typescript.default.parseConfigFileTextToJson(file, contents);
|
|
113
150
|
const tsconfig = tsConfigSchema.parse(parsedJson.config);
|
|
114
151
|
return {
|
|
115
152
|
original: parsedJson.config,
|
|
@@ -117,7 +154,7 @@ const parseTsconfig = (file, contents) => {
|
|
|
117
154
|
srcPaths: tsconfig.compilerOptions?.paths?.["./src/*"] ?? []
|
|
118
155
|
};
|
|
119
156
|
} catch (error) {
|
|
120
|
-
log.warn(`Failed to parse root tsconfig.json as JSON: ${String(error)}`);
|
|
157
|
+
import_logging.log.warn(`Failed to parse root tsconfig.json as JSON: ${String(error)}`);
|
|
121
158
|
return null;
|
|
122
159
|
}
|
|
123
160
|
};
|
|
@@ -158,7 +195,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
158
195
|
}) => {
|
|
159
196
|
let customCondition;
|
|
160
197
|
try {
|
|
161
|
-
const { repo } = await Git.getOwnerAndRepo({ dir: process.cwd() });
|
|
198
|
+
const { repo } = await import__.Git.getOwnerAndRepo({ dir: process.cwd() });
|
|
162
199
|
customCondition = `@seek/${repo}/source`;
|
|
163
200
|
} catch {
|
|
164
201
|
return { result: "skip", reason: "no repository name found" };
|
|
@@ -201,10 +238,10 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
201
238
|
const match = regex.exec(p);
|
|
202
239
|
if (match?.[1] !== void 0) {
|
|
203
240
|
return [
|
|
204
|
-
|
|
241
|
+
import_path.default.join(import_path.default.dirname(file), match[1].replace(/\/?$/, ""))
|
|
205
242
|
];
|
|
206
243
|
}
|
|
207
|
-
log.warn(
|
|
244
|
+
import_logging.log.warn(
|
|
208
245
|
`Unexpected src path format in ${file}: ${p}. Expected format like "apps/api/src/*"`
|
|
209
246
|
);
|
|
210
247
|
return [];
|
|
@@ -216,7 +253,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
216
253
|
return { result: "skip", reason: "no src paths found" };
|
|
217
254
|
}
|
|
218
255
|
const packageJsonPatterns = allSrcPaths.map(
|
|
219
|
-
(srcPath) =>
|
|
256
|
+
(srcPath) => import_path.default.join(srcPath, "package.json")
|
|
220
257
|
);
|
|
221
258
|
const packageJsonFiles = await fetchFiles(packageJsonPatterns);
|
|
222
259
|
const parsedPackageJsonFiles = packageJsonFiles.flatMap(
|
|
@@ -227,7 +264,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
227
264
|
);
|
|
228
265
|
parsedPackageJsonFiles.forEach(({ parsed, file }) => {
|
|
229
266
|
updatePackageJson({ parsed, customCondition });
|
|
230
|
-
const relativeTsconfigPath =
|
|
267
|
+
const relativeTsconfigPath = import_path.default.join(import_path.default.dirname(file), "tsconfig.json");
|
|
231
268
|
const relativeTsconfig = updatedTsconfigFiles.find(
|
|
232
269
|
(tsconfig) => tsconfig.file === relativeTsconfigPath
|
|
233
270
|
);
|
|
@@ -235,12 +272,12 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
235
272
|
relativeTsconfig.parsed.compilerOptions ??= {};
|
|
236
273
|
relativeTsconfig.parsed.compilerOptions.rootDir ??= ".";
|
|
237
274
|
} else {
|
|
238
|
-
log.warn(
|
|
275
|
+
import_logging.log.warn(
|
|
239
276
|
`No corresponding tsconfig.json found for package.json at ${file}. Expected at ${relativeTsconfigPath}`
|
|
240
277
|
);
|
|
241
278
|
}
|
|
242
|
-
const relativeTsconfigBuildPath =
|
|
243
|
-
|
|
279
|
+
const relativeTsconfigBuildPath = import_path.default.join(
|
|
280
|
+
import_path.default.dirname(file),
|
|
244
281
|
"tsconfig.build.json"
|
|
245
282
|
);
|
|
246
283
|
const relativeTsconfigBuild = parsedTsconfigBuildFiles.find(
|
|
@@ -250,7 +287,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
250
287
|
relativeTsconfigBuild.parsed.compilerOptions ??= {};
|
|
251
288
|
relativeTsconfigBuild.parsed.compilerOptions.rootDir ??= "src";
|
|
252
289
|
} else {
|
|
253
|
-
log.warn(
|
|
290
|
+
import_logging.log.warn(
|
|
254
291
|
`No corresponding tsconfig.build.json found for package.json at ${file}. Expected at ${relativeTsconfigBuildPath}`
|
|
255
292
|
);
|
|
256
293
|
}
|
|
@@ -287,7 +324,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
287
324
|
return;
|
|
288
325
|
}
|
|
289
326
|
const updatedContents = JSON.stringify(parsed, null, 2);
|
|
290
|
-
await
|
|
327
|
+
await import_fs_extra.default.promises.writeFile(file, updatedContents);
|
|
291
328
|
})
|
|
292
329
|
);
|
|
293
330
|
const otherFilePromises = Promise.all(
|
|
@@ -295,7 +332,7 @@ const tryConfigureTsConfigForESM = async ({
|
|
|
295
332
|
if (original === parsed) {
|
|
296
333
|
return;
|
|
297
334
|
}
|
|
298
|
-
await
|
|
335
|
+
await import_fs_extra.default.promises.writeFile(file, parsed);
|
|
299
336
|
})
|
|
300
337
|
);
|
|
301
338
|
await Promise.all([jsonFilePromises, otherFilePromises]);
|
|
@@ -305,16 +342,17 @@ const configureTsConfigForESM = async (config) => {
|
|
|
305
342
|
try {
|
|
306
343
|
return await tryConfigureTsConfigForESM(config);
|
|
307
344
|
} catch (err) {
|
|
308
|
-
log.warn("Failed to write configure `tsconfig.json` and `package.json`");
|
|
309
|
-
log.subtle(inspect(err));
|
|
345
|
+
import_logging.log.warn("Failed to write configure `tsconfig.json` and `package.json`");
|
|
346
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
310
347
|
return { result: "skip", reason: "due to an error" };
|
|
311
348
|
}
|
|
312
349
|
};
|
|
313
|
-
export
|
|
350
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
351
|
+
0 && (module.exports = {
|
|
314
352
|
addJestModuleNameMapper,
|
|
315
353
|
configureTsConfigForESM,
|
|
316
354
|
parsePackageJson,
|
|
317
355
|
tryConfigureTsConfigForESM,
|
|
318
356
|
updatePackageJson
|
|
319
|
-
};
|
|
357
|
+
});
|
|
320
358
|
//# sourceMappingURL=configureTsConfigForESM.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\nimport ts from 'typescript';\nimport * as z from 'zod';\n\nimport { Git } from '../../../../../../index.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst packageJsonSchema = z.looseObject({\n imports: z.record(z.string(), z.record(z.string(), z.string())).optional(),\n});\n\ntype PackageJson = z.infer<typeof packageJsonSchema>;\n\nconst tsConfigSchema = z.looseObject({\n compilerOptions: z\n .looseObject({\n customConditions: z.array(z.string()).optional(),\n rootDir: z.string().optional(),\n paths: z\n .record(z.string(), z.union([z.array(z.string()), z.null()]))\n .optional(),\n })\n .optional(),\n});\n\ntype TsConfig = z.infer<typeof tsConfigSchema>;\n\nconst fetchFiles = async (patterns: string[]) => {\n const files = await glob(patterns, {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n return Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n};\n\nexport const addJestModuleNameMapper = (\n contents: string,\n srcPaths: string[],\n) => {\n if (!srcPaths.length) {\n return contents;\n }\n const moduleNameRegex = /moduleNameMapper:\\s*\\{([\\s\\S]*?)\\}/;\n const match = moduleNameRegex.exec(contents);\n\n const srcPathArray = srcPaths.map((subfolderPath) =>\n subfolderPath === '.' || subfolderPath === './'\n ? '<rootDir>/src/$1'\n : `<rootDir>/${subfolderPath}/src/$1`,\n );\n\n const srcModuleMappers = JSON.stringify({\n '^#src/(.*)\\\\.js$': srcPathArray,\n '^#src/(.*)$': srcPathArray,\n });\n\n // strip the surrounding { } from the JSON stringify result\n const newModuleNameMapper = srcModuleMappers\n .replace(/^{/, '')\n .replace(/}$/, '');\n\n if (match?.[1] !== undefined) {\n // insert srcModuleMappers into existing moduleNameMapper\n const existingModuleMappers = match[1];\n\n const optionalComma = !/[,\\s]*$/.test(existingModuleMappers) ? '' : ',';\n const newContents = `${contents.slice(\n 0,\n match.index,\n )}moduleNameMapper: {${existingModuleMappers}${optionalComma}${newModuleNameMapper}}${contents.slice(\n match.index + match[0].length,\n )}`;\n\n return newContents;\n }\n\n // match against function calls\n\n // Match function calls like moduleNameMapper: getMapper()\n const moduleNameMapperFunctionRegex =\n /moduleNameMapper:\\s*([a-zA-Z_$][\\w$]*(?:\\([^)]*\\))?)/;\n const functionMatch = moduleNameMapperFunctionRegex.exec(contents);\n\n if (functionMatch?.[1] !== undefined) {\n const functionBody = functionMatch[1];\n const optionalComma = !/[,\\s]*$/.test(functionBody) ? '' : ',';\n const newContents = `${contents.slice(\n 0,\n functionMatch.index,\n )}moduleNameMapper: {...${functionBody}${optionalComma}${newModuleNameMapper}}${contents.slice(\n functionMatch.index + functionMatch[0].length,\n )}}`;\n\n return newContents;\n }\n\n // Add moduleNameMapper if not present\n\n const insertionPointRegex = /(\\b(jest|export\\s+default)\\b[\\s\\S]*?{)/;\n const insertionMatch = insertionPointRegex.exec(contents);\n\n if (insertionMatch?.[1] !== undefined) {\n const insertionIndex = insertionMatch.index + insertionMatch[0].length;\n const moduleNameMapperString = `\\n moduleNameMapper: {${newModuleNameMapper}},`;\n\n const newContents =\n contents.slice(0, insertionIndex) +\n moduleNameMapperString +\n contents.slice(insertionIndex);\n\n return newContents;\n }\n\n log.warn(\n 'Could not find a suitable place to insert moduleNameMapper in jest config',\n );\n return contents;\n};\n\nexport const parsePackageJson = (\n contents: string,\n): {\n original: PackageJson;\n parsed: PackageJson;\n} | null => {\n try {\n const parsedJson: unknown = JSON.parse(contents);\n return {\n original: parsedJson as PackageJson,\n parsed: packageJsonSchema.parse(parsedJson),\n };\n } catch (error) {\n log.warn(`Failed to parse package.json as JSON: ${String(error)}`);\n return null;\n }\n};\n\nexport const updatePackageJson = ({\n parsed,\n customCondition,\n}: {\n parsed: PackageJson;\n customCondition: string;\n}) => {\n parsed.imports ??= {};\n parsed.imports['#src/*'] ??= {\n [customCondition]: './src/*',\n default: './lib/*',\n };\n\n return {\n parsed,\n };\n};\n\nconst parseTsconfig = (\n file: string,\n contents: string,\n): {\n original: TsConfig;\n parsed: TsConfig;\n srcPaths: string[];\n} | null => {\n try {\n const parsedJson = ts.parseConfigFileTextToJson(file, contents);\n const tsconfig = tsConfigSchema.parse(parsedJson.config);\n\n return {\n original: parsedJson.config as TsConfig,\n parsed: tsconfig,\n srcPaths: tsconfig.compilerOptions?.paths?.['./src/*'] ?? [],\n };\n } catch (error) {\n log.warn(`Failed to parse root tsconfig.json as JSON: ${String(error)}`);\n return null;\n }\n};\n\nconst updateTsConfig = ({\n parsed,\n customCondition,\n file,\n}: {\n parsed: TsConfig;\n customCondition: string;\n file: string;\n}) => {\n if (file === 'tsconfig.json') {\n parsed.compilerOptions ??= {};\n parsed.compilerOptions.customConditions ??= [];\n\n if (\n parsed.compilerOptions.customConditions.includes(customCondition) &&\n customCondition !== '@seek/skuba/source'\n ) {\n throw new Error(\n `Custom condition ${customCondition} already exists in tsconfig.json`,\n );\n }\n\n if (!parsed.compilerOptions.customConditions.includes(customCondition)) {\n parsed.compilerOptions.customConditions.push(customCondition);\n }\n }\n\n let srcPaths: string[] = [];\n ['./src/*', 'src/*', 'src'].forEach((key) => {\n if (parsed.compilerOptions?.paths?.[key]) {\n srcPaths = parsed.compilerOptions.paths[key];\n delete parsed.compilerOptions.paths[key];\n }\n });\n\n if (\n parsed.compilerOptions?.paths &&\n Object.keys(parsed.compilerOptions.paths).length === 0\n ) {\n delete parsed.compilerOptions.paths;\n }\n\n return {\n parsed,\n srcPaths,\n };\n};\n\nexport const tryConfigureTsConfigForESM: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n let customCondition: string;\n try {\n const { repo } = await Git.getOwnerAndRepo({ dir: process.cwd() });\n customCondition = `@seek/${repo}/source`;\n } catch {\n return { result: 'skip', reason: 'no repository name found' };\n }\n\n const tsconfigJsonPatterns = ['**/tsconfig.json'];\n const tsconfigBuildJsonPatterns = ['**/tsconfig.build.json'];\n const jestConfigPatterns = ['**/jest.config.ts', '**/jest.config.*.ts'];\n\n const [tsconfigJsonFiles, tsconfigBuildJsonFiles, jestConfigFiles] =\n await Promise.all([\n fetchFiles(tsconfigJsonPatterns),\n fetchFiles(tsconfigBuildJsonPatterns),\n fetchFiles(jestConfigPatterns),\n ]);\n\n const parsedTsconfigFiles = tsconfigJsonFiles.flatMap(\n ({ file, contents }) => {\n const parsed = parseTsconfig(file, contents);\n return parsed ? [{ file, ...parsed }] : [];\n },\n );\n\n const parsedTsconfigBuildFiles = tsconfigBuildJsonFiles.flatMap(\n ({ file, contents }) => {\n const parsed = parseTsconfig(file, contents);\n return parsed ? [{ file, ...parsed }] : [];\n },\n );\n\n if (parsedTsconfigFiles.length === 0) {\n return { result: 'skip', reason: 'no valid tsconfig.json files found' };\n }\n\n const updatedTsconfigFiles = parsedTsconfigFiles.map(\n ({ file, parsed, original }) => ({\n file,\n original,\n ...updateTsConfig({ parsed, customCondition, file }),\n }),\n );\n\n const allSrcPaths = [\n ...new Set(\n updatedTsconfigFiles.flatMap(({ srcPaths, file }) =>\n srcPaths.flatMap((p) => {\n const regex = /(.*)src\\/?\\*?$/;\n const match = regex.exec(p);\n if (match?.[1] !== undefined) {\n return [\n path.join(path.dirname(file), match[1].replace(/\\/?$/, '')),\n ];\n }\n\n log.warn(\n `Unexpected src path format in ${file}: ${p}. Expected format like \"apps/api/src/*\"`,\n );\n return [];\n }),\n ),\n ),\n ];\n\n if (!allSrcPaths.length) {\n return { result: 'skip', reason: 'no src paths found' };\n }\n\n // Fetch all package.json paths which may be in allSrcPaths\n const packageJsonPatterns = allSrcPaths.map((srcPath) =>\n path.join(srcPath, 'package.json'),\n );\n\n const packageJsonFiles = await fetchFiles(packageJsonPatterns);\n\n const parsedPackageJsonFiles = packageJsonFiles.flatMap(\n ({ file, contents }) => {\n const parsed = parsePackageJson(contents);\n return parsed ? [{ file, ...parsed }] : [];\n },\n );\n\n parsedPackageJsonFiles.forEach(({ parsed, file }) => {\n updatePackageJson({ parsed, customCondition });\n\n const relativeTsconfigPath = path.join(path.dirname(file), 'tsconfig.json');\n\n const relativeTsconfig = updatedTsconfigFiles.find(\n (tsconfig) => tsconfig.file === relativeTsconfigPath,\n );\n\n if (relativeTsconfig) {\n relativeTsconfig.parsed.compilerOptions ??= {};\n relativeTsconfig.parsed.compilerOptions.rootDir ??= '.';\n } else {\n log.warn(\n `No corresponding tsconfig.json found for package.json at ${file}. Expected at ${relativeTsconfigPath}`,\n );\n }\n\n const relativeTsconfigBuildPath = path.join(\n path.dirname(file),\n 'tsconfig.build.json',\n );\n\n const relativeTsconfigBuild = parsedTsconfigBuildFiles.find(\n (tsconfig) => tsconfig.file === relativeTsconfigBuildPath,\n );\n\n if (relativeTsconfigBuild) {\n relativeTsconfigBuild.parsed.compilerOptions ??= {};\n relativeTsconfigBuild.parsed.compilerOptions.rootDir ??= 'src';\n } else {\n log.warn(\n `No corresponding tsconfig.build.json found for package.json at ${file}. Expected at ${relativeTsconfigBuildPath}`,\n );\n }\n });\n\n const updatedJestConfigFiles = jestConfigFiles.map(({ file, contents }) => {\n const parsed = addJestModuleNameMapper(contents, allSrcPaths);\n return { file, original: contents, parsed };\n });\n\n const hasJestConfigsChanged = updatedJestConfigFiles.some(\n ({ parsed, original }) => original !== parsed,\n );\n\n const hasRelativeTsconfigBuildsChanged = parsedTsconfigBuildFiles.some(\n ({ original, parsed }) =>\n JSON.stringify(original) !== JSON.stringify(parsed),\n );\n\n const hasPackageJsonsChanged = parsedPackageJsonFiles.some(\n ({ original, parsed }) =>\n JSON.stringify(original) !== JSON.stringify(parsed),\n );\n\n const hasRootTsconfigChanged = updatedTsconfigFiles.some(\n ({ original, parsed }) =>\n JSON.stringify(original) !== JSON.stringify(parsed),\n );\n\n if (\n mode === 'lint' &&\n (hasRootTsconfigChanged ||\n hasPackageJsonsChanged ||\n hasRelativeTsconfigBuildsChanged ||\n hasJestConfigsChanged)\n ) {\n return { result: 'apply' };\n }\n\n if (\n !hasRootTsconfigChanged &&\n !hasPackageJsonsChanged &&\n !hasRelativeTsconfigBuildsChanged &&\n !hasJestConfigsChanged\n ) {\n return { result: 'skip', reason: 'no changes required' };\n }\n\n const jsonFilePromises = Promise.all(\n [\n ...updatedTsconfigFiles,\n ...parsedTsconfigBuildFiles,\n ...parsedPackageJsonFiles,\n ].map(async ({ file, parsed, original }) => {\n if (JSON.stringify(original) === JSON.stringify(parsed)) {\n return;\n }\n const updatedContents = JSON.stringify(parsed, null, 2);\n await fs.promises.writeFile(file, updatedContents);\n }),\n );\n\n const otherFilePromises = Promise.all(\n updatedJestConfigFiles.map(async ({ file, parsed, original }) => {\n if (original === parsed) {\n return;\n }\n await fs.promises.writeFile(file, parsed);\n }),\n );\n\n await Promise.all([jsonFilePromises, otherFilePromises]);\n\n return { result: 'apply' };\n};\n\nexport const configureTsConfigForESM: PatchFunction = async (config) => {\n try {\n return await tryConfigureTsConfigForESM(config);\n } catch (err) {\n log.warn('Failed to write configure `tsconfig.json` and `package.json`');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"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AS,UAAU,MAAM,MAAM;AAAA,IAC1C,CAAC;AAAA,EACH;AAEA,QAAM,QAAQ,IAAI,CAAC,kBAAkB,iBAAiB,CAAC;AAEvD,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,0BAAyC,OAAO,WAAW;AACtE,MAAI;AACF,WAAO,MAAM,2BAA2B,MAAM;AAAA,EAChD,SAAS,KAAK;AACZ,uBAAI,KAAK,8DAA8D;AACvE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["fs", "ts", "path"]
|
|
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_configureTsConfigForESM = require("./configureTsConfigForESM.js");
|
|
25
|
+
var import_patchApiDockerfiles = require("./patchApiDockerfiles.js");
|
|
26
|
+
var import_rewriteSrcImports = require("./rewriteSrcImports.js");
|
|
27
|
+
var import_updateLambdaConfigs = require("./updateLambdaConfigs.js");
|
|
5
28
|
const patches = [
|
|
6
29
|
{
|
|
7
|
-
apply: rewriteSrcImports,
|
|
30
|
+
apply: import_rewriteSrcImports.rewriteSrcImports,
|
|
8
31
|
description: "Rewrite all 'src' imports to be '#src'"
|
|
9
32
|
},
|
|
10
33
|
{
|
|
11
|
-
apply: configureTsConfigForESM,
|
|
34
|
+
apply: import_configureTsConfigForESM.configureTsConfigForESM,
|
|
12
35
|
description: "Configure `tsconfig.json`, `package.json` and `jest.config.ts` to support custom conditions"
|
|
13
36
|
},
|
|
14
37
|
{
|
|
15
|
-
apply: updateLambdaConfigs,
|
|
38
|
+
apply: import_updateLambdaConfigs.updateLambdaConfigs,
|
|
16
39
|
description: "Update lambda function configurations to support custom conditions"
|
|
17
40
|
},
|
|
18
41
|
{
|
|
19
|
-
apply: patchApiDockerfiles,
|
|
42
|
+
apply: import_patchApiDockerfiles.patchApiDockerfiles,
|
|
20
43
|
description: "Patch Dockerfiles to copy `package.json`"
|
|
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/12.4.1/index.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { configureTsConfigForESM } from './configureTsConfigForESM.js';\nimport { patchApiDockerfiles } from './patchApiDockerfiles.js';\nimport { rewriteSrcImports } from './rewriteSrcImports.js';\nimport { updateLambdaConfigs } from './updateLambdaConfigs.js';\n\nexport const patches: Patches = [\n {\n apply: rewriteSrcImports,\n description: \"Rewrite all 'src' imports to be '#src'\",\n },\n {\n apply: configureTsConfigForESM,\n description:\n 'Configure `tsconfig.json`, `package.json` and `jest.config.ts` to support custom conditions',\n },\n {\n apply: updateLambdaConfigs,\n description:\n 'Update lambda function configurations to support custom conditions',\n },\n {\n apply: patchApiDockerfiles,\n description: 'Patch Dockerfiles to copy `package.json`',\n },\n];\n"],
|
|
5
|
-
"mappings": "AAEA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qCAAwC;AACxC,iCAAoC;AACpC,+BAAkC;AAClC,iCAAoC;AAE7B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,43 @@
|
|
|
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 patchApiDockerfiles_exports = {};
|
|
30
|
+
__export(patchApiDockerfiles_exports, {
|
|
31
|
+
patchApiDockerfiles: () => patchApiDockerfiles
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(patchApiDockerfiles_exports);
|
|
34
|
+
var import_util = require("util");
|
|
35
|
+
var import_fast_glob = require("fast-glob");
|
|
36
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
+
var import_logging = require("../../../../../../utils/logging.js");
|
|
5
38
|
const fetchFiles = async (files) => Promise.all(
|
|
6
39
|
files.map(async (file) => {
|
|
7
|
-
const contents = await
|
|
40
|
+
const contents = await import_fs_extra.default.promises.readFile(file, "utf8");
|
|
8
41
|
return {
|
|
9
42
|
file,
|
|
10
43
|
contents
|
|
@@ -61,7 +94,7 @@ ${packageJsonCopyLine}`
|
|
|
61
94
|
return newContents;
|
|
62
95
|
};
|
|
63
96
|
const tryPatchApiDockerfiles = async (config) => {
|
|
64
|
-
const dockerfilePaths = await glob(["**/Dockerfile*"], {
|
|
97
|
+
const dockerfilePaths = await (0, import_fast_glob.glob)(["**/Dockerfile*"], {
|
|
65
98
|
ignore: ["**/.git", "**/node_modules"]
|
|
66
99
|
});
|
|
67
100
|
if (dockerfilePaths.length === 0) {
|
|
@@ -96,7 +129,7 @@ const tryPatchApiDockerfiles = async (config) => {
|
|
|
96
129
|
}
|
|
97
130
|
await Promise.all(
|
|
98
131
|
dockerFilesToPatch.map(
|
|
99
|
-
({ file, contents }) =>
|
|
132
|
+
({ file, contents }) => import_fs_extra.default.promises.writeFile(file, contents, "utf8")
|
|
100
133
|
)
|
|
101
134
|
);
|
|
102
135
|
return {
|
|
@@ -107,12 +140,13 @@ const patchApiDockerfiles = async (config) => {
|
|
|
107
140
|
try {
|
|
108
141
|
return await tryPatchApiDockerfiles(config);
|
|
109
142
|
} catch (err) {
|
|
110
|
-
log.warn("Failed to patch API dockerfiles");
|
|
111
|
-
log.subtle(inspect(err));
|
|
143
|
+
import_logging.log.warn("Failed to patch API dockerfiles");
|
|
144
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
112
145
|
return { result: "skip", reason: "due to an error" };
|
|
113
146
|
}
|
|
114
147
|
};
|
|
115
|
-
export
|
|
148
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
+
0 && (module.exports = {
|
|
116
150
|
patchApiDockerfiles
|
|
117
|
-
};
|
|
151
|
+
});
|
|
118
152
|
//# sourceMappingURL=patchApiDockerfiles.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst applyDockerfilePatch = (contents: string) => {\n const cmdLineRegex = /CMD\\s+\\[.*?\\]/ms;\n const cmdLineMatch = cmdLineRegex.exec(contents);\n const cmdLine = cmdLineMatch?.[0];\n\n if (!cmdLine) {\n return undefined;\n }\n\n // Extract the lib path from CMD line\n // Match patterns like \"./lib/\", \"apps/api/lib/\", \"lib/\"\n const libPathRegex = /\"([^\"]*\\/)?lib\\/[^\"]*\"/;\n const libPathMatch = libPathRegex.exec(cmdLine);\n\n if (!libPathMatch) {\n return undefined;\n }\n\n const fullPath = libPathMatch[1] || './';\n const libParentPath = fullPath.endsWith('/')\n ? fullPath.slice(0, -1)\n : fullPath;\n\n // If the path is empty or just './', the lib is in current directory\n const normalizedPath =\n libParentPath === '.' || libParentPath === '' ? '.' : libParentPath;\n\n // Try to find COPY with --from first\n const copyNodeModulesWithFromRegex =\n /^\\s*COPY\\s+--from=(\\S+)\\s+.*node_modules.*$/m;\n const copyNodeModulesWithFromMatch =\n copyNodeModulesWithFromRegex.exec(contents);\n\n // If no --from, try to find COPY without --from\n const copyNodeModulesWithoutFromRegex =\n /^\\s*COPY\\s+(?!--from).*node_modules.*$/m;\n const copyNodeModulesWithoutFromMatch =\n copyNodeModulesWithoutFromRegex.exec(contents);\n\n const copyNodeModulesMatch =\n copyNodeModulesWithFromMatch ?? copyNodeModulesWithoutFromMatch;\n const copyNodeModulesLine = copyNodeModulesMatch?.[0];\n const fromSource = copyNodeModulesWithFromMatch?.[1];\n\n if (!copyNodeModulesLine) {\n return undefined;\n }\n\n // Check if package.json is already being copied for this path\n const packageJsonPattern = normalizedPath === '.' ? '' : `${normalizedPath}/`;\n const packageJsonCopyPattern = fromSource\n ? new RegExp(\n `^\\\\s*COPY\\\\s+--from=${fromSource}\\\\s+.*${packageJsonPattern}package\\\\.json`,\n 'm',\n )\n : new RegExp(\n `^\\\\s*COPY\\\\s+(?!--from).*${packageJsonPattern}package\\\\.json`,\n 'm',\n );\n\n if (packageJsonCopyPattern.test(contents)) {\n return undefined;\n }\n\n let packageJsonCopyLine: string;\n if (fromSource) {\n packageJsonCopyLine =\n normalizedPath === '.'\n ? `COPY --from=${fromSource} /workdir/package.json package.json`\n : `COPY --from=${fromSource} /workdir/${normalizedPath}/package.json ${normalizedPath}/package.json`;\n } else {\n packageJsonCopyLine =\n normalizedPath === '.'\n ? 'COPY package.json package.json'\n : `COPY ${normalizedPath}/package.json ${normalizedPath}/package.json`;\n }\n\n const newContents = contents.replace(\n copyNodeModulesLine,\n `${copyNodeModulesLine}\\n${packageJsonCopyLine}`,\n );\n\n return newContents;\n};\n\nconst tryPatchApiDockerfiles = async (config: {\n mode: 'lint' | 'format';\n}): Promise<PatchReturnType> => {\n const dockerfilePaths = await glob(['**/Dockerfile*'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (dockerfilePaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no Dockerfiles found',\n };\n }\n\n const dockerfiles = await fetchFiles(dockerfilePaths);\n\n const dockerFilesToPatch = dockerfiles.flatMap(({ file, contents }) => {\n const newContents = applyDockerfilePatch(contents);\n if (!newContents || newContents === contents) {\n return [];\n }\n\n return [\n {\n file,\n contents: newContents,\n },\n ];\n });\n\n if (dockerFilesToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no Dockerfiles to patch',\n };\n }\n\n if (config.mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerFilesToPatch.map(({ file, contents }) =>\n fs.promises.writeFile(file, contents, 'utf8'),\n ),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const patchApiDockerfiles: PatchFunction = async (config) => {\n try {\n return await tryPatchApiDockerfiles(config);\n } catch (err) {\n log.warn('Failed to patch API dockerfiles');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n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I,CAAC,EAAE,MAAM,SAAS,MACvC,gBAAAA,QAAG,SAAS,UAAU,MAAM,UAAU,MAAM;AAAA,IAC9C;AAAA,EACF;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,sBAAqC,OAAO,WAAW;AAClE,MAAI;AACF,WAAO,MAAM,uBAAuB,MAAM;AAAA,EAC5C,SAAS,KAAK;AACZ,uBAAI,KAAK,iCAAiC;AAC1C,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["fs"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { PatchFunction } from '../../index.js';
|
|
2
|
-
export declare const fetchFiles: (files: string[]) => Promise<{
|
|
3
|
-
file: string;
|
|
4
|
-
contents: string;
|
|
5
|
-
}[]>;
|
|
6
2
|
export declare const hasSkubaDiveRegisterImportRegex: RegExp;
|
|
7
3
|
export declare const hasRelativeRegisterImportRegex: RegExp;
|
|
8
4
|
export declare const hasRelativeImportRegex: RegExp;
|