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
|
@@ -1,13 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var patchRenovateConfig_exports = {};
|
|
30
|
+
__export(patchRenovateConfig_exports, {
|
|
31
|
+
tryPatchRenovateConfig: () => tryPatchRenovateConfig
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(patchRenovateConfig_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 fleece = __toESM(require("golden-fleece"));
|
|
38
|
+
var z = __toESM(require("zod/v4"));
|
|
39
|
+
var import_logging = require("../../../utils/logging.js");
|
|
40
|
+
var import_project = require("../../configure/analysis/project.js");
|
|
41
|
+
var import_renovate = require("../../configure/modules/renovate.js");
|
|
42
|
+
var import_prettier = require("../../configure/processing/prettier.js");
|
|
43
|
+
var Git = __toESM(require("@skuba-lib/api/git"));
|
|
11
44
|
const EXISTING_REPO_PRESET_REGEX = /(github|local)>(seek-jobs|seekasia)\//;
|
|
12
45
|
const renovateConfigSchema = z.object({
|
|
13
46
|
extends: z.array(z.string())
|
|
@@ -30,9 +63,9 @@ const patchJson = async ({ filepath, input, presetToAdd }) => {
|
|
|
30
63
|
return;
|
|
31
64
|
}
|
|
32
65
|
config.data.extends.unshift(presetToAdd);
|
|
33
|
-
await
|
|
66
|
+
await import_fs_extra.default.promises.writeFile(
|
|
34
67
|
filepath,
|
|
35
|
-
await formatPrettier(JSON.stringify(config.data), { parser: "json" })
|
|
68
|
+
await (0, import_prettier.formatPrettier)(JSON.stringify(config.data), { parser: "json" })
|
|
36
69
|
);
|
|
37
70
|
return;
|
|
38
71
|
};
|
|
@@ -43,9 +76,9 @@ const patchJson5 = async ({ filepath, input, presetToAdd }) => {
|
|
|
43
76
|
return;
|
|
44
77
|
}
|
|
45
78
|
config.data.extends.unshift(presetToAdd);
|
|
46
|
-
await
|
|
79
|
+
await import_fs_extra.default.promises.writeFile(
|
|
47
80
|
filepath,
|
|
48
|
-
await formatPrettier(fleece.patch(input, config.data), { parser: "json5" })
|
|
81
|
+
await (0, import_prettier.formatPrettier)(fleece.patch(input, config.data), { parser: "json5" })
|
|
49
82
|
);
|
|
50
83
|
return;
|
|
51
84
|
};
|
|
@@ -54,7 +87,7 @@ const patchByFiletype = {
|
|
|
54
87
|
json5: patchJson5
|
|
55
88
|
};
|
|
56
89
|
const patchRenovateConfig = async (mode, dir) => {
|
|
57
|
-
const readFile = createDestinationFileReader(dir);
|
|
90
|
+
const readFile = (0, import_project.createDestinationFileReader)(dir);
|
|
58
91
|
const { owner } = await Git.getOwnerAndRepo({ dir });
|
|
59
92
|
const presetToAdd = ownerToRenovatePreset(owner);
|
|
60
93
|
if (!presetToAdd) {
|
|
@@ -64,7 +97,7 @@ const patchRenovateConfig = async (mode, dir) => {
|
|
|
64
97
|
};
|
|
65
98
|
}
|
|
66
99
|
const maybeConfigs = await Promise.all(
|
|
67
|
-
RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({
|
|
100
|
+
import_renovate.RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({
|
|
68
101
|
input: await readFile(filepath),
|
|
69
102
|
filepath
|
|
70
103
|
}))
|
|
@@ -90,7 +123,7 @@ const patchRenovateConfig = async (mode, dir) => {
|
|
|
90
123
|
const filetype = config.filepath.toLowerCase().endsWith(".json5") ? "json5" : "json";
|
|
91
124
|
const patchFile = patchByFiletype[filetype];
|
|
92
125
|
await patchFile({
|
|
93
|
-
filepath:
|
|
126
|
+
filepath: import_path.default.resolve(dir, config.filepath),
|
|
94
127
|
input: config.input,
|
|
95
128
|
presetToAdd
|
|
96
129
|
});
|
|
@@ -107,12 +140,13 @@ const tryPatchRenovateConfig = (async ({
|
|
|
107
140
|
}
|
|
108
141
|
return await patchRenovateConfig(mode, gitRoot);
|
|
109
142
|
} catch (err) {
|
|
110
|
-
log.warn("Failed to patch Renovate config.");
|
|
111
|
-
log.subtle(inspect(err));
|
|
143
|
+
import_logging.log.warn("Failed to patch Renovate config.");
|
|
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
|
tryPatchRenovateConfig
|
|
117
|
-
};
|
|
151
|
+
});
|
|
118
152
|
//# sourceMappingURL=patchRenovateConfig.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/lint/internalLints/patchRenovateConfig.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\nimport * as fleece from 'golden-fleece';\nimport * as z from 'zod/v4';\n\nimport { log } from '../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../configure/analysis/project.js';\nimport { RENOVATE_CONFIG_FILENAMES } from '../../configure/modules/renovate.js';\nimport { formatPrettier } from '../../configure/processing/prettier.js';\n\nimport type { PatchFunction, PatchReturnType } from './upgrade/index.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\nconst EXISTING_REPO_PRESET_REGEX = /(github|local)>(seek-jobs|seekasia)\\//;\n\ntype RenovateFiletype = 'json' | 'json5';\n\ntype RenovatePreset =\n | 'local>seekasia/renovate-config'\n | 'local>seek-jobs/renovate-config';\n\nconst renovateConfigSchema = z.object({\n extends: z.array(z.string()),\n});\n\nconst ownerToRenovatePreset = (owner: string): RenovatePreset | undefined => {\n const lowercaseOwner = owner.toLowerCase();\n\n switch (lowercaseOwner) {\n case 'seekasia':\n return 'local>seekasia/renovate-config';\n\n case 'seek-jobs':\n return 'local>seek-jobs/renovate-config';\n\n default:\n return;\n }\n};\n\ntype PatchFile = (props: {\n filepath: string;\n input: string;\n presetToAdd: RenovatePreset;\n}) => Promise<void>;\n\nconst patchJson: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const json: unknown = JSON.parse(input);\n\n const config = renovateConfigSchema.safeParse(json);\n\n if (!config.success) {\n return;\n }\n\n config.data.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n await formatPrettier(JSON.stringify(config.data), { parser: 'json' }),\n );\n\n return;\n};\n\nconst patchJson5: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const json: unknown = fleece.evaluate(input);\n\n const config = renovateConfigSchema.safeParse(json);\n\n if (!config.success) {\n return;\n }\n\n config.data.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n await formatPrettier(fleece.patch(input, config.data), { parser: 'json5' }),\n );\n\n return;\n};\n\nconst patchByFiletype: Record<RenovateFiletype, PatchFile> = {\n json: patchJson,\n json5: patchJson5,\n};\n\nconst patchRenovateConfig = async (\n mode: 'format' | 'lint',\n dir: string,\n): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(dir);\n\n const { owner } = await Git.getOwnerAndRepo({ dir });\n\n const presetToAdd = ownerToRenovatePreset(owner);\n\n if (!presetToAdd) {\n return {\n result: 'skip',\n reason: 'owner does not map to a SEEK preset',\n };\n }\n\n const maybeConfigs = await Promise.all(\n RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({\n input: await readFile(filepath),\n filepath,\n })),\n );\n\n const config = maybeConfigs.find((maybeConfig) => Boolean(maybeConfig.input));\n if (!config?.input) {\n return { result: 'skip', reason: 'no config found' };\n }\n\n if (\n // The file appears to mention the baseline preset for the configured Git\n // owner. This is a naive check for simplicity.\n config.input.includes(presetToAdd) ||\n // Ignore any renovate configuration which already extends a SEEK-Jobs or seekasia config\n EXISTING_REPO_PRESET_REGEX.exec(config.input)\n ) {\n return {\n result: 'skip',\n reason: 'config already has a SEEK preset',\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n const filetype: RenovateFiletype = config.filepath\n .toLowerCase()\n .endsWith('.json5')\n ? 'json5'\n : 'json';\n\n const patchFile = patchByFiletype[filetype];\n\n await patchFile({\n filepath: path.resolve(dir, config.filepath),\n input: config.input,\n presetToAdd,\n });\n\n return { result: 'apply' };\n};\n\nexport const tryPatchRenovateConfig = (async ({\n mode,\n dir = process.cwd(),\n}) => {\n try {\n // In a monorepo we may be invoked within a subdirectory, but we are working\n // with Renovate config that should be relative to the repository root.\n const gitRoot = await Git.findRoot({ dir });\n if (!gitRoot) {\n return { result: 'skip', reason: 'no Git root found' };\n }\n\n return await patchRenovateConfig(mode, gitRoot);\n } catch (err) {\n log.warn('Failed to patch Renovate config.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n}) satisfies PatchFunction;\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AACf,aAAwB;AACxB,QAAmB;AAEnB,qBAAoB;AACpB,qBAA4C;AAC5C,sBAA0C;AAC1C,sBAA+B;AAI/B,UAAqB;AAErB,MAAM,6BAA6B;AAQnC,MAAM,uBAAuB,EAAE,OAAO;AAAA,EACpC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;AAC7B,CAAC;AAED,MAAM,wBAAwB,CAAC,UAA8C;AAC3E,QAAM,iBAAiB,MAAM,YAAY;AAEzC,UAAQ,gBAAgB;AAAA,IACtB,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET;AACE;AAAA,EACJ;AACF;AAQA,MAAM,YAAuB,OAAO,EAAE,UAAU,OAAO,YAAY,MAAM;AACvE,QAAM,OAAgB,KAAK,MAAM,KAAK;AAEtC,QAAM,SAAS,qBAAqB,UAAU,IAAI;A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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 refreshConfigFiles_exports = {};
|
|
30
|
+
__export(refreshConfigFiles_exports, {
|
|
31
|
+
REFRESHABLE_CONFIG_FILES: () => REFRESHABLE_CONFIG_FILES,
|
|
32
|
+
refreshConfigFiles: () => refreshConfigFiles,
|
|
33
|
+
tryRefreshConfigFiles: () => tryRefreshConfigFiles
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(refreshConfigFiles_exports);
|
|
36
|
+
var import_path = __toESM(require("path"));
|
|
37
|
+
var import_util = require("util");
|
|
38
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
39
|
+
var import__ = require("../../../index.js");
|
|
40
|
+
var import_dir = require("../../../utils/dir.js");
|
|
41
|
+
var import_packageManager = require("../../../utils/packageManager.js");
|
|
42
|
+
var import_template = require("../../../utils/template.js");
|
|
43
|
+
var import_package = require("../../configure/analysis/package.js");
|
|
44
|
+
var import_project = require("../../configure/analysis/project.js");
|
|
45
|
+
var import_configFile = require("../../configure/processing/configFile.js");
|
|
16
46
|
const OLD_IGNORE_WARNING = `# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.
|
|
17
47
|
# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.
|
|
18
48
|
# You can use \`skuba format\` to generate the file or otherwise commit an empty file.
|
|
@@ -41,13 +71,13 @@ const REFRESHABLE_CONFIG_FILES = [
|
|
|
41
71
|
];
|
|
42
72
|
const refreshConfigFiles = async (mode, logger) => {
|
|
43
73
|
const [manifest, gitRoot, workspaceRoot, currentWorkspaceProjectRoot] = await Promise.all([
|
|
44
|
-
getDestinationManifest(),
|
|
45
|
-
Git.findRoot({ dir: process.cwd() }),
|
|
46
|
-
findWorkspaceRoot(),
|
|
47
|
-
findCurrentWorkspaceProjectRoot()
|
|
74
|
+
(0, import_package.getDestinationManifest)(),
|
|
75
|
+
import__.Git.findRoot({ dir: process.cwd() }),
|
|
76
|
+
(0, import_dir.findWorkspaceRoot)(),
|
|
77
|
+
(0, import_dir.findCurrentWorkspaceProjectRoot)()
|
|
48
78
|
]);
|
|
49
|
-
const destinationRoot =
|
|
50
|
-
const readDestinationFile = createDestinationFileReader(destinationRoot);
|
|
79
|
+
const destinationRoot = import_path.default.dirname(manifest.path);
|
|
80
|
+
const readDestinationFile = (0, import_project.createDestinationFileReader)(destinationRoot);
|
|
51
81
|
const refreshConfigFile = async ({
|
|
52
82
|
name: filename,
|
|
53
83
|
type: fileType,
|
|
@@ -60,10 +90,10 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
60
90
|
const maybeReadPackageJson = async (type) => type === "pnpm-workspace" ? await readDestinationFile("package.json") : void 0;
|
|
61
91
|
const [inputFile, templateFile, isGitIgnored, packageJson] = await Promise.all([
|
|
62
92
|
readDestinationFile(filename),
|
|
63
|
-
readBaseTemplateFile(`_${filename}`),
|
|
64
|
-
gitRoot ? Git.isFileGitIgnored({
|
|
93
|
+
(0, import_template.readBaseTemplateFile)(`_${filename}`),
|
|
94
|
+
gitRoot ? import__.Git.isFileGitIgnored({
|
|
65
95
|
gitRoot,
|
|
66
|
-
absolutePath:
|
|
96
|
+
absolutePath: import_path.default.join(destinationRoot, filename)
|
|
67
97
|
}) : false,
|
|
68
98
|
maybeReadPackageJson(fileType)
|
|
69
99
|
]);
|
|
@@ -71,15 +101,15 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
71
101
|
return { needsChange: false };
|
|
72
102
|
}
|
|
73
103
|
const data = additionalMapping(
|
|
74
|
-
inputFile ? mergeWithConfigFile(templateFile, fileType, packageJson)(inputFile) : templateFile,
|
|
104
|
+
inputFile ? (0, import_configFile.mergeWithConfigFile)(templateFile, fileType, packageJson)(inputFile) : templateFile,
|
|
75
105
|
packageManager
|
|
76
106
|
);
|
|
77
|
-
const filepath =
|
|
107
|
+
const filepath = import_path.default.join(destinationRoot, filename);
|
|
78
108
|
if (mode === "format") {
|
|
79
109
|
if (data === inputFile) {
|
|
80
110
|
return { needsChange: false };
|
|
81
111
|
}
|
|
82
|
-
await
|
|
112
|
+
await import_fs_extra.default.writeFile(filepath, data);
|
|
83
113
|
return {
|
|
84
114
|
needsChange: false,
|
|
85
115
|
msg: `Refreshed ${logger.bold(filename)}.`,
|
|
@@ -99,7 +129,7 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
99
129
|
}
|
|
100
130
|
return { needsChange: false };
|
|
101
131
|
};
|
|
102
|
-
const packageManager = await detectPackageManager(destinationRoot);
|
|
132
|
+
const packageManager = await (0, import_packageManager.detectPackageManager)(destinationRoot);
|
|
103
133
|
const results = await Promise.all(
|
|
104
134
|
REFRESHABLE_CONFIG_FILES.map(
|
|
105
135
|
(conf) => refreshConfigFile(conf, {
|
|
@@ -121,7 +151,7 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
121
151
|
({ needsChange, filename, msg }) => needsChange && msg ? [
|
|
122
152
|
{
|
|
123
153
|
path: filename,
|
|
124
|
-
message:
|
|
154
|
+
message: (0, import_util.stripVTControlCharacters)(msg)
|
|
125
155
|
}
|
|
126
156
|
] : []
|
|
127
157
|
)
|
|
@@ -132,7 +162,7 @@ const tryRefreshConfigFiles = async (mode, logger) => {
|
|
|
132
162
|
return await refreshConfigFiles(mode, logger);
|
|
133
163
|
} catch (err) {
|
|
134
164
|
logger.warn("Failed to refresh config files.");
|
|
135
|
-
logger.subtle(inspect(err));
|
|
165
|
+
logger.subtle((0, import_util.inspect)(err));
|
|
136
166
|
return {
|
|
137
167
|
ok: false,
|
|
138
168
|
fixable: false,
|
|
@@ -140,9 +170,10 @@ const tryRefreshConfigFiles = async (mode, logger) => {
|
|
|
140
170
|
};
|
|
141
171
|
}
|
|
142
172
|
};
|
|
143
|
-
export
|
|
173
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
174
|
+
0 && (module.exports = {
|
|
144
175
|
REFRESHABLE_CONFIG_FILES,
|
|
145
176
|
refreshConfigFiles,
|
|
146
177
|
tryRefreshConfigFiles
|
|
147
|
-
};
|
|
178
|
+
});
|
|
148
179
|
//# sourceMappingURL=refreshConfigFiles.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/lint/internalLints/refreshConfigFiles.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\nimport { inspect, stripVTControlCharacters as stripAnsi } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../index.js';\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../utils/dir.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../utils/packageManager.js';\nimport { readBaseTemplateFile } from '../../../utils/template.js';\nimport { getDestinationManifest } from '../../configure/analysis/package.js';\nimport { createDestinationFileReader } from '../../configure/analysis/project.js';\nimport { mergeWithConfigFile } from '../../configure/processing/configFile.js';\nimport type { InternalLintResult } from '../internal.js';\n\ntype ConditionOptions = {\n packageManager: PackageManagerConfig;\n isInWorkspaceRoot: boolean;\n};\n\ntype RefreshableConfigFile = {\n name: string;\n type: 'ignore' | 'pnpm-workspace';\n additionalMapping?: (\n s: string,\n packageManager: PackageManagerConfig,\n ) => string;\n if?: (options: ConditionOptions) => boolean;\n};\n\nconst OLD_IGNORE_WARNING = `# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.\n# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.\n# You can use \\`skuba format\\` to generate the file or otherwise commit an empty file.\n# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.\n.npmrc\n`;\n\nconst removeOldWarning = (contents: string) =>\n contents.includes(OLD_IGNORE_WARNING)\n ? `${contents.replace(OLD_IGNORE_WARNING, '').trim()}\\n`\n : contents;\n\nexport const REFRESHABLE_CONFIG_FILES: RefreshableConfigFile[] = [\n {\n name: '.gitignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n { name: '.prettierignore', type: 'ignore' },\n {\n name: 'pnpm-workspace.yaml',\n type: 'pnpm-workspace',\n if: ({ packageManager, isInWorkspaceRoot }) =>\n isInWorkspaceRoot && packageManager.command === 'pnpm',\n },\n {\n name: '.dockerignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n];\n\nexport const refreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n) => {\n const [manifest, gitRoot, workspaceRoot, currentWorkspaceProjectRoot] =\n await Promise.all([\n getDestinationManifest(),\n Git.findRoot({ dir: process.cwd() }),\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshConfigFile = async (\n {\n name: filename,\n type: fileType,\n additionalMapping = (s) => s,\n if: condition = () => true,\n }: RefreshableConfigFile,\n conditionOptions: ConditionOptions,\n ) => {\n if (!condition(conditionOptions)) {\n return { needsChange: false };\n }\n\n const maybeReadPackageJson = async (type: RefreshableConfigFile['type']) =>\n type === 'pnpm-workspace'\n ? await readDestinationFile('package.json')\n : undefined;\n\n const [inputFile, templateFile, isGitIgnored, packageJson] =\n await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n gitRoot\n ? Git.isFileGitIgnored({\n gitRoot,\n absolutePath: path.join(destinationRoot, filename),\n })\n : false,\n maybeReadPackageJson(fileType),\n ]);\n\n // If the file is gitignored and doesn't exist, don't make it\n if (inputFile === undefined && isGitIgnored) {\n return { needsChange: false };\n }\n\n const data = additionalMapping(\n inputFile\n ? mergeWithConfigFile(templateFile, fileType, packageJson)(inputFile)\n : templateFile,\n packageManager,\n );\n\n const filepath = path.join(destinationRoot, filename);\n\n if (mode === 'format') {\n if (data === inputFile) {\n return { needsChange: false };\n }\n\n await fs.writeFile(filepath, data);\n return {\n needsChange: false,\n msg: `Refreshed ${logger.bold(filename)}.`,\n filename,\n };\n }\n\n if (data !== inputFile) {\n return {\n needsChange: true,\n msg: `The ${logger.bold(\n filename,\n )} file is out of date. Run \\`${logger.bold(\n `${packageManager.print.exec} skuba format`,\n )}\\` to update it.`,\n filename,\n };\n }\n\n return { needsChange: false };\n };\n\n const packageManager = await detectPackageManager(destinationRoot);\n\n const results = await Promise.all(\n REFRESHABLE_CONFIG_FILES.map((conf) =>\n refreshConfigFile(conf, {\n packageManager,\n isInWorkspaceRoot: workspaceRoot === currentWorkspaceProjectRoot,\n }),\n ),\n );\n\n // Log after for reproducible test output ordering\n results.forEach((result) => {\n if (result.msg) {\n logger.warn(result.msg);\n }\n });\n\n const anyNeedChanging = results.some(({ needsChange }) => needsChange);\n\n return {\n ok: !anyNeedChanging,\n fixable: anyNeedChanging,\n annotations: results.flatMap(({ needsChange, filename, msg }) =>\n needsChange && msg\n ? [\n {\n path: filename,\n message: stripAnsi(msg),\n },\n ]\n : [],\n ),\n };\n};\n\nexport const tryRefreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n try {\n return await refreshConfigFiles(mode, logger);\n } catch (err) {\n logger.warn('Failed to refresh config files.');\n logger.subtle(inspect(err));\n\n return {\n ok: false,\n fixable: false,\n annotations: [],\n };\n }\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA+D;AAE/D,sBAAe;AAEf,eAAoB;AACpB,iBAGO;AAEP,4BAGO;AACP,sBAAqC;AACrC,qBAAuC;AACvC,qBAA4C;AAC5C,wBAAoC;AAkBpC,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAO3B,MAAM,mBAAmB,CAAC,aACxB,SAAS,SAAS,kBAAkB,IAChC,GAAG,SAAS,QAAQ,oBAAoB,EAAE,EAAE,KAAK,CAAC;AAAA,IAClD;AAEC,MAAM,2BAAoD;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,mBAAmB;AAAA,EACrB;AAAA,EACA,EAAE,MAAM,mBAAmB,MAAM,SAAS;AAAA,EAC1C;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,IAAI,CAAC,EAAE,g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M,wBAAwB,OACnC,MACA,WACgC;AAChC,MAAI;AACF,WAAO,MAAM,mBAAmB,MAAM,MAAM;AAAA,EAC9C,SAAS,KAAK;AACZ,WAAO,KAAK,iCAAiC;AAC7C,WAAO,WAAO,qBAAQ,GAAG,CAAC;AAE1B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["path", "fs", "stripAnsi"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ReadResult } from 'read-pkg-up';
|
|
1
2
|
import type { Logger } from '../../../../utils/logging.js';
|
|
2
3
|
import { type PackageManagerConfig } from '../../../../utils/packageManager.js';
|
|
3
|
-
import type { ReadResult } from '../../../configure/types.js';
|
|
4
4
|
import type { InternalLintResult } from '../../internal.js';
|
|
5
5
|
export type Patches = Patch[];
|
|
6
6
|
export type Patch = {
|
|
@@ -20,4 +20,8 @@ export type PatchConfig = {
|
|
|
20
20
|
dir?: string;
|
|
21
21
|
};
|
|
22
22
|
export type PatchFunction = (config: PatchConfig) => Promise<PatchReturnType>;
|
|
23
|
-
|
|
23
|
+
type UpgradeSkubaResult = InternalLintResult & {
|
|
24
|
+
upgraded?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const upgradeSkuba: (mode: "lint" | "format", logger: Logger, additionalFlags?: string[]) => Promise<UpgradeSkubaResult>;
|
|
27
|
+
export {};
|
|
@@ -1,22 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 upgrade_exports = {};
|
|
30
|
+
__export(upgrade_exports, {
|
|
31
|
+
upgradeSkuba: () => upgradeSkuba
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(upgrade_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
|
+
var import_semver = require("semver");
|
|
37
|
+
var import_manifest = require("../../../../utils/manifest.js");
|
|
38
|
+
var import_packageManager = require("../../../../utils/packageManager.js");
|
|
39
|
+
var import_version = require("../../../../utils/version.js");
|
|
40
|
+
var import_package = require("../../../configure/processing/package.js");
|
|
10
41
|
const getPatches = async (manifestVersion) => {
|
|
11
|
-
const patches = await
|
|
42
|
+
const patches = await import_fs_extra.default.readdir(import_path.default.join(__dirname, "patches"), {
|
|
12
43
|
withFileTypes: true
|
|
13
44
|
});
|
|
14
|
-
const patchesForVersion = sort(
|
|
45
|
+
const patchesForVersion = (0, import_semver.sort)(
|
|
15
46
|
patches.flatMap(
|
|
16
47
|
(patch) => (
|
|
17
48
|
// Is a directory rather than a JavaScript source file
|
|
18
49
|
patch.isDirectory() && // Has been added since the last patch run on the project
|
|
19
|
-
gte(patch.name, manifestVersion) ? patch.name : []
|
|
50
|
+
(0, import_semver.gte)(patch.name, manifestVersion) ? patch.name : []
|
|
20
51
|
)
|
|
21
52
|
)
|
|
22
53
|
);
|
|
@@ -34,16 +65,16 @@ const resolvePatches = async (version) => {
|
|
|
34
65
|
};
|
|
35
66
|
const upgradeSkuba = async (mode, logger, additionalFlags = []) => {
|
|
36
67
|
const [currentVersion, manifest, packageManager] = await Promise.all([
|
|
37
|
-
getSkubaVersion(),
|
|
38
|
-
getConsumerManifest(),
|
|
39
|
-
detectPackageManager()
|
|
68
|
+
(0, import_version.getSkubaVersion)(),
|
|
69
|
+
(0, import_manifest.getConsumerManifest)(),
|
|
70
|
+
(0, import_packageManager.detectPackageManager)()
|
|
40
71
|
]);
|
|
41
72
|
if (!manifest) {
|
|
42
73
|
throw new Error("Could not find a package json for this project");
|
|
43
74
|
}
|
|
44
75
|
manifest.packageJson.skuba ??= { version: "1.0.0" };
|
|
45
76
|
const manifestVersion = additionalFlags.includes("--force-apply-all-patches") ? "1.0.0" : manifest.packageJson.skuba.version;
|
|
46
|
-
if (gte(manifestVersion, currentVersion)) {
|
|
77
|
+
if ((0, import_semver.gte)(manifestVersion, currentVersion)) {
|
|
47
78
|
return { ok: true, fixable: false };
|
|
48
79
|
}
|
|
49
80
|
const patches = await getPatches(manifestVersion);
|
|
@@ -97,23 +128,24 @@ const upgradeSkuba = async (mode, logger, additionalFlags = []) => {
|
|
|
97
128
|
logger.plain(`Patch applied: ${description}`);
|
|
98
129
|
}
|
|
99
130
|
}
|
|
100
|
-
const updatedManifest = await getConsumerManifest();
|
|
131
|
+
const updatedManifest = await (0, import_manifest.getConsumerManifest)();
|
|
101
132
|
if (!updatedManifest) {
|
|
102
133
|
throw new Error("Could not find a package json for this project");
|
|
103
134
|
}
|
|
104
|
-
updatedManifest.packageJson.skuba ??= { version: currentVersion };
|
|
105
135
|
updatedManifest.packageJson.skuba.version = currentVersion;
|
|
106
|
-
const updatedPackageJson = await formatPackage(updatedManifest.packageJson);
|
|
107
|
-
await
|
|
136
|
+
const updatedPackageJson = await (0, import_package.formatPackage)(updatedManifest.packageJson);
|
|
137
|
+
await import_fs_extra.default.writeFile(updatedManifest.path, updatedPackageJson);
|
|
108
138
|
logger.newline();
|
|
109
139
|
logger.plain("skuba update complete.");
|
|
110
140
|
logger.newline();
|
|
111
141
|
return {
|
|
112
142
|
ok: true,
|
|
113
|
-
fixable: false
|
|
143
|
+
fixable: false,
|
|
144
|
+
upgraded: true
|
|
114
145
|
};
|
|
115
146
|
};
|
|
116
|
-
export
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
117
149
|
upgradeSkuba
|
|
118
|
-
};
|
|
150
|
+
});
|
|
119
151
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/internalLints/upgrade/index.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport { gte, sort } from 'semver';\n\nimport type { Logger } from '../../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../../utils/manifest.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../../utils/packageManager.js';\nimport { getSkubaVersion } from '../../../../utils/version.js';\nimport { formatPackage } from '../../../configure/processing/package.js';\nimport type {
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type { ReadResult } from 'read-pkg-up';\nimport { gte, sort } from 'semver';\n\nimport type { Logger } from '../../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../../utils/manifest.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../../utils/packageManager.js';\nimport { getSkubaVersion } from '../../../../utils/version.js';\nimport { formatPackage } from '../../../configure/processing/package.js';\nimport type { SkubaPackageJson } from '../../../init/writePackageJson.js';\nimport type { InternalLintResult } from '../../internal.js';\n\nexport type Patches = Patch[];\nexport type Patch = {\n apply: PatchFunction;\n description: string;\n};\nexport type PatchReturnType =\n | { result: 'apply' }\n | { result: 'skip'; reason?: string };\n\nexport type PatchConfig = {\n mode: 'format' | 'lint';\n manifest: ReadResult;\n packageManager: PackageManagerConfig;\n dir?: string;\n};\n\nexport type PatchFunction = (config: PatchConfig) => Promise<PatchReturnType>;\n\nconst getPatches = async (manifestVersion: string): Promise<Patches> => {\n const patches = await fs.readdir(path.join(__dirname, 'patches'), {\n withFileTypes: true,\n });\n\n // The patches are sorted by the version they were added from.\n // Only return patches that are newer or equal to the current version.\n const patchesForVersion = sort(\n patches.flatMap((patch) =>\n // Is a directory rather than a JavaScript source file\n patch.isDirectory() &&\n // Has been added since the last patch run on the project\n gte(patch.name, manifestVersion)\n ? patch.name\n : [],\n ),\n );\n\n return (await Promise.all(patchesForVersion.map(resolvePatches))).flat();\n};\n\nconst fileExtensions = ['js', 'ts'];\n\n// Hack to allow our Jest environment/transform to resolve the patches\n// In normal scenarios this will resolve immediately after the .js import\nconst resolvePatches = async (version: string): Promise<Patches> => {\n for (const extension of fileExtensions) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (await import(`./patches/${version}/index.${extension}`)).patches;\n } catch {\n // Ignore\n }\n }\n throw new Error(`Could not resolve patches for ${version}`);\n};\n\ntype UpgradeSkubaResult = InternalLintResult & {\n upgraded?: boolean;\n};\n\nexport const upgradeSkuba = async (\n mode: 'lint' | 'format',\n logger: Logger,\n additionalFlags: string[] = [],\n): Promise<UpgradeSkubaResult> => {\n const [currentVersion, manifest, packageManager] = await Promise.all([\n getSkubaVersion(),\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n throw new Error('Could not find a package json for this project');\n }\n\n manifest.packageJson.skuba ??= { version: '1.0.0' };\n\n const manifestVersion = additionalFlags.includes('--force-apply-all-patches')\n ? '1.0.0'\n : (manifest.packageJson.skuba as SkubaPackageJson).version;\n\n // We are up to date, skip patches\n if (gte(manifestVersion, currentVersion)) {\n return { ok: true, fixable: false };\n }\n\n const patches = await getPatches(manifestVersion);\n // No patches to apply even if version out of date. Early exit to avoid unnecessary commits.\n if (patches.length === 0) {\n return { ok: true, fixable: false };\n }\n\n if (mode === 'lint') {\n const results = await Promise.all(\n patches.map(\n async ({ apply }) =>\n await apply({\n mode,\n manifest,\n packageManager,\n }),\n ),\n );\n\n // No patches are applicable. Early exit to avoid unnecessary commits.\n if (results.every(({ result }) => result === 'skip')) {\n return { ok: true, fixable: false };\n }\n\n logger.warn(\n `skuba has patches to apply. Run ${logger.bold(\n `${packageManager.print.exec} skuba format`,\n )} to run them.`,\n );\n\n return {\n ok: false,\n fixable: true,\n annotations: [\n {\n // package.json as likely skuba version has changed\n // TODO: locate the \"skuba\": {} config in the package.json and annotate on the version property\n path: manifest.path,\n message: `skuba has patches to apply. Run ${packageManager.print.exec} skuba format to run them.`,\n },\n ],\n };\n }\n\n logger.plain('Updating skuba...');\n\n // Run these in series in case a subsequent patch relies on a previous patch\n for (const { apply, description } of patches) {\n const result = await apply({\n mode,\n manifest,\n packageManager,\n });\n logger.newline();\n if (result.result === 'skip') {\n logger.plain(\n `Patch skipped: ${description}${\n result.reason ? ` - ${result.reason}` : ''\n }`,\n );\n } else {\n logger.plain(`Patch applied: ${description}`);\n }\n }\n\n const updatedManifest = await getConsumerManifest();\n if (!updatedManifest) {\n throw new Error('Could not find a package json for this project');\n }\n\n (updatedManifest.packageJson.skuba as SkubaPackageJson).version =\n currentVersion;\n\n const updatedPackageJson = await formatPackage(updatedManifest.packageJson);\n\n await fs.writeFile(updatedManifest.path, updatedPackageJson);\n logger.newline();\n logger.plain('skuba update complete.');\n logger.newline();\n\n return {\n ok: true,\n fixable: false,\n upgraded: true,\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAEf,oBAA0B;AAG1B,sBAAoC;AACpC,4BAGO;AACP,qBAAgC;AAChC,qBAA8B;AAsB9B,MAAM,aAAa,OAAO,oBAA8C;AACtE,QAAM,UAAU,MAAM,gBAAAA,QAAG,QAAQ,YAAAC,QAAK,KAAK,WAAW,SAAS,GAAG;AAAA,IAChE,eAAe;AAAA,EACjB,CAAC;AAID,QAAM,wBAAoB;AAAA,IACxB,QAAQ;AAAA,MAAQ,CAAC;AAAA;AAAA,QAEf,MAAM,YAAY;AAAA,YAElB,mBAAI,MAAM,MAAM,eAAe,IAC3B,MAAM,OACN,CAAC;AAAA;AAAA,IACP;AAAA,EACF;AAEA,UAAQ,MAAM,QAAQ,IAAI,kBAAkB,IAAI,cAAc,CAAC,GAAG,KAAK;AACzE;AAEA,MAAM,iBAAiB,CAAC,MAAM,IAAI;AAIlC,MAAM,iBAAiB,OAAO,YAAsC;AAClE,aAAW,aAAa,gBAAgB;AACtC,QAAI;AAEF,cAAQ,MAAM,OAAO,aAAa,OAAO,UAAU,SAAS,KAAK;AAAA,IACnE,QAAQ;AAAA,IAER;AAAA,EACF;AACA,QAAM,IAAI,MAAM,iCAAiC,OAAO,EAAE;AAC5D;AAMO,MAAM,eAAe,OAC1B,MACA,QACA,kBAA4B,CAAC,MACG;AAChC,QAAM,CA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AS,MAAM,MAAM;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AACD,WAAO,QAAQ;AACf,QAAI,OAAO,WAAW,QAAQ;AAC5B,aAAO;AAAA,QACL,kBAAkB,WAAW,GAC3B,OAAO,SAAS,MAAM,OAAO,MAAM,KAAK,EAC1C;AAAA,MACF;AAAA,IACF,OAAO;AACL,aAAO,MAAM,kBAAkB,WAAW,EAAE;AAAA,IAC9C;AAAA,EACF;AAEA,QAAM,kBAAkB,UAAM,qCAAoB;AAClD,MAAI,CAAC,iBAAiB;AACpB,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AAEA,EAAC,gBAAgB,YAAY,MAA2B,UACtD;AAEF,QAAM,qBAAqB,UAAM,8BAAc,gBAAgB,WAAW;AAE1E,QAAM,gBAAAD,QAAG,UAAU,gBAAgB,MAAM,kBAAkB;AAC3D,SAAO,QAAQ;AACf,SAAO,MAAM,wBAAwB;AACrC,SAAO,QAAQ;AAEf,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,UAAU;AAAA,EACZ;AACF;",
|
|
6
|
+
"names": ["fs", "path"]
|
|
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_removeYarnIgnoreOptionalFlags = require("./removeYarnIgnoreOptionalFlags.js");
|
|
2
25
|
const patches = [
|
|
3
26
|
{
|
|
4
|
-
apply: tryRemoveYarnIgnoreOptionalFlags,
|
|
27
|
+
apply: import_removeYarnIgnoreOptionalFlags.tryRemoveYarnIgnoreOptionalFlags,
|
|
5
28
|
description: "Remove yarn --ignore-optional flags 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/10.0.4/index.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryRemoveYarnIgnoreOptionalFlags } from './removeYarnIgnoreOptionalFlags.js';\n\nexport const patches: Patches = [\n {\n apply: tryRemoveYarnIgnoreOptionalFlags,\n description: 'Remove yarn --ignore-optional flags in Dockerfiles',\n },\n];\n"],
|
|
5
|
-
"mappings": "AAEA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2CAAiD;AAE1C,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|