skuba 14.0.0-replace-global-vars-20251121010036 → 14.0.0-tsdown-package-templates-20251225094805
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.d.ts +0 -9
- package/lib/cli/build/assets.js +57 -45
- package/lib/cli/build/assets.js.map +3 -3
- 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/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 +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 +98 -67
- package/lib/cli/init/index.js.map +2 -2
- 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.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.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 +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 +7 -8
- 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 +8 -10
- 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 +10 -3
- package/template/oss-npm-package/skuba.template.js +1 -1
- package/template/oss-npm-package/src/index.test.ts +0 -2
- package/template/oss-npm-package/tsconfig.json +2 -1
- package/template/oss-npm-package/tsdown.config.ts +11 -0
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +11 -4
- package/template/private-npm-package/skuba.template.js +2 -2
- package/template/private-npm-package/src/index.test.ts +0 -2
- package/template/private-npm-package/tsconfig.json +2 -1
- package/template/private-npm-package/tsdown.config.ts +11 -0
- package/lib/cli/buildPackage/index.d.ts +0 -1
- package/lib/cli/buildPackage/index.js +0 -43
- package/lib/cli/buildPackage/index.js.map +0 -7
- 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/adapter/prettier.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport {\n type Options,\n type SupportLanguage,\n check,\n format,\n getSupportInfo,\n resolveConfig,\n} from 'prettier';\n\nimport { crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, pluralise } from '../../utils/logging.js';\nimport { getConsumerManifest } from '../../utils/manifest.js';\nimport {\n formatPackage,\n parsePackage,\n} from '../configure/processing/package.js';\n\nlet languages: SupportLanguage[] | undefined;\n\n/**\n * Infers a parser for the specified filepath.\n *\n * This is a cut-down version of Prettier's built-in function of the same name;\n * ours operates purely on the `filepath` string and does not perform file I/O.\n * Prettier's internal `getInterpreter` function can open a file to read the\n * shebang, and its file descriptor usage can throw warnings on worker threads:\n *\n * ```console\n * Warning: File descriptor 123 closed but not opened in unmanaged mode\n * at Object.closeSync (node:fs:530:11)\n * at Object.closeSync (node_modules/graceful-fs/graceful-fs.js:74:20)\n * ...\n * ```\n *\n * References:\n *\n * - https://github.com/prettier/prettier/blob/2.4.1/src/main/options.js#L167\n * - seek-oss/skuba#659\n */\nexport const inferParser = async (\n filepath: string,\n): Promise<string | undefined> => {\n const filename = path.basename(filepath).toLowerCase();\n\n languages ??= (await getSupportInfo()).languages;\n\n const firstLanguage = languages.find(\n (language) =>\n language.extensions?.some((extension) => filename.endsWith(extension)) ||\n language.filenames?.some((name) => name.toLowerCase() === filename),\n );\n\n return firstLanguage?.parsers[0];\n};\n\nconst isPackageJsonOk = async ({\n data,\n filepath,\n}: {\n data: string;\n filepath: string;\n}): Promise<boolean> => {\n if (path.basename(filepath) !== 'package.json') {\n return true;\n }\n\n try {\n const packageJson = parsePackage(data);\n\n return !packageJson || (await formatPackage(packageJson)) === data;\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n return true;\n};\n\ninterface File {\n data: string;\n options: Options;\n filepath: string;\n}\n\ninterface Result {\n count: number;\n errored: Array<{ err?: unknown; filepath: string }>;\n touched: string[];\n unparsed: string[];\n}\n\nexport const formatOrLintFile = async (\n { data, filepath, options }: File,\n mode: 'format' | 'lint',\n result: Result | null,\n): Promise<string | undefined> => {\n if (mode === 'lint') {\n let ok: boolean;\n try {\n ok =\n (await check(data, options)) &&\n (await isPackageJsonOk({ data, filepath }));\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n if (!ok) {\n result?.errored.push({ filepath });\n }\n\n return;\n }\n\n let formatted: string;\n try {\n formatted = await format(data, options);\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n // Perform additional formatting (i.e. sorting) on a `package.json` manifest.\n try {\n if (path.basename(filepath) === 'package.json') {\n const packageJson = parsePackage(formatted);\n if (packageJson) {\n formatted = await formatPackage(packageJson);\n }\n }\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n if (formatted === data) {\n return;\n }\n\n result?.touched.push(filepath);\n return formatted;\n};\n\nexport interface PrettierOutput {\n ok: boolean;\n result: Result;\n}\n\n/**\n * Formats/lints files with Prettier.\n *\n * Prettier doesn't provide a higher-level Node.js API that replicates the\n * behaviour of its CLI, so we have to plumb together its lower-level functions.\n * On the other hand, this affords more flexibility in how we track and report\n * on progress and results.\n */\nexport const runPrettier = async (\n mode: 'format' | 'lint',\n logger: Logger,\n cwd = process.cwd(),\n): Promise<PrettierOutput> => {\n logger.debug('Initialising Prettier...');\n\n const start = process.hrtime.bigint();\n\n const manifest = await getConsumerManifest(cwd);\n\n const directory = manifest ? path.dirname(manifest.path) : cwd;\n\n logger.debug(\n manifest ? 'Detected project root:' : 'Detected working directory:',\n directory,\n );\n\n logger.debug('Discovering files...');\n\n // Match Prettier's opinion of respecting `.gitignore`.\n // This avoids exhibiting different behaviour than a Prettier IDE integration,\n // though it may present headaches if `.gitignore` and `.prettierignore` rules\n // conflict.\n const relativeFilepaths = await crawlDirectory(directory, [\n '.gitignore',\n '.prettierignore',\n ]);\n\n logger.debug(`Discovered ${pluralise(relativeFilepaths.length, 'file')}.`);\n\n const result: Result = {\n count: relativeFilepaths.length,\n errored: [],\n touched: [],\n unparsed: [],\n };\n\n logger.debug(mode === 'format' ? 'Formatting' : 'Linting', 'files...');\n\n for (const relativeFilepath of relativeFilepaths) {\n // Use relative paths to keep log output cleaner, particularly in the common\n // case where we are executing against the current working directory.\n const filepath = path.relative(\n process.cwd(),\n path.join(directory, relativeFilepath),\n );\n\n // Infer parser upfront so we can skip unsupported files.\n const parser = await inferParser(filepath);\n\n logger.debug(filepath);\n logger.debug(' parser:', parser ?? '-');\n\n if (!parser) {\n result.unparsed.push(filepath);\n continue;\n }\n\n const [config, data] = await Promise.all([\n resolveConfig(filepath),\n fs.promises.readFile(filepath, 'utf-8'),\n ]);\n\n const file: File = {\n data,\n filepath,\n options: { ...config, filepath },\n };\n\n const formatted = await formatOrLintFile(file, mode, result);\n\n if (typeof formatted === 'string') {\n await fs.promises.writeFile(filepath, formatted);\n }\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(\n result.count - result.unparsed.length,\n 'file',\n )} in ${logger.timing(start, end)}.`,\n );\n\n if (result.touched.length) {\n logger.plain(`Formatted ${pluralise(result.touched.length, 'file')}:`);\n for (const filepath of result.touched) {\n logger.warn(filepath);\n }\n }\n\n if (result.errored.length) {\n logger.plain(`Flagged ${pluralise(result.errored.length, 'file')}:`);\n for (const { err, filepath } of result.errored) {\n logger.warn(\n filepath,\n ...(typeof err === 'string' || err instanceof Error\n ? [String(err)]\n : []),\n );\n }\n }\n\n return { ok: result.errored.length === 0, result };\n};\n"],
|
|
5
|
-
"mappings": "AAAA
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["path", "fs"]
|
|
7
7
|
}
|
package/lib/cli/build/args.js
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 args_exports = {};
|
|
30
|
+
__export(args_exports, {
|
|
31
|
+
parseTscArgs: () => parseTscArgs
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(args_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_minimist = __toESM(require("minimist"));
|
|
3
36
|
const parseTscArgs = (args) => {
|
|
4
|
-
const argv =
|
|
37
|
+
const argv = (0, import_minimist.default)(args, {
|
|
5
38
|
alias: { b: "build", p: "project" },
|
|
6
39
|
boolean: "build",
|
|
7
40
|
string: "project"
|
|
@@ -10,7 +43,7 @@ const parseTscArgs = (args) => {
|
|
|
10
43
|
return {
|
|
11
44
|
basename,
|
|
12
45
|
dirname,
|
|
13
|
-
pathname:
|
|
46
|
+
pathname: import_path.default.join(dirname, basename),
|
|
14
47
|
build: Boolean(argv.build),
|
|
15
48
|
project: argv.project
|
|
16
49
|
};
|
|
@@ -24,8 +57,8 @@ const parseTscProject = (project) => {
|
|
|
24
57
|
}
|
|
25
58
|
if (project.toLocaleLowerCase().endsWith(".json")) {
|
|
26
59
|
return {
|
|
27
|
-
basename:
|
|
28
|
-
dirname:
|
|
60
|
+
basename: import_path.default.basename(project),
|
|
61
|
+
dirname: import_path.default.dirname(project)
|
|
29
62
|
};
|
|
30
63
|
}
|
|
31
64
|
return {
|
|
@@ -33,7 +66,8 @@ const parseTscProject = (project) => {
|
|
|
33
66
|
dirname: project
|
|
34
67
|
};
|
|
35
68
|
};
|
|
36
|
-
export
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
37
71
|
parseTscArgs
|
|
38
|
-
};
|
|
72
|
+
});
|
|
39
73
|
//# sourceMappingURL=args.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/args.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport minimist from 'minimist';\n\nexport const parseTscArgs = (args: string[]) => {\n const argv = minimist<{\n build: boolean | undefined;\n project: string | undefined;\n }>(args, {\n alias: { b: 'build', p: 'project' },\n boolean: 'build',\n string: 'project',\n });\n\n const { basename, dirname } = parseTscProject(argv.project);\n\n return {\n basename,\n dirname,\n pathname: path.join(dirname, basename),\n\n build: Boolean(argv.build),\n project: argv.project,\n };\n};\n\nconst parseTscProject = (project: string | undefined) => {\n if (!project) {\n return {\n basename: 'tsconfig.build.json',\n dirname: process.cwd(),\n };\n }\n\n if (project.toLocaleLowerCase().endsWith('.json')) {\n return {\n basename: path.basename(project),\n dirname: path.dirname(project),\n };\n }\n\n return {\n basename: 'tsconfig.json',\n dirname: project,\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAqB;AAEd,MAAM,eAAe,CAAC,SAAmB;AAC9C,QAAM,WAAO,gBAAAA,SAGV,MAAM;AAAA,IACP,OAAO,EAAE,GAAG,SAAS,GAAG,UAAU;AAAA,IAClC,SAAS;AAAA,IACT,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,EAAE,UAAU,QAAQ,IAAI,gBAAgB,KAAK,OAAO;AAE1D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU,YAAAC,QAAK,KAAK,SAAS,QAAQ;AAAA,IAErC,OAAO,QAAQ,KAAK,KAAK;AAAA,IACzB,SAAS,KAAK;AAAA,EAChB;AACF;AAEA,MAAM,kBAAkB,CAAC,YAAgC;AACvD,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,MACL,UAAU;AAAA,MACV,SAAS,QAAQ,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,MAAI,QAAQ,kBAAkB,EAAE,SAAS,OAAO,GAAG;AACjD,WAAO;AAAA,MACL,UAAU,YAAAA,QAAK,SAAS,OAAO;AAAA,MAC/B,SAAS,YAAAA,QAAK,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS;AAAA,EACX;AACF;",
|
|
6
|
+
"names": ["minimist", "path"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import { styleText } from 'node:util';
|
|
2
1
|
import { type Logger } from '../../utils/logging.js';
|
|
3
|
-
type StyleColor = Parameters<typeof styleText>[0];
|
|
4
2
|
export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
|
|
5
|
-
interface CopyAssetsConfig {
|
|
6
|
-
outDir: string;
|
|
7
|
-
name: string;
|
|
8
|
-
prefixColor: StyleColor;
|
|
9
|
-
}
|
|
10
|
-
export declare const copyAssetsConcurrently: (configs: CopyAssetsConfig[]) => Promise<void>;
|
|
11
|
-
export {};
|
package/lib/cli/build/assets.js
CHANGED
|
@@ -1,31 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 assets_exports = {};
|
|
30
|
+
__export(assets_exports, {
|
|
31
|
+
copyAssets: () => copyAssets
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(assets_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
|
+
var import_copy = require("../../utils/copy.js");
|
|
37
|
+
var import_dir = require("../../utils/dir.js");
|
|
38
|
+
var import_logging = require("../../utils/logging.js");
|
|
39
|
+
var import_manifest = require("../../utils/manifest.js");
|
|
40
|
+
const copyAssets = async (destinationDir, logger = import_logging.log) => {
|
|
41
|
+
const manifest = await (0, import_manifest.getManifestProperties)("assets");
|
|
13
42
|
if (!manifest?.value) {
|
|
14
43
|
return;
|
|
15
44
|
}
|
|
16
|
-
const entryPoint = await getEntryPointFromManifest();
|
|
45
|
+
const entryPoint = await (0, import_manifest.getEntryPointFromManifest)();
|
|
17
46
|
if (!entryPoint) {
|
|
18
47
|
return;
|
|
19
48
|
}
|
|
20
|
-
const pathSegments = entryPoint.split(
|
|
49
|
+
const pathSegments = entryPoint.split(import_path.default.sep);
|
|
21
50
|
const srcDir = pathSegments.length > 1 && pathSegments[0] || "";
|
|
22
|
-
const resolvedSrcDir =
|
|
23
|
-
const resolvedDestinationDir =
|
|
24
|
-
|
|
51
|
+
const resolvedSrcDir = import_path.default.resolve(import_path.default.dirname(manifest.path), srcDir);
|
|
52
|
+
const resolvedDestinationDir = import_path.default.resolve(
|
|
53
|
+
import_path.default.dirname(manifest.path),
|
|
25
54
|
destinationDir
|
|
26
55
|
);
|
|
27
|
-
const allFiles = await crawlDirectory(resolvedSrcDir);
|
|
28
|
-
const filesByPattern = buildPatternToFilepathMap(manifest.value, allFiles, {
|
|
56
|
+
const allFiles = await (0, import_dir.crawlDirectory)(resolvedSrcDir);
|
|
57
|
+
const filesByPattern = (0, import_dir.buildPatternToFilepathMap)(manifest.value, allFiles, {
|
|
29
58
|
cwd: resolvedSrcDir,
|
|
30
59
|
dot: true
|
|
31
60
|
});
|
|
@@ -35,37 +64,20 @@ const copyAssets = async (destinationDir, logger = log) => {
|
|
|
35
64
|
await Promise.all(
|
|
36
65
|
matchedFiles.map(async (filename) => {
|
|
37
66
|
logger.subtle(`Copying ${filename}`);
|
|
38
|
-
await
|
|
39
|
-
|
|
67
|
+
await import_fs_extra.default.promises.mkdir(
|
|
68
|
+
import_path.default.dirname(import_path.default.join(resolvedDestinationDir, filename)),
|
|
40
69
|
{ recursive: true }
|
|
41
70
|
);
|
|
42
|
-
await copyFile(
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
await (0, import_copy.copyFile)(
|
|
72
|
+
import_path.default.join(resolvedSrcDir, filename),
|
|
73
|
+
import_path.default.join(resolvedDestinationDir, filename),
|
|
45
74
|
{ processors: [] }
|
|
46
75
|
);
|
|
47
76
|
})
|
|
48
77
|
);
|
|
49
78
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
await Promise.all(
|
|
56
|
-
configs.map(
|
|
57
|
-
async ({ outDir, name, prefixColor }) => copyAssets(
|
|
58
|
-
outDir,
|
|
59
|
-
createLogger({
|
|
60
|
-
debug: false,
|
|
61
|
-
prefixes: [styleText(prefixColor, `${name.padEnd(maxNameLength)} \u2502`)]
|
|
62
|
-
})
|
|
63
|
-
)
|
|
64
|
-
)
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
export {
|
|
68
|
-
copyAssets,
|
|
69
|
-
copyAssetsConcurrently
|
|
70
|
-
};
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
copyAssets
|
|
82
|
+
});
|
|
71
83
|
//# sourceMappingURL=assets.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/assets.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy.js';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, log } from '../../utils/logging.js';\nimport {\n getEntryPointFromManifest,\n getManifestProperties,\n} from '../../utils/manifest.js';\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getManifestProperties<string, string[]>('assets');\n\n if (!manifest?.value) {\n return;\n }\n\n const entryPoint = await getEntryPointFromManifest();\n if (!entryPoint) {\n return;\n }\n\n const pathSegments = entryPoint.split(path.sep);\n const srcDir = (pathSegments.length > 1 && pathSegments[0]) || '';\n const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);\n const resolvedDestinationDir = path.resolve(\n path.dirname(manifest.path),\n destinationDir,\n );\n\n const allFiles = await crawlDirectory(resolvedSrcDir);\n const filesByPattern = buildPatternToFilepathMap(manifest.value, allFiles, {\n cwd: resolvedSrcDir,\n dot: true,\n });\n const matchedFiles = Array.from(\n new Set(Object.values(filesByPattern).flat()),\n );\n\n await Promise.all(\n matchedFiles.map(async (filename) => {\n logger.subtle(`Copying ${filename}`);\n\n await fs.promises.mkdir(\n path.dirname(path.join(resolvedDestinationDir, filename)),\n { recursive: true },\n );\n await copyFile(\n path.join(resolvedSrcDir, filename),\n path.join(resolvedDestinationDir, filename),\n { processors: [] },\n );\n }),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAEf,kBAAyB;AACzB,iBAA0D;AAC1D,qBAAiC;AACjC,sBAGO;AAEA,MAAM,aAAa,OACxB,gBACA,SAAiB,uBACd;AACH,QAAM,WAAW,UAAM,uCAAwC,QAAQ;AAEvE,MAAI,CAAC,UAAU,OAAO;AACpB;AAAA,EACF;AAEA,QAAM,aAAa,UAAM,2CAA0B;AACnD,MAAI,CAAC,YAAY;AACf;AAAA,EACF;AAEA,QAAM,eAAe,WAAW,MAAM,YAAAA,QAAK,GAAG;AAC9C,QAAM,SAAU,aAAa,SAAS,KAAK,aAAa,CAAC,KAAM;AAC/D,QAAM,iBAAiB,YAAAA,QAAK,QAAQ,YAAAA,QAAK,QAAQ,SAAS,IAAI,GAAG,MAAM;AACvE,QAAM,yBAAyB,YAAAA,QAAK;AAAA,IAClC,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,WAAW,UAAM,2BAAe,cAAc;AACpD,QAAM,qBAAiB,sCAA0B,SAAS,OAAO,UAAU;AAAA,IACzE,KAAK;AAAA,IACL,KAAK;AAAA,EACP,CAAC;AACD,QAAM,eAAe,MAAM;AAAA,IACzB,IAAI,IAAI,OAAO,OAAO,cAAc,EAAE,KAAK,CAAC;AAAA,EAC9C;AAEA,QAAM,QAAQ;AAAA,IACZ,aAAa,IAAI,OAAO,aAAa;AACnC,aAAO,OAAO,WAAW,QAAQ,EAAE;AAEnC,YAAM,gBAAAC,QAAG,SAAS;AAAA,QAChB,YAAAD,QAAK,QAAQ,YAAAA,QAAK,KAAK,wBAAwB,QAAQ,CAAC;AAAA,QACxD,EAAE,WAAW,KAAK;AAAA,MACpB;AACA,gBAAM;AAAA,QACJ,YAAAA,QAAK,KAAK,gBAAgB,QAAQ;AAAA,QAClC,YAAAA,QAAK,KAAK,wBAAwB,QAAQ;AAAA,QAC1C,EAAE,YAAY,CAAC,EAAE;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": ["path", "fs"]
|
|
7
7
|
}
|
package/lib/cli/build/esbuild.js
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 esbuild_exports = {};
|
|
20
|
+
__export(esbuild_exports, {
|
|
21
|
+
esbuild: () => esbuild
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(esbuild_exports);
|
|
24
|
+
var import_util = require("util");
|
|
25
|
+
var import_tsconfig_paths = require("@esbuild-plugins/tsconfig-paths");
|
|
26
|
+
var import_esbuild = require("esbuild");
|
|
27
|
+
var import_typescript = require("typescript");
|
|
28
|
+
var import_logging = require("../../utils/logging.js");
|
|
29
|
+
var import_args = require("./args.js");
|
|
30
|
+
var import_tsc = require("./tsc.js");
|
|
8
31
|
const esbuild = async ({ debug, type }, args = process.argv.slice(2)) => {
|
|
9
|
-
const log = createLogger({ debug });
|
|
10
|
-
const tscArgs = parseTscArgs(args);
|
|
11
|
-
const customConditions = getCustomConditions();
|
|
32
|
+
const log = (0, import_logging.createLogger)({ debug });
|
|
33
|
+
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
34
|
+
const customConditions = (0, import_tsc.getCustomConditions)();
|
|
12
35
|
if (tscArgs.build) {
|
|
13
36
|
log.err(
|
|
14
37
|
"skuba does not currently support the tsc --build flag with esbuild"
|
|
@@ -16,7 +39,7 @@ const esbuild = async ({ debug, type }, args = process.argv.slice(2)) => {
|
|
|
16
39
|
process.exitCode = 1;
|
|
17
40
|
return;
|
|
18
41
|
}
|
|
19
|
-
const parsedCommandLine = readTsBuildConfig(args, log);
|
|
42
|
+
const parsedCommandLine = (0, import_tsc.readTsBuildConfig)(args, log);
|
|
20
43
|
if (!parsedCommandLine || process.exitCode) {
|
|
21
44
|
return;
|
|
22
45
|
}
|
|
@@ -24,22 +47,22 @@ const esbuild = async ({ debug, type }, args = process.argv.slice(2)) => {
|
|
|
24
47
|
log.debug(log.bold("Files"));
|
|
25
48
|
entryPoints.forEach((filepath) => log.debug(filepath));
|
|
26
49
|
log.debug(log.bold("Compiler options"));
|
|
27
|
-
log.debug(inspect(compilerOptions));
|
|
50
|
+
log.debug((0, import_util.inspect)(compilerOptions));
|
|
28
51
|
const start = process.hrtime.bigint();
|
|
29
52
|
const bundle = false;
|
|
30
|
-
const isEsm = compilerOptions.module !== ModuleKind.CommonJS && type === "module";
|
|
31
|
-
await build({
|
|
53
|
+
const isEsm = compilerOptions.module !== import_typescript.ModuleKind.CommonJS && type === "module";
|
|
54
|
+
await (0, import_esbuild.build)({
|
|
32
55
|
bundle,
|
|
33
56
|
entryPoints,
|
|
34
|
-
format: isEsm ? "
|
|
57
|
+
format: !isEsm ? "cjs" : void 0,
|
|
35
58
|
outdir: compilerOptions.outDir,
|
|
36
59
|
logLevel: debug ? "debug" : "info",
|
|
37
60
|
logLimit: 0,
|
|
38
|
-
platform: compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs || compilerOptions.moduleResolution === ModuleResolutionKind.Node16 ? "node" : void 0,
|
|
61
|
+
platform: compilerOptions.moduleResolution === import_typescript.ModuleResolutionKind.NodeJs || compilerOptions.moduleResolution === import_typescript.ModuleResolutionKind.Node16 ? "node" : void 0,
|
|
39
62
|
plugins: bundle ? [] : [
|
|
40
63
|
// evanw/esbuild#394
|
|
41
64
|
// eslint-disable-next-line new-cap
|
|
42
|
-
TsconfigPathsPlugin({
|
|
65
|
+
(0, import_tsconfig_paths.TsconfigPathsPlugin)({
|
|
43
66
|
tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions }
|
|
44
67
|
})
|
|
45
68
|
],
|
|
@@ -48,21 +71,22 @@ const esbuild = async ({ debug, type }, args = process.argv.slice(2)) => {
|
|
|
48
71
|
// avoid ambiguity where multiple `tsconfig.json`s are involved in a build.
|
|
49
72
|
// This would be unusual for a typical SEEK project but we can still explore
|
|
50
73
|
// an explicit setting once we implement `skuba.config.ts` (#1167).
|
|
51
|
-
target: compilerOptions.target ? ScriptTarget[compilerOptions.target].toLocaleLowerCase() : void 0,
|
|
74
|
+
target: compilerOptions.target ? import_typescript.ScriptTarget[compilerOptions.target].toLocaleLowerCase() : void 0,
|
|
52
75
|
tsconfig: tscArgs.pathname,
|
|
53
76
|
conditions: customConditions?.length ? customConditions : void 0
|
|
54
77
|
});
|
|
55
78
|
const end = process.hrtime.bigint();
|
|
56
79
|
log.plain(`Built in ${log.timing(start, end)}.`);
|
|
57
80
|
if (compilerOptions.declaration) {
|
|
58
|
-
await tsc([
|
|
81
|
+
await (0, import_tsc.tsc)([
|
|
59
82
|
"--declaration",
|
|
60
83
|
"--emitDeclarationOnly",
|
|
61
84
|
...tscArgs.project ? ["--project", tscArgs.project] : []
|
|
62
85
|
]);
|
|
63
86
|
}
|
|
64
87
|
};
|
|
65
|
-
export
|
|
88
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
+
0 && (module.exports = {
|
|
66
90
|
esbuild
|
|
67
|
-
};
|
|
91
|
+
});
|
|
68
92
|
//# sourceMappingURL=esbuild.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/esbuild.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport { TsconfigPathsPlugin } from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\nimport { getCustomConditions, readTsBuildConfig, tsc } from './tsc.js';\n\ninterface EsbuildParameters {\n debug: boolean;\n type: string | undefined;\n}\n\nexport const esbuild = async (\n { debug, type }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n const customConditions = getCustomConditions();\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n const isEsm =\n compilerOptions.module !== ModuleKind.CommonJS && type === 'module';\n\n await build({\n bundle,\n entryPoints,\n format: isEsm ? '
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport { TsconfigPathsPlugin } from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\nimport { getCustomConditions, readTsBuildConfig, tsc } from './tsc.js';\n\ninterface EsbuildParameters {\n debug: boolean;\n type: string | undefined;\n}\n\nexport const esbuild = async (\n { debug, type }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n const customConditions = getCustomConditions();\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n const isEsm =\n compilerOptions.module !== ModuleKind.CommonJS && type === 'module';\n\n await build({\n bundle,\n entryPoints,\n format: !isEsm ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs ||\n compilerOptions.moduleResolution === ModuleResolutionKind.Node16\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n // eslint-disable-next-line new-cap\n TsconfigPathsPlugin({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n conditions: customConditions?.length ? customConditions : undefined,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAAoC;AACpC,qBAAsB;AACtB,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAA4D;AAOrD,MAAM,UAAU,OACrB,EAAE,OAAO,KAAK,GACd,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,EAAE,MAAM,CAAC;AAElC,QAAM,cAAU,0BAAa,IAAI;AAEjC,QAAM,uBAAmB,gCAAoB;AAE7C,MAAI,QAAQ,OAAO;AACjB,QAAI;AAAA,MACF;AAAA,IACF;AACA,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,wBAAoB,8BAAkB,MAAM,GAAG;AAErD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,WAAW,aAAa,SAAS,gBAAgB,IACvD;AAEF,MAAI,MAAM,IAAI,KAAK,OAAO,CAAC;AAC3B,cAAY,QAAQ,CAAC,aAAa,IAAI,MAAM,QAAQ,CAAC;AAErD,MAAI,MAAM,IAAI,KAAK,kBAAkB,CAAC;AACtC,MAAI,UAAM,qBAAQ,eAAe,CAAC;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAGpC,QAAM,SAAS;AAEf,QAAM,QACJ,gBAAgB,WAAW,6BAAW,YAAY,SAAS;AAE7D,YAAM,sBAAM;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ,CAAC,QAAQ,QAAQ;AAAA,IACzB,QAAQ,gBAAgB;AAAA,IACxB,UAAU,QAAQ,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UACE,gBAAgB,qBAAqB,uCAAqB,UAC1D,gBAAgB,qBAAqB,uCAAqB,SACtD,SACA;AAAA,IACN,SAAS,SACL,CAAC,IACD;AAAA;AAAA;AAAA,UAGE,2CAAoB;AAAA,QAClB,UAAU,EAAE,SAAS,gBAAgB,SAAS,gBAAgB;AAAA,MAChE,CAAC;AAAA,IACH;AAAA,IACJ,WAAW,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,IAK3B,QAAQ,gBAAgB,SACpB,+BAAa,gBAAgB,MAAM,EAAE,kBAAkB,IACvD;AAAA,IACJ,UAAU,QAAQ;AAAA,IAClB,YAAY,kBAAkB,SAAS,mBAAmB;AAAA,EAC5D,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,MAAI,MAAM,YAAY,IAAI,OAAO,OAAO,GAAG,CAAC,GAAG;AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/build/index.js
CHANGED
|
@@ -1,34 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 build_exports = {};
|
|
20
|
+
__export(build_exports, {
|
|
21
|
+
build: () => build
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(build_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_manifest = require("../../utils/manifest.js");
|
|
28
|
+
var import_assets = require("./assets.js");
|
|
29
|
+
var import_esbuild = require("./esbuild.js");
|
|
30
|
+
var import_tsc = require("./tsc.js");
|
|
8
31
|
const build = async (args = process.argv.slice(2)) => {
|
|
9
|
-
const manifest = await getManifestProperties("build");
|
|
32
|
+
const manifest = await (0, import_manifest.getManifestProperties)("build");
|
|
10
33
|
switch (manifest?.value) {
|
|
11
34
|
case "esbuild": {
|
|
12
|
-
const debug = hasDebugFlag(args);
|
|
13
|
-
log.plain(styleText("yellow", "esbuild"));
|
|
14
|
-
await esbuild({ debug, type: manifest.type }, args);
|
|
35
|
+
const debug = (0, import_args.hasDebugFlag)(args);
|
|
36
|
+
import_logging.log.plain((0, import_node_util.styleText)("yellow", "esbuild"));
|
|
37
|
+
await (0, import_esbuild.esbuild)({ debug, type: manifest.type }, args);
|
|
15
38
|
break;
|
|
16
39
|
}
|
|
17
40
|
// TODO: flip the default case over to `esbuild` in skuba vNext.
|
|
18
41
|
case void 0:
|
|
19
42
|
case "tsc": {
|
|
20
|
-
log.plain(styleText("blue", "tsc"));
|
|
21
|
-
await tsc(args);
|
|
43
|
+
import_logging.log.plain((0, import_node_util.styleText)("blue", "tsc"));
|
|
44
|
+
await (0, import_tsc.tsc)(args);
|
|
22
45
|
break;
|
|
23
46
|
}
|
|
24
47
|
default: {
|
|
25
|
-
log.err(
|
|
48
|
+
import_logging.log.err(
|
|
26
49
|
"We don\u2019t support the build tool specified in your",
|
|
27
|
-
log.bold("package.json"),
|
|
50
|
+
import_logging.log.bold("package.json"),
|
|
28
51
|
"yet:"
|
|
29
52
|
);
|
|
30
|
-
log.err(
|
|
31
|
-
log.subtle(
|
|
53
|
+
import_logging.log.err(
|
|
54
|
+
import_logging.log.subtle(
|
|
32
55
|
JSON.stringify({ skuba: { build: manifest?.value } }, null, 2)
|
|
33
56
|
)
|
|
34
57
|
);
|
|
@@ -36,7 +59,7 @@ const build = async (args = process.argv.slice(2)) => {
|
|
|
36
59
|
return;
|
|
37
60
|
}
|
|
38
61
|
}
|
|
39
|
-
const parsedCommandLine = readTsBuildConfig(args, log);
|
|
62
|
+
const parsedCommandLine = (0, import_tsc.readTsBuildConfig)(args, import_logging.log);
|
|
40
63
|
if (!parsedCommandLine || process.exitCode) {
|
|
41
64
|
return;
|
|
42
65
|
}
|
|
@@ -44,9 +67,10 @@ const build = async (args = process.argv.slice(2)) => {
|
|
|
44
67
|
if (!compilerOptions.outDir) {
|
|
45
68
|
return;
|
|
46
69
|
}
|
|
47
|
-
await copyAssets(compilerOptions.outDir);
|
|
70
|
+
await (0, import_assets.copyAssets)(compilerOptions.outDir);
|
|
48
71
|
};
|
|
49
|
-
export
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
50
74
|
build
|
|
51
|
-
};
|
|
75
|
+
});
|
|
52
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { styleText } from 'node:util';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { getManifestProperties } from '../../utils/manifest.js';\n\nimport { copyAssets } from './assets.js';\nimport { esbuild } from './esbuild.js';\nimport { readTsBuildConfig, tsc } from './tsc.js';\n\nexport const build = async (args = process.argv.slice(2)) => {\n // TODO: define a unified `package.json#/skuba` schema and parser so we don't\n // need all these messy lookups.\n const manifest = await getManifestProperties('build');\n\n switch (manifest?.value) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(styleText('yellow', 'esbuild'));\n await esbuild({ debug, type: manifest.type }, args);\n break;\n }\n\n // TODO: flip the default case over to `esbuild` in skuba vNext.\n case undefined:\n case 'tsc': {\n log.plain(styleText('blue', 'tsc'));\n await tsc(args);\n break;\n }\n\n default: {\n log.err(\n 'We don\u2019t support the build tool specified in your',\n log.bold('package.json'),\n 'yet:',\n );\n log.err(\n log.subtle(\n JSON.stringify({ skuba: { build: manifest?.value } }, null, 2),\n ),\n );\n process.exitCode = 1;\n return;\n }\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { options: compilerOptions } = parsedCommandLine;\n\n if (!compilerOptions.outDir) {\n return;\n }\n\n await copyAssets(compilerOptions.outDir);\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAE1B,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAsC;AAEtC,oBAA2B;AAC3B,qBAAwB;AACxB,iBAAuC;AAEhC,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAG3D,QAAM,WAAW,UAAM,uCAAsB,OAAO;AAEpD,UAAQ,UAAU,OAAO;AAAA,IACvB,KAAK,WAAW;AACd,YAAM,YAAQ,0BAAa,IAAI;AAE/B,yBAAI,UAAM,4BAAU,UAAU,SAAS,CAAC;AACxC,gBAAM,wBAAQ,EAAE,OAAO,MAAM,SAAS,KAAK,GAAG,IAAI;AAClD;AAAA,IACF;AAAA;AAAA,IAGA,KAAK;AAAA,IACL,KAAK,OAAO;AACV,yBAAI,UAAM,4BAAU,QAAQ,KAAK,CAAC;AAClC,gBAAM,gBAAI,IAAI;AACd;AAAA,IACF;AAAA,IAEA,SAAS;AACP,yBAAI;AAAA,QACF;AAAA,QACA,mBAAI,KAAK,cAAc;AAAA,QACvB;AAAA,MACF;AACA,yBAAI;AAAA,QACF,mBAAI;AAAA,UACF,KAAK,UAAU,EAAE,OAAO,EAAE,OAAO,UAAU,MAAM,EAAE,GAAG,MAAM,CAAC;AAAA,QAC/D;AAAA,MACF;AACA,cAAQ,WAAW;AACnB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,wBAAoB,8BAAkB,MAAM,kBAAG;AAErD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,gBAAgB,IAAI;AAErC,MAAI,CAAC,gBAAgB,QAAQ;AAC3B;AAAA,EACF;AAEA,YAAM,0BAAW,gBAAgB,MAAM;AACzC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|