skuba 13.0.3 → 14.0.0-esmify-skuba-20251031135439
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.js +10 -2
- package/lib/cli/adapter/eslint.js +10 -46
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/adapter/prettier.js +40 -72
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/args.js +7 -43
- package/lib/cli/build/args.js.map +2 -2
- package/lib/cli/build/assets.js +27 -62
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/build/esbuild.js +20 -55
- package/lib/cli/build/esbuild.js.map +3 -3
- package/lib/cli/build/index.js +20 -56
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/build/tsc.js +24 -66
- package/lib/cli/build/tsc.js.map +2 -2
- package/lib/cli/buildPackage/index.js +7 -33
- package/lib/cli/buildPackage/index.js.map +1 -1
- package/lib/cli/configure/analyseConfiguration.js +15 -51
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.js +24 -60
- package/lib/cli/configure/analyseDependencies.js.map +3 -3
- package/lib/cli/configure/analysis/diff.js +4 -40
- package/lib/cli/configure/analysis/diff.js.map +2 -2
- package/lib/cli/configure/analysis/files.js +7 -43
- package/lib/cli/configure/analysis/files.js.map +2 -2
- package/lib/cli/configure/analysis/git.js +11 -47
- package/lib/cli/configure/analysis/git.js.map +2 -2
- package/lib/cli/configure/analysis/package.js +10 -48
- package/lib/cli/configure/analysis/package.js.map +3 -3
- package/lib/cli/configure/analysis/project.js +18 -53
- package/lib/cli/configure/analysis/project.js.map +2 -2
- package/lib/cli/configure/dependencies/index.js +5 -39
- package/lib/cli/configure/dependencies/index.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +3 -29
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js +3 -29
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js +3 -29
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +1 -27
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js +4 -32
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +31 -61
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.js +13 -49
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/getProjectType.js +13 -36
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +49 -85
- package/lib/cli/configure/index.js.map +3 -3
- package/lib/cli/configure/modules/eslint.js +9 -35
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/ignore.js +7 -33
- package/lib/cli/configure/modules/ignore.js.map +1 -1
- package/lib/cli/configure/modules/index.js +17 -45
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/nodemon.js +2 -28
- package/lib/cli/configure/modules/nodemon.js.map +1 -1
- package/lib/cli/configure/modules/package.js +9 -35
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +10 -36
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +17 -43
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/serverless.js +1 -27
- package/lib/cli/configure/modules/serverless.js.map +1 -1
- package/lib/cli/configure/modules/tslint.js +2 -28
- package/lib/cli/configure/modules/tslint.js.map +1 -1
- package/lib/cli/configure/processing/configFile.js +4 -44
- package/lib/cli/configure/processing/configFile.js.map +1 -1
- package/lib/cli/configure/processing/deleteFiles.js +1 -27
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +2 -30
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +6 -34
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +1 -27
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +2 -28
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.js +10 -52
- package/lib/cli/configure/processing/package.js.map +3 -3
- package/lib/cli/configure/processing/prettier.js +3 -39
- package/lib/cli/configure/processing/prettier.js.map +2 -2
- package/lib/cli/configure/processing/record.js +4 -44
- package/lib/cli/configure/processing/record.js.map +2 -2
- package/lib/cli/configure/processing/typescript.js +28 -70
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/types.js +0 -15
- package/lib/cli/configure/types.js.map +3 -3
- package/lib/cli/format/index.js +19 -55
- package/lib/cli/format/index.js.map +2 -2
- package/lib/cli/help/index.js +5 -31
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.js +75 -107
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.js +16 -54
- package/lib/cli/init/git.js.map +3 -3
- package/lib/cli/init/index.js +66 -99
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.js +20 -56
- package/lib/cli/init/prompts.js.map +3 -3
- package/lib/cli/init/types.js +6 -42
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +5 -39
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +7 -43
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js +2 -38
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +10 -46
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +2 -38
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +2 -38
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +2 -38
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +1 -27
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +10 -46
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +1 -27
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +1 -27
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +3 -29
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/index.js +5 -31
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.js +38 -78
- package/lib/cli/lint/autofix.js.map +3 -3
- package/lib/cli/lint/eslint.js +14 -52
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/external.js +18 -53
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.js +24 -50
- package/lib/cli/lint/index.js.map +1 -1
- package/lib/cli/lint/internal.js +17 -53
- package/lib/cli/lint/internal.js.map +2 -2
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +8 -36
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +10 -46
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +20 -56
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +33 -68
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.js +21 -54
- package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +3 -29
- 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 +10 -46
- 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 +5 -31
- 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 +36 -73
- 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 -49
- 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 +3 -29
- 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 +24 -64
- 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 +3 -29
- 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 -49
- 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 +5 -31
- 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 -49
- 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 -49
- 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 +3 -29
- 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 -49
- 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 +32 -76
- 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 +9 -35
- 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 +10 -46
- 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 +28 -88
- 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 +15 -53
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +16 -52
- 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 +9 -35
- 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 +9 -45
- 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 +11 -47
- 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 +3 -29
- 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 +14 -50
- 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 +10 -46
- 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 +9 -40
- 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 +10 -46
- 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 +10 -46
- 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 +12 -48
- 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 +3 -29
- 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 +10 -46
- 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 +3 -29
- 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 +7 -33
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
- package/lib/cli/lint/prettier.js +13 -51
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/lint/tsc.js +3 -29
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/lint/types.js +0 -15
- package/lib/cli/lint/types.js.map +3 -3
- package/lib/cli/migrate/index.js +9 -35
- package/lib/cli/migrate/index.js.map +1 -1
- package/lib/cli/migrate/nodeVersion/checks.js +26 -68
- package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/index.js +24 -56
- package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
- package/lib/cli/node/index.js +20 -60
- package/lib/cli/node/index.js.map +3 -3
- package/lib/cli/release/index.js +3 -29
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +15 -51
- package/lib/cli/start/index.js.map +3 -3
- package/lib/cli/test/index.js +3 -45
- package/lib/cli/test/index.js.map +2 -2
- package/lib/cli/version/index.js +5 -31
- package/lib/cli/version/index.js.map +1 -1
- package/lib/config/prettier.d.ts +7 -0
- package/lib/index.js +4 -49
- package/lib/index.js.map +2 -2
- package/lib/skuba.js +26 -44
- package/lib/skuba.js.map +3 -3
- package/lib/{cli → src/cli}/configure/analyseDependencies.d.ts +1 -1
- package/lib/{cli → src/cli}/configure/analysis/package.d.ts +2 -3
- package/lib/{cli → src/cli}/configure/ensureTemplateCompletion.d.ts +1 -1
- package/lib/{cli → src/cli}/configure/getEntryPoint.d.ts +1 -1
- package/lib/{cli → src/cli}/configure/getProjectType.d.ts +1 -1
- package/lib/src/cli/configure/processing/package.d.ts +5 -0
- package/lib/{cli → src/cli}/configure/types.d.ts +15 -4
- package/lib/{cli → src/cli}/init/getConfig.d.ts +1 -1
- package/lib/{cli → src/cli}/init/prompts.d.ts +4 -4
- package/lib/{cli → src/cli}/lint/internalLints/upgrade/index.d.ts +1 -1
- package/lib/{index.d.ts → src/index.d.ts} +0 -1
- package/lib/src/utils/fs.d.ts +1 -0
- package/lib/{utils → src/utils}/manifest.d.ts +3 -2
- package/lib/src/utils/sleep.d.ts +5 -0
- package/lib/{utils → src/utils}/wait.d.ts +0 -4
- package/lib/{wrapper → src/wrapper}/http.d.ts +0 -6
- package/lib/src/wrapper/server.d.ts +7 -0
- package/lib/utils/args.js +8 -50
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/command.js +6 -50
- package/lib/utils/command.js.map +3 -3
- package/lib/utils/copy.js +22 -64
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.js +37 -84
- package/lib/utils/dir.js.map +3 -3
- package/lib/utils/env.js +1 -27
- package/lib/utils/env.js.map +1 -1
- package/lib/utils/error.js +11 -53
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.js +26 -70
- package/lib/utils/exec.js.map +3 -3
- package/lib/utils/fs.js +15 -0
- package/lib/utils/fs.js.map +7 -0
- package/lib/utils/help.js +5 -31
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/logging.js +13 -55
- package/lib/utils/logging.js.map +2 -2
- package/lib/utils/logo.js +23 -59
- package/lib/utils/logo.js.map +2 -2
- package/lib/utils/manifest.js +12 -60
- package/lib/utils/manifest.js.map +3 -3
- package/lib/utils/npmrc.js +1 -27
- package/lib/utils/npmrc.js.map +1 -1
- package/lib/utils/packageManager.js +14 -56
- package/lib/utils/packageManager.js.map +2 -2
- package/lib/utils/port.js +4 -42
- package/lib/utils/port.js.map +2 -2
- package/lib/utils/sleep.js +9 -0
- package/lib/utils/sleep.js.map +7 -0
- package/lib/utils/template.js +21 -68
- package/lib/utils/template.js.map +3 -3
- package/lib/utils/validation.js +6 -42
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +11 -53
- package/lib/utils/version.js.map +2 -2
- package/lib/utils/wait.js +6 -42
- package/lib/utils/wait.js.map +2 -2
- package/lib/utils/worker.js +9 -37
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/functionHandler.js +17 -50
- package/lib/wrapper/functionHandler.js.map +2 -2
- package/lib/wrapper/http.js +7 -53
- package/lib/wrapper/http.js.map +3 -3
- package/lib/wrapper/index.js +6 -6
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +7 -43
- package/lib/wrapper/main.js.map +3 -3
- package/lib/wrapper/requestListener.js +12 -47
- package/lib/wrapper/requestListener.js.map +3 -3
- package/lib/wrapper/server.js +9 -0
- package/lib/wrapper/server.js.map +7 -0
- package/package.json +19 -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/.gantry/dev.yml +2 -2
- package/template/express-rest-api/.gantry/prod.yml +2 -2
- package/template/express-rest-api/package.json +6 -5
- 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/.gantry/dev.yml +2 -2
- package/template/koa-rest-api/.gantry/prod.yml +2 -2
- package/template/koa-rest-api/package.json +6 -5
- 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/infra/appStack.ts +1 -1
- 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/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
- 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/config/prettier.d.ts +0 -4
- 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/configure/processing/package.d.ts +0 -71
- 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
- /package/lib/{cli → src/cli}/adapter/eslint.d.ts +0 -0
- /package/lib/{cli → src/cli}/adapter/prettier.d.ts +0 -0
- /package/lib/{cli → src/cli}/build/args.d.ts +0 -0
- /package/lib/{cli → src/cli}/build/assets.d.ts +0 -0
- /package/lib/{cli → src/cli}/build/esbuild.d.ts +0 -0
- /package/lib/{cli → src/cli}/build/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/build/tsc.d.ts +0 -0
- /package/lib/{cli → src/cli}/buildPackage/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/analyseConfiguration.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/analysis/diff.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/analysis/files.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/analysis/git.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/analysis/project.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/dependencies/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/dependencies/seekDatadogCustomMetrics.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/dependencies/seekKoala.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/dependencies/skuba.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/dependencies/skubaDeps.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/dependencies/skubaDive.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/eslint.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/ignore.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/nodemon.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/package.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/prettier.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/renovate.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/serverless.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/modules/tslint.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/configFile.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/deleteFiles.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/javascript.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/json.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/loadFiles.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/module.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/prettier.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/record.d.ts +0 -0
- /package/lib/{cli → src/cli}/configure/processing/typescript.d.ts +0 -0
- /package/lib/{cli → src/cli}/format/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/help/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/init/git.d.ts +0 -0
- /package/lib/{cli → src/cli}/init/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/init/types.d.ts +0 -0
- /package/lib/{cli → src/cli}/init/validation.d.ts +0 -0
- /package/lib/{cli → src/cli}/init/writePackageJson.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/buildkite/eslint.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/buildkite/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/buildkite/internal.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/buildkite/prettier.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/buildkite/tsc.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/github/eslint.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/github/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/github/internal.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/github/prettier.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/github/tsc.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/annotate/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/autofix.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/eslint.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/external.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internal.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/detectBadCodeowners.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/noSkubaTemplateJs.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/patchRenovateConfig.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/refreshConfigFiles.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.0.4/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.0.2/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.0.0/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.0.1/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/prettier.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/tsc.d.ts +0 -0
- /package/lib/{cli → src/cli}/lint/types.d.ts +0 -0
- /package/lib/{cli → src/cli}/migrate/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/migrate/nodeVersion/checks.d.ts +0 -0
- /package/lib/{cli → src/cli}/migrate/nodeVersion/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/node/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/release/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/start/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/test/index.d.ts +0 -0
- /package/lib/{cli → src/cli}/version/index.d.ts +0 -0
- /package/lib/{skuba.d.ts → src/skuba.d.ts} +0 -0
- /package/lib/{utils → src/utils}/args.d.ts +0 -0
- /package/lib/{utils → src/utils}/command.d.ts +0 -0
- /package/lib/{utils → src/utils}/copy.d.ts +0 -0
- /package/lib/{utils → src/utils}/dir.d.ts +0 -0
- /package/lib/{utils → src/utils}/env.d.ts +0 -0
- /package/lib/{utils → src/utils}/error.d.ts +0 -0
- /package/lib/{utils → src/utils}/exec.d.ts +0 -0
- /package/lib/{utils → src/utils}/help.d.ts +0 -0
- /package/lib/{utils → src/utils}/logging.d.ts +0 -0
- /package/lib/{utils → src/utils}/logo.d.ts +0 -0
- /package/lib/{utils → src/utils}/npmrc.d.ts +0 -0
- /package/lib/{utils → src/utils}/packageManager.d.ts +0 -0
- /package/lib/{utils → src/utils}/port.d.ts +0 -0
- /package/lib/{utils → src/utils}/template.d.ts +0 -0
- /package/lib/{utils → src/utils}/validation.d.ts +0 -0
- /package/lib/{utils → src/utils}/version.d.ts +0 -0
- /package/lib/{utils → src/utils}/worker.d.ts +0 -0
- /package/lib/{wrapper → src/wrapper}/functionHandler.d.ts +0 -0
- /package/lib/{wrapper → src/wrapper}/index.d.ts +0 -0
- /package/lib/{wrapper → src/wrapper}/main.d.ts +0 -0
- /package/lib/{wrapper → src/wrapper}/requestListener.d.ts +0 -0
|
@@ -1,59 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 analyseDependencies_exports = {};
|
|
30
|
-
__export(analyseDependencies_exports, {
|
|
31
|
-
analyseDependencies: () => analyseDependencies
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(analyseDependencies_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
|
-
var import_copy = require("../../utils/copy.js");
|
|
37
|
-
var import_logging = require("../../utils/logging.js");
|
|
38
|
-
var import_version = require("../../utils/version.js");
|
|
39
|
-
var import_package = require("./analysis/package.js");
|
|
40
|
-
var dependencyMutators = __toESM(require("./dependencies/index.js"));
|
|
41
|
-
var import_package2 = require("./processing/package.js");
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { copyFiles } from "../../utils/copy.js";
|
|
5
|
+
import { log } from "../../utils/logging.js";
|
|
6
|
+
import { getLatestNpmVersion, getSkubaVersion } from "../../utils/version.js";
|
|
7
|
+
import { diffDependencies } from "./analysis/package.js";
|
|
8
|
+
import * as dependencyMutators from "./dependencies/index.js";
|
|
9
|
+
import { formatPackage } from "./processing/package.js";
|
|
42
10
|
const logDiff = (diff) => {
|
|
43
11
|
const entries = Object.entries(diff);
|
|
44
12
|
if (entries.length === 0) {
|
|
45
|
-
|
|
13
|
+
log.ok("\u2714 No changes");
|
|
46
14
|
return false;
|
|
47
15
|
}
|
|
48
16
|
Object.entries(diff).sort(([nameA], [nameB]) => nameA.localeCompare(nameB)).forEach(
|
|
49
|
-
([name, { operation, version }]) =>
|
|
17
|
+
([name, { operation, version }]) => log.plain(operation, name, log.formatSubtle(version))
|
|
50
18
|
);
|
|
51
19
|
return true;
|
|
52
20
|
};
|
|
53
21
|
const pinUnspecifiedVersions = async (dependencies) => {
|
|
54
22
|
const updates = await Promise.all(
|
|
55
23
|
Object.entries(dependencies).filter(([, version]) => version === "*").map(async ([name]) => {
|
|
56
|
-
const version = await (name === "skuba" ?
|
|
24
|
+
const version = await (name === "skuba" ? getSkubaVersion() : getLatestNpmVersion(name));
|
|
57
25
|
if (version === null) {
|
|
58
26
|
throw new Error(`Failed to fetch latest version of ${name}`);
|
|
59
27
|
}
|
|
@@ -64,7 +32,7 @@ const pinUnspecifiedVersions = async (dependencies) => {
|
|
|
64
32
|
dependencies[name] = version;
|
|
65
33
|
});
|
|
66
34
|
};
|
|
67
|
-
const analyseDependencies = async ({
|
|
35
|
+
export const analyseDependencies = async ({
|
|
68
36
|
destinationRoot,
|
|
69
37
|
include,
|
|
70
38
|
manifest: { packageJson },
|
|
@@ -92,37 +60,37 @@ const analyseDependencies = async ({
|
|
|
92
60
|
pinUnspecifiedVersions(output.dependencies),
|
|
93
61
|
pinUnspecifiedVersions(output.devDependencies)
|
|
94
62
|
]);
|
|
95
|
-
const dependencyDiff =
|
|
63
|
+
const dependencyDiff = diffDependencies({
|
|
96
64
|
old: input.dependencies,
|
|
97
65
|
new: output.dependencies
|
|
98
66
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
67
|
+
log.newline();
|
|
68
|
+
log.plain(log.bold("Dependencies:"));
|
|
69
|
+
log.newline();
|
|
102
70
|
const hasDependencyDiff = logDiff(dependencyDiff);
|
|
103
|
-
const devDependencyDiff =
|
|
71
|
+
const devDependencyDiff = diffDependencies({
|
|
104
72
|
old: input.devDependencies,
|
|
105
73
|
new: output.devDependencies
|
|
106
74
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
log.newline();
|
|
76
|
+
log.plain(log.bold("Dev dependencies:"));
|
|
77
|
+
log.newline();
|
|
110
78
|
const hasDevDependencyDiff = logDiff(devDependencyDiff);
|
|
111
|
-
const packageJsonFilepath =
|
|
79
|
+
const packageJsonFilepath = path.join(destinationRoot, "package.json");
|
|
112
80
|
if (!hasDependencyDiff && !hasDevDependencyDiff) {
|
|
113
81
|
return;
|
|
114
82
|
}
|
|
115
83
|
return async () => {
|
|
116
|
-
const updatedPackageJson = await
|
|
84
|
+
const updatedPackageJson = await formatPackage({
|
|
117
85
|
...packageJson,
|
|
118
86
|
dependencies: output.dependencies,
|
|
119
87
|
devDependencies: output.devDependencies
|
|
120
88
|
});
|
|
121
|
-
await
|
|
89
|
+
await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);
|
|
122
90
|
if (processors.length === 0) {
|
|
123
91
|
return;
|
|
124
92
|
}
|
|
125
|
-
await
|
|
93
|
+
await copyFiles({
|
|
126
94
|
sourceRoot: destinationRoot,
|
|
127
95
|
destinationRoot,
|
|
128
96
|
include,
|
|
@@ -130,8 +98,4 @@ const analyseDependencies = async ({
|
|
|
130
98
|
});
|
|
131
99
|
};
|
|
132
100
|
};
|
|
133
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
-
0 && (module.exports = {
|
|
135
|
-
analyseDependencies
|
|
136
|
-
});
|
|
137
101
|
//# sourceMappingURL=analyseDependencies.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/configure/analyseDependencies.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { type TextProcessor, copyFiles } from '../../utils/copy.js';\nimport { log } from '../../utils/logging.js';\nimport type { ProjectType } from '../../utils/manifest.js';\nimport { getLatestNpmVersion, getSkubaVersion } from '../../utils/version.js';\n\nimport { diffDependencies } from './analysis/package.js';\nimport * as dependencyMutators from './dependencies/index.js';\nimport { formatPackage } from './processing/package.js';\nimport type { DependencyDiff, PackageJson, ReadResult } from './types.js';\n\nconst logDiff = (diff: DependencyDiff): boolean => {\n const entries = Object.entries(diff);\n\n if (entries.length === 0) {\n log.ok('\u2714 No changes');\n\n return false;\n }\n\n Object.entries(diff)\n .sort(([nameA], [nameB]) => nameA.localeCompare(nameB))\n .forEach(([name, { operation, version }]) =>\n log.plain(operation, name, log.formatSubtle(version)),\n );\n\n return true;\n};\n\nconst pinUnspecifiedVersions = async (\n dependencies: Record<string, string | undefined>,\n): Promise<void> => {\n const updates = await Promise.all(\n Object.entries(dependencies)\n .filter(([, version]) => version === '*')\n .map(async ([name]) => {\n const version = await (name === 'skuba'\n ? getSkubaVersion()\n : getLatestNpmVersion(name));\n\n if (version === null) {\n throw new Error(`Failed to fetch latest version of ${name}`);\n }\n\n return [name, version] as const;\n }),\n );\n\n updates.forEach(([name, version]) => {\n dependencies[name] = version;\n });\n};\n\ninterface Props {\n destinationRoot: string;\n include: (pathname: string) => boolean;\n manifest: ReadResult;\n type: ProjectType;\n}\n\nexport const analyseDependencies = async ({\n destinationRoot,\n include,\n manifest: { packageJson },\n type,\n}: Props): Promise<undefined | (() => Promise<void>)> => {\n const input = {\n dependencies: packageJson.dependencies ?? {},\n devDependencies: packageJson.devDependencies ?? {},\n type,\n };\n\n const output = {\n dependencies: { ...input.dependencies },\n devDependencies: { ...input.devDependencies },\n type,\n };\n\n const processors = Object.values(dependencyMutators).reduce<TextProcessor[]>(\n (acc, mutate) => {\n const newProcessors = mutate(output);\n acc.push(...newProcessors);\n return acc;\n },\n [],\n );\n\n await Promise.all([\n pinUnspecifiedVersions(output.dependencies),\n pinUnspecifiedVersions(output.devDependencies),\n ]);\n\n const dependencyDiff = diffDependencies({\n old: input.dependencies,\n new: output.dependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dependencies:'));\n\n log.newline();\n const hasDependencyDiff = logDiff(dependencyDiff);\n\n const devDependencyDiff = diffDependencies({\n old: input.devDependencies,\n new: output.devDependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dev dependencies:'));\n\n log.newline();\n const hasDevDependencyDiff = logDiff(devDependencyDiff);\n\n const packageJsonFilepath = path.join(destinationRoot, 'package.json');\n\n if (!hasDependencyDiff && !hasDevDependencyDiff) {\n return;\n }\n\n return async () => {\n const updatedPackageJson = await formatPackage({\n ...packageJson,\n dependencies: output.dependencies,\n devDependencies: output.devDependencies,\n } as PackageJson);\n\n await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);\n\n if (processors.length === 0) {\n return;\n }\n\n await copyFiles({\n sourceRoot: destinationRoot,\n destinationRoot,\n include,\n processors,\n });\n };\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AAEjB,OAAO,QAAQ;AAEf,SAA6B,iBAAiB;AAC9C,SAAS,WAAW;AAEpB,SAAS,qBAAqB,uBAAuB;AAErD,SAAS,wBAAwB;AACjC,YAAY,wBAAwB;AACpC,SAAS,qBAAqB;AAG9B,MAAM,UAAU,CAAC,SAAkC;AACjD,QAAM,UAAU,OAAO,QAAQ,IAAI;AAEnC,MAAI,QAAQ,WAAW,GAAG;AACxB,QAAI,GAAG,mBAAc;AAErB,WAAO;AAAA,EACT;AAEA,SAAO,QAAQ,IAAI,EAChB,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,MAAM,cAAc,KAAK,CAAC,EACrD;AAAA,IAAQ,CAAC,CAAC,MAAM,EAAE,WAAW,QAAQ,CAAC,MACrC,IAAI,MAAM,WAAW,MAAM,IAAI,aAAa,OAAO,CAAC;AAAA,EACtD;AAEF,SAAO;AACT;AAEA,MAAM,yBAAyB,OAC7B,iBACkB;AAClB,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,OAAO,QAAQ,YAAY,EACxB,OAAO,CAAC,CAAC,EAAE,OAAO,MAAM,YAAY,GAAG,EACvC,IAAI,OAAO,CAAC,IAAI,MAAM;AACrB,YAAM,UAAU,OAAO,SAAS,UAC5B,gBAAgB,IAChB,oBAAoB,IAAI;AAE5B,UAAI,YAAY,MAAM;AACpB,cAAM,IAAI,MAAM,qCAAqC,IAAI,EAAE;AAAA,MAC7D;AAEA,aAAO,CAAC,MAAM,OAAO;AAAA,IACvB,CAAC;AAAA,EACL;AAEA,UAAQ,QAAQ,CAAC,CAAC,MAAM,OAAO,MAAM;AACnC,iBAAa,IAAI,IAAI;AAAA,EACvB,CAAC;AACH;AASO,aAAM,sBAAsB,OAAO;AAAA,EACxC;AAAA,EACA;AAAA,EACA,UAAU,EAAE,YAAY;AAAA,EACxB;AACF,MAAyD;AACvD,QAAM,QAAQ;AAAA,IACZ,cAAc,YAAY,gBAAgB,CAAC;AAAA,IAC3C,iBAAiB,YAAY,mBAAmB,CAAC;AAAA,IACjD;AAAA,EACF;AAEA,QAAM,SAAS;AAAA,IACb,cAAc,EAAE,GAAG,MAAM,aAAa;AAAA,IACtC,iBAAiB,EAAE,GAAG,MAAM,gBAAgB;AAAA,IAC5C;AAAA,EACF;AAEA,QAAM,aAAa,OAAO,OAAO,kBAAkB,EAAE;AAAA,IACnD,CAAC,KAAK,WAAW;AACf,YAAM,gBAAgB,OAAO,MAAM;AACnC,UAAI,KAAK,GAAG,aAAa;AACzB,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,QAAQ,IAAI;AAAA,IAChB,uBAAuB,OAAO,YAAY;AAAA,IAC1C,uBAAuB,OAAO,eAAe;AAAA,EAC/C,CAAC;AAED,QAAM,iBAAiB,iBAAiB;AAAA,IACtC,KAAK,MAAM;AAAA,IACX,KAAK,OAAO;AAAA,EACd,CAAC;AAED,MAAI,QAAQ;AACZ,MAAI,MAAM,IAAI,KAAK,eAAe,CAAC;AAEnC,MAAI,QAAQ;AACZ,QAAM,oBAAoB,QAAQ,cAAc;AAEhD,QAAM,oBAAoB,iBAAiB;AAAA,IACzC,KAAK,MAAM;AAAA,IACX,KAAK,OAAO;AAAA,EACd,CAAC;AAED,MAAI,QAAQ;AACZ,MAAI,MAAM,IAAI,KAAK,mBAAmB,CAAC;AAEvC,MAAI,QAAQ;AACZ,QAAM,uBAAuB,QAAQ,iBAAiB;AAEtD,QAAM,sBAAsB,KAAK,KAAK,iBAAiB,cAAc;AAErE,MAAI,CAAC,qBAAqB,CAAC,sBAAsB;AAC/C;AAAA,EACF;AAEA,SAAO,YAAY;AACjB,UAAM,qBAAqB,MAAM,cAAc;AAAA,MAC7C,GAAG;AAAA,MACH,cAAc,OAAO;AAAA,MACrB,iBAAiB,OAAO;AAAA,IAC1B,CAAgB;AAEhB,UAAM,GAAG,SAAS,UAAU,qBAAqB,kBAAkB;AAEnE,QAAI,WAAW,WAAW,GAAG;AAC3B;AAAA,IACF;AAEA,UAAM,UAAU;AAAA,MACd,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,45 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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 diff_exports = {};
|
|
30
|
-
__export(diff_exports, {
|
|
31
|
-
determineOperation: () => determineOperation
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(diff_exports);
|
|
34
|
-
var import_chalk = __toESM(require("chalk"));
|
|
35
|
-
const determineOperation = (oldData, newData) => {
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
export const determineOperation = (oldData, newData) => {
|
|
36
4
|
if (oldData === void 0) {
|
|
37
|
-
return
|
|
5
|
+
return chalk.green("A");
|
|
38
6
|
}
|
|
39
|
-
return newData === void 0 ?
|
|
7
|
+
return newData === void 0 ? chalk.red("D") : chalk.yellow("M");
|
|
40
8
|
};
|
|
41
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
-
0 && (module.exports = {
|
|
43
|
-
determineOperation
|
|
44
|
-
});
|
|
45
9
|
//# sourceMappingURL=diff.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/analysis/diff.ts"],
|
|
4
4
|
"sourcesContent": ["import chalk from 'chalk';\n\nexport const determineOperation = (\n oldData?: string,\n newData?: string,\n): string => {\n if (oldData === undefined) {\n return chalk.green('A');\n }\n\n return newData === undefined ? chalk.red('D') : chalk.yellow('M');\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";AAAA,OAAO,WAAW;AAEX,aAAM,qBAAqB,CAChC,SACA,YACW;AACX,MAAI,YAAY,QAAW;AACzB,WAAO,MAAM,MAAM,GAAG;AAAA,EACxB;AAEA,SAAO,YAAY,SAAY,MAAM,IAAI,GAAG,IAAI,MAAM,OAAO,GAAG;AAClE;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,58 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 files_exports = {};
|
|
30
|
-
__export(files_exports, {
|
|
31
|
-
tsFileExists: () => tsFileExists
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(files_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
|
-
var import_error = require("../../../utils/error.js");
|
|
37
|
-
const tsFileExists = async (filePath) => {
|
|
38
|
-
const ext = import_path.default.extname(filePath);
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { isErrorWithCode } from "../../../utils/error.js";
|
|
5
|
+
export const tsFileExists = async (filePath) => {
|
|
6
|
+
const ext = path.extname(filePath);
|
|
39
7
|
if (ext !== "" && ext !== ".ts") {
|
|
40
8
|
return false;
|
|
41
9
|
}
|
|
42
10
|
try {
|
|
43
|
-
const stats = await
|
|
11
|
+
const stats = await fs.promises.lstat(
|
|
44
12
|
ext === "" ? `${filePath}.ts` : filePath
|
|
45
13
|
);
|
|
46
14
|
return stats.isFile();
|
|
47
15
|
} catch (err) {
|
|
48
|
-
if (
|
|
16
|
+
if (isErrorWithCode(err, "ENOENT")) {
|
|
49
17
|
return false;
|
|
50
18
|
}
|
|
51
19
|
throw err;
|
|
52
20
|
}
|
|
53
21
|
};
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
tsFileExists
|
|
57
|
-
});
|
|
58
22
|
//# sourceMappingURL=files.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/analysis/files.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from '../../../utils/error.js';\n\nexport const tsFileExists = async (filePath: string) => {\n const ext = path.extname(filePath);\n\n if (ext !== '' && ext !== '.ts') {\n return false;\n }\n\n try {\n const stats = await fs.promises.lstat(\n ext === '' ? `${filePath}.ts` : filePath,\n );\n\n return stats.isFile();\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return false;\n }\n\n throw err;\n }\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AAEjB,OAAO,QAAQ;AAEf,SAAS,uBAAuB;AAEzB,aAAM,eAAe,OAAO,aAAqB;AACtD,QAAM,MAAM,KAAK,QAAQ,QAAQ;AAEjC,MAAI,QAAQ,MAAM,QAAQ,OAAO;AAC/B,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,QAAQ,MAAM,GAAG,SAAS;AAAA,MAC9B,QAAQ,KAAK,GAAG,QAAQ,QAAQ;AAAA,IAClC;AAEA,WAAO,MAAM,OAAO;AAAA,EACtB,SAAS,KAAK;AACZ,QAAI,gBAAgB,KAAK,QAAQ,GAAG;AAClC,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,47 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
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 git_exports = {};
|
|
30
|
-
__export(git_exports, {
|
|
31
|
-
auditWorkingTree: () => auditWorkingTree
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(git_exports);
|
|
34
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
35
|
-
var import_isomorphic_git = __toESM(require("isomorphic-git"));
|
|
36
|
-
var import_dir = require("../../../utils/dir.js");
|
|
37
|
-
var import_logging = require("../../../utils/logging.js");
|
|
38
|
-
const auditWorkingTree = async (dir) => {
|
|
39
|
-
const filepaths = await (0, import_dir.crawlDirectory)(dir);
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import git from "isomorphic-git";
|
|
4
|
+
import { crawlDirectory } from "../../../utils/dir.js";
|
|
5
|
+
import { log } from "../../../utils/logging.js";
|
|
6
|
+
export const auditWorkingTree = async (dir) => {
|
|
7
|
+
const filepaths = await crawlDirectory(dir);
|
|
40
8
|
let anyFailed = false;
|
|
41
9
|
const statuses = await Promise.all(
|
|
42
10
|
filepaths.map(async (filepath) => {
|
|
43
11
|
try {
|
|
44
|
-
return await
|
|
12
|
+
return await git.status({ dir, fs, filepath });
|
|
45
13
|
} catch {
|
|
46
14
|
anyFailed = true;
|
|
47
15
|
return "absent";
|
|
@@ -51,17 +19,13 @@ const auditWorkingTree = async (dir) => {
|
|
|
51
19
|
if (statuses.some(
|
|
52
20
|
(status) => status !== "absent" && status !== "ignored" && status !== "unmodified"
|
|
53
21
|
)) {
|
|
54
|
-
|
|
55
|
-
|
|
22
|
+
log.newline();
|
|
23
|
+
log.warn("You have dirty/untracked files that may be overwritten.");
|
|
56
24
|
} else if (anyFailed) {
|
|
57
|
-
|
|
58
|
-
|
|
25
|
+
log.newline();
|
|
26
|
+
log.warn(
|
|
59
27
|
"Some files failed to be read. Check that you don't have any dirty/untracked files that may be overwritten."
|
|
60
28
|
);
|
|
61
29
|
}
|
|
62
30
|
};
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {
|
|
65
|
-
auditWorkingTree
|
|
66
|
-
});
|
|
67
31
|
//# sourceMappingURL=git.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/analysis/git.ts"],
|
|
4
4
|
"sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\nimport { crawlDirectory } from '../../../utils/dir.js';\nimport { log } from '../../../utils/logging.js';\n\nexport const auditWorkingTree = async (dir: string) => {\n const filepaths = await crawlDirectory(dir);\n\n let anyFailed = false;\n\n const statuses = await Promise.all(\n filepaths.map(async (filepath) => {\n try {\n return await git.status({ dir, fs, filepath });\n } catch {\n // TODO: Why does isomorphic-git sometimes just _fail_?\n anyFailed = true;\n return 'absent';\n }\n }),\n );\n\n if (\n statuses.some(\n (status) =>\n status !== 'absent' && status !== 'ignored' && status !== 'unmodified',\n )\n ) {\n log.newline();\n log.warn('You have dirty/untracked files that may be overwritten.');\n } else if (anyFailed) {\n log.newline();\n log.warn(\n \"Some files failed to be read. Check that you don't have any dirty/untracked files that may be overwritten.\",\n );\n }\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";AAAA,OAAO,QAAQ;AACf,OAAO,SAAS;AAEhB,SAAS,sBAAsB;AAC/B,SAAS,WAAW;AAEb,aAAM,mBAAmB,OAAO,QAAgB;AACrD,QAAM,YAAY,MAAM,eAAe,GAAG;AAE1C,MAAI,YAAY;AAEhB,QAAM,WAAW,MAAM,QAAQ;AAAA,IAC7B,UAAU,IAAI,OAAO,aAAa;AAChC,UAAI;AACF,eAAO,MAAM,IAAI,OAAO,EAAE,KAAK,IAAI,SAAS,CAAC;AAAA,MAC/C,QAAQ;AAEN,oBAAY;AACZ,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MACE,SAAS;AAAA,IACP,CAAC,WACC,WAAW,YAAY,WAAW,aAAa,WAAW;AAAA,EAC9D,GACA;AACA,QAAI,QAAQ;AACZ,QAAI,KAAK,yDAAyD;AAAA,EACpE,WAAW,WAAW;AACpB,QAAI,QAAQ;AACZ,QAAI;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,46 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 package_exports = {};
|
|
30
|
-
__export(package_exports, {
|
|
31
|
-
diffDependencies: () => diffDependencies,
|
|
32
|
-
getDestinationManifest: () => getDestinationManifest
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(package_exports);
|
|
35
|
-
var import_read_pkg_up = __toESM(require("read-pkg-up"));
|
|
36
|
-
var import_logging = require("../../../utils/logging.js");
|
|
37
|
-
var import_diff = require("./diff.js");
|
|
38
|
-
const getDestinationManifest = async (props) => {
|
|
39
|
-
const result = await (0, import_read_pkg_up.default)({ ...props, normalize: false });
|
|
2
|
+
import { readPackageUp } from "read-package-up";
|
|
3
|
+
import { log } from "../../../utils/logging.js";
|
|
4
|
+
import { determineOperation } from "./diff.js";
|
|
5
|
+
export const getDestinationManifest = async (props) => {
|
|
6
|
+
const result = await readPackageUp({ ...props, normalize: false });
|
|
40
7
|
if (result === void 0) {
|
|
41
|
-
|
|
8
|
+
log.err(
|
|
42
9
|
"Could not find a",
|
|
43
|
-
|
|
10
|
+
log.bold("package.json"),
|
|
44
11
|
"in your working directory."
|
|
45
12
|
);
|
|
46
13
|
process.exit(1);
|
|
@@ -48,14 +15,14 @@ const getDestinationManifest = async (props) => {
|
|
|
48
15
|
return result;
|
|
49
16
|
};
|
|
50
17
|
const joinVersions = (a, b) => [a, b].filter((v) => v !== void 0).join(" -> ");
|
|
51
|
-
const diffDependencies = (props) => {
|
|
18
|
+
export const diffDependencies = (props) => {
|
|
52
19
|
const deletionsAndModifications = Object.fromEntries(
|
|
53
20
|
Object.entries(props.old).flatMap(([name, oldVersion]) => {
|
|
54
21
|
if (oldVersion === props.new[name] || oldVersion === void 0) {
|
|
55
22
|
return [];
|
|
56
23
|
}
|
|
57
24
|
const newVersion = props.new[name];
|
|
58
|
-
const operation =
|
|
25
|
+
const operation = determineOperation(oldVersion, newVersion);
|
|
59
26
|
const version = joinVersions(oldVersion, newVersion);
|
|
60
27
|
return [[name, { operation, version }]];
|
|
61
28
|
})
|
|
@@ -66,7 +33,7 @@ const diffDependencies = (props) => {
|
|
|
66
33
|
return [];
|
|
67
34
|
}
|
|
68
35
|
const oldVersion = props.old[name];
|
|
69
|
-
const operation =
|
|
36
|
+
const operation = determineOperation(oldVersion, version);
|
|
70
37
|
return [[name, { operation, version }]];
|
|
71
38
|
})
|
|
72
39
|
);
|
|
@@ -75,9 +42,4 @@ const diffDependencies = (props) => {
|
|
|
75
42
|
...additions
|
|
76
43
|
};
|
|
77
44
|
};
|
|
78
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
-
0 && (module.exports = {
|
|
80
|
-
diffDependencies,
|
|
81
|
-
getDestinationManifest
|
|
82
|
-
});
|
|
83
45
|
//# sourceMappingURL=package.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/analysis/package.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { readPackageUp } from 'read-package-up';\n\nimport { log } from '../../../utils/logging.js';\nimport type { DependencyDiff, ReadResult } from '../types.js';\n\nimport { determineOperation } from './diff.js';\n\ninterface GetDestinationManifestProps {\n cwd?: string;\n}\n\nexport const getDestinationManifest = async (\n props?: GetDestinationManifestProps,\n): Promise<ReadResult> => {\n const result = await readPackageUp({ ...props, normalize: false });\n\n if (result === undefined) {\n log.err(\n 'Could not find a',\n log.bold('package.json'),\n 'in your working directory.',\n );\n process.exit(1);\n }\n\n return result;\n};\n\nconst joinVersions = (a: string | undefined, b: string | undefined) =>\n [a, b].filter((v) => v !== undefined).join(' -> ');\n\ninterface DiffDependenciesProps {\n old: Record<string, string | undefined>;\n new: Record<string, string | undefined>;\n}\n\nexport const diffDependencies = (\n props: DiffDependenciesProps,\n): DependencyDiff => {\n const deletionsAndModifications = Object.fromEntries(\n Object.entries(props.old).flatMap(([name, oldVersion]) => {\n if (oldVersion === props.new[name] || oldVersion === undefined) {\n return [];\n }\n\n const newVersion = props.new[name];\n\n const operation = determineOperation(oldVersion, newVersion);\n const version = joinVersions(oldVersion, newVersion);\n\n return [[name, { operation, version }]] as const;\n }),\n );\n\n const additions = Object.fromEntries(\n Object.entries(props.new).flatMap(([name, version]) => {\n if (name in props.old || version === undefined) {\n return [];\n }\n\n const oldVersion = props.old[name];\n\n const operation = determineOperation(oldVersion, version);\n\n return [[name, { operation, version }]] as const;\n }),\n );\n\n return {\n ...deletionsAndModifications,\n ...additions,\n };\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,qBAAqB;AAE9B,SAAS,WAAW;AAGpB,SAAS,0BAA0B;AAM5B,aAAM,yBAAyB,OACpC,UACwB;AACxB,QAAM,SAAS,MAAM,cAAc,EAAE,GAAG,OAAO,WAAW,MAAM,CAAC;AAEjE,MAAI,WAAW,QAAW;AACxB,QAAI;AAAA,MACF;AAAA,MACA,IAAI,KAAK,cAAc;AAAA,MACvB;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO;AACT;AAEA,MAAM,eAAe,CAAC,GAAuB,MAC3C,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,MAAM,MAAM,MAAS,EAAE,KAAK,MAAM;AAO5C,aAAM,mBAAmB,CAC9B,UACmB;AACnB,QAAM,4BAA4B,OAAO;AAAA,IACvC,OAAO,QAAQ,MAAM,GAAG,EAAE,QAAQ,CAAC,CAAC,MAAM,UAAU,MAAM;AACxD,UAAI,eAAe,MAAM,IAAI,IAAI,KAAK,eAAe,QAAW;AAC9D,eAAO,CAAC;AAAA,MACV;AAEA,YAAM,aAAa,MAAM,IAAI,IAAI;AAEjC,YAAM,YAAY,mBAAmB,YAAY,UAAU;AAC3D,YAAM,UAAU,aAAa,YAAY,UAAU;AAEnD,aAAO,CAAC,CAAC,MAAM,EAAE,WAAW,QAAQ,CAAC,CAAC;AAAA,IACxC,CAAC;AAAA,EACH;AAEA,QAAM,YAAY,OAAO;AAAA,IACvB,OAAO,QAAQ,MAAM,GAAG,EAAE,QAAQ,CAAC,CAAC,MAAM,OAAO,MAAM;AACrD,UAAI,QAAQ,MAAM,OAAO,YAAY,QAAW;AAC9C,eAAO,CAAC;AAAA,MACV;AAEA,YAAM,aAAa,MAAM,IAAI,IAAI;AAEjC,YAAM,YAAY,mBAAmB,YAAY,OAAO;AAExD,aAAO,CAAC,CAAC,MAAM,EAAE,WAAW,QAAQ,CAAC,CAAC;AAAA,IACxC,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,48 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 project_exports = {};
|
|
30
|
-
__export(project_exports, {
|
|
31
|
-
createDestinationFileReader: () => createDestinationFileReader,
|
|
32
|
-
diffFiles: () => diffFiles
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(project_exports);
|
|
35
|
-
var import_path = __toESM(require("path"));
|
|
36
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
-
var import_dir = require("../../../utils/dir.js");
|
|
38
|
-
var import_error = require("../../../utils/error.js");
|
|
39
|
-
var import_modules = require("../modules/index.js");
|
|
40
|
-
var import_diff = require("./diff.js");
|
|
41
|
-
const createDestinationFileReader = (root) => async (filename) => {
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import {
|
|
5
|
+
buildPatternToFilepathMap,
|
|
6
|
+
crawlDirectory
|
|
7
|
+
} from "../../../utils/dir.js";
|
|
8
|
+
import { isErrorWithCode } from "../../../utils/error.js";
|
|
9
|
+
import { loadModules } from "../modules/index.js";
|
|
10
|
+
import { determineOperation } from "./diff.js";
|
|
11
|
+
export const createDestinationFileReader = (root) => async (filename) => {
|
|
42
12
|
try {
|
|
43
|
-
return await
|
|
13
|
+
return await fs.promises.readFile(path.join(root, filename), "utf8");
|
|
44
14
|
} catch (err) {
|
|
45
|
-
if (
|
|
15
|
+
if (isErrorWithCode(err, "ENOENT")) {
|
|
46
16
|
return;
|
|
47
17
|
}
|
|
48
18
|
throw err;
|
|
@@ -50,9 +20,9 @@ const createDestinationFileReader = (root) => async (filename) => {
|
|
|
50
20
|
};
|
|
51
21
|
const loadModuleFiles = async (modules, destinationRoot) => {
|
|
52
22
|
const readDestinationFile = createDestinationFileReader(destinationRoot);
|
|
53
|
-
const allFilepaths = await
|
|
23
|
+
const allFilepaths = await crawlDirectory(destinationRoot);
|
|
54
24
|
const patterns = [...new Set(modules.flatMap((m) => Object.keys(m)))];
|
|
55
|
-
const patternToFilepaths =
|
|
25
|
+
const patternToFilepaths = buildPatternToFilepathMap(patterns, allFilepaths);
|
|
56
26
|
const matchedFilepaths = [
|
|
57
27
|
...new Set(Object.values(patternToFilepaths).flat())
|
|
58
28
|
];
|
|
@@ -69,7 +39,7 @@ const loadModuleFiles = async (modules, destinationRoot) => {
|
|
|
69
39
|
const processTextFiles = async (modules, inputFiles, patternToFilepaths) => {
|
|
70
40
|
const outputFiles = { ...inputFiles };
|
|
71
41
|
const textProcessorEntries = modules.flatMap(
|
|
72
|
-
(
|
|
42
|
+
(module) => Object.entries(module).flatMap(([pattern, processText]) => {
|
|
73
43
|
const filepaths = [pattern, ...patternToFilepaths[pattern] ?? []];
|
|
74
44
|
return [...new Set(filepaths)].map(
|
|
75
45
|
(filepath) => [filepath, processText]
|
|
@@ -85,8 +55,8 @@ const processTextFiles = async (modules, inputFiles, patternToFilepaths) => {
|
|
|
85
55
|
}
|
|
86
56
|
return outputFiles;
|
|
87
57
|
};
|
|
88
|
-
const diffFiles = async (opts) => {
|
|
89
|
-
const modules = await
|
|
58
|
+
export const diffFiles = async (opts) => {
|
|
59
|
+
const modules = await loadModules(opts);
|
|
90
60
|
const { inputFiles, patternToFilepaths } = Object.freeze(
|
|
91
61
|
await loadModuleFiles(modules, opts.destinationRoot)
|
|
92
62
|
);
|
|
@@ -96,14 +66,9 @@ const diffFiles = async (opts) => {
|
|
|
96
66
|
patternToFilepaths
|
|
97
67
|
);
|
|
98
68
|
const diffEntries = Object.entries(outputFiles).filter(([filepath, data]) => inputFiles[filepath] !== data).map(([filepath, data]) => {
|
|
99
|
-
const operation =
|
|
69
|
+
const operation = determineOperation(inputFiles[filepath], data);
|
|
100
70
|
return [filepath, { data, operation }];
|
|
101
71
|
});
|
|
102
72
|
return Object.fromEntries(diffEntries);
|
|
103
73
|
};
|
|
104
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
-
0 && (module.exports = {
|
|
106
|
-
createDestinationFileReader,
|
|
107
|
-
diffFiles
|
|
108
|
-
});
|
|
109
74
|
//# sourceMappingURL=project.js.map
|