skuba 14.0.0-replace-global-vars-20251121010036 → 14.0.0-test-private-templates-20260103062459
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/eslint.js +1 -1
- package/config/jest.js +1 -0
- package/config/prettier.d.ts +4 -8
- package/config/prettier.js +2 -10
- package/jest/moduleNameMapper.js +64 -0
- package/jest/transform.js +62 -0
- package/jest/tsConfig.js +26 -0
- package/jest-preset.js +37 -0
- package/lib/api/jest/index.d.ts +15 -0
- package/lib/api/jest/index.js +59 -0
- package/lib/api/jest/index.js.map +7 -0
- package/lib/cli/adapter/eslint.js +45 -11
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/adapter/prettier.js +67 -39
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/args.js +42 -8
- package/lib/cli/build/args.js.map +2 -2
- package/lib/cli/build/assets.js +60 -28
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/build/esbuild.js +45 -21
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +45 -21
- package/lib/cli/build/index.js.map +1 -1
- package/lib/cli/build/tsc.js +59 -22
- package/lib/cli/build/tsc.js.map +2 -2
- package/lib/cli/buildPackage/index.js +32 -8
- package/lib/cli/buildPackage/index.js.map +1 -1
- package/lib/cli/configure/analyseConfiguration.js +50 -16
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.d.ts +1 -1
- package/lib/cli/configure/analyseDependencies.js +59 -25
- package/lib/cli/configure/analyseDependencies.js.map +3 -3
- package/lib/cli/configure/analysis/diff.js +29 -5
- package/lib/cli/configure/analysis/diff.js.map +1 -1
- package/lib/cli/configure/analysis/files.js +42 -8
- package/lib/cli/configure/analysis/files.js.map +2 -2
- package/lib/cli/configure/analysis/git.js +46 -12
- package/lib/cli/configure/analysis/git.js.map +2 -2
- package/lib/cli/configure/analysis/package.d.ts +3 -2
- package/lib/cli/configure/analysis/package.js +45 -10
- package/lib/cli/configure/analysis/package.js.map +3 -3
- package/lib/cli/configure/analysis/project.js +50 -18
- package/lib/cli/configure/analysis/project.js.map +2 -2
- package/lib/cli/configure/dependencies/index.js +35 -7
- package/lib/cli/configure/dependencies/index.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +28 -4
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js +28 -4
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js +28 -4
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +26 -2
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js +29 -4
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +61 -33
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.d.ts +1 -1
- package/lib/cli/configure/getEntryPoint.js +48 -14
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +35 -14
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +84 -50
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/configure/modules/eslint.js +34 -10
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/ignore.js +32 -8
- package/lib/cli/configure/modules/ignore.js.map +1 -1
- package/lib/cli/configure/modules/index.js +44 -18
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/jest.d.ts +2 -0
- package/lib/cli/configure/modules/jest.js +86 -0
- package/lib/cli/configure/modules/jest.js.map +7 -0
- package/lib/cli/configure/modules/nodemon.js +28 -4
- package/lib/cli/configure/modules/nodemon.js.map +1 -1
- package/lib/cli/configure/modules/package.js +34 -10
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +35 -11
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +40 -17
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/serverless.js +26 -2
- package/lib/cli/configure/modules/serverless.js.map +1 -1
- package/lib/cli/configure/modules/tslint.js +28 -4
- package/lib/cli/configure/modules/tslint.js.map +1 -1
- package/lib/cli/configure/processing/configFile.js +39 -3
- package/lib/cli/configure/processing/configFile.js.map +1 -1
- package/lib/cli/configure/processing/deleteFiles.js +26 -2
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +27 -2
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +31 -6
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +26 -2
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +28 -4
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.d.ts +67 -1
- package/lib/cli/configure/processing/package.js +45 -8
- package/lib/cli/configure/processing/package.js.map +3 -3
- package/lib/cli/configure/processing/prettier.js +38 -4
- package/lib/cli/configure/processing/prettier.js.map +2 -2
- package/lib/cli/configure/processing/record.js +41 -5
- package/lib/cli/configure/processing/record.js.map +2 -2
- package/lib/cli/configure/processing/typescript.js +63 -26
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/types.d.ts +4 -15
- package/lib/cli/configure/types.js +16 -0
- package/lib/cli/configure/types.js.map +3 -3
- package/lib/cli/format/index.js +44 -20
- package/lib/cli/format/index.js.map +1 -1
- package/lib/cli/help/index.js +30 -6
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.d.ts +1 -1
- package/lib/cli/init/getConfig.js +111 -76
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.d.ts +1 -0
- package/lib/cli/init/git.js +88 -16
- package/lib/cli/init/git.js.map +3 -3
- package/lib/cli/init/index.js +98 -67
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +6 -5
- package/lib/cli/init/prompts.js +54 -27
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.js +41 -7
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +30 -2
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +42 -8
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +45 -11
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +26 -2
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +45 -11
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +26 -2
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +26 -2
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +28 -4
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/index.js +30 -6
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.js +73 -37
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/eslint.js +51 -16
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/external.js +51 -19
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.js +49 -25
- package/lib/cli/lint/index.js.map +1 -1
- package/lib/cli/lint/internal.js +42 -18
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +45 -11
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +63 -32
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
- package/lib/cli/lint/internalLints/upgrade/index.js +53 -22
- package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +30 -6
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +65 -34
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +59 -23
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +30 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +67 -29
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +34 -10
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -18
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +50 -15
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +133 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +34 -10
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +44 -10
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +46 -12
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +49 -15
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +34 -10
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +47 -13
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
- package/lib/cli/lint/prettier.js +50 -15
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/lint/tsc.js +28 -4
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/lint/types.js +16 -0
- package/lib/cli/lint/types.js.map +3 -3
- package/lib/cli/migrate/index.d.ts +5 -0
- package/lib/cli/migrate/index.js +79 -15
- package/lib/cli/migrate/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
- package/lib/cli/migrate/nodeVersion/checks.js +51 -120
- package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
- package/lib/cli/migrate/nodeVersion/index.js +239 -65
- package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
- package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
- package/lib/cli/node/index.js +57 -20
- package/lib/cli/node/index.js.map +3 -3
- package/lib/cli/release/index.js +28 -4
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +50 -16
- package/lib/cli/start/index.js.map +3 -3
- package/lib/cli/test/index.js +44 -4
- package/lib/cli/test/index.js.map +2 -2
- package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
- package/lib/cli/test/reporters/github/annotations.js +102 -0
- package/lib/cli/test/reporters/github/annotations.js.map +7 -0
- package/lib/cli/test/reporters/github/index.d.ts +5 -0
- package/lib/cli/test/reporters/github/index.js +74 -0
- package/lib/cli/test/reporters/github/index.js.map +7 -0
- package/lib/cli/version/index.js +30 -6
- package/lib/cli/version/index.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +46 -6
- package/lib/index.js.map +2 -2
- package/lib/skuba.js +45 -26
- package/lib/skuba.js.map +3 -3
- package/lib/utils/args.js +43 -6
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/command.js +42 -4
- package/lib/utils/command.js.map +3 -3
- package/lib/utils/copy.js +57 -20
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.js +72 -32
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/env.js +26 -2
- package/lib/utils/env.js.map +1 -1
- package/lib/utils/error.js +47 -10
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.js +61 -23
- package/lib/utils/exec.js.map +3 -3
- package/lib/utils/fs.js +40 -6
- package/lib/utils/fs.js.map +2 -2
- package/lib/utils/help.js +30 -6
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/logging.js +38 -11
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/logo.js +48 -24
- package/lib/utils/logo.js.map +1 -1
- package/lib/utils/manifest.d.ts +2 -3
- package/lib/utils/manifest.js +48 -8
- package/lib/utils/manifest.js.map +3 -3
- package/lib/utils/npmrc.js +26 -2
- package/lib/utils/npmrc.js.map +1 -1
- package/lib/utils/packageManager.js +49 -12
- package/lib/utils/packageManager.js.map +2 -2
- package/lib/utils/port.js +39 -4
- package/lib/utils/port.js.map +2 -2
- package/lib/utils/sleep.js +26 -2
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/template.d.ts +1 -1
- package/lib/utils/template.js +60 -19
- package/lib/utils/template.js.map +3 -3
- package/lib/utils/validation.js +31 -2
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +46 -9
- package/lib/utils/version.js.map +2 -2
- package/lib/utils/wait.js +32 -7
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.js +35 -10
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/function-arguments.d.js +1 -0
- package/lib/wrapper/functionHandler.js +49 -18
- package/lib/wrapper/functionHandler.js.map +2 -2
- package/lib/wrapper/http.js +43 -8
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js +7 -6
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +42 -8
- package/lib/wrapper/main.js.map +3 -3
- package/lib/wrapper/requestListener.js +47 -13
- package/lib/wrapper/requestListener.js.map +2 -2
- package/lib/wrapper/server.js +28 -4
- package/lib/wrapper/server.js.map +1 -1
- package/package.json +42 -43
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +4 -3
- package/template/base/jest.config.ts +19 -0
- package/template/base/jest.setup.ts +3 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/package.json +8 -9
- package/template/express-rest-api/skuba.template.js +1 -1
- package/template/express-rest-api/src/app.test.ts +0 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/package.json +4 -5
- package/template/greeter/skuba.template.js +1 -1
- package/template/greeter/src/app.test.ts +1 -3
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/package.json +9 -11
- package/template/koa-rest-api/skuba.template.js +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
- package/template/koa-rest-api/src/app.test.ts +0 -2
- package/template/koa-rest-api/src/framework/server.test.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
- package/template/koa-rest-api/src/testing/metrics.ts +0 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -19
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
- package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
- package/template/lambda-sqs-worker-cdk/package.json +9 -9
- package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
- package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
- package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
- package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
- package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
- package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
- package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
- package/template/oss-npm-package/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/_package.json +0 -1
- package/template/oss-npm-package/skuba.template.js +1 -1
- package/template/oss-npm-package/src/index.test.ts +0 -2
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +1 -2
- package/template/private-npm-package/skuba.template.js +2 -2
- package/template/private-npm-package/src/index.test.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.d.ts +0 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js +0 -86
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +0 -16
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +0 -76
- package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
- package/lib/eslint.d.js +0 -1
- package/lib/eslint.d.js.map +0 -7
- package/template/base/vitest.config.ts +0 -25
- /package/lib/cli/lint/internalLints/upgrade/patches/{12.5.0 → 13.1.1}/index.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/typescript.ts"],
|
|
4
4
|
"sourcesContent": ["import ts from 'typescript';\n\nimport { formatPrettier } from './prettier.js';\n\ntype Props = ts.NodeArray<ts.ObjectLiteralElementLike>;\n\ntype Transformer<T> = (context: ts.TransformationContext | null, props: T) => T;\n\nconst BLANK_LINE_PLACEHOLDER = ' __BLANK_LINE_PLACEHOLDER__';\nconst BLANK_LINE_REGEXP = new RegExp(`//${BLANK_LINE_PLACEHOLDER}`, 'g');\n\n/**\n * Append a placeholder comment to the start of a node.\n *\n * Blank lines can be annotated and preserved through the TypeScript printer\n * when this is paired with a dodgy `String.prototype.replace` post-processor.\n */\nconst withLeadingBlankLinePlaceholder = <T extends ts.Node>(node: T) =>\n ts.addSyntheticLeadingComment(\n node,\n ts.SyntaxKind.SingleLineCommentTrivia,\n BLANK_LINE_PLACEHOLDER,\n true,\n );\n\n/**\n * Create the following expression:\n *\n * ```javascript\n * export default {};\n * ```\n */\nconst createExportDefaultObjectLiteralExpression = (\n factory: ts.NodeFactory,\n props: Props,\n callExpression?: ts.Expression,\n): ts.ExportAssignment =>\n factory.createExportAssignment(\n undefined,\n undefined,\n callExpression === undefined\n ? factory.createObjectLiteralExpression(props, true)\n : factory.createCallExpression(callExpression, undefined, [\n factory.createObjectLiteralExpression(props, true),\n ]),\n );\n\nconst createImportFromExpression = (\n factory: ts.NodeFactory,\n moduleName: string,\n importNames: string | string[],\n) => {\n const importClause =\n typeof importNames === 'string'\n ? factory.createImportClause(\n false,\n factory.createIdentifier(importNames),\n undefined,\n )\n : factory.createImportClause(\n false,\n undefined,\n factory.createNamedImports(\n importNames.map((importName) =>\n factory.createImportSpecifier(\n false,\n undefined,\n factory.createIdentifier(importName),\n ),\n ),\n ),\n );\n\n return factory.createImportDeclaration(\n undefined,\n importClause,\n factory.createStringLiteral(moduleName),\n );\n};\n\nconst getPropName = (prop: ts.ObjectLiteralElementLike) =>\n ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)\n ? prop.name.escapedText.toString()\n : undefined;\n\nconst expressionAsDefaultExport = (\n context: ts.TransformationContext,\n transformProps: Transformer<Props>,\n expression: ts.Expression,\n): ts.ExportAssignment | null =>\n withLeadingBlankLinePlaceholder(\n (() => {\n // {}\n if (ts.isObjectLiteralExpression(expression)) {\n const props = transformProps(context, expression.properties);\n\n return createExportDefaultObjectLiteralExpression(\n context.factory,\n props,\n );\n }\n\n // fn({})\n if (\n ts.isCallExpression(expression) &&\n expression.arguments.length === 1 &&\n expression.arguments[0]\n ) {\n const [firstArgument] = expression.arguments;\n\n if (ts.isObjectLiteralExpression(firstArgument)) {\n const props = transformProps(context, firstArgument.properties);\n\n return createExportDefaultObjectLiteralExpression(\n context.factory,\n props,\n expression.expression,\n );\n }\n }\n\n // Anything else\n return context.factory.createExportAssignment(\n undefined,\n undefined,\n expression,\n );\n })(),\n );\n\n/**\n * Mutate `const x = require('')` into `import x from ''`:\n *\n * ```javascript\n * const x = require('');\n *\n * const { x } = require('');\n * ```\n *\n * There's no recursion needed here as we expect the import statement to be a\n * top-level node and therefore an immediate child of the source file.\n */\nconst requireImportsTransformer: ts.TransformerFactory<ts.Node> =\n (context) => (rootNode) =>\n ts.visitEachChild(\n rootNode,\n (node) => {\n let declaration, moduleName;\n\n if (\n ts.isVariableStatement(node) &&\n node.declarationList.declarations.length === 1 &&\n node.declarationList.declarations[0] &&\n ts.isVariableDeclaration(\n (declaration = node.declarationList.declarations[0]),\n ) &&\n declaration.initializer &&\n ts.isCallExpression(declaration.initializer) &&\n declaration.initializer.arguments.length === 1 &&\n declaration.initializer.arguments[0] &&\n ts.isStringLiteral(\n (moduleName = declaration.initializer.arguments[0]),\n ) &&\n ts.isIdentifier(declaration.initializer.expression) &&\n declaration.initializer.expression.text === 'require'\n ) {\n // const x\n if (ts.isIdentifier(declaration.name)) {\n return createImportFromExpression(\n context.factory,\n moduleName.text,\n declaration.name.text,\n );\n }\n\n // const { x }\n if (ts.isObjectBindingPattern(declaration.name)) {\n return createImportFromExpression(\n context.factory,\n moduleName.text,\n declaration.name.elements.flatMap((element) =>\n ts.isIdentifier(element.name) ? [element.name.text] : [],\n ),\n );\n }\n }\n\n return node;\n },\n context,\n );\n\n/**\n * Create a transformer to mutate `module.exports` and `export default`:\n *\n * ```javascript\n * export default {};\n *\n * module.exports = {};\n * ```\n *\n * If the export is a call expression with a single argument, it will try to\n * transform the props of that argument.\n *\n * ```javascript\n * module.exports = fn({});\n * ```\n *\n * There's no recursion needed here as we expect the export statement to be a\n * top-level node and therefore an immediate child of the source file.\n */\nconst createModuleExportsTransformer =\n (transformProps: Transformer<Props>): ts.TransformerFactory<ts.Node> =>\n (context) =>\n (rootNode) =>\n ts.visitEachChild(\n rootNode,\n (node) => {\n // module.exports =\n if (\n ts.isExpressionStatement(node) &&\n ts.isBinaryExpression(node.expression) &&\n ts.isPropertyAccessExpression(node.expression.left) &&\n ts.isIdentifier(node.expression.left.expression) &&\n node.expression.left.expression.escapedText.toString() === 'module' &&\n node.expression.left.name.text === 'exports' &&\n node.expression.operatorToken.kind === ts.SyntaxKind.EqualsToken\n ) {\n return (\n expressionAsDefaultExport(\n context,\n transformProps,\n node.expression.right,\n ) ?? node\n );\n }\n\n // export default\n if (ts.isExportAssignment(node)) {\n return (\n expressionAsDefaultExport(\n context,\n transformProps,\n node.expression,\n ) ?? node\n );\n }\n\n return node;\n },\n context,\n );\n\n/**\n * Create a transformer to filter out unspecified props from an object literal.\n */\nexport const createPropFilter =\n (names: string[]): Transformer<Props> =>\n (context, props) => {\n const nameSet = new Set<unknown>(names);\n\n const factory = context?.factory ?? ts.factory;\n\n return factory.createNodeArray(\n props.filter((prop) => nameSet.has(getPropName(prop))),\n );\n };\n\nexport const createPropAppender =\n (appendingProps: Props): Transformer<Props> =>\n (context, props) => {\n const nameSet = new Set<unknown>(\n props.map(getPropName).filter((prop) => typeof prop === 'string'),\n );\n\n const factory = context?.factory ?? ts.factory;\n\n return factory.createNodeArray([\n ...props,\n ...appendingProps.filter((prop) => !nameSet.has(getPropName(prop))),\n ]);\n };\n\n/**\n * Read out `export default` or `module.exports` props from a source file.\n *\n * The props can then be used when transforming another source file.\n */\nexport const readModuleExports = async (\n inputFile: string,\n): Promise<Props | undefined> => {\n let result: Props | undefined;\n\n await transformModuleImportsAndExports(\n inputFile,\n (_, props) => (result = props),\n );\n\n return result;\n};\n\n/**\n * Mutate imports and exports in a source file:\n *\n * - Convert `const x = require('')` into `import x from ''`\n * - Convert `module.exports =` into `export default`\n * - Run a transformer over the exported props\n */\nexport const transformModuleImportsAndExports = async (\n inputFile: string,\n transformProps: Transformer<Props>,\n): Promise<string> => {\n const sourceFile = ts.createSourceFile('', inputFile, ts.ScriptTarget.Latest);\n\n const moduleExportsTransformer =\n createModuleExportsTransformer(transformProps);\n\n const result = ts.transform(sourceFile, [\n requireImportsTransformer,\n moduleExportsTransformer,\n ]);\n\n const [transformedFile] = result.transformed;\n\n if (!transformedFile) {\n throw new Error(\n `Could not get transformed result for ${JSON.stringify(result)}`,\n );\n }\n\n const text = ts\n .createPrinter()\n .printNode(ts.EmitHint.SourceFile, transformedFile, sourceFile)\n .replace(BLANK_LINE_REGEXP, '');\n\n return formatPrettier(text, { parser: 'typescript' });\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["ts"]
|
|
7
7
|
}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import type { PackageJson as
|
|
1
|
+
import type { PackageJson as TypeFestPackageJson } from 'type-fest';
|
|
2
2
|
import type { ProjectType } from '../../utils/manifest.js';
|
|
3
3
|
import type { PackageManagerConfig } from '../../utils/packageManager.js';
|
|
4
4
|
export type { TsConfigJson } from 'type-fest';
|
|
5
|
-
export type PackageJson =
|
|
6
|
-
skuba?: {
|
|
7
|
-
entryPoint?: string | null;
|
|
8
|
-
template?: string;
|
|
9
|
-
type?: string;
|
|
10
|
-
version: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export type ReadResult = {
|
|
14
|
-
packageJson: PackageJson;
|
|
15
|
-
path: string;
|
|
16
|
-
};
|
|
5
|
+
export type PackageJson = TypeFestPackageJson & Record<string, unknown>;
|
|
17
6
|
export interface DependencySet {
|
|
18
|
-
dependencies: Record<string, string
|
|
19
|
-
devDependencies: Record<string, string
|
|
7
|
+
dependencies: Record<string, string>;
|
|
8
|
+
devDependencies: Record<string, string>;
|
|
20
9
|
type: ProjectType;
|
|
21
10
|
}
|
|
22
11
|
export type DependencyDiff = Record<string, {
|
|
@@ -1 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
1
17
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
3
|
+
"sources": ["../../../src/cli/configure/types.ts"],
|
|
4
|
+
"sourcesContent": ["import type { PackageJson as TypeFestPackageJson } from 'type-fest';\n\nimport type { ProjectType } from '../../utils/manifest.js';\nimport type { PackageManagerConfig } from '../../utils/packageManager.js';\n\nexport type { TsConfigJson } from 'type-fest';\n\nexport type PackageJson = TypeFestPackageJson & Record<string, unknown>;\n\nexport interface DependencySet {\n dependencies: Record<string, string>;\n devDependencies: Record<string, string>;\n type: ProjectType;\n}\n\nexport type DependencyDiff = Record<\n string,\n { operation: string; version: string }\n>;\n\ntype FileProcessor = (\n file: string | undefined,\n files: Files,\n initialFiles: Readonly<Files>,\n) => Promise<string | undefined> | string | undefined;\n\nexport type FileDiff = Record<\n string,\n { data: string | undefined; operation: string }\n>;\n\nexport type Files = Record<string, string | undefined>;\n\nexport type Module = Record<string, FileProcessor>;\n\nexport interface Options {\n destinationRoot: string;\n entryPoint: string;\n firstRun: boolean;\n packageManager: PackageManagerConfig;\n type: ProjectType;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/format/index.js
CHANGED
|
@@ -1,24 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var format_exports = {};
|
|
20
|
+
__export(format_exports, {
|
|
21
|
+
format: () => format
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(format_exports);
|
|
24
|
+
var import_node_util = require("node:util");
|
|
25
|
+
var import_args = require("../../utils/args.js");
|
|
26
|
+
var import_logging = require("../../utils/logging.js");
|
|
27
|
+
var import_eslint = require("../adapter/eslint.js");
|
|
28
|
+
var import_prettier = require("../adapter/prettier.js");
|
|
29
|
+
var import_internal = require("../lint/internal.js");
|
|
7
30
|
const format = async (args = process.argv.slice(2), overrideConfigFile) => {
|
|
8
|
-
const debug = hasDebugFlag(args);
|
|
9
|
-
log.plain(styleText("blueBright", "skuba lints"));
|
|
10
|
-
const internal = await internalLint("format", {
|
|
31
|
+
const debug = (0, import_args.hasDebugFlag)(args);
|
|
32
|
+
import_logging.log.plain((0, import_node_util.styleText)("blueBright", "skuba lints"));
|
|
33
|
+
const internal = await (0, import_internal.internalLint)("format", {
|
|
11
34
|
debug,
|
|
12
35
|
additionalFlags: args.includes("--force-apply-all-patches") ? ["--force-apply-all-patches"] : [],
|
|
13
36
|
serial: true
|
|
14
37
|
});
|
|
15
|
-
const logger = createLogger({ debug });
|
|
16
|
-
log.newline();
|
|
17
|
-
log.plain(styleText("magenta", "ESLint"));
|
|
18
|
-
const eslint = await runESLint("format", logger, overrideConfigFile);
|
|
19
|
-
log.newline();
|
|
20
|
-
log.plain(styleText("cyan", "Prettier"));
|
|
21
|
-
const prettier = await runPrettier("format", logger);
|
|
38
|
+
const logger = (0, import_logging.createLogger)({ debug });
|
|
39
|
+
import_logging.log.newline();
|
|
40
|
+
import_logging.log.plain((0, import_node_util.styleText)("magenta", "ESLint"));
|
|
41
|
+
const eslint = await (0, import_eslint.runESLint)("format", logger, overrideConfigFile);
|
|
42
|
+
import_logging.log.newline();
|
|
43
|
+
import_logging.log.plain((0, import_node_util.styleText)("cyan", "Prettier"));
|
|
44
|
+
const prettier = await (0, import_prettier.runPrettier)("format", logger);
|
|
22
45
|
if (eslint.ok && prettier.ok && internal.ok) {
|
|
23
46
|
return;
|
|
24
47
|
}
|
|
@@ -27,11 +50,12 @@ const format = async (args = process.argv.slice(2), overrideConfigFile) => {
|
|
|
27
50
|
...prettier.ok ? [] : ["Prettier"],
|
|
28
51
|
...internal.ok ? [] : ["skuba"]
|
|
29
52
|
];
|
|
30
|
-
log.newline();
|
|
31
|
-
log.err(tools.join(", "), "found issues that require triage.");
|
|
53
|
+
import_logging.log.newline();
|
|
54
|
+
import_logging.log.err(tools.join(", "), "found issues that require triage.");
|
|
32
55
|
process.exitCode = 1;
|
|
33
56
|
};
|
|
34
|
-
export
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
35
59
|
format
|
|
36
|
-
};
|
|
60
|
+
});
|
|
37
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/format/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { styleText } from 'node:util';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { runESLint } from '../adapter/eslint.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { internalLint } from '../lint/internal.js';\n\nexport const format = async (\n args = process.argv.slice(2),\n overrideConfigFile?: string,\n): Promise<void> => {\n const debug = hasDebugFlag(args);\n\n log.plain(styleText('blueBright', 'skuba lints'));\n\n const internal = await internalLint('format', {\n debug,\n additionalFlags: args.includes('--force-apply-all-patches')\n ? ['--force-apply-all-patches']\n : [],\n serial: true,\n });\n\n const logger = createLogger({ debug });\n\n log.newline();\n log.plain(styleText('magenta', 'ESLint'));\n\n const eslint = await runESLint('format', logger, overrideConfigFile);\n\n log.newline();\n log.plain(styleText('cyan', 'Prettier'));\n\n const prettier = await runPrettier('format', logger);\n\n if (eslint.ok && prettier.ok && internal.ok) {\n return;\n }\n\n const tools = [\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ...(internal.ok ? [] : ['skuba']),\n ];\n\n log.newline();\n log.err(tools.join(', '), 'found issues that require triage.');\n\n process.exitCode = 1;\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAE1B,kBAA6B;AAC7B,qBAAkC;AAClC,oBAA0B;AAC1B,sBAA4B;AAC5B,sBAA6B;AAEtB,MAAM,SAAS,OACpB,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,uBACkB;AAClB,QAAM,YAAQ,0BAAa,IAAI;AAE/B,qBAAI,UAAM,4BAAU,cAAc,aAAa,CAAC;AAEhD,QAAM,WAAW,UAAM,8BAAa,UAAU;AAAA,IAC5C;AAAA,IACA,iBAAiB,KAAK,SAAS,2BAA2B,IACtD,CAAC,2BAA2B,IAC5B,CAAC;AAAA,IACL,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,aAAS,6BAAa,EAAE,MAAM,CAAC;AAErC,qBAAI,QAAQ;AACZ,qBAAI,UAAM,4BAAU,WAAW,QAAQ,CAAC;AAExC,QAAM,SAAS,UAAM,yBAAU,UAAU,QAAQ,kBAAkB;AAEnE,qBAAI,QAAQ;AACZ,qBAAI,UAAM,4BAAU,QAAQ,UAAU,CAAC;AAEvC,QAAM,WAAW,UAAM,6BAAY,UAAU,MAAM;AAEnD,MAAI,OAAO,MAAM,SAAS,MAAM,SAAS,IAAI;AAC3C;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AAAA,IAC9B,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,UAAU;AAAA,IAClC,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,OAAO;AAAA,EACjC;AAEA,qBAAI,QAAQ;AACZ,qBAAI,IAAI,MAAM,KAAK,IAAI,GAAG,mCAAmC;AAE7D,UAAQ,WAAW;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/help/index.js
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var help_exports = {};
|
|
20
|
+
__export(help_exports, {
|
|
21
|
+
help: () => help
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(help_exports);
|
|
24
|
+
var import_help = require("../../utils/help.js");
|
|
25
|
+
var import_logo = require("../../utils/logo.js");
|
|
3
26
|
const help = async () => {
|
|
4
|
-
await showLogoAndVersionInfo();
|
|
5
|
-
showHelp();
|
|
27
|
+
await (0, import_logo.showLogoAndVersionInfo)();
|
|
28
|
+
(0, import_help.showHelp)();
|
|
6
29
|
};
|
|
7
|
-
export
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
8
32
|
help
|
|
9
|
-
};
|
|
33
|
+
});
|
|
10
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/help/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { showHelp } from '../../utils/help.js';\nimport { showLogoAndVersionInfo } from '../../utils/logo.js';\n\nexport const help = async () => {\n await showLogoAndVersionInfo();\n\n showHelp();\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AACzB,kBAAuC;AAEhC,MAAM,OAAO,YAAY;AAC9B,YAAM,oCAAuB;AAE7B,4BAAS;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ export declare const runForm: <T = Record<string, string>>(props: {
|
|
|
6
6
|
message: string;
|
|
7
7
|
name: string;
|
|
8
8
|
}) => Promise<T>;
|
|
9
|
-
export declare const getTemplateConfig: (dir: string) =>
|
|
9
|
+
export declare const getTemplateConfig: (dir: string) => TemplateConfig;
|
|
10
10
|
export declare const configureFromPrompt: () => Promise<InitConfig>;
|
|
11
11
|
export declare const readJSONFromStdIn: () => Promise<unknown>;
|
|
12
12
|
export declare const getConfig: () => Promise<{
|
|
@@ -1,34 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getConfig_exports = {};
|
|
30
|
+
__export(getConfig_exports, {
|
|
31
|
+
configureFromPrompt: () => configureFromPrompt,
|
|
32
|
+
getConfig: () => getConfig,
|
|
33
|
+
getTemplateConfig: () => getTemplateConfig,
|
|
34
|
+
readJSONFromStdIn: () => readJSONFromStdIn,
|
|
35
|
+
runForm: () => runForm
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(getConfig_exports);
|
|
38
|
+
var import_node_util = require("node:util");
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
var import_prompts = require("@inquirer/prompts");
|
|
41
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
42
|
+
var import_copy = require("../../utils/copy.js");
|
|
43
|
+
var import_error = require("../../utils/error.js");
|
|
44
|
+
var import_logging = require("../../utils/logging.js");
|
|
45
|
+
var import_packageManager = require("../../utils/packageManager.js");
|
|
46
|
+
var import_port = require("../../utils/port.js");
|
|
47
|
+
var import_template = require("../../utils/template.js");
|
|
48
|
+
var import_git = require("./git.js");
|
|
49
|
+
var import_prompts2 = require("./prompts.js");
|
|
50
|
+
var import_types = require("./types.js");
|
|
26
51
|
const runForm = async (props) => {
|
|
27
52
|
const { message } = props;
|
|
28
|
-
log.plain(message);
|
|
53
|
+
import_logging.log.plain(message);
|
|
29
54
|
const result = {};
|
|
30
55
|
for (const choice of props.choices) {
|
|
31
|
-
const inputValue = await input({
|
|
56
|
+
const inputValue = await (0, import_prompts.input)({
|
|
32
57
|
message: choice.message,
|
|
33
58
|
default: choice.initial,
|
|
34
59
|
validate: async (inputText) => {
|
|
@@ -44,33 +69,38 @@ const runForm = async (props) => {
|
|
|
44
69
|
};
|
|
45
70
|
const confirmShouldContinue = async (choices) => {
|
|
46
71
|
const fieldsList = choices.map((choice) => choice.message);
|
|
47
|
-
log.newline();
|
|
48
|
-
log.plain("This template uses the following information:");
|
|
49
|
-
log.newline();
|
|
50
|
-
fieldsList.forEach((message) => log.subtle(`- ${message}`));
|
|
51
|
-
log.newline();
|
|
52
|
-
const result = await shouldContinue();
|
|
72
|
+
import_logging.log.newline();
|
|
73
|
+
import_logging.log.plain("This template uses the following information:");
|
|
74
|
+
import_logging.log.newline();
|
|
75
|
+
fieldsList.forEach((message) => import_logging.log.subtle(`- ${message}`));
|
|
76
|
+
import_logging.log.newline();
|
|
77
|
+
const result = await (0, import_prompts2.shouldContinue)();
|
|
53
78
|
return result === "yes";
|
|
54
79
|
};
|
|
55
80
|
const createDirectory = async (dir) => {
|
|
56
81
|
try {
|
|
57
|
-
await
|
|
82
|
+
await import_fs_extra.default.promises.mkdir(dir);
|
|
58
83
|
} catch (err) {
|
|
59
|
-
if (isErrorWithCode(err, "EEXIST")) {
|
|
60
|
-
log.err(`The directory '${dir}' already exists.`);
|
|
84
|
+
if ((0, import_error.isErrorWithCode)(err, "EEXIST")) {
|
|
85
|
+
import_logging.log.err(`The directory '${dir}' already exists.`);
|
|
61
86
|
process.exit(1);
|
|
62
87
|
}
|
|
63
88
|
throw err;
|
|
64
89
|
}
|
|
65
90
|
};
|
|
66
91
|
const cloneTemplate = async (templateName, destinationDir) => {
|
|
67
|
-
const
|
|
68
|
-
|
|
92
|
+
const isGitHubTemplate = templateName.startsWith("github:");
|
|
93
|
+
const isPrivateSeekTemplate = templateName.startsWith("seek:");
|
|
94
|
+
const isCustomTemplate = isGitHubTemplate || isPrivateSeekTemplate;
|
|
95
|
+
if (isGitHubTemplate) {
|
|
69
96
|
const gitHubPath = templateName.slice("github:".length);
|
|
70
|
-
await downloadGitHubTemplate(gitHubPath, destinationDir);
|
|
97
|
+
await (0, import_git.downloadGitHubTemplate)(gitHubPath, destinationDir);
|
|
98
|
+
} else if (isPrivateSeekTemplate) {
|
|
99
|
+
const privateName = templateName.slice("seek:".length);
|
|
100
|
+
await (0, import_git.downloadPrivateTemplate)(privateName, destinationDir);
|
|
71
101
|
} else {
|
|
72
|
-
const templateDir =
|
|
73
|
-
await copyFiles({
|
|
102
|
+
const templateDir = import_path.default.join(import_template.TEMPLATE_DIR, templateName);
|
|
103
|
+
await (0, import_copy.copyFiles)({
|
|
74
104
|
// assume built-in templates have no extraneous files
|
|
75
105
|
include: () => true,
|
|
76
106
|
sourceRoot: templateDir,
|
|
@@ -80,15 +110,15 @@ const cloneTemplate = async (templateName, destinationDir) => {
|
|
|
80
110
|
stripUnderscorePrefix: true
|
|
81
111
|
});
|
|
82
112
|
}
|
|
83
|
-
const templateConfig =
|
|
84
|
-
|
|
113
|
+
const templateConfig = getTemplateConfig(
|
|
114
|
+
import_path.default.join(process.cwd(), destinationDir)
|
|
85
115
|
);
|
|
86
116
|
if (isCustomTemplate) {
|
|
87
|
-
log.newline();
|
|
88
|
-
log.warn(
|
|
117
|
+
import_logging.log.newline();
|
|
118
|
+
import_logging.log.warn(
|
|
89
119
|
"You may need to run",
|
|
90
|
-
log.bold(
|
|
91
|
-
`${configForPackageManager(templateConfig.packageManager).print.exec} skuba configure`
|
|
120
|
+
import_logging.log.bold(
|
|
121
|
+
`${(0, import_packageManager.configForPackageManager)(templateConfig.packageManager).print.exec} skuba configure`
|
|
92
122
|
),
|
|
93
123
|
"once this is done."
|
|
94
124
|
);
|
|
@@ -96,27 +126,31 @@ const cloneTemplate = async (templateName, destinationDir) => {
|
|
|
96
126
|
return templateConfig;
|
|
97
127
|
};
|
|
98
128
|
const selectTemplateName = async () => {
|
|
99
|
-
const templateSelection = await getTemplateName();
|
|
129
|
+
const templateSelection = await (0, import_prompts2.getTemplateName)();
|
|
100
130
|
if (templateSelection === "github \u2192") {
|
|
101
|
-
const gitHubPath = await getGitPath();
|
|
131
|
+
const gitHubPath = await (0, import_prompts2.getGitPath)();
|
|
102
132
|
return `github:${gitHubPath}`;
|
|
103
133
|
}
|
|
134
|
+
if (templateSelection === "seek \u2192") {
|
|
135
|
+
const privateName = await (0, import_prompts2.getPrivateTemplateName)();
|
|
136
|
+
return `seek:${privateName}`;
|
|
137
|
+
}
|
|
104
138
|
return templateSelection;
|
|
105
139
|
};
|
|
106
140
|
const generatePlaceholders = (choices) => Object.fromEntries(
|
|
107
141
|
choices.map(({ name }) => [name, `<%- ${name} %>`])
|
|
108
142
|
);
|
|
109
|
-
const getTemplateConfig =
|
|
110
|
-
const templateConfigPath =
|
|
143
|
+
const getTemplateConfig = (dir) => {
|
|
144
|
+
const templateConfigPath = import_path.default.join(dir, import_template.TEMPLATE_CONFIG_FILENAME);
|
|
111
145
|
try {
|
|
112
|
-
const
|
|
113
|
-
return templateConfigSchema.parse(
|
|
146
|
+
const templateConfig = require(templateConfigPath);
|
|
147
|
+
return import_template.templateConfigSchema.parse(templateConfig);
|
|
114
148
|
} catch (err) {
|
|
115
|
-
if (isErrorWithCode(err, "MODULE_NOT_FOUND")) {
|
|
149
|
+
if ((0, import_error.isErrorWithCode)(err, "MODULE_NOT_FOUND")) {
|
|
116
150
|
return {
|
|
117
151
|
entryPoint: void 0,
|
|
118
152
|
fields: [],
|
|
119
|
-
packageManager: DEFAULT_PACKAGE_MANAGER,
|
|
153
|
+
packageManager: import_packageManager.DEFAULT_PACKAGE_MANAGER,
|
|
120
154
|
type: void 0
|
|
121
155
|
};
|
|
122
156
|
}
|
|
@@ -130,7 +164,7 @@ const baseToTemplateData = async ({
|
|
|
130
164
|
defaultBranch
|
|
131
165
|
}) => {
|
|
132
166
|
const [orgName, teamName] = ownerName.split("/");
|
|
133
|
-
const port = String(await getRandomPort());
|
|
167
|
+
const port = String(await (0, import_port.getRandomPort)());
|
|
134
168
|
if (!orgName) {
|
|
135
169
|
throw new Error(`Invalid format for owner name: ${ownerName}`);
|
|
136
170
|
}
|
|
@@ -148,8 +182,8 @@ const baseToTemplateData = async ({
|
|
|
148
182
|
};
|
|
149
183
|
};
|
|
150
184
|
const configureFromPrompt = async () => {
|
|
151
|
-
const { ownerName, platformName, repoName, defaultBranch } = await runForm(BASE_PROMPT_PROPS);
|
|
152
|
-
log.plain(styleText("cyan", repoName), "by", styleText("cyan", ownerName));
|
|
185
|
+
const { ownerName, platformName, repoName, defaultBranch } = await runForm(import_prompts2.BASE_PROMPT_PROPS);
|
|
186
|
+
import_logging.log.plain((0, import_node_util.styleText)("cyan", repoName), "by", (0, import_node_util.styleText)("cyan", ownerName));
|
|
153
187
|
const templateData = await baseToTemplateData({
|
|
154
188
|
ownerName,
|
|
155
189
|
platformName,
|
|
@@ -158,7 +192,7 @@ const configureFromPrompt = async () => {
|
|
|
158
192
|
});
|
|
159
193
|
const destinationDir = repoName;
|
|
160
194
|
await createDirectory(destinationDir);
|
|
161
|
-
log.newline();
|
|
195
|
+
import_logging.log.newline();
|
|
162
196
|
const templateName = await selectTemplateName();
|
|
163
197
|
const { entryPoint, fields, noSkip, packageManager, type } = await cloneTemplate(templateName, destinationDir);
|
|
164
198
|
if (fields.length === 0) {
|
|
@@ -174,12 +208,12 @@ const configureFromPrompt = async () => {
|
|
|
174
208
|
}
|
|
175
209
|
const shouldContinueWithTemplate = noSkip ? true : await confirmShouldContinue(fields);
|
|
176
210
|
if (shouldContinueWithTemplate) {
|
|
177
|
-
log.newline();
|
|
211
|
+
import_logging.log.newline();
|
|
178
212
|
const customAnswers2 = await runForm({
|
|
179
213
|
choices: fields,
|
|
180
|
-
message: styleText(
|
|
214
|
+
message: (0, import_node_util.styleText)(
|
|
181
215
|
"bold",
|
|
182
|
-
`Complete ${styleText("cyan", templateName)}:`
|
|
216
|
+
`Complete ${(0, import_node_util.styleText)("cyan", templateName)}:`
|
|
183
217
|
),
|
|
184
218
|
name: "customAnswers"
|
|
185
219
|
});
|
|
@@ -193,9 +227,9 @@ const configureFromPrompt = async () => {
|
|
|
193
227
|
type
|
|
194
228
|
};
|
|
195
229
|
}
|
|
196
|
-
log.newline();
|
|
197
|
-
log.warn(
|
|
198
|
-
`Resume this later with ${styleText("bold", `${configForPackageManager(packageManager).print.exec} skuba configure`)}.`
|
|
230
|
+
import_logging.log.newline();
|
|
231
|
+
import_logging.log.warn(
|
|
232
|
+
`Resume this later with ${(0, import_node_util.styleText)("bold", `${(0, import_packageManager.configForPackageManager)(packageManager).print.exec} skuba configure`)}.`
|
|
199
233
|
);
|
|
200
234
|
const customAnswers = generatePlaceholders(fields);
|
|
201
235
|
return {
|
|
@@ -215,24 +249,24 @@ const readJSONFromStdIn = async () => {
|
|
|
215
249
|
);
|
|
216
250
|
text = text.trim();
|
|
217
251
|
if (text === "") {
|
|
218
|
-
log.err("No data from stdin.");
|
|
252
|
+
import_logging.log.err("No data from stdin.");
|
|
219
253
|
process.exit(1);
|
|
220
254
|
}
|
|
221
255
|
let value;
|
|
222
256
|
try {
|
|
223
257
|
value = JSON.parse(text);
|
|
224
258
|
} catch {
|
|
225
|
-
log.err("Invalid JSON from stdin.");
|
|
259
|
+
import_logging.log.err("Invalid JSON from stdin.");
|
|
226
260
|
process.exit(1);
|
|
227
261
|
}
|
|
228
262
|
return value;
|
|
229
263
|
};
|
|
230
264
|
const configureFromPipe = async () => {
|
|
231
265
|
const value = await readJSONFromStdIn();
|
|
232
|
-
const result = initConfigInputSchema.safeParse(value);
|
|
266
|
+
const result = import_types.initConfigInputSchema.safeParse(value);
|
|
233
267
|
if (!result.success) {
|
|
234
|
-
log.err("Invalid data from stdin:");
|
|
235
|
-
log.err(result.error);
|
|
268
|
+
import_logging.log.err("Invalid data from stdin:");
|
|
269
|
+
import_logging.log.err(result.error);
|
|
236
270
|
process.exit(1);
|
|
237
271
|
}
|
|
238
272
|
const { destinationDir, templateComplete, templateName } = result.data;
|
|
@@ -244,7 +278,7 @@ const configureFromPipe = async () => {
|
|
|
244
278
|
const { entryPoint, fields, noSkip, packageManager, type } = await cloneTemplate(templateName, destinationDir);
|
|
245
279
|
if (!templateComplete) {
|
|
246
280
|
if (noSkip) {
|
|
247
|
-
log.err("Templating for", log.bold(templateName), "cannot be skipped.");
|
|
281
|
+
import_logging.log.err("Templating for", import_logging.log.bold(templateName), "cannot be skipped.");
|
|
248
282
|
process.exit(1);
|
|
249
283
|
}
|
|
250
284
|
return {
|
|
@@ -262,9 +296,9 @@ const configureFromPipe = async () => {
|
|
|
262
296
|
const provided = new Set(Object.keys(templateData));
|
|
263
297
|
const missing = required.filter((name) => !provided.has(name));
|
|
264
298
|
if (missing.length > 0) {
|
|
265
|
-
log.err("This template uses the following information:");
|
|
266
|
-
log.newline();
|
|
267
|
-
missing.forEach((name) => log.err(`- ${name}`));
|
|
299
|
+
import_logging.log.err("This template uses the following information:");
|
|
300
|
+
import_logging.log.newline();
|
|
301
|
+
missing.forEach((name) => import_logging.log.err(`- ${name}`));
|
|
268
302
|
process.exit(1);
|
|
269
303
|
}
|
|
270
304
|
return {
|
|
@@ -276,11 +310,12 @@ const configureFromPipe = async () => {
|
|
|
276
310
|
};
|
|
277
311
|
};
|
|
278
312
|
const getConfig = () => process.stdin.isTTY ? configureFromPrompt() : configureFromPipe();
|
|
279
|
-
export
|
|
313
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
314
|
+
0 && (module.exports = {
|
|
280
315
|
configureFromPrompt,
|
|
281
316
|
getConfig,
|
|
282
317
|
getTemplateConfig,
|
|
283
318
|
readJSONFromStdIn,
|
|
284
319
|
runForm
|
|
285
|
-
};
|
|
320
|
+
});
|
|
286
321
|
//# sourceMappingURL=getConfig.js.map
|