skuba 14.0.0-replace-global-vars-20251121010036 → 14.0.0-rfc-pnpm-config-skuba-20260106120954
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.d.ts +1 -1
- package/lib/cli/configure/processing/configFile.js +34 -43
- package/lib/cli/configure/processing/configFile.js.map +2 -2
- package/lib/cli/configure/processing/deleteFiles.js +26 -2
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +27 -2
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +31 -6
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +26 -2
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +28 -4
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.d.ts +67 -1
- package/lib/cli/configure/processing/package.js +45 -8
- package/lib/cli/configure/processing/package.js.map +3 -3
- package/lib/cli/configure/processing/prettier.js +38 -4
- package/lib/cli/configure/processing/prettier.js.map +2 -2
- package/lib/cli/configure/processing/record.js +41 -5
- package/lib/cli/configure/processing/record.js.map +2 -2
- package/lib/cli/configure/processing/typescript.js +63 -26
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/types.d.ts +4 -15
- package/lib/cli/configure/types.js +16 -0
- package/lib/cli/configure/types.js.map +3 -3
- package/lib/cli/format/index.js +44 -20
- package/lib/cli/format/index.js.map +1 -1
- package/lib/cli/help/index.js +30 -6
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.d.ts +1 -1
- package/lib/cli/init/getConfig.js +100 -74
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.js +51 -16
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.js +117 -68
- package/lib/cli/init/index.js.map +3 -3
- package/lib/cli/init/prompts.d.ts +4 -4
- package/lib/cli/init/prompts.js +48 -27
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.js +41 -7
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +30 -2
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +42 -8
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +45 -11
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +26 -2
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +45 -11
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +26 -2
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +26 -2
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +28 -4
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/index.js +30 -6
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.js +73 -37
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/eslint.js +51 -16
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/external.js +51 -19
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.js +49 -25
- package/lib/cli/lint/index.js.map +1 -1
- package/lib/cli/lint/internal.js +42 -18
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +45 -11
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +1 -1
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +65 -42
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
- package/lib/cli/lint/internalLints/upgrade/index.js +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 +45 -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/migrateToPnpmConfig.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/migrateToPnpmConfig.js +139 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/migrateToPnpmConfig.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.js +55 -18
- package/lib/utils/template.js.map +3 -3
- package/lib/utils/validation.js +31 -2
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +46 -9
- package/lib/utils/version.js.map +2 -2
- package/lib/utils/wait.js +32 -7
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.js +35 -10
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/function-arguments.d.js +1 -0
- package/lib/wrapper/functionHandler.js +49 -18
- package/lib/wrapper/functionHandler.js.map +2 -2
- package/lib/wrapper/http.js +43 -8
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js +7 -6
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +42 -8
- package/lib/wrapper/main.js.map +3 -3
- package/lib/wrapper/requestListener.js +47 -13
- package/lib/wrapper/requestListener.js.map +2 -2
- package/lib/wrapper/server.js +28 -4
- package/lib/wrapper/server.js.map +1 -1
- package/package.json +45 -45
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +0 -23
- 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 +1 -2
- 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 +2 -3
- 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
package/lib/cli/init/index.js
CHANGED
|
@@ -1,28 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 init_exports = {};
|
|
30
|
+
__export(init_exports, {
|
|
31
|
+
init: () => init
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(init_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_util = require("util");
|
|
36
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
+
var import_args = require("../../utils/args.js");
|
|
38
|
+
var import_copy = require("../../utils/copy.js");
|
|
39
|
+
var import_dir = require("../../utils/dir.js");
|
|
40
|
+
var import_exec = require("../../utils/exec.js");
|
|
41
|
+
var import_logging = require("../../utils/logging.js");
|
|
42
|
+
var import_logo = require("../../utils/logo.js");
|
|
43
|
+
var import_manifest = require("../../utils/manifest.js");
|
|
44
|
+
var import_packageManager = require("../../utils/packageManager.js");
|
|
45
|
+
var import_template = require("../../utils/template.js");
|
|
46
|
+
var import_prettier = require("../adapter/prettier.js");
|
|
47
|
+
var import_patchRenovateConfig = require("../lint/internalLints/patchRenovateConfig.js");
|
|
48
|
+
var import_getConfig = require("./getConfig.js");
|
|
49
|
+
var import_git = require("./git.js");
|
|
50
|
+
var import_writePackageJson = require("./writePackageJson.js");
|
|
51
|
+
var Git = __toESM(require("@skuba-lib/api/git"));
|
|
21
52
|
const init = async (args = process.argv.slice(2)) => {
|
|
22
53
|
const opts = {
|
|
23
|
-
debug: hasDebugFlag(args)
|
|
54
|
+
debug: (0, import_args.hasDebugFlag)(args)
|
|
24
55
|
};
|
|
25
|
-
const skubaVersionInfo = await showLogoAndVersionInfo();
|
|
56
|
+
const skubaVersionInfo = await (0, import_logo.showLogoAndVersionInfo)();
|
|
26
57
|
const {
|
|
27
58
|
destinationDir,
|
|
28
59
|
entryPoint,
|
|
@@ -31,15 +62,15 @@ const init = async (args = process.argv.slice(2)) => {
|
|
|
31
62
|
templateData,
|
|
32
63
|
templateName,
|
|
33
64
|
type
|
|
34
|
-
} = await getConfig();
|
|
35
|
-
await ensureCommands(packageManager);
|
|
36
|
-
const include = await createInclusionFilter([
|
|
37
|
-
|
|
38
|
-
|
|
65
|
+
} = await (0, import_getConfig.getConfig)();
|
|
66
|
+
await (0, import_exec.ensureCommands)(packageManager);
|
|
67
|
+
const include = await (0, import_dir.createInclusionFilter)([
|
|
68
|
+
import_path.default.join(destinationDir, ".gitignore"),
|
|
69
|
+
import_path.default.join(import_template.BASE_TEMPLATE_DIR, "_.gitignore")
|
|
39
70
|
]);
|
|
40
|
-
const processors = [createEjsRenderer(templateData)];
|
|
41
|
-
await copyFiles({
|
|
42
|
-
sourceRoot: BASE_TEMPLATE_DIR,
|
|
71
|
+
const processors = [(0, import_copy.createEjsRenderer)(templateData)];
|
|
72
|
+
await (0, import_copy.copyFiles)({
|
|
73
|
+
sourceRoot: import_template.BASE_TEMPLATE_DIR,
|
|
43
74
|
destinationRoot: destinationDir,
|
|
44
75
|
include,
|
|
45
76
|
// prefer template-specific files
|
|
@@ -48,15 +79,15 @@ const init = async (args = process.argv.slice(2)) => {
|
|
|
48
79
|
// base template has files like _eslint.config.js
|
|
49
80
|
stripUnderscorePrefix: true
|
|
50
81
|
});
|
|
51
|
-
await copyFiles({
|
|
82
|
+
await (0, import_copy.copyFiles)({
|
|
52
83
|
sourceRoot: destinationDir,
|
|
53
84
|
destinationRoot: destinationDir,
|
|
54
85
|
include,
|
|
55
86
|
processors
|
|
56
87
|
});
|
|
57
88
|
await Promise.all([
|
|
58
|
-
templateComplete ? ensureTemplateConfigDeletion(destinationDir) : Promise.resolve(),
|
|
59
|
-
writePackageJson({
|
|
89
|
+
templateComplete ? (0, import_template.ensureTemplateConfigDeletion)(destinationDir) : Promise.resolve(),
|
|
90
|
+
(0, import_writePackageJson.writePackageJson)({
|
|
60
91
|
cwd: destinationDir,
|
|
61
92
|
entryPoint,
|
|
62
93
|
template: templateName,
|
|
@@ -64,21 +95,38 @@ const init = async (args = process.argv.slice(2)) => {
|
|
|
64
95
|
version: skubaVersionInfo.local
|
|
65
96
|
})
|
|
66
97
|
]);
|
|
67
|
-
const exec = createExec({
|
|
98
|
+
const exec = (0, import_exec.createExec)({
|
|
68
99
|
cwd: destinationDir,
|
|
69
100
|
stdio: "pipe",
|
|
70
101
|
streamStdio: packageManager
|
|
71
102
|
});
|
|
72
|
-
log.newline();
|
|
73
|
-
await initialiseRepo(destinationDir, templateData);
|
|
74
|
-
const [manifest, packageManagerConfig] = await Promise.all([
|
|
75
|
-
getConsumerManifest(destinationDir),
|
|
76
|
-
detectPackageManager(destinationDir)
|
|
103
|
+
import_logging.log.newline();
|
|
104
|
+
await (0, import_git.initialiseRepo)(destinationDir, templateData);
|
|
105
|
+
const [manifest, packageManagerConfig, skubaManifest] = await Promise.all([
|
|
106
|
+
(0, import_manifest.getConsumerManifest)(destinationDir),
|
|
107
|
+
(0, import_packageManager.detectPackageManager)(destinationDir),
|
|
108
|
+
(0, import_manifest.getSkubaManifest)()
|
|
77
109
|
]);
|
|
78
110
|
if (!manifest) {
|
|
79
111
|
throw new Error("Repository doesn't contain a package.json file.");
|
|
80
112
|
}
|
|
81
|
-
|
|
113
|
+
const pnpmPluginSkubaVersion = skubaManifest.devDependencies?.["pnpm-plugin-skuba"] || "latest";
|
|
114
|
+
if (packageManager === "pnpm") {
|
|
115
|
+
if (process.env.SKUBA_INTEGRATION_TEST === "true") {
|
|
116
|
+
await import_fs_extra.default.promises.symlink(
|
|
117
|
+
import_path.default.resolve("../skuba/packages/pnpm-plugin-skuba/.pnpmfile.cjs"),
|
|
118
|
+
import_path.default.join(destinationDir, ".pnpmfile.cjs")
|
|
119
|
+
);
|
|
120
|
+
} else {
|
|
121
|
+
await exec(
|
|
122
|
+
packageManager,
|
|
123
|
+
"add",
|
|
124
|
+
"--config",
|
|
125
|
+
`pnpm-plugin-skuba@${pnpmPluginSkubaVersion}`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
await (0, import_patchRenovateConfig.tryPatchRenovateConfig)({
|
|
82
130
|
mode: "format",
|
|
83
131
|
dir: destinationDir,
|
|
84
132
|
manifest,
|
|
@@ -88,55 +136,56 @@ const init = async (args = process.argv.slice(2)) => {
|
|
|
88
136
|
let depsInstalled = false;
|
|
89
137
|
try {
|
|
90
138
|
await exec(packageManager, "add", "-D", skubaSlug);
|
|
91
|
-
await runPrettier(
|
|
139
|
+
await (0, import_prettier.runPrettier)(
|
|
92
140
|
"format",
|
|
93
|
-
createLogger({ debug: opts.debug }),
|
|
141
|
+
(0, import_logging.createLogger)({ debug: opts.debug }),
|
|
94
142
|
destinationDir
|
|
95
143
|
);
|
|
96
144
|
depsInstalled = true;
|
|
97
145
|
} catch (err) {
|
|
98
|
-
log.warn(inspect(err));
|
|
146
|
+
import_logging.log.warn((0, import_util.inspect)(err));
|
|
99
147
|
}
|
|
100
148
|
await Git.commitAllChanges({
|
|
101
149
|
dir: destinationDir,
|
|
102
150
|
message: `Clone ${templateName}`
|
|
103
151
|
});
|
|
104
152
|
const logGitHubRepoCreation = () => {
|
|
105
|
-
log.plain(
|
|
153
|
+
import_logging.log.plain(
|
|
106
154
|
"Next, create an empty",
|
|
107
|
-
log.bold(`${templateData.orgName}/${templateData.repoName}`),
|
|
155
|
+
import_logging.log.bold(`${templateData.orgName}/${templateData.repoName}`),
|
|
108
156
|
"repository:"
|
|
109
157
|
);
|
|
110
|
-
log.ok("https://github.com/new");
|
|
158
|
+
import_logging.log.ok("https://github.com/new");
|
|
111
159
|
};
|
|
112
160
|
if (!depsInstalled) {
|
|
113
|
-
log.newline();
|
|
114
|
-
log.warn(log.bold("\u2717 Failed to install dependencies."));
|
|
115
|
-
log.newline();
|
|
161
|
+
import_logging.log.newline();
|
|
162
|
+
import_logging.log.warn(import_logging.log.bold("\u2717 Failed to install dependencies."));
|
|
163
|
+
import_logging.log.newline();
|
|
116
164
|
logGitHubRepoCreation();
|
|
117
|
-
log.newline();
|
|
118
|
-
log.plain("Then, resume initialisation:");
|
|
119
|
-
log.ok("cd", destinationDir);
|
|
120
|
-
log.ok(packageManager, "add", "-D", skubaSlug);
|
|
121
|
-
log.ok(packageManager, "run", "format");
|
|
122
|
-
log.ok("git add --all");
|
|
123
|
-
log.ok("git commit --message", `'Pin ${skubaSlug}'`);
|
|
124
|
-
log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);
|
|
125
|
-
log.newline();
|
|
165
|
+
import_logging.log.newline();
|
|
166
|
+
import_logging.log.plain("Then, resume initialisation:");
|
|
167
|
+
import_logging.log.ok("cd", destinationDir);
|
|
168
|
+
import_logging.log.ok(packageManager, "add", "-D", skubaSlug);
|
|
169
|
+
import_logging.log.ok(packageManager, "run", "format");
|
|
170
|
+
import_logging.log.ok("git add --all");
|
|
171
|
+
import_logging.log.ok("git commit --message", `'Pin ${skubaSlug}'`);
|
|
172
|
+
import_logging.log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);
|
|
173
|
+
import_logging.log.newline();
|
|
126
174
|
process.exitCode = 1;
|
|
127
175
|
return;
|
|
128
176
|
}
|
|
129
|
-
log.newline();
|
|
130
|
-
log.ok(log.bold("\u2714 Project initialised!"));
|
|
131
|
-
log.newline();
|
|
177
|
+
import_logging.log.newline();
|
|
178
|
+
import_logging.log.ok(import_logging.log.bold("\u2714 Project initialised!"));
|
|
179
|
+
import_logging.log.newline();
|
|
132
180
|
logGitHubRepoCreation();
|
|
133
|
-
log.newline();
|
|
134
|
-
log.plain("Then, push your local changes:");
|
|
135
|
-
log.ok("cd", destinationDir);
|
|
136
|
-
log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);
|
|
137
|
-
log.newline();
|
|
181
|
+
import_logging.log.newline();
|
|
182
|
+
import_logging.log.plain("Then, push your local changes:");
|
|
183
|
+
import_logging.log.ok("cd", destinationDir);
|
|
184
|
+
import_logging.log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);
|
|
185
|
+
import_logging.log.newline();
|
|
138
186
|
};
|
|
139
|
-
export
|
|
187
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
188
|
+
0 && (module.exports = {
|
|
140
189
|
init
|
|
141
|
-
};
|
|
190
|
+
});
|
|
142
191
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/index.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { copyFiles, createEjsRenderer } from '../../utils/copy.js';\nimport { createInclusionFilter } from '../../utils/dir.js';\nimport { createExec, ensureCommands } from '../../utils/exec.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { showLogoAndVersionInfo } from '../../utils/logo.js';\nimport { getConsumerManifest } from '../../utils/manifest.js';\nimport { detectPackageManager } from '../../utils/packageManager.js';\nimport {\n BASE_TEMPLATE_DIR,\n ensureTemplateConfigDeletion,\n} from '../../utils/template.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { tryPatchRenovateConfig } from '../lint/internalLints/patchRenovateConfig.js';\n\nimport { getConfig } from './getConfig.js';\nimport { initialiseRepo } from './git.js';\nimport type { Input } from './types.js';\nimport { writePackageJson } from './writePackageJson.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\nexport const init = async (args = process.argv.slice(2)) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n };\n\n const skubaVersionInfo = await showLogoAndVersionInfo();\n\n const {\n destinationDir,\n entryPoint,\n packageManager,\n templateComplete,\n templateData,\n templateName,\n type,\n } = await getConfig();\n\n await ensureCommands(packageManager);\n\n const include = await createInclusionFilter([\n path.join(destinationDir, '.gitignore'),\n path.join(BASE_TEMPLATE_DIR, '_.gitignore'),\n ]);\n\n const processors = [createEjsRenderer(templateData)];\n\n await copyFiles({\n sourceRoot: BASE_TEMPLATE_DIR,\n destinationRoot: destinationDir,\n include,\n // prefer template-specific files\n overwrite: false,\n processors,\n // base template has files like _eslint.config.js\n stripUnderscorePrefix: true,\n });\n\n await copyFiles({\n sourceRoot: destinationDir,\n destinationRoot: destinationDir,\n include,\n processors,\n });\n\n await Promise.all([\n templateComplete\n ? ensureTemplateConfigDeletion(destinationDir)\n : Promise.resolve(),\n\n writePackageJson({\n cwd: destinationDir,\n entryPoint,\n template: templateName,\n type,\n version: skubaVersionInfo.local,\n }),\n ]);\n\n const exec = createExec({\n cwd: destinationDir,\n stdio: 'pipe',\n streamStdio: packageManager,\n });\n\n log.newline();\n await initialiseRepo(destinationDir, templateData);\n\n const [manifest, packageManagerConfig] = await Promise.all([\n getConsumerManifest(destinationDir),\n detectPackageManager(destinationDir),\n ]);\n\n if (!manifest) {\n throw new Error(\"Repository doesn't contain a package.json file.\");\n }\n\n // Patch in a baseline Renovate preset based on the configured Git owner.\n await tryPatchRenovateConfig({\n mode: 'format',\n dir: destinationDir,\n manifest,\n packageManager: packageManagerConfig,\n });\n\n const skubaSlug = `skuba@${skubaVersionInfo.local}`;\n\n let depsInstalled = false;\n try {\n // The `-D` shorthand is portable across our package managers.\n await exec(packageManager, 'add', '-D', skubaSlug);\n\n // Templating can initially leave certain files in an unformatted state;\n // consider a Markdown table with columns sized based on content length.\n await runPrettier(\n 'format',\n createLogger({ debug: opts.debug }),\n destinationDir,\n );\n\n depsInstalled = true;\n } catch (err) {\n log.warn(inspect(err));\n }\n\n await Git.commitAllChanges({\n dir: destinationDir,\n message: `Clone ${templateName}`,\n });\n\n const logGitHubRepoCreation = () => {\n log.plain(\n 'Next, create an empty',\n log.bold(`${templateData.orgName}/${templateData.repoName}`),\n 'repository:',\n );\n log.ok('https://github.com/new');\n };\n\n if (!depsInstalled) {\n log.newline();\n log.warn(log.bold('\u2717 Failed to install dependencies.'));\n\n log.newline();\n logGitHubRepoCreation();\n\n log.newline();\n log.plain('Then, resume initialisation:');\n log.ok('cd', destinationDir);\n // The `-D` shorthand is portable across our package managers.\n log.ok(packageManager, 'add', '-D', skubaSlug);\n log.ok(packageManager, 'run', 'format');\n log.ok('git add --all');\n log.ok('git commit --message', `'Pin ${skubaSlug}'`);\n log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);\n\n log.newline();\n process.exitCode = 1;\n return;\n }\n\n log.newline();\n log.ok(log.bold('\u2714 Project initialised!'));\n\n log.newline();\n logGitHubRepoCreation();\n\n log.newline();\n log.plain('Then, push your local changes:');\n log.ok('cd', destinationDir);\n log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);\n\n log.newline();\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { copyFiles, createEjsRenderer } from '../../utils/copy.js';\nimport { createInclusionFilter } from '../../utils/dir.js';\nimport { createExec, ensureCommands } from '../../utils/exec.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { showLogoAndVersionInfo } from '../../utils/logo.js';\nimport { getConsumerManifest, getSkubaManifest } from '../../utils/manifest.js';\nimport { detectPackageManager } from '../../utils/packageManager.js';\nimport {\n BASE_TEMPLATE_DIR,\n ensureTemplateConfigDeletion,\n} from '../../utils/template.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { tryPatchRenovateConfig } from '../lint/internalLints/patchRenovateConfig.js';\n\nimport { getConfig } from './getConfig.js';\nimport { initialiseRepo } from './git.js';\nimport type { Input } from './types.js';\nimport { writePackageJson } from './writePackageJson.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\nexport const init = async (args = process.argv.slice(2)) => {\n const opts: Input = {\n debug: hasDebugFlag(args),\n };\n\n const skubaVersionInfo = await showLogoAndVersionInfo();\n\n const {\n destinationDir,\n entryPoint,\n packageManager,\n templateComplete,\n templateData,\n templateName,\n type,\n } = await getConfig();\n\n await ensureCommands(packageManager);\n\n const include = await createInclusionFilter([\n path.join(destinationDir, '.gitignore'),\n path.join(BASE_TEMPLATE_DIR, '_.gitignore'),\n ]);\n\n const processors = [createEjsRenderer(templateData)];\n\n await copyFiles({\n sourceRoot: BASE_TEMPLATE_DIR,\n destinationRoot: destinationDir,\n include,\n // prefer template-specific files\n overwrite: false,\n processors,\n // base template has files like _eslint.config.js\n stripUnderscorePrefix: true,\n });\n\n await copyFiles({\n sourceRoot: destinationDir,\n destinationRoot: destinationDir,\n include,\n processors,\n });\n\n await Promise.all([\n templateComplete\n ? ensureTemplateConfigDeletion(destinationDir)\n : Promise.resolve(),\n\n writePackageJson({\n cwd: destinationDir,\n entryPoint,\n template: templateName,\n type,\n version: skubaVersionInfo.local,\n }),\n ]);\n\n const exec = createExec({\n cwd: destinationDir,\n stdio: 'pipe',\n streamStdio: packageManager,\n });\n\n log.newline();\n await initialiseRepo(destinationDir, templateData);\n\n const [manifest, packageManagerConfig, skubaManifest] = await Promise.all([\n getConsumerManifest(destinationDir),\n detectPackageManager(destinationDir),\n getSkubaManifest(),\n ]);\n\n if (!manifest) {\n throw new Error(\"Repository doesn't contain a package.json file.\");\n }\n\n const pnpmPluginSkubaVersion =\n skubaManifest.devDependencies?.['pnpm-plugin-skuba'] || 'latest';\n\n if (packageManager === 'pnpm') {\n if (process.env.SKUBA_INTEGRATION_TEST === 'true') {\n await fs.promises.symlink(\n path.resolve('../skuba/packages/pnpm-plugin-skuba/.pnpmfile.cjs'),\n path.join(destinationDir, '.pnpmfile.cjs'),\n );\n } else {\n await exec(\n packageManager,\n 'add',\n '--config',\n `pnpm-plugin-skuba@${pnpmPluginSkubaVersion}`,\n );\n }\n }\n\n // Patch in a baseline Renovate preset based on the configured Git owner.\n await tryPatchRenovateConfig({\n mode: 'format',\n dir: destinationDir,\n manifest,\n packageManager: packageManagerConfig,\n });\n\n const skubaSlug = `skuba@${skubaVersionInfo.local}`;\n\n let depsInstalled = false;\n try {\n // The `-D` shorthand is portable across our package managers.\n await exec(packageManager, 'add', '-D', skubaSlug);\n\n // Templating can initially leave certain files in an unformatted state;\n // consider a Markdown table with columns sized based on content length.\n await runPrettier(\n 'format',\n createLogger({ debug: opts.debug }),\n destinationDir,\n );\n\n depsInstalled = true;\n } catch (err) {\n log.warn(inspect(err));\n }\n\n await Git.commitAllChanges({\n dir: destinationDir,\n message: `Clone ${templateName}`,\n });\n\n const logGitHubRepoCreation = () => {\n log.plain(\n 'Next, create an empty',\n log.bold(`${templateData.orgName}/${templateData.repoName}`),\n 'repository:',\n );\n log.ok('https://github.com/new');\n };\n\n if (!depsInstalled) {\n log.newline();\n log.warn(log.bold('\u2717 Failed to install dependencies.'));\n\n log.newline();\n logGitHubRepoCreation();\n\n log.newline();\n log.plain('Then, resume initialisation:');\n log.ok('cd', destinationDir);\n // The `-D` shorthand is portable across our package managers.\n log.ok(packageManager, 'add', '-D', skubaSlug);\n log.ok(packageManager, 'run', 'format');\n log.ok('git add --all');\n log.ok('git commit --message', `'Pin ${skubaSlug}'`);\n log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);\n\n log.newline();\n process.exitCode = 1;\n return;\n }\n\n log.newline();\n log.ok(log.bold('\u2714 Project initialised!'));\n\n log.newline();\n logGitHubRepoCreation();\n\n log.newline();\n log.plain('Then, push your local changes:');\n log.ok('cd', destinationDir);\n log.ok(`git push --set-upstream origin ${templateData.defaultBranch}`);\n\n log.newline();\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["path", "fs"]
|
|
7
7
|
}
|
|
@@ -18,7 +18,7 @@ declare const BASE_CHOICES: readonly [{
|
|
|
18
18
|
readonly name: "ownerName";
|
|
19
19
|
readonly message: "Owner";
|
|
20
20
|
readonly initial: "SEEK-Jobs/my-team";
|
|
21
|
-
readonly validate: (value: unknown) => true | "
|
|
21
|
+
readonly validate: (value: unknown) => true | "Required" | "Must contain a valid GitHub org name" | "Must contain a valid GitHub team name";
|
|
22
22
|
}, {
|
|
23
23
|
readonly name: "repoName";
|
|
24
24
|
readonly message: "Repo";
|
|
@@ -35,14 +35,14 @@ declare const BASE_CHOICES: readonly [{
|
|
|
35
35
|
readonly message: "Default Branch";
|
|
36
36
|
readonly initial: "main";
|
|
37
37
|
readonly allowInitial: true;
|
|
38
|
-
readonly validate: (value: unknown) => true | "
|
|
38
|
+
readonly validate: (value: unknown) => true | "Required";
|
|
39
39
|
}];
|
|
40
40
|
export declare const BASE_PROMPT_PROPS: {
|
|
41
41
|
choices: readonly [{
|
|
42
42
|
readonly name: "ownerName";
|
|
43
43
|
readonly message: "Owner";
|
|
44
44
|
readonly initial: "SEEK-Jobs/my-team";
|
|
45
|
-
readonly validate: (value: unknown) => true | "
|
|
45
|
+
readonly validate: (value: unknown) => true | "Required" | "Must contain a valid GitHub org name" | "Must contain a valid GitHub team name";
|
|
46
46
|
}, {
|
|
47
47
|
readonly name: "repoName";
|
|
48
48
|
readonly message: "Repo";
|
|
@@ -59,7 +59,7 @@ export declare const BASE_PROMPT_PROPS: {
|
|
|
59
59
|
readonly message: "Default Branch";
|
|
60
60
|
readonly initial: "main";
|
|
61
61
|
readonly allowInitial: true;
|
|
62
|
-
readonly validate: (value: unknown) => true | "
|
|
62
|
+
readonly validate: (value: unknown) => true | "Required";
|
|
63
63
|
}];
|
|
64
64
|
message: string;
|
|
65
65
|
name: string;
|
package/lib/cli/init/prompts.js
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 prompts_exports = {};
|
|
20
|
+
__export(prompts_exports, {
|
|
21
|
+
BASE_PROMPT_PROPS: () => BASE_PROMPT_PROPS,
|
|
22
|
+
getGitPath: () => getGitPath,
|
|
23
|
+
getTemplateName: () => getTemplateName,
|
|
24
|
+
shouldContinue: () => shouldContinue
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(prompts_exports);
|
|
27
|
+
var import_prompts = require("@inquirer/prompts");
|
|
28
|
+
var import_fs = require("../../utils/fs.js");
|
|
29
|
+
var import_template = require("../../utils/template.js");
|
|
30
|
+
var import_validation = require("./validation.js");
|
|
11
31
|
const BASE_CHOICES = [
|
|
12
32
|
{
|
|
13
33
|
name: "ownerName",
|
|
@@ -15,13 +35,13 @@ const BASE_CHOICES = [
|
|
|
15
35
|
initial: "SEEK-Jobs/my-team",
|
|
16
36
|
validate: (value) => {
|
|
17
37
|
if (typeof value !== "string") {
|
|
18
|
-
return "
|
|
38
|
+
return "Required";
|
|
19
39
|
}
|
|
20
40
|
const [org, team] = value.split("/");
|
|
21
|
-
if (!org || !isGitHubOrg(org)) {
|
|
22
|
-
return "
|
|
41
|
+
if (!org || !(0, import_validation.isGitHubOrg)(org)) {
|
|
42
|
+
return "Must contain a valid GitHub org name";
|
|
23
43
|
}
|
|
24
|
-
return team === void 0 || isGitHubTeam(team) || "
|
|
44
|
+
return team === void 0 || (0, import_validation.isGitHubTeam)(team) || "Must contain a valid GitHub team name";
|
|
25
45
|
}
|
|
26
46
|
},
|
|
27
47
|
{
|
|
@@ -30,12 +50,12 @@ const BASE_CHOICES = [
|
|
|
30
50
|
initial: "my-repo",
|
|
31
51
|
validate: async (value) => {
|
|
32
52
|
if (typeof value !== "string") {
|
|
33
|
-
return "
|
|
53
|
+
return "Required";
|
|
34
54
|
}
|
|
35
|
-
if (!isGitHubRepo(value)) {
|
|
36
|
-
return "
|
|
55
|
+
if (!(0, import_validation.isGitHubRepo)(value)) {
|
|
56
|
+
return "Must be a valid GitHub repo name";
|
|
37
57
|
}
|
|
38
|
-
const exists = await pathExists(value);
|
|
58
|
+
const exists = await (0, import_fs.pathExists)(value);
|
|
39
59
|
return !exists || `'${value}' is an existing directory`;
|
|
40
60
|
}
|
|
41
61
|
},
|
|
@@ -44,14 +64,14 @@ const BASE_CHOICES = [
|
|
|
44
64
|
message: "Platform",
|
|
45
65
|
initial: "arm64",
|
|
46
66
|
allowInitial: true,
|
|
47
|
-
validate: (value) => isPlatform(value) || `
|
|
67
|
+
validate: (value) => (0, import_validation.isPlatform)(value) || `Must be ${import_validation.PLATFORM_OPTIONS}`
|
|
48
68
|
},
|
|
49
69
|
{
|
|
50
70
|
name: "defaultBranch",
|
|
51
71
|
message: "Default Branch",
|
|
52
72
|
initial: "main",
|
|
53
73
|
allowInitial: true,
|
|
54
|
-
validate: (value) => typeof value === "string" && value.length > 0 ? true : "
|
|
74
|
+
validate: (value) => typeof value === "string" && value.length > 0 ? true : "Required"
|
|
55
75
|
}
|
|
56
76
|
];
|
|
57
77
|
const BASE_PROMPT_PROPS = {
|
|
@@ -59,26 +79,27 @@ const BASE_PROMPT_PROPS = {
|
|
|
59
79
|
message: "For starters, some project details:",
|
|
60
80
|
name: "baseAnswers"
|
|
61
81
|
};
|
|
62
|
-
const shouldContinue = async () => select({
|
|
82
|
+
const shouldContinue = async () => (0, import_prompts.select)({
|
|
63
83
|
message: "Fill this in now?",
|
|
64
84
|
choices: [
|
|
65
85
|
{ name: "Yes", value: "yes" },
|
|
66
86
|
{ name: "No", value: "no" }
|
|
67
87
|
]
|
|
68
88
|
});
|
|
69
|
-
const getGitPath = async () => input({
|
|
89
|
+
const getGitPath = async () => (0, import_prompts.input)({
|
|
70
90
|
message: "Git path",
|
|
71
91
|
default: "seek-oss/skuba",
|
|
72
|
-
validate: (value) => /[^/]+\/[^/]+/.test(value) || "
|
|
92
|
+
validate: (value) => /[^/]+\/[^/]+/.test(value) || "Must be a valid path"
|
|
73
93
|
});
|
|
74
|
-
const getTemplateName = async () => select({
|
|
94
|
+
const getTemplateName = async () => (0, import_prompts.select)({
|
|
75
95
|
message: "Select a template:",
|
|
76
|
-
choices: TEMPLATE_NAMES_WITH_BYO.map((name) => ({ name, value: name }))
|
|
96
|
+
choices: import_template.TEMPLATE_NAMES_WITH_BYO.map((name) => ({ name, value: name }))
|
|
77
97
|
});
|
|
78
|
-
export
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
79
100
|
BASE_PROMPT_PROPS,
|
|
80
101
|
getGitPath,
|
|
81
102
|
getTemplateName,
|
|
82
103
|
shouldContinue
|
|
83
|
-
};
|
|
104
|
+
});
|
|
84
105
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/prompts.ts"],
|
|
4
|
-
"sourcesContent": ["import { input, select } from '@inquirer/prompts';\n\nimport { pathExists } from '../../utils/fs.js';\nimport { TEMPLATE_NAMES_WITH_BYO } from '../../utils/template.js';\n\nimport {\n PLATFORM_OPTIONS,\n type Platform,\n isGitHubOrg,\n isGitHubRepo,\n isGitHubTeam,\n isPlatform,\n} from './validation.js';\n\nexport interface Choice {\n name: string;\n message: string;\n initial?: string;\n validate?: (value: string) => boolean | string | Promise<boolean | string>;\n /**\n * Whether the user is allowed to skip field entry and use the initial value.\n *\n * Defaults to `false`.\n */\n allowInitial?: boolean;\n}\n\nexport type BaseFields = Record<\n (typeof BASE_CHOICES)[number]['name'],\n string\n> & {\n platformName: Platform;\n};\n\nconst BASE_CHOICES = [\n {\n name: 'ownerName',\n message: 'Owner',\n initial: 'SEEK-Jobs/my-team',\n validate: (value: unknown) => {\n if (typeof value !== 'string') {\n return '
|
|
5
|
-
"mappings": "AAAA
|
|
4
|
+
"sourcesContent": ["import { input, select } from '@inquirer/prompts';\n\nimport { pathExists } from '../../utils/fs.js';\nimport { TEMPLATE_NAMES_WITH_BYO } from '../../utils/template.js';\n\nimport {\n PLATFORM_OPTIONS,\n type Platform,\n isGitHubOrg,\n isGitHubRepo,\n isGitHubTeam,\n isPlatform,\n} from './validation.js';\n\nexport interface Choice {\n name: string;\n message: string;\n initial?: string;\n validate?: (value: string) => boolean | string | Promise<boolean | string>;\n /**\n * Whether the user is allowed to skip field entry and use the initial value.\n *\n * Defaults to `false`.\n */\n allowInitial?: boolean;\n}\n\nexport type BaseFields = Record<\n (typeof BASE_CHOICES)[number]['name'],\n string\n> & {\n platformName: Platform;\n};\n\nconst BASE_CHOICES = [\n {\n name: 'ownerName',\n message: 'Owner',\n initial: 'SEEK-Jobs/my-team',\n validate: (value: unknown) => {\n if (typeof value !== 'string') {\n return 'Required';\n }\n\n const [org, team] = value.split('/');\n\n if (!org || !isGitHubOrg(org)) {\n return 'Must contain a valid GitHub org name';\n }\n\n return (\n team === undefined ||\n isGitHubTeam(team) ||\n 'Must contain a valid GitHub team name'\n );\n },\n },\n {\n name: 'repoName',\n message: 'Repo',\n initial: 'my-repo',\n validate: async (value: unknown) => {\n if (typeof value !== 'string') {\n return 'Required';\n }\n\n if (!isGitHubRepo(value)) {\n return 'Must be a valid GitHub repo name';\n }\n\n const exists = await pathExists(value);\n\n return !exists || `'${value}' is an existing directory`;\n },\n },\n {\n name: 'platformName',\n message: 'Platform',\n initial: 'arm64',\n allowInitial: true,\n validate: (value: unknown) =>\n isPlatform(value) || `Must be ${PLATFORM_OPTIONS}`,\n },\n {\n name: 'defaultBranch',\n message: 'Default Branch',\n initial: 'main',\n allowInitial: true,\n validate: (value: unknown) =>\n typeof value === 'string' && value.length > 0 ? true : 'Required',\n },\n] as const;\n\nexport const BASE_PROMPT_PROPS = {\n choices: BASE_CHOICES,\n message: 'For starters, some project details:',\n name: 'baseAnswers',\n};\n\nexport const shouldContinue = async () =>\n select({\n message: 'Fill this in now?',\n choices: [\n { name: 'Yes', value: 'yes' },\n { name: 'No', value: 'no' },\n ],\n });\n\nexport const getGitPath = async () =>\n input({\n message: 'Git path',\n default: 'seek-oss/skuba',\n validate: (value: string) =>\n /[^/]+\\/[^/]+/.test(value) || 'Must be a valid path',\n });\n\nexport const getTemplateName = async () =>\n select({\n message: 'Select a template:',\n choices: TEMPLATE_NAMES_WITH_BYO.map((name) => ({ name, value: name })),\n });\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8B;AAE9B,gBAA2B;AAC3B,sBAAwC;AAExC,wBAOO;AAsBP,MAAM,eAAe;AAAA,EACnB;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU,CAAC,UAAmB;AAC5B,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAEA,YAAM,CAAC,KAAK,IAAI,IAAI,MAAM,MAAM,GAAG;AAEnC,UAAI,CAAC,OAAO,KAAC,+BAAY,GAAG,GAAG;AAC7B,eAAO;AAAA,MACT;AAEA,aACE,SAAS,cACT,gCAAa,IAAI,KACjB;AAAA,IAEJ;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU,OAAO,UAAmB;AAClC,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAEA,UAAI,KAAC,gCAAa,KAAK,GAAG;AACxB,eAAO;AAAA,MACT;AAEA,YAAM,SAAS,UAAM,sBAAW,KAAK;AAErC,aAAO,CAAC,UAAU,IAAI,KAAK;AAAA,IAC7B;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,cAAc;AAAA,IACd,UAAU,CAAC,cACT,8BAAW,KAAK,KAAK,WAAW,kCAAgB;AAAA,EACpD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,cAAc;AAAA,IACd,UAAU,CAAC,UACT,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,OAAO;AAAA,EAC3D;AACF;AAEO,MAAM,oBAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,iBAAiB,gBAC5B,uBAAO;AAAA,EACL,SAAS;AAAA,EACT,SAAS;AAAA,IACP,EAAE,MAAM,OAAO,OAAO,MAAM;AAAA,IAC5B,EAAE,MAAM,MAAM,OAAO,KAAK;AAAA,EAC5B;AACF,CAAC;AAEI,MAAM,aAAa,gBACxB,sBAAM;AAAA,EACJ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU,CAAC,UACT,eAAe,KAAK,KAAK,KAAK;AAClC,CAAC;AAEI,MAAM,kBAAkB,gBAC7B,uBAAO;AAAA,EACL,SAAS;AAAA,EACT,SAAS,wCAAwB,IAAI,CAAC,UAAU,EAAE,MAAM,OAAO,KAAK,EAAE;AACxE,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/init/types.js
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 types_exports = {};
|
|
30
|
+
__export(types_exports, {
|
|
31
|
+
initConfigInputSchema: () => initConfigInputSchema
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(types_exports);
|
|
34
|
+
var z = __toESM(require("zod/v4"));
|
|
35
|
+
var import_manifest = require("../../utils/manifest.js");
|
|
36
|
+
var import_packageManager = require("../../utils/packageManager.js");
|
|
4
37
|
const initConfigInputSchema = z.object({
|
|
5
38
|
destinationDir: z.string(),
|
|
6
39
|
templateComplete: z.boolean(),
|
|
@@ -27,10 +60,11 @@ const initConfigSchema = initConfigInputSchema.omit({
|
|
|
27
60
|
port: z.string()
|
|
28
61
|
}).catchall(z.string()),
|
|
29
62
|
entryPoint: z.string().optional(),
|
|
30
|
-
packageManager: packageManagerSchema,
|
|
31
|
-
type: projectTypeSchema.optional()
|
|
63
|
+
packageManager: import_packageManager.packageManagerSchema,
|
|
64
|
+
type: import_manifest.projectTypeSchema.optional()
|
|
32
65
|
});
|
|
33
|
-
export
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
34
68
|
initConfigInputSchema
|
|
35
|
-
};
|
|
69
|
+
});
|
|
36
70
|
//# sourceMappingURL=types.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/types.ts"],
|
|
4
4
|
"sourcesContent": ["import * as z from 'zod/v4';\n\nimport { projectTypeSchema } from '../../utils/manifest.js';\nimport { packageManagerSchema } from '../../utils/packageManager.js';\n\nexport interface Input {\n /**\n * Whether to enable verbose debug logging.\n *\n * Defaults to `false`.\n */\n debug: boolean;\n}\n\nexport type InitConfigInput = z.infer<typeof initConfigInputSchema>;\n\nexport const initConfigInputSchema = z.object({\n destinationDir: z.string(),\n templateComplete: z.boolean(),\n templateData: z\n .object({\n ownerName: z.string(),\n repoName: z.string(),\n platformName: z.union([z.literal('amd64'), z.literal('arm64')]),\n defaultBranch: z.string(),\n })\n .catchall(z.string()),\n templateName: z.string(),\n});\n\nexport type InitConfig = z.infer<typeof initConfigSchema>;\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst initConfigSchema = initConfigInputSchema\n .omit({\n templateData: true,\n })\n .extend({\n templateData: z\n .object({\n ownerName: z.string(),\n repoName: z.string(),\n defaultBranch: z.string(),\n\n // Derived from ownerName\n // TODO: use zod to transform `InitConfigInput` -> `InitConfig`?\n orgName: z.string(),\n teamName: z.string(),\n\n // Generated by init command\n port: z.string(),\n })\n .catchall(z.string()),\n\n entryPoint: z.string().optional(),\n packageManager: packageManagerSchema,\n type: projectTypeSchema.optional(),\n });\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAEnB,sBAAkC;AAClC,4BAAqC;AAa9B,MAAM,wBAAwB,EAAE,OAAO;AAAA,EAC5C,gBAAgB,EAAE,OAAO;AAAA,EACzB,kBAAkB,EAAE,QAAQ;AAAA,EAC5B,cAAc,EACX,OAAO;AAAA,IACN,WAAW,EAAE,OAAO;AAAA,IACpB,UAAU,EAAE,OAAO;AAAA,IACnB,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,CAAC,CAAC;AAAA,IAC9D,eAAe,EAAE,OAAO;AAAA,EAC1B,CAAC,EACA,SAAS,EAAE,OAAO,CAAC;AAAA,EACtB,cAAc,EAAE,OAAO;AACzB,CAAC;AAKD,MAAM,mBAAmB,sBACtB,KAAK;AAAA,EACJ,cAAc;AAChB,CAAC,EACA,OAAO;AAAA,EACN,cAAc,EACX,OAAO;AAAA,IACN,WAAW,EAAE,OAAO;AAAA,IACpB,UAAU,EAAE,OAAO;AAAA,IACnB,eAAe,EAAE,OAAO;AAAA;AAAA;AAAA,IAIxB,SAAS,EAAE,OAAO;AAAA,IAClB,UAAU,EAAE,OAAO;AAAA;AAAA,IAGnB,MAAM,EAAE,OAAO;AAAA,EACjB,CAAC,EACA,SAAS,EAAE,OAAO,CAAC;AAAA,EAEtB,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,gBAAgB;AAAA,EAChB,MAAM,kCAAkB,SAAS;AACnC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,30 @@
|
|
|
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 validation_exports = {};
|
|
20
|
+
__export(validation_exports, {
|
|
21
|
+
PLATFORM_OPTIONS: () => PLATFORM_OPTIONS,
|
|
22
|
+
isGitHubOrg: () => isGitHubOrg,
|
|
23
|
+
isGitHubRepo: () => isGitHubRepo,
|
|
24
|
+
isGitHubTeam: () => isGitHubTeam,
|
|
25
|
+
isPlatform: () => isPlatform
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(validation_exports);
|
|
1
28
|
const isGitHubOrg = (value) => /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/.test(value) && !value.includes("--");
|
|
2
29
|
const isGitHubRepo = (value) => /^[A-Za-z0-9_.-]+$/.test(value) && value !== "." && value !== "..";
|
|
3
30
|
const isGitHubTeam = (value) => /^[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?$/.test(value) && !value.endsWith("-") && !value.includes("--");
|
|
@@ -5,11 +32,12 @@ const PLATFORMS = ["amd64", "arm64"];
|
|
|
5
32
|
const PLATFORM_OPTIONS = PLATFORMS.join(" | ");
|
|
6
33
|
const platformSet = new Set(PLATFORMS);
|
|
7
34
|
const isPlatform = (value) => platformSet.has(value);
|
|
8
|
-
export
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
9
37
|
PLATFORM_OPTIONS,
|
|
10
38
|
isGitHubOrg,
|
|
11
39
|
isGitHubRepo,
|
|
12
40
|
isGitHubTeam,
|
|
13
41
|
isPlatform
|
|
14
|
-
};
|
|
42
|
+
});
|
|
15
43
|
//# sourceMappingURL=validation.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/validation.ts"],
|
|
4
4
|
"sourcesContent": ["export const isGitHubOrg = (value: string) =>\n /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/.test(value) &&\n !value.includes('--');\n\nexport const isGitHubRepo = (value: string) =>\n /^[A-Za-z0-9_.-]+$/.test(value) && value !== '.' && value !== '..';\n\nexport const isGitHubTeam = (value: string) =>\n /^[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?$/.test(value) &&\n !value.endsWith('-') &&\n !value.includes('--');\n\nconst PLATFORMS = ['amd64', 'arm64'] as const;\n\nexport type Platform = (typeof PLATFORMS)[number];\n\nexport const PLATFORM_OPTIONS = PLATFORMS.join(' | ');\n\nconst platformSet = new Set<unknown>(PLATFORMS);\n\nexport const isPlatform = (value: unknown) => platformSet.has(value);\n"],
|
|
5
|
-
"mappings": "AAAO,MAAM,cAAc,CAAC,UAC1B,6CAA6C,KAAK,KAAK,KACvD,CAAC,MAAM,SAAS,IAAI;AAEf,MAAM,eAAe,CAAC,UAC3B,oBAAoB,KAAK,KAAK,KAAK,UAAU,OAAO,UAAU;AAEzD,MAAM,eAAe,CAAC,UAC3B,gDAAgD,KAAK,KAAK,KAC1D,CAAC,MAAM,SAAS,GAAG,KACnB,CAAC,MAAM,SAAS,IAAI;AAEtB,MAAM,YAAY,CAAC,SAAS,OAAO;AAI5B,MAAM,mBAAmB,UAAU,KAAK,KAAK;AAEpD,MAAM,cAAc,IAAI,IAAa,SAAS;AAEvC,MAAM,aAAa,CAAC,UAAmB,YAAY,IAAI,KAAK;",
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc,CAAC,UAC1B,6CAA6C,KAAK,KAAK,KACvD,CAAC,MAAM,SAAS,IAAI;AAEf,MAAM,eAAe,CAAC,UAC3B,oBAAoB,KAAK,KAAK,KAAK,UAAU,OAAO,UAAU;AAEzD,MAAM,eAAe,CAAC,UAC3B,gDAAgD,KAAK,KAAK,KAC1D,CAAC,MAAM,SAAS,GAAG,KACnB,CAAC,MAAM,SAAS,IAAI;AAEtB,MAAM,YAAY,CAAC,SAAS,OAAO;AAI5B,MAAM,mBAAmB,UAAU,KAAK,KAAK;AAEpD,MAAM,cAAc,IAAI,IAAa,SAAS;AAEvC,MAAM,aAAa,CAAC,UAAmB,YAAY,IAAI,KAAK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|