skuba 14.0.0-migrate-to-inquirer-20251031060542 → 14.0.0-replace-global-vars-20251117052457
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/prettier.d.ts +8 -4
- package/config/prettier.js +10 -2
- package/lib/cli/adapter/eslint.js +11 -45
- package/lib/cli/adapter/eslint.js.map +3 -3
- package/lib/cli/adapter/prettier.js +39 -67
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/args.js +8 -42
- package/lib/cli/build/args.js.map +2 -2
- package/lib/cli/build/assets.d.ts +3 -2
- package/lib/cli/build/assets.js +28 -60
- package/lib/cli/build/assets.js.map +3 -3
- package/lib/cli/build/esbuild.js +21 -45
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +21 -55
- package/lib/cli/build/index.js.map +3 -3
- package/lib/cli/build/tsc.js +23 -61
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/buildPackage/index.js +8 -32
- package/lib/cli/buildPackage/index.js.map +1 -1
- package/lib/cli/configure/analyseConfiguration.js +16 -50
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.d.ts +1 -1
- package/lib/cli/configure/analyseDependencies.js +25 -59
- package/lib/cli/configure/analyseDependencies.js.map +3 -3
- package/lib/cli/configure/analysis/diff.js +5 -39
- package/lib/cli/configure/analysis/diff.js.map +3 -3
- package/lib/cli/configure/analysis/files.js +8 -42
- package/lib/cli/configure/analysis/files.js.map +2 -2
- package/lib/cli/configure/analysis/git.js +12 -46
- package/lib/cli/configure/analysis/git.js.map +2 -2
- package/lib/cli/configure/analysis/package.d.ts +2 -3
- package/lib/cli/configure/analysis/package.js +10 -45
- package/lib/cli/configure/analysis/package.js.map +3 -3
- package/lib/cli/configure/analysis/project.js +18 -50
- package/lib/cli/configure/analysis/project.js.map +2 -2
- package/lib/cli/configure/dependencies/index.js +7 -35
- package/lib/cli/configure/dependencies/index.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +4 -28
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js +4 -28
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js +4 -28
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +2 -26
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js +4 -29
- 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 +35 -60
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.d.ts +1 -1
- package/lib/cli/configure/getEntryPoint.js +14 -48
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +14 -35
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +50 -84
- package/lib/cli/configure/index.js.map +3 -3
- package/lib/cli/configure/modules/eslint.js +10 -34
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/ignore.js +8 -32
- package/lib/cli/configure/modules/ignore.js.map +1 -1
- package/lib/cli/configure/modules/index.js +18 -44
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/nodemon.js +4 -28
- package/lib/cli/configure/modules/nodemon.js.map +1 -1
- package/lib/cli/configure/modules/package.js +10 -34
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +11 -35
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +17 -40
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/serverless.js +2 -26
- package/lib/cli/configure/modules/serverless.js.map +1 -1
- package/lib/cli/configure/modules/tslint.js +4 -28
- package/lib/cli/configure/modules/tslint.js.map +1 -1
- package/lib/cli/configure/processing/configFile.js +3 -39
- package/lib/cli/configure/processing/configFile.js.map +1 -1
- package/lib/cli/configure/processing/deleteFiles.js +2 -26
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +2 -27
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +6 -31
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +2 -26
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +4 -28
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.d.ts +1 -67
- package/lib/cli/configure/processing/package.js +8 -45
- package/lib/cli/configure/processing/package.js.map +3 -3
- package/lib/cli/configure/processing/prettier.js +4 -38
- package/lib/cli/configure/processing/prettier.js.map +2 -2
- package/lib/cli/configure/processing/record.js +5 -41
- package/lib/cli/configure/processing/record.js.map +2 -2
- package/lib/cli/configure/processing/typescript.js +26 -63
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/types.d.ts +15 -4
- package/lib/cli/configure/types.js +0 -16
- package/lib/cli/configure/types.js.map +3 -3
- package/lib/cli/format/index.js +20 -54
- package/lib/cli/format/index.js.map +3 -3
- package/lib/cli/help/index.js +6 -30
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.d.ts +1 -1
- package/lib/cli/init/getConfig.js +76 -104
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.js +16 -51
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.js +67 -98
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.js +21 -42
- package/lib/cli/init/prompts.js.map +1 -1
- package/lib/cli/init/types.js +7 -41
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +2 -30
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +8 -42
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js +3 -37
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +11 -45
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +3 -37
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +3 -37
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +3 -37
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +2 -26
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +11 -45
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +2 -26
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +2 -26
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +4 -28
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/index.js +6 -30
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.js +37 -73
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/eslint.js +16 -51
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/external.js +19 -51
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.js +26 -52
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +20 -52
- package/lib/cli/lint/internal.js.map +3 -3
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +8 -33
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +12 -48
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +21 -55
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +33 -66
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
- package/lib/cli/lint/internalLints/upgrade/index.js +23 -56
- package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +4 -28
- 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 +11 -45
- 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 +6 -30
- 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 +37 -65
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +11 -46
- 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 +4 -28
- 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 +23 -59
- 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 +4 -28
- 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 +11 -46
- 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 +6 -30
- 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 +11 -46
- 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 +11 -46
- 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 +4 -28
- 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 +11 -46
- 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 +29 -67
- 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 +10 -34
- 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 +11 -45
- 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 +4 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +18 -63
- 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 +15 -50
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.d.ts +2 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +11 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +5 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +72 -0
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +17 -51
- 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 +10 -34
- 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 +10 -44
- 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 +12 -46
- 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 +4 -28
- 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 +15 -49
- 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 +11 -45
- 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 +10 -39
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +11 -45
- 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 +11 -45
- 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 +13 -47
- 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 +4 -28
- 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 +11 -45
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +4 -28
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +8 -32
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
- package/lib/cli/lint/prettier.js +15 -50
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/lint/tsc.js +4 -28
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/lint/types.js +0 -16
- package/lib/cli/lint/types.js.map +3 -3
- package/lib/cli/migrate/index.js +10 -34
- package/lib/cli/migrate/index.js.map +1 -1
- package/lib/cli/migrate/nodeVersion/checks.js +24 -61
- package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/index.js +25 -55
- package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
- package/lib/cli/node/index.js +20 -57
- package/lib/cli/node/index.js.map +3 -3
- package/lib/cli/release/index.js +4 -28
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +16 -50
- package/lib/cli/start/index.js.map +3 -3
- package/lib/cli/test/index.js +4 -44
- package/lib/cli/test/index.js.map +2 -2
- package/lib/cli/version/index.js +6 -30
- package/lib/cli/version/index.js.map +1 -1
- package/lib/eslint.d.js +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +6 -46
- package/lib/index.js.map +2 -2
- package/lib/skuba.js +26 -45
- package/lib/skuba.js.map +3 -3
- package/lib/utils/args.js +6 -43
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/command.js +4 -42
- package/lib/utils/command.js.map +3 -3
- package/lib/utils/copy.js +20 -57
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.js +32 -72
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/env.js +2 -26
- package/lib/utils/env.js.map +1 -1
- package/lib/utils/error.js +10 -47
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.d.ts +3 -2
- package/lib/utils/exec.js +24 -62
- package/lib/utils/exec.js.map +3 -3
- package/lib/utils/fs.js +6 -40
- package/lib/utils/fs.js.map +3 -3
- package/lib/utils/help.js +6 -30
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/logging.d.ts +9 -10
- package/lib/utils/logging.js +11 -48
- package/lib/utils/logging.js.map +3 -3
- package/lib/utils/logo.js +28 -59
- package/lib/utils/logo.js.map +3 -3
- package/lib/utils/manifest.d.ts +3 -2
- package/lib/utils/manifest.js +8 -48
- package/lib/utils/manifest.js.map +3 -3
- package/lib/utils/npmrc.js +2 -26
- package/lib/utils/npmrc.js.map +1 -1
- package/lib/utils/packageManager.js +12 -49
- package/lib/utils/packageManager.js.map +2 -2
- package/lib/utils/port.js +4 -39
- package/lib/utils/port.js.map +2 -2
- package/lib/utils/sleep.js +2 -26
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/template.js +18 -55
- package/lib/utils/template.js.map +3 -3
- package/lib/utils/validation.js +2 -31
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +9 -46
- package/lib/utils/version.js.map +2 -2
- package/lib/utils/wait.js +7 -32
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.d.ts +3 -3
- package/lib/utils/worker.js +10 -35
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/function-arguments.d.js +0 -1
- package/lib/wrapper/functionHandler.js +18 -49
- package/lib/wrapper/functionHandler.js.map +2 -2
- package/lib/wrapper/http.d.ts +0 -6
- package/lib/wrapper/http.js +8 -51
- package/lib/wrapper/http.js.map +3 -3
- package/lib/wrapper/index.js +6 -7
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +8 -42
- package/lib/wrapper/main.js.map +3 -3
- package/lib/wrapper/requestListener.js +13 -46
- package/lib/wrapper/requestListener.js.map +3 -3
- package/lib/wrapper/server.d.ts +7 -0
- package/lib/wrapper/server.js +11 -0
- package/lib/wrapper/server.js.map +7 -0
- package/package.json +17 -24
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +3 -2
- package/template/base/vitest.config.ts +25 -0
- package/template/express-rest-api/package.json +2 -1
- package/template/express-rest-api/skuba.template.js +1 -1
- package/template/express-rest-api/src/app.test.ts +1 -0
- package/template/greeter/package.json +4 -3
- package/template/greeter/skuba.template.js +1 -1
- package/template/greeter/src/app.test.ts +3 -1
- package/template/koa-rest-api/package.json +2 -1
- package/template/koa-rest-api/skuba.template.js +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +2 -0
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +2 -0
- package/template/koa-rest-api/src/app.test.ts +2 -0
- package/template/koa-rest-api/src/framework/server.test.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +2 -0
- package/template/koa-rest-api/src/testing/metrics.ts +2 -0
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +15 -3
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +11 -9
- package/template/lambda-sqs-worker-cdk/package.json +6 -5
- package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -1
- package/template/lambda-sqs-worker-cdk/src/app.test.ts +22 -13
- package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +1 -0
- package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +33 -31
- package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +8 -2
- package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +3 -2
- package/template/lambda-sqs-worker-cdk/src/testing/services.ts +4 -3
- package/template/oss-npm-package/_package.json +1 -0
- package/template/oss-npm-package/skuba.template.js +1 -1
- package/template/oss-npm-package/src/index.test.ts +2 -0
- package/template/private-npm-package/_package.json +1 -0
- package/template/private-npm-package/skuba.template.js +1 -1
- package/template/private-npm-package/src/index.test.ts +2 -0
- package/config/jest.js +0 -1
- package/jest/moduleNameMapper.js +0 -64
- package/jest/transform.js +0 -62
- package/jest/tsConfig.js +0 -26
- package/jest-preset.js +0 -37
- package/lib/api/jest/index.d.ts +0 -15
- package/lib/api/jest/index.js +0 -59
- package/lib/api/jest/index.js.map +0 -7
- package/lib/cli/configure/modules/jest.d.ts +0 -2
- package/lib/cli/configure/modules/jest.js +0 -86
- package/lib/cli/configure/modules/jest.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
- package/lib/cli/test/reporters/github/annotations.d.ts +0 -9
- package/lib/cli/test/reporters/github/annotations.js +0 -102
- package/lib/cli/test/reporters/github/annotations.js.map +0 -7
- package/lib/cli/test/reporters/github/index.d.ts +0 -5
- package/lib/cli/test/reporters/github/index.js +0 -74
- package/lib/cli/test/reporters/github/index.js.map +0 -7
- package/template/base/jest.config.ts +0 -19
- package/template/base/jest.setup.ts +0 -3
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 annotate_exports = {};
|
|
20
|
-
__export(annotate_exports, {
|
|
21
|
-
createAnnotations: () => createAnnotations
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(annotate_exports);
|
|
24
|
-
var import_buildkite = require("./buildkite/index.js");
|
|
25
|
-
var import_github = require("./github/index.js");
|
|
1
|
+
import { createBuildkiteAnnotations } from "./buildkite/index.js";
|
|
2
|
+
import { createGitHubAnnotations } from "./github/index.js";
|
|
26
3
|
const createAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStream) => {
|
|
27
4
|
await Promise.all([
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
createGitHubAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),
|
|
6
|
+
createBuildkiteAnnotations(
|
|
30
7
|
internal,
|
|
31
8
|
eslint,
|
|
32
9
|
prettier,
|
|
@@ -35,8 +12,7 @@ const createAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStr
|
|
|
35
12
|
)
|
|
36
13
|
]);
|
|
37
14
|
};
|
|
38
|
-
|
|
39
|
-
0 && (module.exports = {
|
|
15
|
+
export {
|
|
40
16
|
createAnnotations
|
|
41
|
-
}
|
|
17
|
+
};
|
|
42
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/lint/annotate/index.ts"],
|
|
4
4
|
"sourcesContent": ["import type { ESLintOutput } from '../../../cli/adapter/eslint.js';\nimport type { PrettierOutput } from '../../../cli/adapter/prettier.js';\nimport type { StreamInterceptor } from '../external.js';\nimport type { InternalLintResult } from '../internal.js';\n\nimport { createBuildkiteAnnotations } from './buildkite/index.js';\nimport { createGitHubAnnotations } from './github/index.js';\n\nexport const createAnnotations = async (\n internal: InternalLintResult,\n eslint: ESLintOutput,\n prettier: PrettierOutput,\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): Promise<void> => {\n await Promise.all([\n createGitHubAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),\n createBuildkiteAnnotations(\n internal,\n eslint,\n prettier,\n tscOk,\n tscOutputStream,\n ),\n ]);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAKA,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AAEjC,MAAM,oBAAoB,OAC/B,UACA,QACA,UACA,OACA,oBACkB;AAClB,QAAM,QAAQ,IAAI;AAAA,IAChB,wBAAwB,UAAU,QAAQ,UAAU,OAAO,eAAe;AAAA,IAC1E;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/autofix.js
CHANGED
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 autofix_exports = {};
|
|
30
|
-
__export(autofix_exports, {
|
|
31
|
-
AUTOFIX_IGNORE_FILES_BASE: () => AUTOFIX_IGNORE_FILES_BASE,
|
|
32
|
-
AUTOFIX_IGNORE_FILES_NPMRC: () => AUTOFIX_IGNORE_FILES_NPMRC,
|
|
33
|
-
autofix: () => autofix
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(autofix_exports);
|
|
36
|
-
var import_util = require("util");
|
|
37
|
-
var import_simple_git = require("simple-git");
|
|
38
|
-
var import_env = require("../../utils/env.js");
|
|
39
|
-
var import_logging = require("../../utils/logging.js");
|
|
40
|
-
var import_npmrc = require("../../utils/npmrc.js");
|
|
41
|
-
var import_wait = require("../../utils/wait.js");
|
|
42
|
-
var import_eslint = require("../adapter/eslint.js");
|
|
43
|
-
var import_prettier = require("../adapter/prettier.js");
|
|
44
|
-
var import_project = require("../configure/analysis/project.js");
|
|
45
|
-
var import_internal = require("./internal.js");
|
|
46
|
-
var Buildkite = __toESM(require("@skuba-lib/api/buildkite"));
|
|
47
|
-
var Git = __toESM(require("@skuba-lib/api/git"));
|
|
48
|
-
var GitHub = __toESM(require("@skuba-lib/api/github"));
|
|
1
|
+
import { inspect } from "util";
|
|
2
|
+
import { simpleGit } from "simple-git";
|
|
3
|
+
import { isCiEnv } from "../../utils/env.js";
|
|
4
|
+
import { createLogger, log } from "../../utils/logging.js";
|
|
5
|
+
import { hasNpmrcSecret } from "../../utils/npmrc.js";
|
|
6
|
+
import { throwOnTimeout } from "../../utils/wait.js";
|
|
7
|
+
import { runESLint } from "../adapter/eslint.js";
|
|
8
|
+
import { runPrettier } from "../adapter/prettier.js";
|
|
9
|
+
import { createDestinationFileReader } from "../configure/analysis/project.js";
|
|
10
|
+
import { internalLint } from "./internal.js";
|
|
11
|
+
import * as Buildkite from "@skuba-lib/api/buildkite";
|
|
12
|
+
import * as Git from "@skuba-lib/api/git";
|
|
13
|
+
import * as GitHub from "@skuba-lib/api/github";
|
|
49
14
|
const RENOVATE_DEFAULT_PREFIX = "renovate";
|
|
50
15
|
const AUTOFIX_COMMIT_MESSAGE = "Run `skuba format`";
|
|
51
16
|
const AUTOFIX_IGNORE_FILES_BASE = [
|
|
@@ -68,7 +33,7 @@ const shouldPush = async ({
|
|
|
68
33
|
currentBranch,
|
|
69
34
|
dir
|
|
70
35
|
}) => {
|
|
71
|
-
if (!
|
|
36
|
+
if (!isCiEnv()) {
|
|
72
37
|
return false;
|
|
73
38
|
}
|
|
74
39
|
const isDefaultBuildkiteBranch = currentBranch && [process.env.BUILDKITE_PIPELINE_DEFAULT_BRANCH, "master", "main"].includes(
|
|
@@ -83,7 +48,7 @@ const shouldPush = async ({
|
|
|
83
48
|
await GitHub.getPullRequestNumber();
|
|
84
49
|
} catch {
|
|
85
50
|
const warning = "An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.";
|
|
86
|
-
|
|
51
|
+
log.warn(warning);
|
|
87
52
|
try {
|
|
88
53
|
await Buildkite.annotate(Buildkite.md.terminal(warning));
|
|
89
54
|
} catch {
|
|
@@ -102,8 +67,8 @@ const shouldPush = async ({
|
|
|
102
67
|
return true;
|
|
103
68
|
};
|
|
104
69
|
const getIgnores = async (dir) => {
|
|
105
|
-
const contents = await
|
|
106
|
-
if (
|
|
70
|
+
const contents = await createDestinationFileReader(dir)(".npmrc");
|
|
71
|
+
if (hasNpmrcSecret(contents ?? "")) {
|
|
107
72
|
return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];
|
|
108
73
|
}
|
|
109
74
|
return AUTOFIX_IGNORE_FILES_BASE;
|
|
@@ -122,8 +87,8 @@ const autofix = async (params) => {
|
|
|
122
87
|
return;
|
|
123
88
|
}
|
|
124
89
|
try {
|
|
125
|
-
|
|
126
|
-
|
|
90
|
+
log.newline();
|
|
91
|
+
log.warn(
|
|
127
92
|
`Attempting to autofix issues (${[
|
|
128
93
|
params.internal ? "skuba" : void 0,
|
|
129
94
|
params.internal || params.eslint ? "ESLint" : void 0,
|
|
@@ -131,14 +96,14 @@ const autofix = async (params) => {
|
|
|
131
96
|
// Prettier is always run
|
|
132
97
|
].filter((s) => s !== void 0).join(", ")})...`
|
|
133
98
|
);
|
|
134
|
-
const logger =
|
|
99
|
+
const logger = createLogger({ debug: params.debug });
|
|
135
100
|
if (params.internal) {
|
|
136
|
-
await
|
|
101
|
+
await internalLint("format");
|
|
137
102
|
}
|
|
138
103
|
if (params.internal || params.eslint) {
|
|
139
|
-
await
|
|
104
|
+
await runESLint("format", logger, params.eslintConfigFile);
|
|
140
105
|
}
|
|
141
|
-
await
|
|
106
|
+
await runPrettier("format", logger);
|
|
142
107
|
if (process.env.GITHUB_ACTIONS) {
|
|
143
108
|
const ref2 = await Git.commitAllChanges({
|
|
144
109
|
dir,
|
|
@@ -146,20 +111,20 @@ const autofix = async (params) => {
|
|
|
146
111
|
ignore: await getIgnores(dir)
|
|
147
112
|
});
|
|
148
113
|
if (!ref2) {
|
|
149
|
-
return
|
|
114
|
+
return log.warn("No autofixes detected.");
|
|
150
115
|
}
|
|
151
|
-
await
|
|
152
|
-
|
|
116
|
+
await throwOnTimeout(simpleGit().push(), { s: 30 });
|
|
117
|
+
log.warn(`Pushed fix commit ${ref2}.`);
|
|
153
118
|
return;
|
|
154
119
|
}
|
|
155
120
|
if (!currentBranch) {
|
|
156
|
-
|
|
157
|
-
|
|
121
|
+
log.warn("Could not determine the current branch.");
|
|
122
|
+
log.warn(
|
|
158
123
|
"Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container."
|
|
159
124
|
);
|
|
160
125
|
return;
|
|
161
126
|
}
|
|
162
|
-
const ref = await
|
|
127
|
+
const ref = await throwOnTimeout(
|
|
163
128
|
GitHub.uploadAllFileChanges({
|
|
164
129
|
branch: currentBranch,
|
|
165
130
|
dir,
|
|
@@ -169,23 +134,22 @@ const autofix = async (params) => {
|
|
|
169
134
|
{ s: 30 }
|
|
170
135
|
);
|
|
171
136
|
if (!ref) {
|
|
172
|
-
return
|
|
137
|
+
return log.warn("No autofixes detected.");
|
|
173
138
|
}
|
|
174
|
-
|
|
139
|
+
log.warn(`Pushed fix commit ${ref}.`);
|
|
175
140
|
} catch (err) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
141
|
+
log.warn(log.bold("Failed to push fix commit."));
|
|
142
|
+
log.warn(
|
|
143
|
+
log.bold(
|
|
179
144
|
"Does your CI environment have write access to your Git repository?"
|
|
180
145
|
)
|
|
181
146
|
);
|
|
182
|
-
|
|
147
|
+
log.subtle(inspect(err));
|
|
183
148
|
}
|
|
184
149
|
};
|
|
185
|
-
|
|
186
|
-
0 && (module.exports = {
|
|
150
|
+
export {
|
|
187
151
|
AUTOFIX_IGNORE_FILES_BASE,
|
|
188
152
|
AUTOFIX_IGNORE_FILES_NPMRC,
|
|
189
153
|
autofix
|
|
190
|
-
}
|
|
154
|
+
};
|
|
191
155
|
//# sourceMappingURL=autofix.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/autofix.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport { simpleGit } from 'simple-git';\n\nimport { isCiEnv } from '../../utils/env.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { hasNpmrcSecret } from '../../utils/npmrc.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\nimport { runESLint } from '../adapter/eslint.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { createDestinationFileReader } from '../configure/analysis/project.js';\n\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nimport * as Buildkite from '@skuba-lib/api/buildkite';\nimport * as Git from '@skuba-lib/api/git';\nimport * as GitHub from '@skuba-lib/api/github';\n\nconst RENOVATE_DEFAULT_PREFIX = 'renovate';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nexport const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[] = [\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nexport const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: '.npmrc',\n state: 'modified',\n },\n];\n\nconst shouldPush = async ({\n currentBranch,\n dir,\n}: {\n currentBranch?: string;\n dir: string;\n}) => {\n if (!isCiEnv()) {\n // We're not running in a CI environment so we don't need to push autofixes.\n // Ideally we'd drive this off of repository write permissions, but that is\n // non-trivial to infer without attempting an actual write.\n return false;\n }\n\n const isDefaultBuildkiteBranch =\n currentBranch &&\n [process.env.BUILDKITE_PIPELINE_DEFAULT_BRANCH, 'master', 'main'].includes(\n currentBranch,\n );\n\n const isProtectedGitHubBranch = process.env.GITHUB_REF_PROTECTED === 'true';\n\n if (isDefaultBuildkiteBranch || isProtectedGitHubBranch) {\n // The current branch is a protected branch.\n // We respect GitHub Flow; avoid pushing directly to the default branch.\n return false;\n }\n\n if (currentBranch?.startsWith(RENOVATE_DEFAULT_PREFIX)) {\n try {\n await GitHub.getPullRequestNumber();\n } catch {\n const warning =\n 'An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.';\n log.warn(warning);\n try {\n await Buildkite.annotate(Buildkite.md.terminal(warning));\n } catch {}\n\n return false;\n }\n }\n\n let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage?.startsWith(AUTOFIX_COMMIT_MESSAGE)) {\n // Short circuit when the head commit appears to be one of our autofixes.\n // Repeating the same operation is unlikely to correct outstanding issues.\n return false;\n }\n\n // Allow the push attempt to go ahead if our guards have been cleared.\n return true;\n};\n\nconst getIgnores = async (dir: string): Promise<Git.ChangedFile[]> => {\n const contents = await createDestinationFileReader(dir)('.npmrc');\n\n // If an .npmrc has secrets, we need to ignore it\n if (hasNpmrcSecret(contents ?? '')) {\n return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];\n }\n\n return AUTOFIX_IGNORE_FILES_BASE;\n};\n\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n internal: boolean;\n\n eslintConfigFile?: string;\n}\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n if (!params.eslint && !params.prettier && !params.internal) {\n return;\n }\n\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n if (!(await shouldPush({ currentBranch, dir }))) {\n return;\n }\n\n try {\n log.newline();\n\n log.warn(\n `Attempting to autofix issues (${[\n params.internal ? 'skuba' : undefined,\n params.internal || params.eslint ? 'ESLint' : undefined,\n 'Prettier', // Prettier is always run\n ]\n .filter((s) => s !== undefined)\n .join(', ')})...`,\n );\n\n const logger = createLogger({ debug: params.debug });\n\n if (params.internal) {\n await internalLint('format');\n }\n\n if (params.internal || params.eslint) {\n await runESLint('format', logger, params.eslintConfigFile);\n }\n\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint/internal fixes.\n await runPrettier('format', logger);\n\n if (process.env.GITHUB_ACTIONS) {\n // GitHub runners have Git installed locally\n const ref = await Git.commitAllChanges({\n dir,\n message: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n });\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n await throwOnTimeout(simpleGit().push(), { s: 30 });\n log.warn(`Pushed fix commit ${ref}.`);\n return;\n }\n\n // Other CI Environments, use GitHub API\n if (!currentBranch) {\n log.warn('Could not determine the current branch.');\n log.warn(\n 'Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container.',\n );\n return;\n }\n\n const ref = await throwOnTimeout(\n GitHub.uploadAllFileChanges({\n branch: currentBranch,\n dir,\n messageHeadline: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n }),\n { s: 30 },\n );\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n log.warn(`Pushed fix commit ${ref}.`);\n } catch (err) {\n log.warn(log.bold('Failed to push fix commit.'));\n log.warn(\n log.bold(\n 'Does your CI environment have write access to your Git repository?',\n ),\n );\n log.subtle(inspect(err));\n }\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["ref"]
|
|
7
7
|
}
|
package/lib/cli/lint/eslint.js
CHANGED
|
@@ -1,62 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
runESLintInCurrentThread: () => runESLintInCurrentThread,
|
|
32
|
-
runESLintInWorkerThread: () => runESLintInWorkerThread
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(eslint_exports);
|
|
35
|
-
var import_path = __toESM(require("path"));
|
|
36
|
-
var import_worker_threads = require("worker_threads");
|
|
37
|
-
var import_chalk = __toESM(require("chalk"));
|
|
38
|
-
var import_logging = require("../../utils/logging.js");
|
|
39
|
-
var import_worker = require("../../utils/worker.js");
|
|
40
|
-
var import_eslint = require("../adapter/eslint.js");
|
|
41
|
-
const LOG_PREFIX = import_chalk.default.magenta("ESLint \u2502");
|
|
42
|
-
const runESLintInCurrentThread = ({ debug, eslintConfigFile }) => (0, import_eslint.runESLint)(
|
|
1
|
+
import { styleText } from "node:util";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { isMainThread } from "worker_threads";
|
|
4
|
+
import { createLogger } from "../../utils/logging.js";
|
|
5
|
+
import { execWorkerThread, postWorkerOutput } from "../../utils/worker.js";
|
|
6
|
+
import { runESLint } from "../adapter/eslint.js";
|
|
7
|
+
const LOG_PREFIX = styleText("magenta", "ESLint \u2502");
|
|
8
|
+
const runESLintInCurrentThread = ({ debug, eslintConfigFile }) => runESLint(
|
|
43
9
|
"lint",
|
|
44
|
-
|
|
10
|
+
createLogger({ debug, prefixes: [LOG_PREFIX] }),
|
|
45
11
|
eslintConfigFile
|
|
46
12
|
);
|
|
47
|
-
const runESLintInWorkerThread = (input) =>
|
|
48
|
-
|
|
13
|
+
const runESLintInWorkerThread = (input) => execWorkerThread(
|
|
14
|
+
path.posix.join(import.meta.dirname, "eslint.js"),
|
|
49
15
|
input
|
|
50
16
|
);
|
|
51
|
-
if (!
|
|
52
|
-
|
|
17
|
+
if (!isMainThread) {
|
|
18
|
+
postWorkerOutput(
|
|
53
19
|
runESLintInCurrentThread,
|
|
54
|
-
|
|
20
|
+
createLogger({ debug: false, prefixes: [LOG_PREFIX] })
|
|
55
21
|
);
|
|
56
22
|
}
|
|
57
|
-
|
|
58
|
-
0 && (module.exports = {
|
|
23
|
+
export {
|
|
59
24
|
runESLintInCurrentThread,
|
|
60
25
|
runESLintInWorkerThread
|
|
61
|
-
}
|
|
26
|
+
};
|
|
62
27
|
//# sourceMappingURL=eslint.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type ESLintOutput, runESLint } from '../adapter/eslint.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = styleText('magenta', 'ESLint \u2502');\n\nexport const runESLintInCurrentThread = ({ debug, eslintConfigFile }: Input) =>\n runESLint(\n 'lint',\n createLogger({ debug, prefixes: [LOG_PREFIX] }),\n eslintConfigFile,\n );\n\nexport const runESLintInWorkerThread = (input: Input) =>\n execWorkerThread<Input, ESLintOutput>(\n path.posix.join(import.meta.dirname, 'eslint.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runESLintInCurrentThread,\n createLogger({ debug: false, prefixes: [LOG_PREFIX] }),\n );\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAE7B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,wBAAwB;AACnD,SAA4B,iBAAiB;AAI7C,MAAM,aAAa,UAAU,WAAW,iBAAY;AAE7C,MAAM,2BAA2B,CAAC,EAAE,OAAO,iBAAiB,MACjE;AAAA,EACE;AAAA,EACA,aAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EAC9C;AACF;AAEK,MAAM,0BAA0B,CAAC,UACtC;AAAA,EACE,KAAK,MAAM,KAAK,YAAY,SAAS,WAAW;AAAA,EAChD;AACF;AAEF,IAAI,CAAC,cAAc;AACjB;AAAA,IACE;AAAA,IACA,aAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/external.js
CHANGED
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 external_exports = {};
|
|
30
|
-
__export(external_exports, {
|
|
31
|
-
StreamInterceptor: () => StreamInterceptor,
|
|
32
|
-
externalLint: () => externalLint
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(external_exports);
|
|
35
|
-
var import_stream = __toESM(require("stream"));
|
|
36
|
-
var import_eslint = require("./eslint.js");
|
|
37
|
-
var import_prettier = require("./prettier.js");
|
|
38
|
-
var import_tsc = require("./tsc.js");
|
|
1
|
+
import stream from "stream";
|
|
2
|
+
import { runESLintInCurrentThread, runESLintInWorkerThread } from "./eslint.js";
|
|
3
|
+
import {
|
|
4
|
+
runPrettierInCurrentThread,
|
|
5
|
+
runPrettierInWorkerThread
|
|
6
|
+
} from "./prettier.js";
|
|
7
|
+
import { runTscInNewProcess } from "./tsc.js";
|
|
39
8
|
const tscPrefixRegex = /^(.*?tsc\s+│.*?\s)/gm;
|
|
40
|
-
class StreamInterceptor extends
|
|
9
|
+
class StreamInterceptor extends stream.Transform {
|
|
41
10
|
chunks = [];
|
|
42
11
|
output() {
|
|
43
12
|
return Buffer.concat(this.chunks).toString().replace(tscPrefixRegex, "");
|
|
@@ -49,22 +18,22 @@ class StreamInterceptor extends import_stream.default.Transform {
|
|
|
49
18
|
}
|
|
50
19
|
const lintConcurrently = async ({ tscOutputStream, ...input }) => {
|
|
51
20
|
const [eslint, prettier, tscOk] = await Promise.all([
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
21
|
+
runESLintInWorkerThread(input),
|
|
22
|
+
runPrettierInWorkerThread(input),
|
|
23
|
+
runTscInNewProcess({ ...input, tscOutputStream })
|
|
55
24
|
]);
|
|
56
25
|
return { eslint, prettier, tscOk };
|
|
57
26
|
};
|
|
58
27
|
const lintSerially = async ({ tscOutputStream, ...input }) => {
|
|
59
|
-
const eslint = await
|
|
60
|
-
const prettier = await
|
|
61
|
-
const tscOk = await
|
|
28
|
+
const eslint = await runESLintInWorkerThread(input);
|
|
29
|
+
const prettier = await runPrettierInWorkerThread(input);
|
|
30
|
+
const tscOk = await runTscInNewProcess({ ...input, tscOutputStream });
|
|
62
31
|
return { eslint, prettier, tscOk };
|
|
63
32
|
};
|
|
64
33
|
const lintSeriallyWithoutWorkerThreads = async (input) => {
|
|
65
|
-
const eslint = await
|
|
66
|
-
const prettier = await
|
|
67
|
-
const tscOk = await
|
|
34
|
+
const eslint = await runESLintInCurrentThread(input);
|
|
35
|
+
const prettier = await runPrettierInCurrentThread(input);
|
|
36
|
+
const tscOk = await runTscInNewProcess(input);
|
|
68
37
|
return { eslint, prettier, tscOk };
|
|
69
38
|
};
|
|
70
39
|
const selectLintFunction = (input) => {
|
|
@@ -86,9 +55,8 @@ const externalLint = async (input) => {
|
|
|
86
55
|
tscOutputStream
|
|
87
56
|
};
|
|
88
57
|
};
|
|
89
|
-
|
|
90
|
-
0 && (module.exports = {
|
|
58
|
+
export {
|
|
91
59
|
StreamInterceptor,
|
|
92
60
|
externalLint
|
|
93
|
-
}
|
|
61
|
+
};
|
|
94
62
|
//# sourceMappingURL=external.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/external.ts"],
|
|
4
4
|
"sourcesContent": ["import stream from 'stream';\n\nimport { runESLintInCurrentThread, runESLintInWorkerThread } from './eslint.js';\nimport {\n runPrettierInCurrentThread,\n runPrettierInWorkerThread,\n} from './prettier.js';\nimport { runTscInNewProcess } from './tsc.js';\nimport type { Input } from './types.js';\n\nconst tscPrefixRegex = /^(.*?tsc\\s+\u2502.*?\\s)/gm;\n\nexport class StreamInterceptor extends stream.Transform {\n private chunks: Uint8Array[] = [];\n\n public output() {\n return Buffer.concat(this.chunks).toString().replace(tscPrefixRegex, '');\n }\n\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n this.chunks.push(chunk);\n\n callback(null, chunk);\n }\n}\n\nconst lintConcurrently = async ({ tscOutputStream, ...input }: Input) => {\n const [eslint, prettier, tscOk] = await Promise.all([\n runESLintInWorkerThread(input),\n runPrettierInWorkerThread(input),\n runTscInNewProcess({ ...input, tscOutputStream }),\n ]);\n\n return { eslint, prettier, tscOk };\n};\n\n/**\n * Run linting tools `--serial`ly for resource-constrained environments.\n *\n * Note that we still run ESLint and Prettier in worker threads as a\n * counterintuitive optimisation. Memory can be more readily freed on worker\n * thread exit, which isn't as easy with a monolithic main thread.\n */\nconst lintSerially = async ({ tscOutputStream, ...input }: Input) => {\n const eslint = await runESLintInWorkerThread(input);\n const prettier = await runPrettierInWorkerThread(input);\n const tscOk = await runTscInNewProcess({ ...input, tscOutputStream });\n\n return { eslint, prettier, tscOk };\n};\n\nconst lintSeriallyWithoutWorkerThreads = async (input: Input) => {\n const eslint = await runESLintInCurrentThread(input);\n const prettier = await runPrettierInCurrentThread(input);\n const tscOk = await runTscInNewProcess(input);\n\n return { eslint, prettier, tscOk };\n};\n\nconst selectLintFunction = (input: Input) => {\n if (!input.workerThreads) {\n return lintSeriallyWithoutWorkerThreads;\n }\n\n // `--debug` implies `--serial`.\n const isSerial = input.debug || input.serial;\n\n return isSerial ? lintSerially : lintConcurrently;\n};\n\nexport const externalLint = async (input: Input) => {\n const lint = selectLintFunction(input);\n\n const tscOutputStream = new StreamInterceptor();\n tscOutputStream.pipe(input.tscOutputStream ?? process.stdout);\n\n const { eslint, prettier, tscOk } = await lint({ ...input, tscOutputStream });\n\n return {\n eslint,\n prettier,\n tscOk,\n tscOutputStream,\n };\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AAEnB,SAAS,0BAA0B,+BAA+B;AAClE;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AAGnC,MAAM,iBAAiB;AAEhB,MAAM,0BAA0B,OAAO,UAAU;AAAA,EAC9C,SAAuB,CAAC;AAAA,EAEzB,SAAS;AACd,WAAO,OAAO,OAAO,KAAK,MAAM,EAAE,SAAS,EAAE,QAAQ,gBAAgB,EAAE;AAAA,EACzE;AAAA,EAEA,WACE,OACA,WACA,UACA;AACA,SAAK,OAAO,KAAK,KAAK;AAEtB,aAAS,MAAM,KAAK;AAAA,EACtB;AACF;AAEA,MAAM,mBAAmB,OAAO,EAAE,iBAAiB,GAAG,MAAM,MAAa;AACvE,QAAM,CAAC,QAAQ,UAAU,KAAK,IAAI,MAAM,QAAQ,IAAI;AAAA,IAClD,wBAAwB,KAAK;AAAA,IAC7B,0BAA0B,KAAK;AAAA,IAC/B,mBAAmB,EAAE,GAAG,OAAO,gBAAgB,CAAC;AAAA,EAClD,CAAC;AAED,SAAO,EAAE,QAAQ,UAAU,MAAM;AACnC;AASA,MAAM,eAAe,OAAO,EAAE,iBAAiB,GAAG,MAAM,MAAa;AACnE,QAAM,SAAS,MAAM,wBAAwB,KAAK;AAClD,QAAM,WAAW,MAAM,0BAA0B,KAAK;AACtD,QAAM,QAAQ,MAAM,mBAAmB,EAAE,GAAG,OAAO,gBAAgB,CAAC;AAEpE,SAAO,EAAE,QAAQ,UAAU,MAAM;AACnC;AAEA,MAAM,mCAAmC,OAAO,UAAiB;AAC/D,QAAM,SAAS,MAAM,yBAAyB,KAAK;AACnD,QAAM,WAAW,MAAM,2BAA2B,KAAK;AACvD,QAAM,QAAQ,MAAM,mBAAmB,KAAK;AAE5C,SAAO,EAAE,QAAQ,UAAU,MAAM;AACnC;AAEA,MAAM,qBAAqB,CAAC,UAAiB;AAC3C,MAAI,CAAC,MAAM,eAAe;AACxB,WAAO;AAAA,EACT;AAGA,QAAM,WAAW,MAAM,SAAS,MAAM;AAEtC,SAAO,WAAW,eAAe;AACnC;AAEO,MAAM,eAAe,OAAO,UAAiB;AAClD,QAAM,OAAO,mBAAmB,KAAK;AAErC,QAAM,kBAAkB,IAAI,kBAAkB;AAC9C,kBAAgB,KAAK,MAAM,mBAAmB,QAAQ,MAAM;AAE5D,QAAM,EAAE,QAAQ,UAAU,MAAM,IAAI,MAAM,KAAK,EAAE,GAAG,OAAO,gBAAgB,CAAC;AAE5E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/index.js
CHANGED
|
@@ -1,52 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 lint_exports = {};
|
|
20
|
-
__export(lint_exports, {
|
|
21
|
-
lint: () => lint
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(lint_exports);
|
|
24
|
-
var import_util = require("util");
|
|
25
|
-
var import_args = require("../../utils/args.js");
|
|
26
|
-
var import_logging = require("../../utils/logging.js");
|
|
27
|
-
var import_packageManager = require("../../utils/packageManager.js");
|
|
28
|
-
var import_wait = require("../../utils/wait.js");
|
|
29
|
-
var import_annotate = require("./annotate/index.js");
|
|
30
|
-
var import_autofix = require("./autofix.js");
|
|
31
|
-
var import_external = require("./external.js");
|
|
32
|
-
var import_internal = require("./internal.js");
|
|
1
|
+
import { inspect } from "util";
|
|
2
|
+
import { hasDebugFlag, hasSerialFlag } from "../../utils/args.js";
|
|
3
|
+
import { log } from "../../utils/logging.js";
|
|
4
|
+
import { detectPackageManager } from "../../utils/packageManager.js";
|
|
5
|
+
import { throwOnTimeout } from "../../utils/wait.js";
|
|
6
|
+
import { createAnnotations } from "./annotate/index.js";
|
|
7
|
+
import { autofix } from "./autofix.js";
|
|
8
|
+
import { externalLint } from "./external.js";
|
|
9
|
+
import { internalLint } from "./internal.js";
|
|
33
10
|
const lint = async (args = process.argv.slice(2), tscWriteable = void 0, workerThreads = true) => {
|
|
34
11
|
const opts = {
|
|
35
|
-
debug:
|
|
36
|
-
serial:
|
|
12
|
+
debug: hasDebugFlag(args),
|
|
13
|
+
serial: hasSerialFlag(args),
|
|
37
14
|
tscOutputStream: tscWriteable,
|
|
38
15
|
workerThreads
|
|
39
16
|
};
|
|
40
|
-
const { eslint, prettier, tscOk, tscOutputStream } = await
|
|
41
|
-
const internal = await
|
|
17
|
+
const { eslint, prettier, tscOk, tscOutputStream } = await externalLint(opts);
|
|
18
|
+
const internal = await internalLint("lint", opts);
|
|
42
19
|
try {
|
|
43
|
-
await
|
|
44
|
-
|
|
20
|
+
await throwOnTimeout(
|
|
21
|
+
createAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),
|
|
45
22
|
{ s: 30 }
|
|
46
23
|
);
|
|
47
24
|
} catch (err) {
|
|
48
|
-
|
|
49
|
-
|
|
25
|
+
log.warn("Failed to annotate lint results.");
|
|
26
|
+
log.subtle(inspect(err));
|
|
50
27
|
}
|
|
51
28
|
if (!internal.ok || !eslint.ok || !prettier.ok || !tscOk) {
|
|
52
29
|
process.exitCode = 1;
|
|
@@ -56,28 +33,25 @@ const lint = async (args = process.argv.slice(2), tscWriteable = void 0, workerT
|
|
|
56
33
|
...prettier.ok ? [] : ["Prettier"],
|
|
57
34
|
...tscOk ? [] : ["tsc"]
|
|
58
35
|
];
|
|
59
|
-
|
|
36
|
+
log.err(`${tools.join(", ")} found issues that require triage.`);
|
|
60
37
|
if (internal.fixable || eslint.fixable || !prettier.ok) {
|
|
61
|
-
const packageManager = await
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
`Try running ${
|
|
65
|
-
packageManager.print.exec
|
|
66
|
-
"skuba",
|
|
67
|
-
"format"
|
|
38
|
+
const packageManager = await detectPackageManager();
|
|
39
|
+
log.newline();
|
|
40
|
+
log.warn(
|
|
41
|
+
`Try running ${log.bold(
|
|
42
|
+
`${packageManager.print.exec} skuba format`
|
|
68
43
|
)} to fix them.`
|
|
69
44
|
);
|
|
70
45
|
}
|
|
71
46
|
}
|
|
72
|
-
await
|
|
47
|
+
await autofix({
|
|
73
48
|
debug: opts.debug,
|
|
74
49
|
eslint: eslint.fixable,
|
|
75
50
|
prettier: !prettier.ok,
|
|
76
51
|
internal: internal.fixable
|
|
77
52
|
});
|
|
78
53
|
};
|
|
79
|
-
|
|
80
|
-
0 && (module.exports = {
|
|
54
|
+
export {
|
|
81
55
|
lint
|
|
82
|
-
}
|
|
56
|
+
};
|
|
83
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Writable } from 'stream';\nimport { inspect } from 'util';\n\nimport { hasDebugFlag, hasSerialFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { detectPackageManager } from '../../utils/packageManager.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\n\nimport { createAnnotations } from './annotate/index.js';\nimport { autofix } from './autofix.js';\nimport { externalLint } from './external.js';\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nexport const lint = async (\n args = process.argv.slice(2),\n tscWriteable: Writable | undefined = undefined,\n workerThreads = true,\n) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n serial: hasSerialFlag(args),\n tscOutputStream: tscWriteable,\n workerThreads,\n };\n\n const { eslint, prettier, tscOk, tscOutputStream } = await externalLint(opts);\n const internal = await internalLint('lint', opts);\n\n try {\n await throwOnTimeout(\n createAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),\n { s: 30 },\n );\n } catch (err) {\n log.warn('Failed to annotate lint results.');\n log.subtle(inspect(err));\n }\n\n if (!internal.ok || !eslint.ok || !prettier.ok || !tscOk) {\n process.exitCode = 1;\n\n const tools = [\n ...(internal.ok ? [] : ['skuba']),\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ...(tscOk ? [] : ['tsc']),\n ];\n\n log.err(`${tools.join(', ')} found issues that require triage.`);\n\n if (internal.fixable || eslint.fixable || !prettier.ok) {\n const packageManager = await detectPackageManager();\n log.newline();\n log.warn(\n `Try running ${log.bold(\n packageManager.print.exec
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { Writable } from 'stream';\nimport { inspect } from 'util';\n\nimport { hasDebugFlag, hasSerialFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { detectPackageManager } from '../../utils/packageManager.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\n\nimport { createAnnotations } from './annotate/index.js';\nimport { autofix } from './autofix.js';\nimport { externalLint } from './external.js';\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nexport const lint = async (\n args = process.argv.slice(2),\n tscWriteable: Writable | undefined = undefined,\n workerThreads = true,\n) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n serial: hasSerialFlag(args),\n tscOutputStream: tscWriteable,\n workerThreads,\n };\n\n const { eslint, prettier, tscOk, tscOutputStream } = await externalLint(opts);\n const internal = await internalLint('lint', opts);\n\n try {\n await throwOnTimeout(\n createAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),\n { s: 30 },\n );\n } catch (err) {\n log.warn('Failed to annotate lint results.');\n log.subtle(inspect(err));\n }\n\n if (!internal.ok || !eslint.ok || !prettier.ok || !tscOk) {\n process.exitCode = 1;\n\n const tools = [\n ...(internal.ok ? [] : ['skuba']),\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ...(tscOk ? [] : ['tsc']),\n ];\n\n log.err(`${tools.join(', ')} found issues that require triage.`);\n\n if (internal.fixable || eslint.fixable || !prettier.ok) {\n const packageManager = await detectPackageManager();\n log.newline();\n log.warn(\n `Try running ${log.bold(\n `${packageManager.print.exec} skuba format`,\n )} to fix them.`,\n );\n }\n }\n\n await autofix({\n debug: opts.debug,\n eslint: eslint.fixable,\n prettier: !prettier.ok,\n internal: internal.fixable,\n });\n};\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,eAAe;AAExB,SAAS,cAAc,qBAAqB;AAC5C,SAAS,WAAW;AACpB,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAE/B,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAGtB,MAAM,OAAO,OAClB,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,eAAqC,QACrC,gBAAgB,SACb;AACH,QAAM,OAAc;AAAA,IAClB,OAAO,aAAa,IAAI;AAAA,IACxB,QAAQ,cAAc,IAAI;AAAA,IAC1B,iBAAiB;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,QAAQ,UAAU,OAAO,gBAAgB,IAAI,MAAM,aAAa,IAAI;AAC5E,QAAM,WAAW,MAAM,aAAa,QAAQ,IAAI;AAEhD,MAAI;AACF,UAAM;AAAA,MACJ,kBAAkB,UAAU,QAAQ,UAAU,OAAO,eAAe;AAAA,MACpE,EAAE,GAAG,GAAG;AAAA,IACV;AAAA,EACF,SAAS,KAAK;AACZ,QAAI,KAAK,kCAAkC;AAC3C,QAAI,OAAO,QAAQ,GAAG,CAAC;AAAA,EACzB;AAEA,MAAI,CAAC,SAAS,MAAM,CAAC,OAAO,MAAM,CAAC,SAAS,MAAM,CAAC,OAAO;AACxD,YAAQ,WAAW;AAEnB,UAAM,QAAQ;AAAA,MACZ,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,OAAO;AAAA,MAC/B,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AAAA,MAC9B,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,UAAU;AAAA,MAClC,GAAI,QAAQ,CAAC,IAAI,CAAC,KAAK;AAAA,IACzB;AAEA,QAAI,IAAI,GAAG,MAAM,KAAK,IAAI,CAAC,oCAAoC;AAE/D,QAAI,SAAS,WAAW,OAAO,WAAW,CAAC,SAAS,IAAI;AACtD,YAAM,iBAAiB,MAAM,qBAAqB;AAClD,UAAI,QAAQ;AACZ,UAAI;AAAA,QACF,eAAe,IAAI;AAAA,UACjB,GAAG,eAAe,MAAM,IAAI;AAAA,QAC9B,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,OAAO,KAAK;AAAA,IACZ,QAAQ,OAAO;AAAA,IACf,UAAU,CAAC,SAAS;AAAA,IACpB,UAAU,SAAS;AAAA,EACrB,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|