skuba 0.0.0-master-20231002013336 → 0.0.0-master-20240206001217

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.
Files changed (221) hide show
  1. package/README.md +3 -3
  2. package/jest/transform.test.ts +3 -1
  3. package/lib/api/jest/index.d.ts +3 -3
  4. package/lib/api/jest/index.js +19 -1
  5. package/lib/api/jest/index.js.map +2 -2
  6. package/lib/api/net/compose.js +2 -1
  7. package/lib/api/net/compose.js.map +2 -2
  8. package/lib/cli/adapter/prettier.d.ts +1 -1
  9. package/lib/cli/adapter/prettier.js +11 -10
  10. package/lib/cli/adapter/prettier.js.map +2 -2
  11. package/lib/cli/build/index.js +0 -2
  12. package/lib/cli/build/index.js.map +2 -2
  13. package/lib/cli/buildPackage.js +0 -2
  14. package/lib/cli/buildPackage.js.map +2 -2
  15. package/lib/cli/configure/analyseConfiguration.d.ts +2 -0
  16. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  17. package/lib/cli/configure/getEntryPoint.js +1 -1
  18. package/lib/cli/configure/getEntryPoint.js.map +2 -2
  19. package/lib/cli/configure/getProjectType.d.ts +1 -1
  20. package/lib/cli/configure/getProjectType.js +6 -3
  21. package/lib/cli/configure/getProjectType.js.map +2 -2
  22. package/lib/cli/configure/index.js +11 -12
  23. package/lib/cli/configure/index.js.map +2 -2
  24. package/lib/cli/configure/modules/index.js +0 -2
  25. package/lib/cli/configure/modules/index.js.map +2 -2
  26. package/lib/cli/configure/modules/package.d.ts +1 -1
  27. package/lib/cli/configure/modules/package.js +2 -1
  28. package/lib/cli/configure/modules/package.js.map +2 -2
  29. package/lib/cli/configure/patchRenovateConfig.d.ts +2 -1
  30. package/lib/cli/configure/patchRenovateConfig.js +36 -21
  31. package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
  32. package/lib/cli/configure/types.d.ts +2 -0
  33. package/lib/cli/configure/types.js.map +1 -1
  34. package/lib/cli/configure/upgrade/index.d.ts +15 -0
  35. package/lib/cli/configure/upgrade/index.js +130 -0
  36. package/lib/cli/configure/upgrade/index.js.map +7 -0
  37. package/lib/cli/configure/{addEmptyExports.d.ts → upgrade/patches/7.3.1/addEmptyExports.d.ts} +2 -2
  38. package/lib/cli/configure/{addEmptyExports.js → upgrade/patches/7.3.1/addEmptyExports.js} +15 -11
  39. package/lib/cli/configure/upgrade/patches/7.3.1/addEmptyExports.js.map +7 -0
  40. package/lib/cli/configure/upgrade/patches/7.3.1/index.d.ts +2 -0
  41. package/lib/cli/configure/upgrade/patches/7.3.1/index.js +55 -0
  42. package/lib/cli/configure/upgrade/patches/7.3.1/index.js.map +7 -0
  43. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.d.ts +2 -0
  44. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js +94 -0
  45. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js.map +7 -0
  46. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.d.ts +2 -0
  47. package/lib/cli/configure/{patchDockerfile.js → upgrade/patches/7.3.1/patchDockerfile.js} +18 -12
  48. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.js.map +7 -0
  49. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.d.ts +2 -0
  50. package/lib/cli/configure/{patchServerListener.js → upgrade/patches/7.3.1/patchServerListener.js} +18 -14
  51. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.js.map +7 -0
  52. package/lib/cli/format.js +7 -14
  53. package/lib/cli/format.js.map +2 -2
  54. package/lib/cli/init/getConfig.d.ts +7 -5
  55. package/lib/cli/init/getConfig.js +61 -34
  56. package/lib/cli/init/getConfig.js.map +2 -2
  57. package/lib/cli/init/git.d.ts +2 -1
  58. package/lib/cli/init/git.js +2 -9
  59. package/lib/cli/init/git.js.map +2 -2
  60. package/lib/cli/init/index.d.ts +1 -1
  61. package/lib/cli/init/index.js +19 -10
  62. package/lib/cli/init/index.js.map +2 -2
  63. package/lib/cli/init/prompts.d.ts +26 -3
  64. package/lib/cli/init/prompts.js +10 -2
  65. package/lib/cli/init/prompts.js.map +2 -2
  66. package/lib/cli/init/types.d.ts +120 -27
  67. package/lib/cli/init/types.js +30 -35
  68. package/lib/cli/init/types.js.map +2 -2
  69. package/lib/cli/init/writePackageJson.d.ts +6 -0
  70. package/lib/cli/init/writePackageJson.js.map +2 -2
  71. package/lib/cli/lint/annotate/buildkite/index.d.ts +2 -1
  72. package/lib/cli/lint/annotate/buildkite/index.js +5 -3
  73. package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
  74. package/lib/cli/lint/annotate/buildkite/internal.d.ts +2 -0
  75. package/lib/cli/lint/annotate/buildkite/internal.js +45 -0
  76. package/lib/cli/lint/annotate/buildkite/internal.js.map +7 -0
  77. package/lib/cli/lint/annotate/github/index.d.ts +2 -1
  78. package/lib/cli/lint/annotate/github/index.js +4 -2
  79. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  80. package/lib/cli/lint/annotate/github/internal.d.ts +3 -0
  81. package/lib/cli/lint/annotate/github/internal.js +36 -0
  82. package/lib/cli/lint/annotate/github/internal.js.map +7 -0
  83. package/lib/cli/lint/annotate/index.d.ts +4 -3
  84. package/lib/cli/lint/annotate/index.js +9 -3
  85. package/lib/cli/lint/annotate/index.js.map +2 -2
  86. package/lib/cli/lint/autofix.d.ts +3 -1
  87. package/lib/cli/lint/autofix.js +36 -59
  88. package/lib/cli/lint/autofix.js.map +3 -3
  89. package/lib/cli/lint/external.d.ts +6 -1
  90. package/lib/cli/lint/external.js +6 -29
  91. package/lib/cli/lint/external.js.map +2 -2
  92. package/lib/cli/lint/index.d.ts +2 -1
  93. package/lib/cli/lint/index.js +46 -14
  94. package/lib/cli/lint/index.js.map +2 -2
  95. package/lib/cli/lint/internal.d.ts +12 -1
  96. package/lib/cli/lint/internal.js +55 -19
  97. package/lib/cli/lint/internal.js.map +3 -3
  98. package/lib/cli/lint/internalLints/deleteFiles.d.ts +3 -0
  99. package/lib/cli/lint/internalLints/deleteFiles.js +102 -0
  100. package/lib/cli/lint/internalLints/deleteFiles.js.map +7 -0
  101. package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +3 -0
  102. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +75 -0
  103. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +7 -0
  104. package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +11 -0
  105. package/lib/cli/lint/internalLints/refreshConfigFiles.js +147 -0
  106. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +7 -0
  107. package/lib/cli/test/index.js +0 -2
  108. package/lib/cli/test/index.js.map +2 -2
  109. package/lib/skuba.d.ts +1 -1
  110. package/lib/skuba.js.map +1 -1
  111. package/lib/utils/error.d.ts +30 -10
  112. package/lib/utils/error.js +10 -20
  113. package/lib/utils/error.js.map +2 -2
  114. package/lib/utils/exec.d.ts +2 -1
  115. package/lib/utils/exec.js +3 -2
  116. package/lib/utils/exec.js.map +2 -2
  117. package/lib/utils/logging.d.ts +2 -0
  118. package/lib/utils/logging.js +1 -0
  119. package/lib/utils/logging.js.map +2 -2
  120. package/lib/utils/logo.js +6 -10
  121. package/lib/utils/logo.js.map +3 -3
  122. package/lib/utils/manifest.d.ts +4 -4
  123. package/lib/utils/manifest.js +10 -10
  124. package/lib/utils/manifest.js.map +2 -2
  125. package/lib/utils/npmrc.d.ts +1 -0
  126. package/lib/utils/npmrc.js +29 -0
  127. package/lib/utils/npmrc.js.map +7 -0
  128. package/lib/utils/packageManager.d.ts +24 -0
  129. package/lib/utils/packageManager.js +97 -0
  130. package/lib/utils/packageManager.js.map +7 -0
  131. package/lib/utils/template.d.ts +46 -13
  132. package/lib/utils/template.js +17 -15
  133. package/lib/utils/template.js.map +2 -2
  134. package/lib/utils/worker.d.ts +1 -0
  135. package/lib/wrapper/http.d.ts +1 -0
  136. package/package.json +50 -47
  137. package/template/base/_.dockerignore +0 -1
  138. package/template/base/_.eslintignore +1 -0
  139. package/template/base/_.gitignore +1 -1
  140. package/template/base/_.npmrc +8 -0
  141. package/template/express-rest-api/.buildkite/pipeline.yml +16 -12
  142. package/template/express-rest-api/.gantry/dev.yml +3 -0
  143. package/template/express-rest-api/.nvmrc +1 -1
  144. package/template/express-rest-api/Dockerfile +6 -12
  145. package/template/express-rest-api/Dockerfile.dev-deps +8 -7
  146. package/template/express-rest-api/README.md +12 -12
  147. package/template/express-rest-api/docker-compose.yml +0 -10
  148. package/template/express-rest-api/gantry.apply.yml +5 -0
  149. package/template/express-rest-api/gantry.build.yml +1 -2
  150. package/template/express-rest-api/package.json +4 -4
  151. package/template/express-rest-api/skuba.template.js +1 -0
  152. package/template/greeter/.buildkite/pipeline.yml +15 -11
  153. package/template/greeter/.nvmrc +1 -1
  154. package/template/greeter/Dockerfile +8 -7
  155. package/template/greeter/README.md +9 -9
  156. package/template/greeter/docker-compose.yml +0 -10
  157. package/template/greeter/package.json +3 -3
  158. package/template/greeter/skuba.template.js +1 -0
  159. package/template/koa-rest-api/.buildkite/pipeline.yml +16 -12
  160. package/template/koa-rest-api/.gantry/dev.yml +3 -0
  161. package/template/koa-rest-api/.nvmrc +1 -1
  162. package/template/koa-rest-api/Dockerfile +6 -12
  163. package/template/koa-rest-api/Dockerfile.dev-deps +8 -7
  164. package/template/koa-rest-api/README.md +12 -12
  165. package/template/koa-rest-api/docker-compose.yml +0 -10
  166. package/template/koa-rest-api/gantry.apply.yml +5 -0
  167. package/template/koa-rest-api/gantry.build.yml +1 -2
  168. package/template/koa-rest-api/package.json +10 -8
  169. package/template/koa-rest-api/skuba.template.js +1 -0
  170. package/template/koa-rest-api/src/app.test.ts +8 -4
  171. package/template/koa-rest-api/src/framework/validation.test.ts +48 -15
  172. package/template/koa-rest-api/src/framework/validation.ts +31 -8
  173. package/template/koa-rest-api/src/testing/types.ts +16 -4
  174. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +25 -18
  175. package/template/lambda-sqs-worker/.nvmrc +1 -1
  176. package/template/lambda-sqs-worker/Dockerfile +8 -8
  177. package/template/lambda-sqs-worker/README.md +14 -14
  178. package/template/lambda-sqs-worker/_.npmrc +12 -0
  179. package/template/lambda-sqs-worker/docker-compose.yml +0 -15
  180. package/template/lambda-sqs-worker/package.json +6 -7
  181. package/template/lambda-sqs-worker/serverless.yml +5 -2
  182. package/template/lambda-sqs-worker/skuba.template.js +1 -0
  183. package/template/lambda-sqs-worker/src/framework/validation.test.ts +1 -1
  184. package/template/lambda-sqs-worker/src/hooks.ts +1 -2
  185. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +46 -21
  186. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  187. package/template/lambda-sqs-worker-cdk/Dockerfile +11 -9
  188. package/template/lambda-sqs-worker-cdk/cdk.json +12 -6
  189. package/template/lambda-sqs-worker-cdk/docker-compose.yml +0 -15
  190. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +1590 -228
  191. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +23 -3
  192. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +128 -15
  193. package/template/lambda-sqs-worker-cdk/package.json +9 -7
  194. package/template/lambda-sqs-worker-cdk/shared/context-types.ts +1 -0
  195. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -0
  196. package/template/lambda-sqs-worker-cdk/src/app.ts +14 -1
  197. package/template/lambda-sqs-worker-cdk/src/postHook.ts +154 -0
  198. package/template/lambda-sqs-worker-cdk/src/preHook.ts +95 -0
  199. package/template/oss-npm-package/.github/workflows/release.yml +10 -7
  200. package/template/oss-npm-package/.github/workflows/validate.yml +10 -7
  201. package/template/oss-npm-package/.nvmrc +1 -1
  202. package/template/oss-npm-package/.releaserc +16 -0
  203. package/template/oss-npm-package/README.md +18 -18
  204. package/template/oss-npm-package/_package.json +3 -2
  205. package/template/oss-npm-package/skuba.template.js +1 -0
  206. package/template/private-npm-package/.nvmrc +1 -1
  207. package/template/private-npm-package/.releaserc +16 -0
  208. package/template/private-npm-package/README.md +18 -18
  209. package/template/private-npm-package/_package.json +3 -3
  210. package/template/private-npm-package/skuba.template.js +1 -0
  211. package/lib/cli/configure/addEmptyExports.js.map +0 -7
  212. package/lib/cli/configure/modules/tsconfig.d.ts +0 -2
  213. package/lib/cli/configure/modules/tsconfig.js +0 -87
  214. package/lib/cli/configure/modules/tsconfig.js.map +0 -7
  215. package/lib/cli/configure/patchDockerfile.d.ts +0 -1
  216. package/lib/cli/configure/patchDockerfile.js.map +0 -7
  217. package/lib/cli/configure/patchServerListener.d.ts +0 -3
  218. package/lib/cli/configure/patchServerListener.js.map +0 -7
  219. package/lib/cli/configure/refreshIgnoreFiles.d.ts +0 -3
  220. package/lib/cli/configure/refreshIgnoreFiles.js +0 -78
  221. package/lib/cli/configure/refreshIgnoreFiles.js.map +0 -7
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/cli/lint/internalLints/refreshConfigFiles.ts"],
4
+ "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { writeFile } from 'fs-extra';\nimport stripAnsi from 'strip-ansi';\n\nimport type { Logger } from '../../../utils/logging';\nimport { hasNpmrcSecret } from '../../../utils/npmrc';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../utils/packageManager';\nimport { readBaseTemplateFile } from '../../../utils/template';\nimport { getDestinationManifest } from '../../configure/analysis/package';\nimport { createDestinationFileReader } from '../../configure/analysis/project';\nimport { mergeWithIgnoreFile } from '../../configure/processing/ignoreFile';\nimport type { InternalLintResult } from '../internal';\n\nconst ensureNoAuthToken = (fileContents: string) =>\n fileContents\n .split('\\n')\n .filter((line) => !hasNpmrcSecret(line))\n .join('\\n');\n\nconst REFRESHABLE_CONFIG_FILES = [\n { name: '.eslintignore' },\n { name: '.gitignore' },\n { name: '.prettierignore' },\n {\n name: '.npmrc',\n additionalMapping: ensureNoAuthToken,\n if: (packageManager: PackageManagerConfig) =>\n packageManager.command === 'pnpm',\n },\n];\n\nexport const refreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n) => {\n const manifest = await getDestinationManifest();\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshConfigFile = async (\n filename: string,\n packageManager: PackageManagerConfig,\n additionalMapping: (\n s: string,\n packageManager: PackageManagerConfig,\n ) => string = (s) => s,\n condition: (packageManager: PackageManagerConfig) => boolean = () => true,\n ) => {\n if (!condition(packageManager)) {\n return { needsChange: false };\n }\n\n const [inputFile, templateFile] = await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n ]);\n\n const data = additionalMapping(\n inputFile ? mergeWithIgnoreFile(templateFile)(inputFile) : templateFile,\n packageManager,\n );\n\n const filepath = path.join(destinationRoot, filename);\n\n if (mode === 'format') {\n if (data === inputFile) {\n return { needsChange: false };\n }\n\n await writeFile(filepath, data);\n return {\n needsChange: false,\n msg: `Refreshed ${logger.bold(filename)}.`,\n filename,\n };\n }\n\n if (data !== inputFile) {\n return {\n needsChange: true,\n msg: `The ${logger.bold(\n filename,\n )} file is out of date. Run \\`${logger.bold(\n packageManager.exec,\n 'skuba',\n 'format',\n )}\\` to update it.`,\n filename,\n };\n }\n\n return { needsChange: false };\n };\n\n const packageManager = await detectPackageManager(destinationRoot);\n\n const results = await Promise.all(\n REFRESHABLE_CONFIG_FILES.map((conf) =>\n refreshConfigFile(\n conf.name,\n packageManager,\n conf.additionalMapping,\n conf.if,\n ),\n ),\n );\n\n // Log after for reproducible test output ordering\n results.forEach((result) => {\n if (result.msg) {\n logger.warn(result.msg, logger.dim('refresh-config-files'));\n }\n });\n\n const anyNeedChanging = results.some(({ needsChange }) => needsChange);\n\n return {\n ok: !anyNeedChanging,\n fixable: anyNeedChanging,\n annotations: results.flatMap(({ needsChange, filename, msg }) =>\n needsChange && msg\n ? [\n {\n path: filename,\n message: stripAnsi(msg),\n },\n ]\n : [],\n ),\n };\n};\n\nexport const tryRefreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n try {\n return await refreshConfigFiles(mode, logger);\n } catch (err) {\n logger.warn('Failed to refresh config files.');\n logger.subtle(inspect(err));\n\n return {\n ok: false,\n fixable: false,\n annotations: [],\n };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,sBAA0B;AAC1B,wBAAsB;AAGtB,mBAA+B;AAC/B,4BAGO;AACP,sBAAqC;AACrC,qBAAuC;AACvC,qBAA4C;AAC5C,wBAAoC;AAGpC,MAAM,oBAAoB,CAAC,iBACzB,aACG,MAAM,IAAI,EACV,OAAO,CAAC,SAAS,KAAC,6BAAe,IAAI,CAAC,EACtC,KAAK,IAAI;AAEd,MAAM,2BAA2B;AAAA,EAC/B,EAAE,MAAM,gBAAgB;AAAA,EACxB,EAAE,MAAM,aAAa;AAAA,EACrB,EAAE,MAAM,kBAAkB;AAAA,EAC1B;AAAA,IACE,MAAM;AAAA,IACN,mBAAmB;AAAA,IACnB,IAAI,CAAC,mBACH,eAAe,YAAY;AAAA,EAC/B;AACF;AAEO,MAAM,qBAAqB,OAChC,MACA,WACG;AACH,QAAM,WAAW,UAAM,uCAAuB;AAE9C,QAAM,kBAAkB,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAElD,QAAM,0BAAsB,4CAA4B,eAAe;AAEvE,QAAM,oBAAoB,OACxB,UACAC,iBACA,oBAGc,CAAC,MAAM,GACrB,YAA+D,MAAM,SAClE;AACH,QAAI,CAAC,UAAUA,eAAc,GAAG;AAC9B,aAAO,EAAE,aAAa,MAAM;AAAA,IAC9B;AAEA,UAAM,CAAC,WAAW,YAAY,IAAI,MAAM,QAAQ,IAAI;AAAA,MAClD,oBAAoB,QAAQ;AA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IAAI,MACzD,eAAe,MACX;AAAA,QACE;AAAA,UACE,MAAM;AAAA,UACN,aAAS,kBAAAC,SAAU,GAAG;AAAA,QACxB;AAAA,MACF,IACA,CAAC;AAAA,IACP;AAAA,EACF;AACF;AAEO,MAAM,wBAAwB,OACnC,MACA,WACgC;AAChC,MAAI;AACF,WAAO,MAAM,mBAAmB,MAAM,MAAM;AAAA,EAC9C,SAAS,KAAK;AACZ,WAAO,KAAK,iCAAiC;AAC7C,WAAO,WAAO,qBAAQ,GAAG,CAAC;AAE1B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
6
+ "names": ["path", "packageManager", "stripAnsi"]
7
+ }
@@ -22,9 +22,7 @@ __export(test_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(test_exports);
24
24
  var import_jest = require("jest");
25
- var import_addEmptyExports = require("../configure/addEmptyExports");
26
25
  const test = async () => {
27
- await (0, import_addEmptyExports.tryAddEmptyExports)();
28
26
  process.env.NODE_ENV ??= "test";
29
27
  const argv = process.argv.slice(2);
30
28
  return (0, import_jest.run)(argv);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/test/index.ts"],
4
- "sourcesContent": ["import { run } from 'jest';\n\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\n\nexport const test = async () => {\n await tryAddEmptyExports();\n\n // This is usually set in `jest-cli`'s binary wrapper\n process.env.NODE_ENV ??= 'test';\n\n const argv = process.argv.slice(2);\n\n return run(argv);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoB;AAEpB,6BAAmC;AAE5B,MAAM,OAAO,YAAY;AAC9B,YAAM,2CAAmB;AAGzB,UAAQ,IAAI,aAAa;AAEzB,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,aAAO,iBAAI,IAAI;AACjB;",
4
+ "sourcesContent": ["import { run } from 'jest';\n\nexport const test = async () => {\n // This is usually set in `jest-cli`'s binary wrapper\n process.env.NODE_ENV ??= 'test';\n\n const argv = process.argv.slice(2);\n\n return run(argv);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoB;AAEb,MAAM,OAAO,YAAY;AAE9B,UAAQ,IAAI,aAAa;AAEzB,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,aAAO,iBAAI,IAAI;AACjB;",
6
6
  "names": []
7
7
  }
package/lib/skuba.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * This is where you end up when you run:
6
6
  *
7
7
  * ```bash
8
- * [yarn] skuba help
8
+ * [pnpm|yarn] skuba help
9
9
  * ```
10
10
  */
11
11
  export {};
package/lib/skuba.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/skuba.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\n\n/**\n * Entry point for the CLI.\n *\n * This is where you end up when you run:\n *\n * ```bash\n * [yarn] skuba help\n * ```\n */\n\nimport path from 'path';\n\nimport { parseProcessArgs } from './utils/args';\nimport {\n COMMAND_DIR,\n COMMAND_SET,\n type Command,\n commandToModule,\n} from './utils/command';\nimport { handleCliError } from './utils/error';\nimport { showHelp } from './utils/help';\nimport { log } from './utils/logging';\nimport { showLogoAndVersionInfo } from './utils/logo';\nimport { hasProp } from './utils/validation';\n\nconst skuba = async () => {\n const { commandName } = parseProcessArgs(process.argv);\n\n if (COMMAND_SET.has(commandName)) {\n const moduleName = commandToModule(commandName as Command);\n\n /* eslint-disable @typescript-eslint/no-var-requires */\n const commandModule = require(\n path.join(COMMAND_DIR, moduleName),\n ) as unknown;\n\n if (!hasProp(commandModule, moduleName)) {\n log.err(log.bold(commandName), \"couldn't run! Please submit an issue.\");\n process.exitCode = 1;\n return;\n }\n\n const run = commandModule[moduleName] as () => Promise<unknown>;\n\n return run();\n }\n\n log.err(log.bold(commandName), 'is not recognised as a command.');\n await showLogoAndVersionInfo();\n showHelp();\n\n process.exitCode = 1;\n return;\n};\n\nskuba().catch(handleCliError);\n"],
4
+ "sourcesContent": ["#!/usr/bin/env node\n\n/**\n * Entry point for the CLI.\n *\n * This is where you end up when you run:\n *\n * ```bash\n * [pnpm|yarn] skuba help\n * ```\n */\n\nimport path from 'path';\n\nimport { parseProcessArgs } from './utils/args';\nimport {\n COMMAND_DIR,\n COMMAND_SET,\n type Command,\n commandToModule,\n} from './utils/command';\nimport { handleCliError } from './utils/error';\nimport { showHelp } from './utils/help';\nimport { log } from './utils/logging';\nimport { showLogoAndVersionInfo } from './utils/logo';\nimport { hasProp } from './utils/validation';\n\nconst skuba = async () => {\n const { commandName } = parseProcessArgs(process.argv);\n\n if (COMMAND_SET.has(commandName)) {\n const moduleName = commandToModule(commandName as Command);\n\n /* eslint-disable @typescript-eslint/no-var-requires */\n const commandModule = require(\n path.join(COMMAND_DIR, moduleName),\n ) as unknown;\n\n if (!hasProp(commandModule, moduleName)) {\n log.err(log.bold(commandName), \"couldn't run! Please submit an issue.\");\n process.exitCode = 1;\n return;\n }\n\n const run = commandModule[moduleName] as () => Promise<unknown>;\n\n return run();\n }\n\n log.err(log.bold(commandName), 'is not recognised as a command.');\n await showLogoAndVersionInfo();\n showHelp();\n\n process.exitCode = 1;\n return;\n};\n\nskuba().catch(handleCliError);\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAYA,kBAAiB;AAEjB,kBAAiC;AACjC,qBAKO;AACP,mBAA+B;AAC/B,kBAAyB;AACzB,qBAAoB;AACpB,kBAAuC;AACvC,wBAAwB;AAExB,MAAM,QAAQ,YAAY;AACxB,QAAM,EAAE,YAAY,QAAI,8BAAiB,QAAQ,IAAI;AAErD,MAAI,2BAAY,IAAI,WAAW,GAAG;AAChC,UAAM,iBAAa,gCAAgB,WAAsB;AAGzD,UAAM,gBAAgB,QACpB,YAAAA,QAAK,KAAK,4BAAa,UAAU,CACnC;AAEA,QAAI,KAAC,2BAAQ,eAAe,UAAU,GAAG;AACvC,yBAAI,IAAI,mBAAI,KAAK,WAAW,GAAG,uCAAuC;AACtE,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,UAAM,MAAM,cAAc,UAAU;AAEpC,WAAO,IAAI;AAAA,EACb;AAEA,qBAAI,IAAI,mBAAI,KAAK,WAAW,GAAG,iCAAiC;AAChE,YAAM,oCAAuB;AAC7B,4BAAS;AAET,UAAQ,WAAW;AACnB;AACF;AAEA,MAAM,EAAE,MAAM,2BAAc;",
6
6
  "names": ["path"]
7
7
  }
@@ -1,15 +1,35 @@
1
1
  /// <reference types="node" />
2
2
  import { inspect } from 'util';
3
- import * as t from 'runtypes';
4
- export type ConcurrentlyErrors = t.Static<typeof ConcurrentlyErrors>;
5
- export declare const ConcurrentlyErrors: t.Array<t.Record<{
6
- command: t.Record<{
7
- command: t.String;
8
- name: t.String;
9
- }, false>;
10
- index: t.Number;
11
- exitCode: t.Number;
12
- }, false>, false>;
3
+ import { z } from 'zod';
4
+ export type ConcurrentlyErrors = z.infer<typeof concurrentlyErrorsSchema>;
5
+ export declare const concurrentlyErrorsSchema: z.ZodArray<z.ZodObject<{
6
+ command: z.ZodObject<{
7
+ command: z.ZodString;
8
+ name: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ name: string;
11
+ command: string;
12
+ }, {
13
+ name: string;
14
+ command: string;
15
+ }>;
16
+ index: z.ZodNumber;
17
+ exitCode: z.ZodNumber;
18
+ }, "strip", z.ZodTypeAny, {
19
+ index: number;
20
+ exitCode: number;
21
+ command: {
22
+ name: string;
23
+ command: string;
24
+ };
25
+ }, {
26
+ index: number;
27
+ exitCode: number;
28
+ command: {
29
+ name: string;
30
+ command: string;
31
+ };
32
+ }>, "many">;
13
33
  /**
14
34
  * Creates an error that returns its plain `message` rather than a full stack
15
35
  * trace when `util.inspect`ed.
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,35 +15,27 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
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
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var error_exports = {};
30
20
  __export(error_exports, {
31
- ConcurrentlyErrors: () => ConcurrentlyErrors,
21
+ concurrentlyErrorsSchema: () => concurrentlyErrorsSchema,
32
22
  createTerseError: () => createTerseError,
33
23
  handleCliError: () => handleCliError,
34
24
  isErrorWithCode: () => isErrorWithCode
35
25
  });
36
26
  module.exports = __toCommonJS(error_exports);
37
27
  var import_util = require("util");
38
- var t = __toESM(require("runtypes"));
28
+ var import_zod = require("zod");
39
29
  var import_logging = require("./logging");
40
30
  var import_validation = require("./validation");
41
- const ConcurrentlyErrors = t.Array(
42
- t.Record({
43
- command: t.Record({
44
- command: t.String,
45
- name: t.String
31
+ const concurrentlyErrorsSchema = import_zod.z.array(
32
+ import_zod.z.object({
33
+ command: import_zod.z.object({
34
+ command: import_zod.z.string(),
35
+ name: import_zod.z.string()
46
36
  }),
47
- index: t.Number,
48
- exitCode: t.Number
37
+ index: import_zod.z.number(),
38
+ exitCode: import_zod.z.number()
49
39
  })
50
40
  );
51
41
  const createTerseError = (message) => Object.assign(new Error(message), {
@@ -64,7 +54,7 @@ const handleCliError = (err) => {
64
54
  const isErrorWithCode = (err, code) => (0, import_validation.hasProp)(err, "code") && err.code === code;
65
55
  // Annotate the CommonJS export names for ESM import in node:
66
56
  0 && (module.exports = {
67
- ConcurrentlyErrors,
57
+ concurrentlyErrorsSchema,
68
58
  createTerseError,
69
59
  handleCliError,
70
60
  isErrorWithCode
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/error.ts"],
4
- "sourcesContent": ["/* eslint-disable new-cap */\n\nimport { inspect } from 'util';\n\nimport type { ExecaError } from 'execa';\nimport * as t from 'runtypes';\n\nimport { log } from './logging';\nimport { hasNumberProp, hasProp } from './validation';\n\nexport type ConcurrentlyErrors = t.Static<typeof ConcurrentlyErrors>;\n\nexport const ConcurrentlyErrors = t.Array(\n t.Record({\n command: t.Record({\n command: t.String,\n name: t.String,\n }),\n index: t.Number,\n exitCode: t.Number,\n }),\n);\n\n/**\n * Creates an error that returns its plain `message` rather than a full stack\n * trace when `util.inspect`ed.\n *\n * This can be useful for terser handling and logging of known error scenarios\n * that have descriptive messages.\n *\n * https://nodejs.org/api/util.html#custom-inspection-functions-on-objects\n */\nexport const createTerseError = (message?: string) =>\n Object.assign(new Error(message), {\n [inspect.custom]: () => message,\n });\n\nconst isExecaError = (err: unknown): err is ExecaError =>\n hasNumberProp(err, 'exitCode');\n\nexport const handleCliError = (err: unknown) => {\n if (isExecaError(err)) {\n process.exitCode = err.exitCode;\n return;\n }\n\n log.err(inspect(err));\n process.exitCode = 1;\n return;\n};\n\nexport const isErrorWithCode = <T>(\n err: unknown,\n code: T,\n): err is Record<PropertyKey, unknown> & { code: T } =>\n hasProp(err, 'code') && err.code === code;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAwB;AAGxB,QAAmB;AAEnB,qBAAoB;AACpB,wBAAuC;AAIhC,MAAM,qBAAqB,EAAE;AAAA,EAClC,EAAE,OAAO;AAAA,IACP,SAAS,EAAE,OAAO;AAAA,MAChB,SAAS,EAAE;AAAA,MACX,MAAM,EAAE;AAAA,IACV,CAAC;AAAA,IACD,OAAO,EAAE;AAAA,IACT,UAAU,EAAE;AAAA,EACd,CAAC;AACH;AAWO,MAAM,mBAAmB,CAAC,YAC/B,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;AAAA,EAChC,CAAC,oBAAQ,MAAM,GAAG,MAAM;AAC1B,CAAC;AAEH,MAAM,eAAe,CAAC,YACpB,iCAAc,KAAK,UAAU;AAExB,MAAM,iBAAiB,CAAC,QAAiB;AAC9C,MAAI,aAAa,GAAG,GAAG;AACrB,YAAQ,WAAW,IAAI;AACvB;AAAA,EACF;AAEA,qBAAI,QAAI,qBAAQ,GAAG,CAAC;AACpB,UAAQ,WAAW;AACnB;AACF;AAEO,MAAM,kBAAkB,CAC7B,KACA,aAEA,2BAAQ,KAAK,MAAM,KAAK,IAAI,SAAS;",
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport type { ExecaError } from 'execa';\nimport { z } from 'zod';\n\nimport { log } from './logging';\nimport { hasNumberProp, hasProp } from './validation';\n\nexport type ConcurrentlyErrors = z.infer<typeof concurrentlyErrorsSchema>;\n\nexport const concurrentlyErrorsSchema = z.array(\n z.object({\n command: z.object({\n command: z.string(),\n name: z.string(),\n }),\n index: z.number(),\n exitCode: z.number(),\n }),\n);\n\n/**\n * Creates an error that returns its plain `message` rather than a full stack\n * trace when `util.inspect`ed.\n *\n * This can be useful for terser handling and logging of known error scenarios\n * that have descriptive messages.\n *\n * https://nodejs.org/api/util.html#custom-inspection-functions-on-objects\n */\nexport const createTerseError = (message?: string) =>\n Object.assign(new Error(message), {\n [inspect.custom]: () => message,\n });\n\nconst isExecaError = (err: unknown): err is ExecaError =>\n hasNumberProp(err, 'exitCode');\n\nexport const handleCliError = (err: unknown) => {\n if (isExecaError(err)) {\n process.exitCode = err.exitCode;\n return;\n }\n\n log.err(inspect(err));\n process.exitCode = 1;\n return;\n};\n\nexport const isErrorWithCode = <T>(\n err: unknown,\n code: T,\n): err is Record<PropertyKey, unknown> & { code: T } =>\n hasProp(err, 'code') && err.code === code;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAGxB,iBAAkB;AAElB,qBAAoB;AACpB,wBAAuC;AAIhC,MAAM,2BAA2B,aAAE;AAAA,EACxC,aAAE,OAAO;AAAA,IACP,SAAS,aAAE,OAAO;AAAA,MAChB,SAAS,aAAE,OAAO;AAAA,MAClB,MAAM,aAAE,OAAO;AAAA,IACjB,CAAC;AAAA,IACD,OAAO,aAAE,OAAO;AAAA,IAChB,UAAU,aAAE,OAAO;AAAA,EACrB,CAAC;AACH;AAWO,MAAM,mBAAmB,CAAC,YAC/B,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;AAAA,EAChC,CAAC,oBAAQ,MAAM,GAAG,MAAM;AAC1B,CAAC;AAEH,MAAM,eAAe,CAAC,YACpB,iCAAc,KAAK,UAAU;AAExB,MAAM,iBAAiB,CAAC,QAAiB;AAC9C,MAAI,aAAa,GAAG,GAAG;AACrB,YAAQ,WAAW,IAAI;AACvB;AAAA,EACF;AAEA,qBAAI,QAAI,qBAAQ,GAAG,CAAC;AACpB,UAAQ,WAAW;AACnB;AACF;AAEO,MAAM,kBAAkB,CAC7B,KACA,aAEA,2BAAQ,KAAK,MAAM,KAAK,IAAI,SAAS;",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,7 @@
2
2
  import stream from 'stream';
3
3
  import type { Color } from 'chalk';
4
4
  import execa, { type ExecaChildProcess } from 'execa';
5
+ import type { PackageManager } from './packageManager';
5
6
  export type Exec = (command: string, ...args: string[]) => ExecaChildProcess<string>;
6
7
  interface ExecConcurrentlyCommand {
7
8
  command: string;
@@ -29,7 +30,7 @@ interface ExecConcurrentlyOptions {
29
30
  outputStream?: stream.Writable;
30
31
  }
31
32
  type ExecOptions = execa.Options & {
32
- streamStdio?: true | 'yarn';
33
+ streamStdio?: true | PackageManager;
33
34
  };
34
35
  export declare const createExec: (opts: ExecOptions) => Exec;
35
36
  export declare const exec: Exec;
package/lib/utils/exec.js CHANGED
@@ -84,6 +84,7 @@ const runCommand = (command, args, opts) => {
84
84
  subprocess.stderr?.pipe(stderrFilter).pipe(process.stderr);
85
85
  subprocess.stdout?.pipe(stdoutFilter).pipe(process.stdout);
86
86
  break;
87
+ case "pnpm":
87
88
  case true:
88
89
  subprocess.stderr?.pipe(process.stderr);
89
90
  subprocess.stdout?.pipe(process.stdout);
@@ -116,11 +117,11 @@ const execConcurrently = async (commands, { maxProcesses, nameLength, outputStre
116
117
  }
117
118
  ).result;
118
119
  } catch (err) {
119
- const result = import_error.ConcurrentlyErrors.validate(err);
120
+ const result = import_error.concurrentlyErrorsSchema.safeParse(err);
120
121
  if (!result.success) {
121
122
  throw err;
122
123
  }
123
- const failed = result.value.filter(({ exitCode }) => exitCode !== 0).sort(({ index: indexA }, { index: indexB }) => indexA - indexB).map((subprocess) => subprocess.command.name);
124
+ const failed = result.data.filter(({ exitCode }) => exitCode !== 0).sort(({ index: indexA }, { index: indexB }) => indexA - indexB).map((subprocess) => subprocess.command.name);
124
125
  throw Error(
125
126
  `${failed.join(", ")} subprocess${failed.length === 1 ? "" : "es"} failed.`
126
127
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/exec.ts"],
4
- "sourcesContent": ["import { cpus } from 'os';\nimport stream from 'stream';\nimport util from 'util';\n\nimport type { Color } from 'chalk';\nimport concurrently from 'concurrently';\nimport execa, { type ExecaChildProcess } from 'execa';\nimport npmRunPath from 'npm-run-path';\nimport npmWhich from 'npm-which';\n\nimport { ConcurrentlyErrors, isErrorWithCode } from './error';\nimport { log } from './logging';\n\nclass YarnSpamFilter extends stream.Transform {\n silenced = false;\n\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Yarn spews the entire installed dependency tree after this message\n if (str.startsWith('info Direct dependencies')) {\n this.silenced = true;\n }\n\n if (\n !this.silenced &&\n // This isn't very useful given the command generates a lockfile\n !str.startsWith('info No lockfile found')\n ) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nclass YarnWarningFilter extends stream.Transform {\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Filter out annoying deprecation warnings that users can do little about\n if (!str.startsWith('warning skuba >')) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nexport type Exec = (\n command: string,\n ...args: string[]\n) => ExecaChildProcess<string>;\n\ninterface ExecConcurrentlyCommand {\n command: string;\n name: string;\n prefixColor?: typeof Color;\n}\n\ninterface ExecConcurrentlyOptions {\n /**\n * The maximum number of processes that can execute concurrently.\n *\n * Defaults to the CPU core count.\n */\n maxProcesses?: number;\n\n /**\n * A set length to pad names to.\n *\n * Defaults to the length of the longest command name.\n */\n nameLength?: number;\n\n /**\n * The stream that logging output will be written to.\n *\n * Defaults to `process.stdout`.\n */\n outputStream?: stream.Writable;\n}\n\ntype ExecOptions = execa.Options & { streamStdio?: true | 'yarn' };\n\nconst envWithPath = {\n PATH: npmRunPath({ cwd: __dirname }),\n};\n\nconst runCommand = (command: string, args: string[], opts?: ExecOptions) => {\n const subprocess = execa(command, args, {\n localDir: __dirname,\n preferLocal: true,\n stdio: 'inherit',\n ...opts,\n });\n\n switch (opts?.streamStdio) {\n case 'yarn':\n const stderrFilter = new YarnWarningFilter();\n const stdoutFilter = new YarnSpamFilter();\n\n subprocess.stderr?.pipe(stderrFilter).pipe(process.stderr);\n subprocess.stdout?.pipe(stdoutFilter).pipe(process.stdout);\n\n break;\n\n case true:\n subprocess.stderr?.pipe(process.stderr);\n subprocess.stdout?.pipe(process.stdout);\n\n break;\n }\n\n return subprocess;\n};\n\nconst whichCallback = npmWhich(__dirname);\n\nconst which = util.promisify<string, string>(whichCallback);\n\nexport const createExec =\n (opts: ExecOptions): Exec =>\n (command, ...args) =>\n runCommand(command, args, opts);\n\nexport const exec: Exec = (command, ...args) => runCommand(command, args);\n\nexport const execConcurrently = async (\n commands: ExecConcurrentlyCommand[],\n { maxProcesses, nameLength, outputStream }: ExecConcurrentlyOptions = {},\n) => {\n const maxNameLength =\n nameLength ??\n commands.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n try {\n await concurrently(\n commands.map(({ command, name, prefixColor }) => ({\n command,\n env: envWithPath,\n name: name.padEnd(maxNameLength),\n prefixColor,\n })),\n {\n maxProcesses: maxProcesses ?? cpus().length,\n\n outputStream,\n\n // Use a minimalist logging prefix.\n prefix: '{name} \u2502',\n },\n ).result;\n } catch (err) {\n const result = ConcurrentlyErrors.validate(err);\n\n if (!result.success) {\n throw err;\n }\n\n const failed = result.value\n .filter(({ exitCode }) => exitCode !== 0)\n .sort(({ index: indexA }, { index: indexB }) => indexA - indexB)\n .map((subprocess) => subprocess.command.name);\n\n throw Error(\n `${failed.join(', ')} subprocess${\n failed.length === 1 ? '' : 'es'\n } failed.`,\n );\n }\n};\n\nexport const ensureCommands = async (...names: string[]) => {\n let success = true;\n\n await Promise.all(\n names.map(async (name) => {\n const result = await hasCommand(name);\n\n if (!result) {\n success = false;\n\n log.err(log.bold(name), 'needs to be installed.');\n }\n }),\n );\n\n if (!success) {\n process.exit(1);\n }\n};\n\nexport const hasCommand = async (name: string) => {\n try {\n await which(name);\n\n return true;\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return false;\n }\n\n throw err;\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAA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AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,iBAAiB,UAAU,UAAoB;AAC1D,MAAI,UAAU;AAEd,QAAM,QAAQ;AAAA,IACZ,MAAM,IAAI,OAAO,SAAS;AACxB,YAAM,SAAS,MAAM,WAAW,IAAI;AAEpC,UAAI,CAAC,QAAQ;AACX,kBAAU;AAEV,2BAAI,IAAI,mBAAI,KAAK,IAAI,GAAG,wBAAwB;AAAA,MAClD;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,CAAC,SAAS;AACZ,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEO,MAAM,aAAa,OAAO,SAAiB;AAChD,MAAI;AACF,UAAM,MAAM,IAAI;AAEhB,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,YAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;",
4
+ "sourcesContent": ["import { cpus } from 'os';\nimport stream from 'stream';\nimport util from 'util';\n\nimport type { Color } from 'chalk';\nimport concurrently from 'concurrently';\nimport execa, { type ExecaChildProcess } from 'execa';\nimport npmRunPath from 'npm-run-path';\nimport npmWhich from 'npm-which';\n\nimport { concurrentlyErrorsSchema, isErrorWithCode } from './error';\nimport { log } from './logging';\nimport type { PackageManager } from './packageManager';\n\nclass YarnSpamFilter extends stream.Transform {\n silenced = false;\n\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Yarn spews the entire installed dependency tree after this message\n if (str.startsWith('info Direct dependencies')) {\n this.silenced = true;\n }\n\n if (\n !this.silenced &&\n // This isn't very useful given the command generates a lockfile\n !str.startsWith('info No lockfile found')\n ) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nclass YarnWarningFilter extends stream.Transform {\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Filter out annoying deprecation warnings that users can do little about\n if (!str.startsWith('warning skuba >')) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nexport type Exec = (\n command: string,\n ...args: string[]\n) => ExecaChildProcess<string>;\n\ninterface ExecConcurrentlyCommand {\n command: string;\n name: string;\n prefixColor?: typeof Color;\n}\n\ninterface ExecConcurrentlyOptions {\n /**\n * The maximum number of processes that can execute concurrently.\n *\n * Defaults to the CPU core count.\n */\n maxProcesses?: number;\n\n /**\n * A set length to pad names to.\n *\n * Defaults to the length of the longest command name.\n */\n nameLength?: number;\n\n /**\n * The stream that logging output will be written to.\n *\n * Defaults to `process.stdout`.\n */\n outputStream?: stream.Writable;\n}\n\ntype ExecOptions = execa.Options & { streamStdio?: true | PackageManager };\n\nconst envWithPath = {\n PATH: npmRunPath({ cwd: __dirname }),\n};\n\nconst runCommand = (command: string, args: string[], opts?: ExecOptions) => {\n const subprocess = execa(command, args, {\n localDir: __dirname,\n preferLocal: true,\n stdio: 'inherit',\n ...opts,\n });\n\n switch (opts?.streamStdio) {\n case 'yarn':\n const stderrFilter = new YarnWarningFilter();\n const stdoutFilter = new YarnSpamFilter();\n\n subprocess.stderr?.pipe(stderrFilter).pipe(process.stderr);\n subprocess.stdout?.pipe(stdoutFilter).pipe(process.stdout);\n\n break;\n\n case 'pnpm':\n case true:\n subprocess.stderr?.pipe(process.stderr);\n subprocess.stdout?.pipe(process.stdout);\n\n break;\n }\n\n return subprocess;\n};\n\nconst whichCallback = npmWhich(__dirname);\n\nconst which = util.promisify<string, string>(whichCallback);\n\nexport const createExec =\n (opts: ExecOptions): Exec =>\n (command, ...args) =>\n runCommand(command, args, opts);\n\nexport const exec: Exec = (command, ...args) => runCommand(command, args);\n\nexport const execConcurrently = async (\n commands: ExecConcurrentlyCommand[],\n { maxProcesses, nameLength, outputStream }: ExecConcurrentlyOptions = {},\n) => {\n const maxNameLength =\n nameLength ??\n commands.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n try {\n await concurrently(\n commands.map(({ command, name, prefixColor }) => ({\n command,\n env: envWithPath,\n name: name.padEnd(maxNameLength),\n prefixColor,\n })),\n {\n maxProcesses: maxProcesses ?? cpus().length,\n\n outputStream,\n\n // Use a minimalist logging prefix.\n prefix: '{name} \u2502',\n },\n ).result;\n } catch (err) {\n const result = concurrentlyErrorsSchema.safeParse(err);\n\n if (!result.success) {\n throw err;\n }\n\n const failed = result.data\n .filter(({ exitCode }) => exitCode !== 0)\n .sort(({ index: indexA }, { index: indexB }) => indexA - indexB)\n .map((subprocess) => subprocess.command.name);\n\n throw Error(\n `${failed.join(', ')} subprocess${\n failed.length === 1 ? '' : 'es'\n } failed.`,\n );\n }\n};\n\nexport const ensureCommands = async (...names: string[]) => {\n let success = true;\n\n await Promise.all(\n names.map(async (name) => {\n const result = await hasCommand(name);\n\n if (!result) {\n success = false;\n\n log.err(log.bold(name), 'needs to be installed.');\n }\n }),\n );\n\n if (!success) {\n process.exit(1);\n }\n};\n\nexport const hasCommand = async (name: string) => {\n try {\n await which(name);\n\n return true;\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return false;\n }\n\n throw err;\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,oBAAmB;AACnB,kBAAiB;AAGjB,0BAAyB;AACzB,mBAA8C;AAC9C,0BAAuB;AACvB,uBAAqB;AAErB,mBAA0D;AAC1D,qBAAoB;AAGpB,MAAM,uBAAuB,cAAAA,QAAO,UAAU;AAAA,EAC5C,WAAW;AAAA,EAEX,WACE,OACA,WACA,UACA;AACA,UAAM,MAAM,OAAO,KAAK,KAAK,EAAE,SAAS;AAGxC,QAAI,IAAI,WAAW,0BAA0B,GAAG;AAC9C,WAAK,WAAW;AAAA,IAClB;AAEA,QACE,CAAC,KAAK;AAAA,IAEN,CAAC,IAAI,WAAW,wBAAwB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AM,MAAM,IAAI;AAEhB,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,YAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;",
6
6
  "names": ["stream", "npmRunPath", "execa", "npmWhich", "util", "concurrently"]
7
7
  }
@@ -2,6 +2,7 @@ import chalk from 'chalk';
2
2
  export type Logger = typeof log;
3
3
  export declare const createLogger: (debug: boolean, ...prefixes: unknown[]) => {
4
4
  bold: chalk.Chalk;
5
+ dim: chalk.Chalk;
5
6
  formatSubtle: chalk.Chalk;
6
7
  timing: (start: bigint, end: bigint) => string;
7
8
  debug: (...message: unknown[]) => void;
@@ -14,6 +15,7 @@ export declare const createLogger: (debug: boolean, ...prefixes: unknown[]) => {
14
15
  };
15
16
  export declare const log: {
16
17
  bold: chalk.Chalk;
18
+ dim: chalk.Chalk;
17
19
  formatSubtle: chalk.Chalk;
18
20
  timing: (start: bigint, end: bigint) => string;
19
21
  debug: (...message: unknown[]) => void;
@@ -38,6 +38,7 @@ const createLogger = (debug, ...prefixes) => {
38
38
  const log2 = (...message) => console.log(...prefixes, ...message);
39
39
  return {
40
40
  bold: import_chalk.default.bold,
41
+ dim: import_chalk.default.dim,
41
42
  formatSubtle: import_chalk.default.grey,
42
43
  timing: (start, end) => `${Number((end - start) / BigInt(1e7)) / 100}s`,
43
44
  debug: (...message) => debug ? log2(import_chalk.default.grey(...message)) : void 0,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/logging.ts"],
4
- "sourcesContent": ["/* eslint-disable no-console */\n\nimport chalk from 'chalk';\n\nexport type Logger = typeof log;\n\nexport const createLogger = (debug: boolean, ...prefixes: unknown[]) => {\n const log = (...message: unknown[]) => console.log(...prefixes, ...message);\n\n return {\n bold: chalk.bold,\n formatSubtle: chalk.grey,\n\n timing: (start: bigint, end: bigint) =>\n `${Number((end - start) / BigInt(10_000_000)) / 100}s`,\n\n debug: (...message: unknown[]) =>\n debug ? log(chalk.grey(...message)) : undefined,\n subtle: (...message: unknown[]) => log(chalk.grey(...message)),\n err: (...message: unknown[]) => log(chalk.red(...message)),\n newline: () => log(),\n ok: (...message: unknown[]) => log(chalk.green(...message)),\n plain: (...message: unknown[]) => log(...message),\n warn: (...message: unknown[]) => log(chalk.yellow(...message)),\n };\n};\n\nexport const log = createLogger(false);\n\nexport const pluralise = (count: number, subject: string) =>\n `${count} ${subject}${count === 1 ? '' : 's'}`;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAkB;AAIX,MAAM,eAAe,CAAC,UAAmB,aAAwB;AACtE,QAAMA,OAAM,IAAI,YAAuB,QAAQ,IAAI,GAAG,UAAU,GAAG,OAAO;AAE1E,SAAO;AAAA,IACL,MAAM,aAAAC,QAAM;AAAA,IACZ,cAAc,aAAAA,QAAM;AAAA,IAEpB,QAAQ,CAAC,OAAe,QACtB,GAAG,QAAQ,MAAM,SAAS,OAAO,GAAU,CAAC,IAAI,GAAG;AAAA,IAErD,OAAO,IAAI,YACT,QAAQD,KAAI,aAAAC,QAAM,KAAK,GAAG,OAAO,CAAC,IAAI;AAAA,IACxC,QAAQ,IAAI,YAAuBD,KAAI,aAAAC,QAAM,KAAK,GAAG,OAAO,CAAC;AAAA,IAC7D,KAAK,IAAI,YAAuBD,KAAI,aAAAC,QAAM,IAAI,GAAG,OAAO,CAAC;AAAA,IACzD,SAAS,MAAMD,KAAI;AAAA,IACnB,IAAI,IAAI,YAAuBA,KAAI,aAAAC,QAAM,MAAM,GAAG,OAAO,CAAC;AAAA,IAC1D,OAAO,IAAI,YAAuBD,KAAI,GAAG,OAAO;AAAA,IAChD,MAAM,IAAI,YAAuBA,KAAI,aAAAC,QAAM,OAAO,GAAG,OAAO,CAAC;AAAA,EAC/D;AACF;AAEO,MAAM,MAAM,aAAa,KAAK;AAE9B,MAAM,YAAY,CAAC,OAAe,YACvC,GAAG,KAAK,IAAI,OAAO,GAAG,UAAU,IAAI,KAAK,GAAG;",
4
+ "sourcesContent": ["/* eslint-disable no-console */\n\nimport chalk from 'chalk';\n\nexport type Logger = typeof log;\n\nexport const createLogger = (debug: boolean, ...prefixes: unknown[]) => {\n const log = (...message: unknown[]) => console.log(...prefixes, ...message);\n\n return {\n bold: chalk.bold,\n dim: chalk.dim,\n formatSubtle: chalk.grey,\n\n timing: (start: bigint, end: bigint) =>\n `${Number((end - start) / BigInt(10_000_000)) / 100}s`,\n\n debug: (...message: unknown[]) =>\n debug ? log(chalk.grey(...message)) : undefined,\n subtle: (...message: unknown[]) => log(chalk.grey(...message)),\n err: (...message: unknown[]) => log(chalk.red(...message)),\n newline: () => log(),\n ok: (...message: unknown[]) => log(chalk.green(...message)),\n plain: (...message: unknown[]) => log(...message),\n warn: (...message: unknown[]) => log(chalk.yellow(...message)),\n };\n};\n\nexport const log = createLogger(false);\n\nexport const pluralise = (count: number, subject: string) =>\n `${count} ${subject}${count === 1 ? '' : 's'}`;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAkB;AAIX,MAAM,eAAe,CAAC,UAAmB,aAAwB;AACtE,QAAMA,OAAM,IAAI,YAAuB,QAAQ,IAAI,GAAG,UAAU,GAAG,OAAO;AAE1E,SAAO;AAAA,IACL,MAAM,aAAAC,QAAM;AAAA,IACZ,KAAK,aAAAA,QAAM;AAAA,IACX,cAAc,aAAAA,QAAM;AAAA,IAEpB,QAAQ,CAAC,OAAe,QACtB,GAAG,QAAQ,MAAM,SAAS,OAAO,GAAU,CAAC,IAAI,GAAG;AAAA,IAErD,OAAO,IAAI,YACT,QAAQD,KAAI,aAAAC,QAAM,KAAK,GAAG,OAAO,CAAC,IAAI;AAAA,IACxC,QAAQ,IAAI,YAAuBD,KAAI,aAAAC,QAAM,KAAK,GAAG,OAAO,CAAC;AAAA,IAC7D,KAAK,IAAI,YAAuBD,KAAI,aAAAC,QAAM,IAAI,GAAG,OAAO,CAAC;AAAA,IACzD,SAAS,MAAMD,KAAI;AAAA,IACnB,IAAI,IAAI,YAAuBA,KAAI,aAAAC,QAAM,MAAM,GAAG,OAAO,CAAC;AAAA,IAC1D,OAAO,IAAI,YAAuBD,KAAI,GAAG,OAAO;AAAA,IAChD,MAAM,IAAI,YAAuBA,KAAI,aAAAC,QAAM,OAAO,GAAG,OAAO,CAAC;AAAA,EAC/D;AACF;AAEO,MAAM,MAAM,aAAa,KAAK;AAE9B,MAAM,YAAY,CAAC,OAAe,YACvC,GAAG,KAAK,IAAI,OAAO,GAAG,UAAU,IAAI,KAAK,GAAG;",
6
6
  "names": ["log", "chalk"]
7
7
  }
package/lib/utils/logo.js CHANGED
@@ -32,8 +32,8 @@ __export(logo_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(logo_exports);
34
34
  var import_chalk = __toESM(require("chalk"));
35
- var import_is_installed_globally = __toESM(require("is-installed-globally"));
36
35
  var import_logging = require("./logging");
36
+ var import_packageManager = require("./packageManager");
37
37
  var import_version = require("./version");
38
38
  const LOGO = import_chalk.default.blueBright(`
39
39
  \u256D\u2500\u256E ${import_chalk.default.magentaBright(" ")}\u256D\u2500\u256E
@@ -42,7 +42,10 @@ const LOGO = import_chalk.default.blueBright(`
42
42
  \u2570\u2500\u2500\u2500\u2570\u2500\u2534\u2500${import_chalk.default.magentaBright("\u2570\u2500\u2500\u2500\u256F")}\u2500\u2500\u2500\u256F\u2500\u2500 \u2570
43
43
  `);
44
44
  const showLogoAndVersionInfo = async () => {
45
- const versionInfo = await (0, import_version.getSkubaVersionInfo)();
45
+ const [versionInfo, packageManager] = await Promise.all([
46
+ (0, import_version.getSkubaVersionInfo)(),
47
+ (0, import_packageManager.detectPackageManager)()
48
+ ]);
46
49
  import_logging.log.plain(LOGO);
47
50
  import_logging.log.subtle(
48
51
  import_logging.log.bold(versionInfo.local),
@@ -55,14 +58,7 @@ const showLogoAndVersionInfo = async () => {
55
58
  import_logging.log.warn("Your skuba installation is out of date.");
56
59
  import_logging.log.warn("Consider upgrading:");
57
60
  import_logging.log.newline();
58
- import_logging.log.warn(
59
- import_logging.log.bold(
60
- "yarn",
61
- ...import_is_installed_globally.default ? ["global"] : [],
62
- "upgrade",
63
- `skuba@${versionInfo.latest}`
64
- )
65
- );
61
+ import_logging.log.warn(import_logging.log.bold(packageManager.update, `skuba@${versionInfo.latest}`));
66
62
  import_logging.log.newline();
67
63
  }
68
64
  return versionInfo;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/logo.ts"],
4
- "sourcesContent": ["import chalk from 'chalk';\nimport isInstalledGlobally from 'is-installed-globally';\n\nimport { log } from './logging';\nimport { getSkubaVersionInfo } from './version';\n\nconst LOGO = chalk.blueBright(`\n \u256D\u2500\u256E ${chalk.magentaBright(' ')}\u256D\u2500\u256E\n\u256D\u2500\u2500\u2500\u2502 \u2570\u2500${chalk.magentaBright('\u256D\u2500\u252C\u2500\u256E')} \u2570\u2500\u256E\u2500\u2500\u2500\u256E\n\u2502_ \u2500\u2524 <${chalk.magentaBright('\u2502 \u2575 \u2502')} \u2022 \u2502 \u2022 \u2502\n\u2570\u2500\u2500\u2500\u2570\u2500\u2534\u2500${chalk.magentaBright('\u2570\u2500\u2500\u2500\u256F')}\u2500\u2500\u2500\u256F\u2500\u2500 \u2570\n`);\n\nexport const showLogoAndVersionInfo = async () => {\n const versionInfo = await getSkubaVersionInfo();\n\n log.plain(LOGO);\n log.subtle(\n log.bold(versionInfo.local),\n '|',\n 'latest',\n log.bold(versionInfo.latest ?? 'offline \u2708'),\n );\n log.newline();\n\n if (versionInfo.isStale) {\n log.warn('Your skuba installation is out of date.');\n log.warn('Consider upgrading:');\n log.newline();\n log.warn(\n log.bold(\n 'yarn',\n ...(isInstalledGlobally ? ['global'] : []),\n 'upgrade',\n `skuba@${versionInfo.latest}`,\n ),\n );\n log.newline();\n }\n\n return versionInfo;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,mCAAgC;AAEhC,qBAAoB;AACpB,qBAAoC;AAEpC,MAAM,OAAO,aAAAA,QAAM,WAAW;AAAA,yBACpB,aAAAA,QAAM,cAAc,MAAM,CAAC;AAAA,6CAC3B,aAAAA,QAAM,cAAc,gCAAO,CAAC;AAAA,yBAC5B,aAAAA,QAAM,cAAc,sBAAO,CAAC;AAAA,kDAC5B,aAAAA,QAAM,cAAc,gCAAO,CAAC;AAAA,CACrC;AAEM,MAAM,yBAAyB,YAAY;AAChD,QAAM,cAAc,UAAM,oCAAoB;AAE9C,qBAAI,MAAM,IAAI;AACd,qBAAI;AAAA,IACF,mBAAI,KAAK,YAAY,KAAK;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,mBAAI,KAAK,YAAY,UAAU,gBAAW;AAAA,EAC5C;AACA,qBAAI,QAAQ;AAEZ,MAAI,YAAY,SAAS;AACvB,uBAAI,KAAK,yCAAyC;AAClD,uBAAI,KAAK,qBAAqB;AAC9B,uBAAI,QAAQ;AACZ,uBAAI;AAAA,MACF,mBAAI;AAAA,QACF;AAAA,QACA,GAAI,6BAAAC,UAAsB,CAAC,QAAQ,IAAI,CAAC;AAAA,QACxC;AAAA,QACA,SAAS,YAAY,MAAM;AAAA,MAC7B;AAAA,IACF;AACA,uBAAI,QAAQ;AAAA,EACd;AAEA,SAAO;AACT;",
6
- "names": ["chalk", "isInstalledGlobally"]
4
+ "sourcesContent": ["import chalk from 'chalk';\n\nimport { log } from './logging';\nimport { detectPackageManager } from './packageManager';\nimport { getSkubaVersionInfo } from './version';\n\nconst LOGO = chalk.blueBright(`\n \u256D\u2500\u256E ${chalk.magentaBright(' ')}\u256D\u2500\u256E\n\u256D\u2500\u2500\u2500\u2502 \u2570\u2500${chalk.magentaBright('\u256D\u2500\u252C\u2500\u256E')} \u2570\u2500\u256E\u2500\u2500\u2500\u256E\n\u2502_ \u2500\u2524 <${chalk.magentaBright('\u2502 \u2575 \u2502')} \u2022 \u2502 \u2022 \u2502\n\u2570\u2500\u2500\u2500\u2570\u2500\u2534\u2500${chalk.magentaBright('\u2570\u2500\u2500\u2500\u256F')}\u2500\u2500\u2500\u256F\u2500\u2500 \u2570\n`);\n\nexport const showLogoAndVersionInfo = async () => {\n const [versionInfo, packageManager] = await Promise.all([\n getSkubaVersionInfo(),\n detectPackageManager(),\n ]);\n\n log.plain(LOGO);\n log.subtle(\n log.bold(versionInfo.local),\n '|',\n 'latest',\n log.bold(versionInfo.latest ?? 'offline \u2708'),\n );\n log.newline();\n\n if (versionInfo.isStale) {\n log.warn('Your skuba installation is out of date.');\n log.warn('Consider upgrading:');\n log.newline();\n log.warn(log.bold(packageManager.update, `skuba@${versionInfo.latest}`));\n log.newline();\n }\n\n return versionInfo;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,qBAAoB;AACpB,4BAAqC;AACrC,qBAAoC;AAEpC,MAAM,OAAO,aAAAA,QAAM,WAAW;AAAA,yBACpB,aAAAA,QAAM,cAAc,MAAM,CAAC;AAAA,6CAC3B,aAAAA,QAAM,cAAc,gCAAO,CAAC;AAAA,yBAC5B,aAAAA,QAAM,cAAc,sBAAO,CAAC;AAAA,kDAC5B,aAAAA,QAAM,cAAc,gCAAO,CAAC;AAAA,CACrC;AAEM,MAAM,yBAAyB,YAAY;AAChD,QAAM,CAAC,aAAa,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,QACtD,oCAAoB;AAAA,QACpB,4CAAqB;AAAA,EACvB,CAAC;AAED,qBAAI,MAAM,IAAI;AACd,qBAAI;AAAA,IACF,mBAAI,KAAK,YAAY,KAAK;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,mBAAI,KAAK,YAAY,UAAU,gBAAW;AAAA,EAC5C;AACA,qBAAI,QAAQ;AAEZ,MAAI,YAAY,SAAS;AACvB,uBAAI,KAAK,yCAAyC;AAClD,uBAAI,KAAK,qBAAqB;AAC9B,uBAAI,QAAQ;AACZ,uBAAI,KAAK,mBAAI,KAAK,eAAe,QAAQ,SAAS,YAAY,MAAM,EAAE,CAAC;AACvE,uBAAI,QAAQ;AAAA,EACd;AAEA,SAAO;AACT;",
6
+ "names": ["chalk"]
7
7
  }
@@ -1,10 +1,10 @@
1
1
  import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';
2
- import * as t from 'runtypes';
3
- export type ProjectType = t.Static<typeof ProjectType>;
4
- export declare const ProjectType: t.Union<[t.Literal<"application">, t.Literal<"package">]>;
2
+ import { z } from 'zod';
3
+ export type ProjectType = z.infer<typeof projectTypeSchema>;
4
+ export declare const projectTypeSchema: z.ZodUnion<[z.ZodLiteral<"application">, z.ZodLiteral<"package">]>;
5
5
  export declare const PROJECT_TYPES: readonly ["application", "package"];
6
6
  export declare const getSkubaManifest: () => Promise<NormalizedPackageJson>;
7
- export declare const getConsumerManifest: () => Promise<readPkgUp.NormalizedReadResult | undefined>;
7
+ export declare const getConsumerManifest: (cwd?: string) => Promise<readPkgUp.NormalizedReadResult | undefined>;
8
8
  export declare const getPropFromConsumerManifest: <T extends string, V = unknown>(prop: T) => Promise<V | undefined>;
9
9
  export declare const getStringPropFromConsumerManifest: <T extends string>(prop: T) => Promise<string | undefined>;
10
10
  export declare const getEntryPointFromManifest: () => Promise<string>;
@@ -29,21 +29,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var manifest_exports = {};
30
30
  __export(manifest_exports, {
31
31
  PROJECT_TYPES: () => PROJECT_TYPES,
32
- ProjectType: () => ProjectType,
33
32
  getConsumerManifest: () => getConsumerManifest,
34
33
  getEntryPointFromManifest: () => getEntryPointFromManifest,
35
34
  getPropFromConsumerManifest: () => getPropFromConsumerManifest,
36
35
  getSkubaManifest: () => getSkubaManifest,
37
- getStringPropFromConsumerManifest: () => getStringPropFromConsumerManifest
36
+ getStringPropFromConsumerManifest: () => getStringPropFromConsumerManifest,
37
+ projectTypeSchema: () => projectTypeSchema
38
38
  });
39
39
  module.exports = __toCommonJS(manifest_exports);
40
40
  var import_read_pkg_up = __toESM(require("read-pkg-up"));
41
- var t = __toESM(require("runtypes"));
41
+ var import_zod = require("zod");
42
42
  var import_validation = require("./validation");
43
- const ProjectType = t.Union(
44
- t.Literal("application"),
45
- t.Literal("package")
46
- );
43
+ const projectTypeSchema = import_zod.z.union([
44
+ import_zod.z.literal("application"),
45
+ import_zod.z.literal("package")
46
+ ]);
47
47
  const PROJECT_TYPES = ["application", "package"];
48
48
  const DEFAULT_ENTRY_POINT = "src/app.ts";
49
49
  let skubaManifest;
@@ -57,7 +57,7 @@ const getSkubaManifest = async () => {
57
57
  }
58
58
  return skubaManifest = result.packageJson;
59
59
  };
60
- const getConsumerManifest = () => (0, import_read_pkg_up.default)();
60
+ const getConsumerManifest = (cwd) => (0, import_read_pkg_up.default)({ cwd });
61
61
  const getPropFromConsumerManifest = async (prop) => {
62
62
  const result = await getConsumerManifest();
63
63
  return result !== void 0 && (0, import_validation.hasProp)(result.packageJson.skuba, prop) ? result.packageJson.skuba[prop] : void 0;
@@ -73,11 +73,11 @@ const getEntryPointFromManifest = async () => {
73
73
  // Annotate the CommonJS export names for ESM import in node:
74
74
  0 && (module.exports = {
75
75
  PROJECT_TYPES,
76
- ProjectType,
77
76
  getConsumerManifest,
78
77
  getEntryPointFromManifest,
79
78
  getPropFromConsumerManifest,
80
79
  getSkubaManifest,
81
- getStringPropFromConsumerManifest
80
+ getStringPropFromConsumerManifest,
81
+ projectTypeSchema
82
82
  });
83
83
  //# sourceMappingURL=manifest.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/manifest.ts"],
4
- "sourcesContent": ["/* eslint-disable new-cap */\n\nimport readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport * as t from 'runtypes';\n\nimport { hasProp } from './validation';\n\nexport type ProjectType = t.Static<typeof ProjectType>;\n\nexport const ProjectType = t.Union(\n t.Literal('application'),\n t.Literal('package'),\n);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = () => readPkgUp();\n\nexport const getPropFromConsumerManifest = async <\n T extends string,\n V = unknown,\n>(\n prop: T,\n): Promise<V | undefined> => {\n const result = await getConsumerManifest();\n\n return result !== undefined && hasProp<T, V>(result.packageJson.skuba, prop)\n ? result.packageJson.skuba[prop]\n : undefined;\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const result = await getPropFromConsumerManifest(prop);\n\n return typeof result === 'string' ? result : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAAsD;AACtD,QAAmB;AAEnB,wBAAwB;AAIjB,MAAM,cAAc,EAAE;AAAA,EAC3B,EAAE,QAAQ,aAAa;AAAA,EACvB,EAAE,QAAQ,SAAS;AACrB;AAEO,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,UAAM,mBAAAA,SAAU;AAE5C,MAAM,8BAA8B,OAIzC,SAC2B;AAC3B,QAAM,SAAS,MAAM,oBAAoB;AAEzC,SAAO,WAAW,cAAa,2BAAc,OAAO,YAAY,OAAO,IAAI,IACvE,OAAO,YAAY,MAAM,IAAI,IAC7B;AACN;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,SAAS,MAAM,4BAA4B,IAAI;AAErD,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
4
+ "sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport { z } from 'zod';\n\nimport { hasProp } from './validation';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = (cwd?: string) => readPkgUp({ cwd });\n\nexport const getPropFromConsumerManifest = async <\n T extends string,\n V = unknown,\n>(\n prop: T,\n): Promise<V | undefined> => {\n const result = await getConsumerManifest();\n\n return result !== undefined && hasProp<T, V>(result.packageJson.skuba, prop)\n ? result.packageJson.skuba[prop]\n : undefined;\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const result = await getPropFromConsumerManifest(prop);\n\n return typeof result === 'string' ? result : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsD;AACtD,iBAAkB;AAElB,wBAAwB;AAIjB,MAAM,oBAAoB,aAAE,MAAM;AAAA,EACvC,aAAE,QAAQ,aAAa;AAAA,EACvB,aAAE,QAAQ,SAAS;AACrB,CAAC;AAEM,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,CAAC,YAAiB,mBAAAA,SAAU,EAAE,IAAI,CAAC;AAE/D,MAAM,8BAA8B,OAIzC,SAC2B;AAC3B,QAAM,SAAS,MAAM,oBAAoB;AAEzC,SAAO,WAAW,cAAa,2BAAc,OAAO,YAAY,OAAO,IAAI,IACvE,OAAO,YAAY,MAAM,IAAI,IAC7B;AACN;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,SAAS,MAAM,4BAA4B,IAAI;AAErD,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
6
6
  "names": ["readPkgUp"]
7
7
  }
@@ -0,0 +1 @@
1
+ export declare const hasNpmrcSecret: (lineOrFullFileContents: string) => boolean;
@@ -0,0 +1,29 @@
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 npmrc_exports = {};
20
+ __export(npmrc_exports, {
21
+ hasNpmrcSecret: () => hasNpmrcSecret
22
+ });
23
+ module.exports = __toCommonJS(npmrc_exports);
24
+ const hasNpmrcSecret = (lineOrFullFileContents) => lineOrFullFileContents.includes("_auth") || lineOrFullFileContents.includes("_password");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ hasNpmrcSecret
28
+ });
29
+ //# sourceMappingURL=npmrc.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/npmrc.ts"],
4
+ "sourcesContent": ["// Preventing against _auth, _authToken, _password\n// https://docs.npmjs.com/cli/v10/configuring-npm/npmrc#auth-related-configuration\n\nexport const hasNpmrcSecret = (lineOrFullFileContents: string): boolean =>\n lineOrFullFileContents.includes('_auth') ||\n lineOrFullFileContents.includes('_password');\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,iBAAiB,CAAC,2BAC7B,uBAAuB,SAAS,OAAO,KACvC,uBAAuB,SAAS,WAAW;",
6
+ "names": []
7
+ }
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export declare const DEFAULT_PACKAGE_MANAGER = "yarn";
3
+ export type PackageManagerConfig = (typeof PACKAGE_MANAGERS)[keyof typeof PACKAGE_MANAGERS] & {
4
+ command: PackageManager;
5
+ };
6
+ declare const PACKAGE_MANAGERS: {
7
+ pnpm: {
8
+ exec: string;
9
+ install: string;
10
+ runSilent: string;
11
+ update: string;
12
+ };
13
+ yarn: {
14
+ exec: string;
15
+ install: string;
16
+ runSilent: string;
17
+ update: string;
18
+ };
19
+ };
20
+ export declare const configForPackageManager: (packageManager: PackageManager) => PackageManagerConfig;
21
+ export declare const detectPackageManager: (cwd?: string) => Promise<PackageManagerConfig>;
22
+ export type PackageManager = z.infer<typeof packageManagerSchema>;
23
+ export declare const packageManagerSchema: z.ZodDefault<z.ZodEnum<["pnpm", "yarn"]>>;
24
+ export {};