skuba 14.0.0-esmify-skuba-20251105032119 → 14.0.0-hacky-hack-lang-json-20260108235938
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 -0
- 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 +3 -3
- 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/{src/cli → cli}/build/assets.d.ts +3 -2
- package/lib/cli/build/assets.js +60 -28
- package/lib/cli/build/assets.js.map +3 -3
- package/lib/cli/build/esbuild.d.ts +8 -0
- package/lib/cli/build/esbuild.js +64 -23
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +53 -21
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/build/tsc.js +60 -24
- package/lib/cli/build/tsc.js.map +3 -3
- 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/{src/cli → 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 +2 -2
- 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/{src/cli → 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/{src/cli → cli}/configure/ensureTemplateCompletion.d.ts +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +63 -32
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/{src/cli → cli}/configure/getEntryPoint.d.ts +2 -2
- package/lib/cli/configure/getEntryPoint.js +51 -19
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/{src/cli → cli}/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +36 -17
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +91 -56
- package/lib/cli/configure/index.js.map +3 -3
- 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 +71 -0
- 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/{src/cli → 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 +2 -2
- package/lib/cli/help/index.js +30 -6
- package/lib/cli/help/index.js.map +1 -1
- package/lib/{src/cli → cli}/init/getConfig.d.ts +2 -2
- package/lib/cli/init/getConfig.js +121 -102
- 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/{src/cli → cli}/init/prompts.d.ts +13 -10
- package/lib/cli/init/prompts.js +56 -35
- 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/{src/cli → cli}/lint/autofix.d.ts +5 -0
- package/lib/cli/lint/autofix.js +80 -40
- package/lib/cli/lint/autofix.js.map +2 -2
- 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 +50 -28
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +44 -18
- package/lib/cli/lint/internal.js.map +2 -2
- 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 +46 -14
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
- 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 +64 -35
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
- package/lib/{src/cli → cli}/lint/internalLints/upgrade/index.d.ts +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.js +105 -41
- 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.js +63 -17
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +2 -2
- 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 +149 -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 +6 -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 -0
- 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 +10 -0
- package/lib/cli/migrate/nodeVersion/index.js +239 -65
- package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
- package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
- package/lib/cli/node/index.js +57 -20
- package/lib/cli/node/index.js.map +3 -3
- package/lib/cli/release/index.js +28 -4
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +50 -16
- package/lib/cli/start/index.js.map +3 -3
- package/lib/cli/test/index.js +44 -4
- package/lib/cli/test/index.js.map +2 -2
- package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
- package/lib/cli/test/reporters/github/annotations.js +102 -0
- package/lib/cli/test/reporters/github/annotations.js.map +7 -0
- package/lib/cli/test/reporters/github/index.d.ts +5 -0
- package/lib/cli/test/reporters/github/index.js +74 -0
- package/lib/cli/test/reporters/github/index.js.map +7 -0
- package/lib/cli/version/index.js +30 -6
- package/lib/cli/version/index.js.map +1 -1
- package/lib/{src/index.d.ts → 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/{src/utils → utils}/exec.d.ts +3 -2
- package/lib/utils/exec.js +62 -24
- 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/{src/utils → utils}/logging.d.ts +9 -10
- package/lib/utils/logging.js +38 -11
- package/lib/utils/logging.js.map +2 -2
- package/lib/utils/logo.js +52 -25
- package/lib/utils/logo.js.map +2 -2
- package/lib/{src/utils → 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/{src/utils → utils}/worker.d.ts +3 -3
- 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 +2 -2
- package/package.json +43 -45
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +4 -3
- package/template/base/jest.config.ts +19 -0
- package/template/base/jest.setup.ts +3 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/package.json +8 -9
- package/template/express-rest-api/skuba.template.js +1 -1
- package/template/express-rest-api/src/app.test.ts +0 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/package.json +4 -5
- package/template/greeter/skuba.template.js +1 -1
- package/template/greeter/src/app.test.ts +1 -3
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/package.json +9 -11
- package/template/koa-rest-api/skuba.template.js +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
- package/template/koa-rest-api/src/app.test.ts +0 -2
- package/template/koa-rest-api/src/framework/server.test.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
- package/template/koa-rest-api/src/testing/metrics.ts +0 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -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/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/config/prettier.d.ts +0 -7
- package/lib/enquirer.d.js +0 -1
- package/lib/enquirer.d.js.map +0 -7
- package/lib/eslint.d.js +0 -1
- package/lib/eslint.d.js.map +0 -7
- package/lib/src/cli/build/esbuild.d.ts +0 -6
- package/lib/src/cli/configure/processing/package.d.ts +0 -5
- package/lib/src/cli/migrate/index.d.ts +0 -1
- package/lib/src/cli/migrate/nodeVersion/checks.d.ts +0 -14
- package/lib/src/cli/migrate/nodeVersion/index.d.ts +0 -4
- package/template/base/vitest.config.ts +0 -25
- package/lib/{src/cli → cli}/adapter/eslint.d.ts +0 -0
- package/lib/{src/cli → cli}/adapter/prettier.d.ts +0 -0
- package/lib/{src/cli → cli}/build/args.d.ts +0 -0
- package/lib/{src/cli → cli}/build/index.d.ts +0 -0
- package/lib/{src/cli → cli}/build/tsc.d.ts +0 -0
- package/lib/{src/cli → cli}/buildPackage/index.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/analyseConfiguration.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/analysis/diff.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/analysis/files.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/analysis/git.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/analysis/project.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/dependencies/index.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/dependencies/seekDatadogCustomMetrics.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/dependencies/seekKoala.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/dependencies/skuba.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/dependencies/skubaDeps.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/dependencies/skubaDive.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/index.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/eslint.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/ignore.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/index.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/nodemon.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/package.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/prettier.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/renovate.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/serverless.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/modules/tslint.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/configFile.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/deleteFiles.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/javascript.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/json.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/loadFiles.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/module.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/prettier.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/record.d.ts +0 -0
- package/lib/{src/cli → cli}/configure/processing/typescript.d.ts +0 -0
- package/lib/{src/cli → cli}/format/index.d.ts +0 -0
- package/lib/{src/cli → cli}/help/index.d.ts +0 -0
- package/lib/{src/cli → cli}/init/git.d.ts +0 -0
- package/lib/{src/cli → cli}/init/index.d.ts +0 -0
- package/lib/{src/cli → cli}/init/types.d.ts +1 -1
- /package/lib/{src/cli → cli}/init/validation.d.ts +0 -0
- /package/lib/{src/cli → cli}/init/writePackageJson.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/buildkite/eslint.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/buildkite/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/buildkite/internal.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/buildkite/prettier.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/buildkite/tsc.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/github/eslint.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/github/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/github/internal.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/github/prettier.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/github/tsc.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/annotate/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/eslint.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/external.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internal.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/detectBadCodeowners.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/noSkubaTemplateJs.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/patchRenovateConfig.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/refreshConfigFiles.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.0.4/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.0.2/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.d.ts +0 -0
- /package/lib/{src/cli/lint/internalLints/upgrade/patches/7.3.1 → cli/lint/internalLints/upgrade/patches/13.1.1}/index.d.ts +0 -0
- /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.1.0 → cli/lint/internalLints/upgrade/patches/13.1.1}/upgradeNode.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.d.ts +0 -0
- /package/lib/{src/cli/lint/internalLints/upgrade/patches/8.0.0 → cli/lint/internalLints/upgrade/patches/7.3.1}/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.d.ts +0 -0
- /package/lib/{src/cli/lint/internalLints/upgrade/patches/8.2.1 → cli/lint/internalLints/upgrade/patches/8.0.0}/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.d.ts +0 -0
- /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.0.1 → cli/lint/internalLints/upgrade/patches/8.2.1}/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.d.ts +0 -0
- /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.1.0 → cli/lint/internalLints/upgrade/patches/9.0.1}/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/prettier.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/tsc.d.ts +0 -0
- /package/lib/{src/cli → cli}/lint/types.d.ts +0 -0
- /package/lib/{src/cli → cli}/node/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/release/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/start/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/test/index.d.ts +0 -0
- /package/lib/{src/cli → cli}/version/index.d.ts +0 -0
- /package/lib/{src/skuba.d.ts → skuba.d.ts} +0 -0
- /package/lib/{src/utils → utils}/args.d.ts +0 -0
- /package/lib/{src/utils → utils}/command.d.ts +0 -0
- /package/lib/{src/utils → utils}/copy.d.ts +0 -0
- /package/lib/{src/utils → utils}/dir.d.ts +0 -0
- /package/lib/{src/utils → utils}/env.d.ts +0 -0
- /package/lib/{src/utils → utils}/error.d.ts +0 -0
- /package/lib/{src/utils → utils}/fs.d.ts +0 -0
- /package/lib/{src/utils → utils}/help.d.ts +0 -0
- /package/lib/{src/utils → utils}/logo.d.ts +0 -0
- /package/lib/{src/utils → utils}/npmrc.d.ts +0 -0
- /package/lib/{src/utils → utils}/packageManager.d.ts +0 -0
- /package/lib/{src/utils → utils}/port.d.ts +0 -0
- /package/lib/{src/utils → utils}/sleep.d.ts +0 -0
- /package/lib/{src/utils → utils}/template.d.ts +0 -0
- /package/lib/{src/utils → utils}/validation.d.ts +0 -0
- /package/lib/{src/utils → utils}/version.d.ts +0 -0
- /package/lib/{src/utils → utils}/wait.d.ts +0 -0
- /package/lib/{src/wrapper → wrapper}/functionHandler.d.ts +0 -0
- /package/lib/{src/wrapper → wrapper}/http.d.ts +0 -0
- /package/lib/{src/wrapper → wrapper}/index.d.ts +0 -0
- /package/lib/{src/wrapper → wrapper}/main.d.ts +0 -0
- /package/lib/{src/wrapper → wrapper}/requestListener.d.ts +0 -0
- /package/lib/{src/wrapper → wrapper}/server.d.ts +0 -0
package/config/eslint.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
module.exports = require('eslint-config-skuba');
|
package/config/jest.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../jest-preset');
|
package/config/prettier.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* @see https://prettier.io/docs/configuration
|
|
3
|
-
* @satisfies {import('prettier').Config}
|
|
4
|
-
*/
|
|
5
|
-
const config = {
|
|
1
|
+
module.exports = {
|
|
6
2
|
singleQuote: true,
|
|
7
3
|
tabWidth: 2,
|
|
8
4
|
trailingComma: 'all',
|
|
9
|
-
plugins: [
|
|
10
|
-
new URL(import.meta.resolve('prettier-plugin-packagejson')).pathname,
|
|
11
|
-
],
|
|
5
|
+
plugins: [require.resolve('prettier-plugin-packagejson')],
|
|
12
6
|
};
|
|
13
|
-
|
|
14
|
-
export default config;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const { pathsToModuleNameMapper } = require('ts-jest');
|
|
4
|
+
|
|
5
|
+
const { tryParseTsConfig } = require('./tsConfig');
|
|
6
|
+
|
|
7
|
+
module.exports.createModuleNameMapper = (getConfig) => {
|
|
8
|
+
const maybeTsConfig = tryParseTsConfig(getConfig);
|
|
9
|
+
|
|
10
|
+
const paths = Object.fromEntries(
|
|
11
|
+
Object.entries(maybeTsConfig?.options.paths ?? {}).flatMap(
|
|
12
|
+
([key, values]) => [
|
|
13
|
+
// Pass through the input path entry almost verbatim.
|
|
14
|
+
// We trim a trailing slash because TypeScript allows `import 'src'`
|
|
15
|
+
// to be resolved by the alias `src/`, but Jest's mapper does not.
|
|
16
|
+
[
|
|
17
|
+
key.replace(/\/$/, ''),
|
|
18
|
+
values.map((value) => value.replace(/\/$/, '')),
|
|
19
|
+
],
|
|
20
|
+
// Append a variant of the input path entry.
|
|
21
|
+
// As TypeScript allows both `import 'src'` and `import 'src/nested'`
|
|
22
|
+
// to be resolved by the alias `src/*` (and likewise for plain `src`),
|
|
23
|
+
// we need to seed two Jest mappings per path.
|
|
24
|
+
...(key.endsWith('/*')
|
|
25
|
+
? [
|
|
26
|
+
[
|
|
27
|
+
// Given a path `src/*`, seed an extra `src`.
|
|
28
|
+
key.replace(/\/\*$/, ''),
|
|
29
|
+
values.map((value) => value.replace(/\/\*$/, '')),
|
|
30
|
+
],
|
|
31
|
+
]
|
|
32
|
+
: [
|
|
33
|
+
[
|
|
34
|
+
// Given a path `src`, seed an extra `src/*`.
|
|
35
|
+
path.join(key, '*'),
|
|
36
|
+
values.map((value) => path.join(value, '*')),
|
|
37
|
+
],
|
|
38
|
+
]),
|
|
39
|
+
],
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const prefix = path.join('<rootDir>', maybeTsConfig?.options.baseUrl ?? '.');
|
|
44
|
+
|
|
45
|
+
const moduleNameMapper = pathsToModuleNameMapper(paths, {
|
|
46
|
+
prefix,
|
|
47
|
+
useESM: true,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Always try finding the file with extension before trying without
|
|
51
|
+
moduleNameMapper['^(\\.{1,2}/.*)\\.js$'] = ['$1.js', '$1'];
|
|
52
|
+
|
|
53
|
+
// Normalise away any `..`s that may crop up from `baseUrl` usage.
|
|
54
|
+
// For example, a `baseUrl` of `src` and a path of `../cli` will result in
|
|
55
|
+
// `<rootDir>/src/../cli`, which can be normalised to `<rootDir>/cli`.
|
|
56
|
+
return Object.fromEntries(
|
|
57
|
+
Object.entries(moduleNameMapper).map(([key, values]) => [
|
|
58
|
+
key,
|
|
59
|
+
Array.isArray(values)
|
|
60
|
+
? values.map((value) => path.normalize(value))
|
|
61
|
+
: path.normalize(values),
|
|
62
|
+
]),
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const { defaults } = require('ts-jest/presets');
|
|
2
|
+
const { ModuleResolutionKind } = require('typescript');
|
|
3
|
+
|
|
4
|
+
const { tryParseTsConfig } = require('./tsConfig');
|
|
5
|
+
|
|
6
|
+
const TS_JEST_NAME = 'ts-jest';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolved path of the `ts-jest` preset.
|
|
10
|
+
*
|
|
11
|
+
* This allows Jest to resolve the preset even if it is installed to a nested
|
|
12
|
+
* `./node_modules/skuba/node_modules/ts-jest` directory.
|
|
13
|
+
*/
|
|
14
|
+
const TS_JEST_PATH = require.resolve(TS_JEST_NAME);
|
|
15
|
+
|
|
16
|
+
const maybeTsConfig = tryParseTsConfig();
|
|
17
|
+
|
|
18
|
+
const BROKEN_MODULE_RESOLUTIONS = new Set([
|
|
19
|
+
ModuleResolutionKind.Bundler,
|
|
20
|
+
ModuleResolutionKind.NodeNext,
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Passing through these module resolutions seems to break `ts-jest`.
|
|
25
|
+
*
|
|
26
|
+
* ```
|
|
27
|
+
* error TS5110: Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext'.
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* https://github.com/kulshekhar/ts-jest/issues/4198
|
|
31
|
+
*/
|
|
32
|
+
const tsconfig = BROKEN_MODULE_RESOLUTIONS.has(
|
|
33
|
+
maybeTsConfig?.options.moduleResolution,
|
|
34
|
+
)
|
|
35
|
+
? { tsconfig: { moduleResolution: 'Node' } }
|
|
36
|
+
: undefined;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Rewrite `ts-jest` transformations using our resolved `TS_JEST_PATH`.
|
|
40
|
+
*
|
|
41
|
+
* @type {import ('@jest/types').Config.InitialOptions['transform']}
|
|
42
|
+
*/
|
|
43
|
+
module.exports.transform = Object.fromEntries(
|
|
44
|
+
Object.entries(defaults.transform).map(([key, value]) => {
|
|
45
|
+
if (typeof value === 'string') {
|
|
46
|
+
return [key, value === TS_JEST_NAME ? [TS_JEST_PATH, tsconfig] : value];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return [
|
|
50
|
+
key,
|
|
51
|
+
value[0] === TS_JEST_NAME
|
|
52
|
+
? [
|
|
53
|
+
TS_JEST_PATH,
|
|
54
|
+
{
|
|
55
|
+
...value[1],
|
|
56
|
+
...tsconfig,
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
: value,
|
|
60
|
+
];
|
|
61
|
+
}),
|
|
62
|
+
);
|
package/jest/tsConfig.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const {
|
|
2
|
+
sys,
|
|
3
|
+
findConfigFile,
|
|
4
|
+
readConfigFile,
|
|
5
|
+
parseJsonConfigFileContent,
|
|
6
|
+
} = require('typescript');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @returns {unknown}
|
|
10
|
+
*/
|
|
11
|
+
const getTsConfigFromDisk = () => {
|
|
12
|
+
const filename =
|
|
13
|
+
findConfigFile('.', sys.fileExists.bind(this)) ?? 'tsconfig.json';
|
|
14
|
+
|
|
15
|
+
return readConfigFile(filename, sys.readFile.bind(this)).config;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports.tryParseTsConfig = (getConfig = getTsConfigFromDisk) => {
|
|
19
|
+
try {
|
|
20
|
+
const json = getConfig();
|
|
21
|
+
|
|
22
|
+
return parseJsonConfigFileContent(json, sys, '.');
|
|
23
|
+
} catch {
|
|
24
|
+
// Bail out here to support zero-config mode.
|
|
25
|
+
}
|
|
26
|
+
};
|
package/jest-preset.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { defaults } = require('ts-jest/presets');
|
|
2
|
+
|
|
3
|
+
const { createModuleNameMapper } = require('./jest/moduleNameMapper');
|
|
4
|
+
const { transform } = require('./jest/transform');
|
|
5
|
+
|
|
6
|
+
/** @type {import('@jest/types').Config.InitialOptions} */
|
|
7
|
+
module.exports = {
|
|
8
|
+
...defaults,
|
|
9
|
+
|
|
10
|
+
moduleNameMapper: createModuleNameMapper(),
|
|
11
|
+
transform,
|
|
12
|
+
|
|
13
|
+
collectCoverageFrom: [
|
|
14
|
+
'**/*.ts',
|
|
15
|
+
'**/*.tsx',
|
|
16
|
+
'!**/node_modules*/**',
|
|
17
|
+
'!<rootDir>/coverage*/**',
|
|
18
|
+
'!<rootDir>/dist*/**',
|
|
19
|
+
'!<rootDir>/lib*/**',
|
|
20
|
+
'!<rootDir>/tmp*/**',
|
|
21
|
+
'!<rootDir>/jest.*.ts',
|
|
22
|
+
],
|
|
23
|
+
coverageDirectory: 'coverage',
|
|
24
|
+
reporters: ['default', require.resolve('./lib/cli/test/reporters/github')],
|
|
25
|
+
testEnvironment: 'node',
|
|
26
|
+
testPathIgnorePatterns: [
|
|
27
|
+
'/node_modules.*/',
|
|
28
|
+
'<rootDir>/(coverage|dist|lib|tmp).*/',
|
|
29
|
+
],
|
|
30
|
+
watchPlugins: [
|
|
31
|
+
require.resolve('jest-watch-typeahead/filename'),
|
|
32
|
+
require.resolve('jest-watch-typeahead/testname'),
|
|
33
|
+
],
|
|
34
|
+
testEnvironmentOptions: {
|
|
35
|
+
globalsCleanup: 'on',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Config } from '@jest/types';
|
|
2
|
+
export type { Config } from '@jest/types';
|
|
3
|
+
/**
|
|
4
|
+
* Set of Jest options that are recommended and supported for customisation.
|
|
5
|
+
*
|
|
6
|
+
* While we technically accept anything compatible with `Config.InitialOptions`,
|
|
7
|
+
* these are tacitly endorsed for our use cases and receive IntelliSense.
|
|
8
|
+
*/
|
|
9
|
+
type DefaultOptions = 'collectCoverage' | 'collectCoverageFrom' | 'coveragePathIgnorePatterns' | 'coverageThreshold' | 'displayName' | 'globals' | 'globalSetup' | 'globalTeardown' | 'projects' | 'setupFiles' | 'setupFilesAfterEnv' | 'snapshotSerializers' | 'testEnvironment' | 'testPathIgnorePatterns' | 'testTimeout' | 'watchPathIgnorePatterns';
|
|
10
|
+
/**
|
|
11
|
+
* Merge additional Jest options into the **skuba** preset.
|
|
12
|
+
*
|
|
13
|
+
* This concatenates array options like `testPathIgnorePatterns`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const mergePreset: <AdditionalOptions extends keyof Config.InitialOptions>({ projects, ...options }: Pick<Config.InitialOptions, AdditionalOptions | DefaultOptions>) => Config.InitialOptions;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 jest_exports = {};
|
|
30
|
+
__export(jest_exports, {
|
|
31
|
+
mergePreset: () => mergePreset
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(jest_exports);
|
|
34
|
+
var import_jest_preset = __toESM(require("../../../jest-preset.js"));
|
|
35
|
+
var import_record = require("../../cli/configure/processing/record.js");
|
|
36
|
+
const mergePreset = ({
|
|
37
|
+
projects,
|
|
38
|
+
...options
|
|
39
|
+
}) => {
|
|
40
|
+
const root = (0, import_record.mergeRaw)(import_jest_preset.default, options);
|
|
41
|
+
return {
|
|
42
|
+
...root,
|
|
43
|
+
projects: projects?.map((project) => {
|
|
44
|
+
if (typeof project === "string") {
|
|
45
|
+
return project;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
moduleNameMapper: root.moduleNameMapper,
|
|
49
|
+
transform: root.transform,
|
|
50
|
+
...project
|
|
51
|
+
};
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
mergePreset
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/jest/index.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Config } from '@jest/types';\n\nimport jestPreset from '../../../jest-preset.js';\nimport { mergeRaw } from '../../cli/configure/processing/record.js';\n\n// Avoid TS4082 in Jest configuration files:\n// Default export of the module has or is using private name `ConfigGlobals`.\nexport type { Config } from '@jest/types';\n\n/**\n * Set of Jest options that are recommended and supported for customisation.\n *\n * While we technically accept anything compatible with `Config.InitialOptions`,\n * these are tacitly endorsed for our use cases and receive IntelliSense.\n */\ntype DefaultOptions =\n | 'collectCoverage'\n | 'collectCoverageFrom'\n | 'coveragePathIgnorePatterns'\n | 'coverageThreshold'\n | 'displayName'\n | 'globals'\n | 'globalSetup'\n | 'globalTeardown'\n | 'projects'\n | 'setupFiles'\n | 'setupFilesAfterEnv'\n | 'snapshotSerializers'\n | 'testEnvironment'\n | 'testPathIgnorePatterns'\n | 'testTimeout'\n | 'watchPathIgnorePatterns';\n\n/**\n * Merge additional Jest options into the **skuba** preset.\n *\n * This concatenates array options like `testPathIgnorePatterns`.\n */\nexport const mergePreset = <\n AdditionalOptions extends keyof Config.InitialOptions,\n>({\n projects,\n ...options\n}: Pick<\n Config.InitialOptions,\n AdditionalOptions | DefaultOptions\n>): Config.InitialOptions => {\n const root = mergeRaw(jestPreset, options);\n\n return {\n ...root,\n\n projects: projects?.map((project) => {\n if (typeof project === 'string') {\n return project;\n }\n\n return {\n moduleNameMapper: root.moduleNameMapper,\n transform: root.transform,\n ...project,\n };\n }),\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAAuB;AACvB,oBAAyB;AAmClB,MAAM,cAAc,CAEzB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAG6B;AAC3B,QAAM,WAAO,wBAAS,mBAAAA,SAAY,OAAO;AAEzC,SAAO;AAAA,IACL,GAAG;AAAA,IAEH,UAAU,UAAU,IAAI,CAAC,YAAY;AACnC,UAAI,OAAO,YAAY,UAAU;AAC/B,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,QACL,kBAAkB,KAAK;AAAA,QACvB,WAAW,KAAK;AAAA,QAChB,GAAG;AAAA,MACL;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": ["jestPreset"]
|
|
7
|
+
}
|
|
@@ -1,17 +1,50 @@
|
|
|
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 eslint_exports = {};
|
|
30
|
+
__export(eslint_exports, {
|
|
31
|
+
runESLint: () => runESLint
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(eslint_exports);
|
|
34
|
+
var import_node_util = require("node:util");
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_eslint = require("eslint");
|
|
37
|
+
var import_logging = require("../../utils/logging.js");
|
|
5
38
|
const symbolForResult = (result) => {
|
|
6
39
|
if (result.errorCount) {
|
|
7
|
-
return
|
|
40
|
+
return (0, import_node_util.styleText)("red", "\u25CB");
|
|
8
41
|
}
|
|
9
|
-
return result.warningCount ?
|
|
42
|
+
return result.warningCount ? (0, import_node_util.styleText)("yellow", "\u25CD") : (0, import_node_util.styleText)("green", "\u25CB");
|
|
10
43
|
};
|
|
11
44
|
const runESLint = async (mode, logger, overrideConfigFile) => {
|
|
12
45
|
logger.debug("Initialising ESLint...");
|
|
13
46
|
const cwd = process.cwd();
|
|
14
|
-
const ESLint = await loadESLint({ useFlatConfig: true });
|
|
47
|
+
const ESLint = await (0, import_eslint.loadESLint)({ useFlatConfig: true });
|
|
15
48
|
const engine = new ESLint({
|
|
16
49
|
cache: true,
|
|
17
50
|
fix: mode === "format",
|
|
@@ -36,7 +69,7 @@ const runESLint = async (mode, logger, overrideConfigFile) => {
|
|
|
36
69
|
}
|
|
37
70
|
const end = process.hrtime.bigint();
|
|
38
71
|
logger.plain(
|
|
39
|
-
`Processed ${pluralise(results.length, "file")} in ${logger.timing(
|
|
72
|
+
`Processed ${(0, import_logging.pluralise)(results.length, "file")} in ${logger.timing(
|
|
40
73
|
start,
|
|
41
74
|
end
|
|
42
75
|
)}.`
|
|
@@ -45,7 +78,7 @@ const runESLint = async (mode, logger, overrideConfigFile) => {
|
|
|
45
78
|
const warnings = [];
|
|
46
79
|
let fixable = false;
|
|
47
80
|
for (const result of results) {
|
|
48
|
-
const relativePath =
|
|
81
|
+
const relativePath = import_path.default.relative(cwd, result.filePath);
|
|
49
82
|
if (result.fixableErrorCount + result.fixableWarningCount) {
|
|
50
83
|
fixable = true;
|
|
51
84
|
}
|
|
@@ -85,7 +118,8 @@ const lintFiles = async (engine) => {
|
|
|
85
118
|
throw error;
|
|
86
119
|
}
|
|
87
120
|
};
|
|
88
|
-
export
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
89
123
|
runESLint
|
|
90
|
-
};
|
|
124
|
+
});
|
|
91
125
|
//# sourceMappingURL=eslint.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/adapter/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\n\nimport { type ESLint, type Linter, loadESLint } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging.js';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return styleText('red', '\u25CB');\n }\n\n return result.warningCount\n ? styleText('yellow', '\u25CD')\n : styleText('green', '\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n overrideConfigFile?: string,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const cwd = process.cwd();\n\n const ESLint = await loadESLint({ useFlatConfig: true });\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n overrideConfigFile,\n overrideConfig: {\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n },\n });\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, { type, results }] = await Promise.all([\n engine.loadFormatter(),\n lintFiles(engine),\n ]);\n\n if (type === 'no-config') {\n logger.plain(\n 'skuba could not find an eslint config file. Do you need to run format or configure?',\n );\n return { ok: false, fixable: false, errors: [], warnings: [], output: '' };\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(\n results,\n engine.getRulesMetaForResults(results),\n );\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n\nconst lintFiles = async (engine: ESLint) => {\n try {\n const result = await engine.lintFiles([]);\n return { type: 'results', results: result } as const;\n } catch (error) {\n if (\n error instanceof Error &&\n error.message === 'Could not find config file.'\n ) {\n return { type: 'no-config', results: undefined } as const;\n }\n throw error;\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAiB;AAEjB,oBAAqD;AAErD,qBAAuC;AAEvC,MAAM,kBAAkB,CAAC,WAA8B;AACrD,MAAI,OAAO,YAAY;AACrB,eAAO,4BAAU,OAAO,QAAG;AAAA,EAC7B;AAEA,SAAO,OAAO,mBACV,4BAAU,UAAU,QAAG,QACvB,4BAAU,SAAS,QAAG;AAC5B;AAeO,MAAM,YAAY,OACvB,MACA,QACA,uBAC0B;AAC1B,SAAO,MAAM,wBAAwB;AAErC,QAAM,MAAM,QAAQ,IAAI;AAExB,QAAM,SAAS,UAAM,0BAAW,EAAE,eAAe,KAAK,CAAC;AACvD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,OAAO;AAAA,IACP,KAAK,SAAS;AAAA,IACd;AAAA,IACA,gBAAgB;AAAA,MACd,eAAe;AAAA,QACb,+BAA+B;AAAA,MACjC;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO,MAAM,qBAAqB;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAEpC,QAAM,CAAC,WAAW,EAAE,MAAM,QAAQ,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IACvD,OAAO,cAAc;AAAA,IACrB,UAAU,MAAM;AAAA,EAClB,CAAC;AAED,MAAI,SAAS,aAAa;AACxB,WAAO;AAAA,MACL;AAAA,IACF;AACA,WAAO,EAAE,IAAI,OAAO,SAAS,OAAO,QAAQ,CAAC,GAAG,UAAU,CAAC,GAAG,QAAQ,GAAG;AAAA,EAC3E;AAEA,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,SAAO;AAAA,IACL,iBAAa,0BAAU,QAAQ,QAAQ,MAAM,CAAC,OAAO,OAAO;AAAA,MAC1D;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,SAAyB,CAAC;AAChC,QAAM,WAA2B,CAAC;AAClC,MAAI,UAAU;AAEd,aAAW,UAAU,SAAS;AAC5B,UAAM,eAAe,YAAAA,QAAK,SAAS,KAAK,OAAO,QAAQ;AACvD,QAAI,OAAO,oBAAoB,OAAO,qBAAqB;AACzD,gBAAU;AAAA,IACZ;AAEA,QAAI,OAAO,YAAY;AACrB,aAAO,KAAK;AAAA,QACV,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,QAAI,OAAO,cAAc;AACvB,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,OAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU;AAAA,IAC7B;AAAA,IACA,OAAO,uBAAuB,OAAO;AAAA,EACvC;AAEA,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;AAEA,MAAM,YAAY,OAAO,WAAmB;AAC1C,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,UAAU,CAAC,CAAC;AACxC,WAAO,EAAE,MAAM,WAAW,SAAS,OAAO;AAAA,EAC5C,SAAS,OAAO;AACd,QACE,iBAAiB,SACjB,MAAM,YAAY,+BAClB;AACA,aAAO,EAAE,MAAM,aAAa,SAAS,OAAU;AAAA,IACjD;AACA,UAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": ["path"]
|
|
7
7
|
}
|
|
@@ -1,22 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 prettier_exports = {};
|
|
30
|
+
__export(prettier_exports, {
|
|
31
|
+
formatOrLintFile: () => formatOrLintFile,
|
|
32
|
+
inferParser: () => inferParser,
|
|
33
|
+
runPrettier: () => runPrettier
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(prettier_exports);
|
|
36
|
+
var import_path = __toESM(require("path"));
|
|
37
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
|
+
var import_prettier = require("prettier");
|
|
39
|
+
var import_dir = require("../../utils/dir.js");
|
|
40
|
+
var import_logging = require("../../utils/logging.js");
|
|
41
|
+
var import_manifest = require("../../utils/manifest.js");
|
|
42
|
+
var import_package = require("../configure/processing/package.js");
|
|
16
43
|
let languages;
|
|
17
44
|
const inferParser = async (filepath) => {
|
|
18
|
-
const filename =
|
|
19
|
-
languages ??= (await getSupportInfo()).languages;
|
|
45
|
+
const filename = import_path.default.basename(filepath).toLowerCase();
|
|
46
|
+
languages ??= (await (0, import_prettier.getSupportInfo)()).languages;
|
|
20
47
|
const firstLanguage = languages.find(
|
|
21
48
|
(language) => language.extensions?.some((extension) => filename.endsWith(extension)) || language.filenames?.some((name) => name.toLowerCase() === filename)
|
|
22
49
|
);
|
|
@@ -26,12 +53,12 @@ const isPackageJsonOk = async ({
|
|
|
26
53
|
data,
|
|
27
54
|
filepath
|
|
28
55
|
}) => {
|
|
29
|
-
if (
|
|
56
|
+
if (import_path.default.basename(filepath) !== "package.json") {
|
|
30
57
|
return true;
|
|
31
58
|
}
|
|
32
59
|
try {
|
|
33
|
-
const packageJson = parsePackage(data);
|
|
34
|
-
return !packageJson || await formatPackage(packageJson) === data;
|
|
60
|
+
const packageJson = (0, import_package.parsePackage)(data);
|
|
61
|
+
return !packageJson || await (0, import_package.formatPackage)(packageJson) === data;
|
|
35
62
|
} catch {
|
|
36
63
|
}
|
|
37
64
|
return true;
|
|
@@ -40,7 +67,7 @@ const formatOrLintFile = async ({ data, filepath, options }, mode, result) => {
|
|
|
40
67
|
if (mode === "lint") {
|
|
41
68
|
let ok;
|
|
42
69
|
try {
|
|
43
|
-
ok = await check(data, options) && await isPackageJsonOk({ data, filepath });
|
|
70
|
+
ok = await (0, import_prettier.check)(data, options) && await isPackageJsonOk({ data, filepath });
|
|
44
71
|
} catch (err) {
|
|
45
72
|
result?.errored.push({ err, filepath });
|
|
46
73
|
return;
|
|
@@ -52,16 +79,16 @@ const formatOrLintFile = async ({ data, filepath, options }, mode, result) => {
|
|
|
52
79
|
}
|
|
53
80
|
let formatted;
|
|
54
81
|
try {
|
|
55
|
-
formatted = await format(data, options);
|
|
82
|
+
formatted = await (0, import_prettier.format)(data, options);
|
|
56
83
|
} catch (err) {
|
|
57
84
|
result?.errored.push({ err, filepath });
|
|
58
85
|
return;
|
|
59
86
|
}
|
|
60
87
|
try {
|
|
61
|
-
if (
|
|
62
|
-
const packageJson = parsePackage(formatted);
|
|
88
|
+
if (import_path.default.basename(filepath) === "package.json") {
|
|
89
|
+
const packageJson = (0, import_package.parsePackage)(formatted);
|
|
63
90
|
if (packageJson) {
|
|
64
|
-
formatted = await formatPackage(packageJson);
|
|
91
|
+
formatted = await (0, import_package.formatPackage)(packageJson);
|
|
65
92
|
}
|
|
66
93
|
}
|
|
67
94
|
} catch {
|
|
@@ -75,18 +102,18 @@ const formatOrLintFile = async ({ data, filepath, options }, mode, result) => {
|
|
|
75
102
|
const runPrettier = async (mode, logger, cwd = process.cwd()) => {
|
|
76
103
|
logger.debug("Initialising Prettier...");
|
|
77
104
|
const start = process.hrtime.bigint();
|
|
78
|
-
const manifest = await getConsumerManifest(cwd);
|
|
79
|
-
const directory = manifest ?
|
|
105
|
+
const manifest = await (0, import_manifest.getConsumerManifest)(cwd);
|
|
106
|
+
const directory = manifest ? import_path.default.dirname(manifest.path) : cwd;
|
|
80
107
|
logger.debug(
|
|
81
108
|
manifest ? "Detected project root:" : "Detected working directory:",
|
|
82
109
|
directory
|
|
83
110
|
);
|
|
84
111
|
logger.debug("Discovering files...");
|
|
85
|
-
const relativeFilepaths = await crawlDirectory(directory, [
|
|
112
|
+
const relativeFilepaths = await (0, import_dir.crawlDirectory)(directory, [
|
|
86
113
|
".gitignore",
|
|
87
114
|
".prettierignore"
|
|
88
115
|
]);
|
|
89
|
-
logger.debug(`Discovered ${pluralise(relativeFilepaths.length, "file")}.`);
|
|
116
|
+
logger.debug(`Discovered ${(0, import_logging.pluralise)(relativeFilepaths.length, "file")}.`);
|
|
90
117
|
const result = {
|
|
91
118
|
count: relativeFilepaths.length,
|
|
92
119
|
errored: [],
|
|
@@ -95,9 +122,9 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
|
|
|
95
122
|
};
|
|
96
123
|
logger.debug(mode === "format" ? "Formatting" : "Linting", "files...");
|
|
97
124
|
for (const relativeFilepath of relativeFilepaths) {
|
|
98
|
-
const filepath =
|
|
125
|
+
const filepath = import_path.default.relative(
|
|
99
126
|
process.cwd(),
|
|
100
|
-
|
|
127
|
+
import_path.default.join(directory, relativeFilepath)
|
|
101
128
|
);
|
|
102
129
|
const parser = await inferParser(filepath);
|
|
103
130
|
logger.debug(filepath);
|
|
@@ -107,8 +134,8 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
|
|
|
107
134
|
continue;
|
|
108
135
|
}
|
|
109
136
|
const [config, data] = await Promise.all([
|
|
110
|
-
resolveConfig(filepath),
|
|
111
|
-
|
|
137
|
+
(0, import_prettier.resolveConfig)(filepath),
|
|
138
|
+
import_fs_extra.default.promises.readFile(filepath, "utf-8")
|
|
112
139
|
]);
|
|
113
140
|
const file = {
|
|
114
141
|
data,
|
|
@@ -117,24 +144,24 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
|
|
|
117
144
|
};
|
|
118
145
|
const formatted = await formatOrLintFile(file, mode, result);
|
|
119
146
|
if (typeof formatted === "string") {
|
|
120
|
-
await
|
|
147
|
+
await import_fs_extra.default.promises.writeFile(filepath, formatted);
|
|
121
148
|
}
|
|
122
149
|
}
|
|
123
150
|
const end = process.hrtime.bigint();
|
|
124
151
|
logger.plain(
|
|
125
|
-
`Processed ${pluralise(
|
|
152
|
+
`Processed ${(0, import_logging.pluralise)(
|
|
126
153
|
result.count - result.unparsed.length,
|
|
127
154
|
"file"
|
|
128
155
|
)} in ${logger.timing(start, end)}.`
|
|
129
156
|
);
|
|
130
157
|
if (result.touched.length) {
|
|
131
|
-
logger.plain(`Formatted ${pluralise(result.touched.length, "file")}:`);
|
|
158
|
+
logger.plain(`Formatted ${(0, import_logging.pluralise)(result.touched.length, "file")}:`);
|
|
132
159
|
for (const filepath of result.touched) {
|
|
133
160
|
logger.warn(filepath);
|
|
134
161
|
}
|
|
135
162
|
}
|
|
136
163
|
if (result.errored.length) {
|
|
137
|
-
logger.plain(`Flagged ${pluralise(result.errored.length, "file")}:`);
|
|
164
|
+
logger.plain(`Flagged ${(0, import_logging.pluralise)(result.errored.length, "file")}:`);
|
|
138
165
|
for (const { err, filepath } of result.errored) {
|
|
139
166
|
logger.warn(
|
|
140
167
|
filepath,
|
|
@@ -144,9 +171,10 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
|
|
|
144
171
|
}
|
|
145
172
|
return { ok: result.errored.length === 0, result };
|
|
146
173
|
};
|
|
147
|
-
export
|
|
174
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
175
|
+
0 && (module.exports = {
|
|
148
176
|
formatOrLintFile,
|
|
149
177
|
inferParser,
|
|
150
178
|
runPrettier
|
|
151
|
-
};
|
|
179
|
+
});
|
|
152
180
|
//# sourceMappingURL=prettier.js.map
|