skuba 7.3.0 → 7.4.0-horrible-hacks-20240206023615

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 (212) hide show
  1. package/README.md +3 -3
  2. package/jest/transform.test.ts +3 -1
  3. package/lib/api/jest/index.d.ts +1 -1
  4. package/lib/api/jest/index.js.map +2 -2
  5. package/lib/cli/adapter/prettier.d.ts +1 -1
  6. package/lib/cli/adapter/prettier.js +11 -10
  7. package/lib/cli/adapter/prettier.js.map +2 -2
  8. package/lib/cli/build/index.js +0 -2
  9. package/lib/cli/build/index.js.map +2 -2
  10. package/lib/cli/buildPackage.js +0 -2
  11. package/lib/cli/buildPackage.js.map +2 -2
  12. package/lib/cli/configure/analyseConfiguration.d.ts +2 -0
  13. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  14. package/lib/cli/configure/getEntryPoint.js +1 -1
  15. package/lib/cli/configure/getEntryPoint.js.map +2 -2
  16. package/lib/cli/configure/getProjectType.js +1 -1
  17. package/lib/cli/configure/getProjectType.js.map +2 -2
  18. package/lib/cli/configure/index.js +11 -8
  19. package/lib/cli/configure/index.js.map +2 -2
  20. package/lib/cli/configure/modules/index.js +0 -2
  21. package/lib/cli/configure/modules/index.js.map +2 -2
  22. package/lib/cli/configure/modules/package.d.ts +1 -1
  23. package/lib/cli/configure/modules/package.js +2 -1
  24. package/lib/cli/configure/modules/package.js.map +2 -2
  25. package/lib/cli/configure/patchRenovateConfig.d.ts +2 -1
  26. package/lib/cli/configure/patchRenovateConfig.js +23 -10
  27. package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
  28. package/lib/cli/configure/types.d.ts +2 -0
  29. package/lib/cli/configure/types.js.map +1 -1
  30. package/lib/cli/configure/upgrade/index.d.ts +15 -0
  31. package/lib/cli/configure/upgrade/index.js +130 -0
  32. package/lib/cli/configure/upgrade/index.js.map +7 -0
  33. package/lib/cli/configure/{addEmptyExports.d.ts → upgrade/patches/7.3.1/addEmptyExports.d.ts} +2 -2
  34. package/lib/cli/configure/{addEmptyExports.js → upgrade/patches/7.3.1/addEmptyExports.js} +15 -11
  35. package/lib/cli/configure/upgrade/patches/7.3.1/addEmptyExports.js.map +7 -0
  36. package/lib/cli/configure/upgrade/patches/7.3.1/index.d.ts +2 -0
  37. package/lib/cli/configure/upgrade/patches/7.3.1/index.js +55 -0
  38. package/lib/cli/configure/upgrade/patches/7.3.1/index.js.map +7 -0
  39. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.d.ts +2 -0
  40. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js +94 -0
  41. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js.map +7 -0
  42. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.d.ts +2 -0
  43. package/lib/cli/configure/{patchDockerfile.js → upgrade/patches/7.3.1/patchDockerfile.js} +18 -12
  44. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.js.map +7 -0
  45. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.d.ts +2 -0
  46. package/lib/cli/configure/{patchServerListener.js → upgrade/patches/7.3.1/patchServerListener.js} +18 -14
  47. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.js.map +7 -0
  48. package/lib/cli/format.js +7 -14
  49. package/lib/cli/format.js.map +2 -2
  50. package/lib/cli/init/getConfig.d.ts +4 -2
  51. package/lib/cli/init/getConfig.js +53 -26
  52. package/lib/cli/init/getConfig.js.map +2 -2
  53. package/lib/cli/init/git.d.ts +2 -1
  54. package/lib/cli/init/git.js +2 -9
  55. package/lib/cli/init/git.js.map +2 -2
  56. package/lib/cli/init/index.d.ts +1 -1
  57. package/lib/cli/init/index.js +19 -9
  58. package/lib/cli/init/index.js.map +2 -2
  59. package/lib/cli/init/prompts.d.ts +26 -3
  60. package/lib/cli/init/prompts.js +10 -2
  61. package/lib/cli/init/prompts.js.map +2 -2
  62. package/lib/cli/init/types.d.ts +21 -0
  63. package/lib/cli/init/types.js +5 -1
  64. package/lib/cli/init/types.js.map +2 -2
  65. package/lib/cli/init/writePackageJson.d.ts +6 -0
  66. package/lib/cli/init/writePackageJson.js.map +2 -2
  67. package/lib/cli/lint/annotate/buildkite/index.d.ts +2 -1
  68. package/lib/cli/lint/annotate/buildkite/index.js +5 -3
  69. package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
  70. package/lib/cli/lint/annotate/buildkite/internal.d.ts +2 -0
  71. package/lib/cli/lint/annotate/buildkite/internal.js +45 -0
  72. package/lib/cli/lint/annotate/buildkite/internal.js.map +7 -0
  73. package/lib/cli/lint/annotate/github/index.d.ts +2 -1
  74. package/lib/cli/lint/annotate/github/index.js +4 -2
  75. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  76. package/lib/cli/lint/annotate/github/internal.d.ts +3 -0
  77. package/lib/cli/lint/annotate/github/internal.js +36 -0
  78. package/lib/cli/lint/annotate/github/internal.js.map +7 -0
  79. package/lib/cli/lint/annotate/index.d.ts +4 -3
  80. package/lib/cli/lint/annotate/index.js +9 -3
  81. package/lib/cli/lint/annotate/index.js.map +2 -2
  82. package/lib/cli/lint/autofix.d.ts +3 -1
  83. package/lib/cli/lint/autofix.js +36 -59
  84. package/lib/cli/lint/autofix.js.map +3 -3
  85. package/lib/cli/lint/external.d.ts +6 -1
  86. package/lib/cli/lint/external.js +6 -29
  87. package/lib/cli/lint/external.js.map +2 -2
  88. package/lib/cli/lint/index.d.ts +2 -1
  89. package/lib/cli/lint/index.js +46 -14
  90. package/lib/cli/lint/index.js.map +2 -2
  91. package/lib/cli/lint/internal.d.ts +12 -1
  92. package/lib/cli/lint/internal.js +55 -19
  93. package/lib/cli/lint/internal.js.map +3 -3
  94. package/lib/cli/lint/internalLints/deleteFiles.d.ts +3 -0
  95. package/lib/cli/lint/internalLints/deleteFiles.js +102 -0
  96. package/lib/cli/lint/internalLints/deleteFiles.js.map +7 -0
  97. package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +3 -0
  98. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +75 -0
  99. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +7 -0
  100. package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +11 -0
  101. package/lib/cli/lint/internalLints/refreshConfigFiles.js +147 -0
  102. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +7 -0
  103. package/lib/cli/test/index.js +0 -2
  104. package/lib/cli/test/index.js.map +2 -2
  105. package/lib/skuba.d.ts +1 -1
  106. package/lib/skuba.js.map +1 -1
  107. package/lib/utils/exec.d.ts +2 -1
  108. package/lib/utils/exec.js +1 -0
  109. package/lib/utils/exec.js.map +2 -2
  110. package/lib/utils/logging.d.ts +2 -0
  111. package/lib/utils/logging.js +1 -0
  112. package/lib/utils/logging.js.map +2 -2
  113. package/lib/utils/logo.js +6 -10
  114. package/lib/utils/logo.js.map +3 -3
  115. package/lib/utils/manifest.d.ts +1 -1
  116. package/lib/utils/manifest.js +1 -1
  117. package/lib/utils/manifest.js.map +2 -2
  118. package/lib/utils/npmrc.d.ts +1 -0
  119. package/lib/utils/npmrc.js +29 -0
  120. package/lib/utils/npmrc.js.map +7 -0
  121. package/lib/utils/packageManager.d.ts +24 -0
  122. package/lib/utils/packageManager.js +97 -0
  123. package/lib/utils/packageManager.js.map +7 -0
  124. package/lib/utils/template.d.ts +8 -5
  125. package/lib/utils/template.js +3 -1
  126. package/lib/utils/template.js.map +2 -2
  127. package/lib/utils/worker.d.ts +1 -0
  128. package/lib/wrapper/http.d.ts +1 -0
  129. package/package.json +47 -44
  130. package/template/base/_.dockerignore +0 -1
  131. package/template/base/_.eslintignore +1 -0
  132. package/template/base/_.gitignore +1 -1
  133. package/template/base/_.npmrc +8 -0
  134. package/template/express-rest-api/.buildkite/pipeline.yml +13 -10
  135. package/template/express-rest-api/.gantry/dev.yml +3 -0
  136. package/template/express-rest-api/.nvmrc +1 -1
  137. package/template/express-rest-api/Dockerfile +6 -12
  138. package/template/express-rest-api/Dockerfile.dev-deps +8 -7
  139. package/template/express-rest-api/README.md +6 -6
  140. package/template/express-rest-api/docker-compose.yml +0 -10
  141. package/template/express-rest-api/gantry.apply.yml +5 -0
  142. package/template/express-rest-api/gantry.build.yml +1 -2
  143. package/template/express-rest-api/package.json +4 -4
  144. package/template/express-rest-api/skuba.template.js +1 -0
  145. package/template/greeter/.buildkite/pipeline.yml +12 -9
  146. package/template/greeter/.nvmrc +1 -1
  147. package/template/greeter/Dockerfile +8 -7
  148. package/template/greeter/README.md +6 -6
  149. package/template/greeter/docker-compose.yml +0 -10
  150. package/template/greeter/package.json +3 -3
  151. package/template/greeter/skuba.template.js +1 -0
  152. package/template/koa-rest-api/.buildkite/pipeline.yml +13 -10
  153. package/template/koa-rest-api/.gantry/dev.yml +3 -0
  154. package/template/koa-rest-api/.nvmrc +1 -1
  155. package/template/koa-rest-api/Dockerfile +6 -12
  156. package/template/koa-rest-api/Dockerfile.dev-deps +8 -7
  157. package/template/koa-rest-api/README.md +6 -6
  158. package/template/koa-rest-api/docker-compose.yml +0 -10
  159. package/template/koa-rest-api/gantry.apply.yml +5 -0
  160. package/template/koa-rest-api/gantry.build.yml +1 -2
  161. package/template/koa-rest-api/package.json +10 -8
  162. package/template/koa-rest-api/skuba.template.js +1 -0
  163. package/template/koa-rest-api/src/framework/validation.test.ts +48 -15
  164. package/template/koa-rest-api/src/framework/validation.ts +31 -8
  165. package/template/koa-rest-api/src/testing/types.ts +16 -4
  166. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +21 -15
  167. package/template/lambda-sqs-worker/.nvmrc +1 -1
  168. package/template/lambda-sqs-worker/Dockerfile +8 -8
  169. package/template/lambda-sqs-worker/README.md +8 -8
  170. package/template/lambda-sqs-worker/_.npmrc +12 -0
  171. package/template/lambda-sqs-worker/docker-compose.yml +0 -15
  172. package/template/lambda-sqs-worker/package.json +6 -7
  173. package/template/lambda-sqs-worker/serverless.yml +5 -2
  174. package/template/lambda-sqs-worker/skuba.template.js +1 -0
  175. package/template/lambda-sqs-worker/src/hooks.ts +1 -2
  176. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +42 -18
  177. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  178. package/template/lambda-sqs-worker-cdk/Dockerfile +11 -9
  179. package/template/lambda-sqs-worker-cdk/cdk.json +12 -6
  180. package/template/lambda-sqs-worker-cdk/docker-compose.yml +0 -15
  181. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +1590 -228
  182. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +23 -3
  183. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +128 -15
  184. package/template/lambda-sqs-worker-cdk/package.json +9 -7
  185. package/template/lambda-sqs-worker-cdk/shared/context-types.ts +1 -0
  186. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -0
  187. package/template/lambda-sqs-worker-cdk/src/app.ts +14 -1
  188. package/template/lambda-sqs-worker-cdk/src/postHook.ts +154 -0
  189. package/template/lambda-sqs-worker-cdk/src/preHook.ts +95 -0
  190. package/template/oss-npm-package/.github/workflows/release.yml +10 -7
  191. package/template/oss-npm-package/.github/workflows/validate.yml +10 -7
  192. package/template/oss-npm-package/.nvmrc +1 -1
  193. package/template/oss-npm-package/.releaserc +16 -0
  194. package/template/oss-npm-package/README.md +17 -17
  195. package/template/oss-npm-package/_package.json +3 -2
  196. package/template/oss-npm-package/skuba.template.js +1 -0
  197. package/template/private-npm-package/.nvmrc +1 -1
  198. package/template/private-npm-package/.releaserc +16 -0
  199. package/template/private-npm-package/README.md +16 -16
  200. package/template/private-npm-package/_package.json +3 -3
  201. package/template/private-npm-package/skuba.template.js +1 -0
  202. package/lib/cli/configure/addEmptyExports.js.map +0 -7
  203. package/lib/cli/configure/modules/tsconfig.d.ts +0 -2
  204. package/lib/cli/configure/modules/tsconfig.js +0 -87
  205. package/lib/cli/configure/modules/tsconfig.js.map +0 -7
  206. package/lib/cli/configure/patchDockerfile.d.ts +0 -1
  207. package/lib/cli/configure/patchDockerfile.js.map +0 -7
  208. package/lib/cli/configure/patchServerListener.d.ts +0 -3
  209. package/lib/cli/configure/patchServerListener.js.map +0 -7
  210. package/lib/cli/configure/refreshIgnoreFiles.d.ts +0 -3
  211. package/lib/cli/configure/refreshIgnoreFiles.js +0 -78
  212. package/lib/cli/configure/refreshIgnoreFiles.js.map +0 -7
@@ -0,0 +1,102 @@
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 deleteFiles_exports = {};
30
+ __export(deleteFiles_exports, {
31
+ deleteFilesLint: () => deleteFilesLint
32
+ });
33
+ module.exports = __toCommonJS(deleteFiles_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_util = require("util");
36
+ var import_fs_extra = require("fs-extra");
37
+ var import_packageManager = require("../../../utils/packageManager");
38
+ const AUTOFIX_DELETE_FILES = [
39
+ // Try to delete this SEEK-Jobs/gutenberg automation file that may have been
40
+ // accidentally committed in old versions of skuba.
41
+ "Dockerfile-incunabulum"
42
+ ];
43
+ const deleteFilesLint = async (mode, logger) => {
44
+ const dir = process.cwd();
45
+ const toDelete = (await Promise.all(
46
+ AUTOFIX_DELETE_FILES.map(
47
+ async (filename) => [filename, await (0, import_fs_extra.pathExists)(import_path.default.join(dir, filename))]
48
+ )
49
+ )).filter(([, exists]) => exists).map(([filename]) => filename);
50
+ if (mode === "format") {
51
+ if (toDelete.length === 0) {
52
+ return { ok: true, fixable: false };
53
+ }
54
+ try {
55
+ await Promise.all(
56
+ toDelete.map((filename) => {
57
+ logger.warn(`Deleting ${logger.bold(filename)}.`);
58
+ return (0, import_fs_extra.rm)(import_path.default.join(dir, filename), { force: true });
59
+ })
60
+ );
61
+ return {
62
+ ok: true,
63
+ fixable: false
64
+ };
65
+ } catch (err) {
66
+ logger.warn(logger.bold("Failed to delete files."));
67
+ logger.subtle((0, import_util.inspect)(err));
68
+ return {
69
+ ok: true,
70
+ // It's not really a huge deal if we can't delete these files
71
+ fixable: false
72
+ };
73
+ }
74
+ }
75
+ if (toDelete.length) {
76
+ const packageManager = await (0, import_packageManager.detectPackageManager)();
77
+ logger.warn(
78
+ `Some files should be deleted. Run ${logger.bold(
79
+ packageManager.exec,
80
+ "skuba",
81
+ "format"
82
+ )} to delete them. ${logger.dim("delete-files")}`
83
+ );
84
+ return {
85
+ ok: false,
86
+ fixable: true,
87
+ annotations: toDelete.map((filename) => ({
88
+ path: filename,
89
+ message: "This file should be deleted."
90
+ }))
91
+ };
92
+ }
93
+ return {
94
+ ok: true,
95
+ fixable: false
96
+ };
97
+ };
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ deleteFilesLint
101
+ });
102
+ //# sourceMappingURL=deleteFiles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/cli/lint/internalLints/deleteFiles.ts"],
4
+ "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { pathExists, rm } from 'fs-extra';\n\nimport type { Logger } from '../../../utils/logging';\nimport { detectPackageManager } from '../../../utils/packageManager';\nimport type { InternalLintResult } from '../internal';\n\nconst AUTOFIX_DELETE_FILES = [\n // Try to delete this SEEK-Jobs/gutenberg automation file that may have been\n // accidentally committed in old versions of skuba.\n 'Dockerfile-incunabulum',\n];\n\nexport const deleteFilesLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n const dir = process.cwd();\n\n const toDelete = (\n await Promise.all(\n AUTOFIX_DELETE_FILES.map(\n async (filename) =>\n [filename, await pathExists(path.join(dir, filename))] as const,\n ),\n )\n )\n .filter(([, exists]) => exists)\n .map(([filename]) => filename);\n\n if (mode === 'format') {\n if (toDelete.length === 0) {\n return { ok: true, fixable: false };\n }\n\n try {\n await Promise.all(\n toDelete.map((filename) => {\n logger.warn(`Deleting ${logger.bold(filename)}.`);\n return rm(path.join(dir, filename), { force: true });\n }),\n );\n\n return {\n ok: true,\n fixable: false,\n };\n } catch (err) {\n logger.warn(logger.bold('Failed to delete files.'));\n logger.subtle(inspect(err));\n\n return {\n ok: true, // It's not really a huge deal if we can't delete these files\n fixable: false,\n };\n }\n }\n\n if (toDelete.length) {\n const packageManager = await detectPackageManager();\n\n logger.warn(\n `Some files should be deleted. Run ${logger.bold(\n packageManager.exec,\n 'skuba',\n 'format',\n )} to delete them. ${logger.dim('delete-files')}`,\n );\n\n return {\n ok: false,\n fixable: true,\n annotations: toDelete.map((filename) => ({\n path: filename,\n message: 'This file should be deleted.',\n })),\n };\n }\n\n return {\n ok: true,\n fixable: false,\n };\n};\n"],
5
+ "mappings": ";;;;;;;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AA,MACF,CAAC,oBAAoB,OAAO,IAAI,cAAc,CAAC;AAAA,IACjD;AAEA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa,SAAS,IAAI,CAAC,cAAc;AAAA,QACvC,MAAM;AAAA,QACN,SAAS;AAAA,MACX,EAAE;AAAA,IACJ;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,SAAS;AAAA,EACX;AACF;",
6
+ "names": ["path"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { Logger } from '../../../utils/logging';
2
+ import type { InternalLintResult } from '../internal';
3
+ export declare const noSkubaTemplateJs: (_mode: 'format' | 'lint', logger: Logger) => Promise<InternalLintResult>;
@@ -0,0 +1,75 @@
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 noSkubaTemplateJs_exports = {};
30
+ __export(noSkubaTemplateJs_exports, {
31
+ noSkubaTemplateJs: () => noSkubaTemplateJs
32
+ });
33
+ module.exports = __toCommonJS(noSkubaTemplateJs_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_fs_extra = require("fs-extra");
36
+ var import_manifest = require("../../../utils/manifest");
37
+ var import_packageManager = require("../../../utils/packageManager");
38
+ const noSkubaTemplateJs = async (_mode, logger) => {
39
+ const [manifest, packageManager] = await Promise.all([
40
+ (0, import_manifest.getConsumerManifest)(),
41
+ (0, import_packageManager.detectPackageManager)()
42
+ ]);
43
+ if (!manifest) {
44
+ return { ok: true, fixable: false };
45
+ }
46
+ const templateConfigPath = import_path.default.join(
47
+ import_path.default.dirname(manifest.path),
48
+ "skuba.template.js"
49
+ );
50
+ if (await (0, import_fs_extra.pathExists)(templateConfigPath)) {
51
+ logger.err(
52
+ `Template is incomplete; run ${logger.bold(
53
+ packageManager.exec,
54
+ "skuba",
55
+ "configure"
56
+ )}. ${logger.dim("no-skuba-template-js")}`
57
+ );
58
+ return {
59
+ ok: false,
60
+ fixable: false,
61
+ annotations: [
62
+ {
63
+ path: "skuba.template.js",
64
+ message: `Template is incomplete; run ${packageManager.exec} skuba configure.`
65
+ }
66
+ ]
67
+ };
68
+ }
69
+ return { ok: true, fixable: false };
70
+ };
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ noSkubaTemplateJs
74
+ });
75
+ //# sourceMappingURL=noSkubaTemplateJs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/cli/lint/internalLints/noSkubaTemplateJs.ts"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport { pathExists } from 'fs-extra';\n\nimport type { Logger } from '../../../utils/logging';\nimport { getConsumerManifest } from '../../../utils/manifest';\nimport { detectPackageManager } from '../../../utils/packageManager';\nimport type { InternalLintResult } from '../internal';\n\nexport const noSkubaTemplateJs = async (\n _mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n const [manifest, packageManager] = await Promise.all([\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n // This will throw elsewhere\n return { ok: true, fixable: false };\n }\n\n const templateConfigPath = path.join(\n path.dirname(manifest.path),\n 'skuba.template.js',\n );\n\n if (await pathExists(templateConfigPath)) {\n logger.err(\n `Template is incomplete; run ${logger.bold(\n packageManager.exec,\n 'skuba',\n 'configure',\n )}. ${logger.dim('no-skuba-template-js')}`,\n );\n\n return {\n ok: false,\n fixable: false,\n annotations: [\n {\n path: 'skuba.template.js',\n message: `Template is incomplete; run ${packageManager.exec} skuba configure.`,\n },\n ],\n };\n }\n\n return { ok: true, fixable: false };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAA2B;AAG3B,sBAAoC;AACpC,4BAAqC;AAG9B,MAAM,oBAAoB,OAC/B,OACA,WACgC;AAChC,QAAM,CAAC,UAAU,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,QACnD,qCAAoB;AAAA,QACpB,4CAAqB;AAAA,EACvB,CAAC;AAED,MAAI,CAAC,UAAU;AAEb,WAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AAAA,EACpC;AAEA,QAAM,qBAAqB,YAAAA,QAAK;AAAA,IAC9B,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,UAAM,4BAAW,kBAAkB,GAAG;AACxC,WAAO;AAAA,MACL,+BAA+B,OAAO;AAAA,QACpC,eAAe;AAAA,QACf;AAAA,QACA;AAAA,MACF,CAAC,KAAK,OAAO,IAAI,sBAAsB,CAAC;AAAA,IAC1C;AAEA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,QACX;AAAA,UACE,MAAM;AAAA,UACN,SAAS,+BAA+B,eAAe,IAAI;AAAA,QAC7D;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AACpC;",
6
+ "names": ["path"]
7
+ }
@@ -0,0 +1,11 @@
1
+ import type { Logger } from '../../../utils/logging';
2
+ import type { InternalLintResult } from '../internal';
3
+ export declare const refreshConfigFiles: (mode: 'format' | 'lint', logger: Logger) => Promise<{
4
+ ok: boolean;
5
+ fixable: boolean;
6
+ annotations: {
7
+ path: string;
8
+ message: string;
9
+ }[];
10
+ }>;
11
+ export declare const tryRefreshConfigFiles: (mode: 'format' | 'lint', logger: Logger) => Promise<InternalLintResult>;
@@ -0,0 +1,147 @@
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 refreshConfigFiles_exports = {};
30
+ __export(refreshConfigFiles_exports, {
31
+ refreshConfigFiles: () => refreshConfigFiles,
32
+ tryRefreshConfigFiles: () => tryRefreshConfigFiles
33
+ });
34
+ module.exports = __toCommonJS(refreshConfigFiles_exports);
35
+ var import_path = __toESM(require("path"));
36
+ var import_util = require("util");
37
+ var import_fs_extra = require("fs-extra");
38
+ var import_strip_ansi = __toESM(require("strip-ansi"));
39
+ var import_npmrc = require("../../../utils/npmrc");
40
+ var import_packageManager = require("../../../utils/packageManager");
41
+ var import_template = require("../../../utils/template");
42
+ var import_package = require("../../configure/analysis/package");
43
+ var import_project = require("../../configure/analysis/project");
44
+ var import_ignoreFile = require("../../configure/processing/ignoreFile");
45
+ const ensureNoAuthToken = (fileContents) => fileContents.split("\n").filter((line) => !(0, import_npmrc.hasNpmrcSecret)(line)).join("\n");
46
+ const REFRESHABLE_CONFIG_FILES = [
47
+ { name: ".eslintignore" },
48
+ { name: ".gitignore" },
49
+ { name: ".prettierignore" },
50
+ {
51
+ name: ".npmrc",
52
+ additionalMapping: ensureNoAuthToken,
53
+ if: (packageManager) => packageManager.command === "pnpm"
54
+ }
55
+ ];
56
+ const refreshConfigFiles = async (mode, logger) => {
57
+ const manifest = await (0, import_package.getDestinationManifest)();
58
+ const destinationRoot = import_path.default.dirname(manifest.path);
59
+ const readDestinationFile = (0, import_project.createDestinationFileReader)(destinationRoot);
60
+ const refreshConfigFile = async (filename, packageManager2, additionalMapping = (s) => s, condition = () => true) => {
61
+ if (!condition(packageManager2)) {
62
+ return { needsChange: false };
63
+ }
64
+ const [inputFile, templateFile] = await Promise.all([
65
+ readDestinationFile(filename),
66
+ (0, import_template.readBaseTemplateFile)(`_${filename}`)
67
+ ]);
68
+ const data = additionalMapping(
69
+ inputFile ? (0, import_ignoreFile.mergeWithIgnoreFile)(templateFile)(inputFile) : templateFile,
70
+ packageManager2
71
+ );
72
+ const filepath = import_path.default.join(destinationRoot, filename);
73
+ if (mode === "format") {
74
+ if (data === inputFile) {
75
+ return { needsChange: false };
76
+ }
77
+ await (0, import_fs_extra.writeFile)(filepath, data);
78
+ return {
79
+ needsChange: false,
80
+ msg: `Refreshed ${logger.bold(filename)}.`,
81
+ filename
82
+ };
83
+ }
84
+ if (data !== inputFile) {
85
+ return {
86
+ needsChange: true,
87
+ msg: `The ${logger.bold(
88
+ filename
89
+ )} file is out of date. Run \`${logger.bold(
90
+ packageManager2.exec,
91
+ "skuba",
92
+ "format"
93
+ )}\` to update it.`,
94
+ filename
95
+ };
96
+ }
97
+ return { needsChange: false };
98
+ };
99
+ const packageManager = await (0, import_packageManager.detectPackageManager)(destinationRoot);
100
+ const results = await Promise.all(
101
+ REFRESHABLE_CONFIG_FILES.map(
102
+ (conf) => refreshConfigFile(
103
+ conf.name,
104
+ packageManager,
105
+ conf.additionalMapping,
106
+ conf.if
107
+ )
108
+ )
109
+ );
110
+ results.forEach((result) => {
111
+ if (result.msg) {
112
+ logger.warn(result.msg, logger.dim("refresh-config-files"));
113
+ }
114
+ });
115
+ const anyNeedChanging = results.some(({ needsChange }) => needsChange);
116
+ return {
117
+ ok: !anyNeedChanging,
118
+ fixable: anyNeedChanging,
119
+ annotations: results.flatMap(
120
+ ({ needsChange, filename, msg }) => needsChange && msg ? [
121
+ {
122
+ path: filename,
123
+ message: (0, import_strip_ansi.default)(msg)
124
+ }
125
+ ] : []
126
+ )
127
+ };
128
+ };
129
+ const tryRefreshConfigFiles = async (mode, logger) => {
130
+ try {
131
+ return await refreshConfigFiles(mode, logger);
132
+ } catch (err) {
133
+ logger.warn("Failed to refresh config files.");
134
+ logger.subtle((0, import_util.inspect)(err));
135
+ return {
136
+ ok: false,
137
+ fixable: false,
138
+ annotations: []
139
+ };
140
+ }
141
+ };
142
+ // Annotate the CommonJS export names for ESM import in node:
143
+ 0 && (module.exports = {
144
+ refreshConfigFiles,
145
+ tryRefreshConfigFiles
146
+ });
147
+ //# sourceMappingURL=refreshConfigFiles.js.map
@@ -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;AAC5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-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
  }
@@ -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);
@@ -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 { concurrentlyErrorsSchema, 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 = 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;AAEpB,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;AAC9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C;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,GACxC;AACA,WAAK,KAAK,KAAK;AAAA,IACjB;AAEA,aAAS;AAAA,EACX;AACF;AAEA,MAAM,0BAA0B,cAAAA,QAAO,UAAU;AAAA,EAC/C,WACE,OACA,WACA,UACA;AACA,UAAM,MAAM,OAAO,KAAK,KAAK,EAAE,SAAS;AAGxC,QAAI,CAAC,IAAI,WAAW,iBAAiB,GAAG;AACtC,WAAK,KAAK,KAAK;AAAA,IACjB;AAEA,aAAS;AAAA,EACX;AACF;AAsCA,MAAM,cAAc;AAAA,EAClB,UAAM,oBAAAC,SAAW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A,QAErC;AAAA;AAAA,QAGA,QAAQ;AAAA,MACV;AAAA,IACF,EAAE;AAAA,EACJ,SAAS,KAAK;AACZ,UAAM,SAAS,sCAAyB,UAAU,GAAG;AAErD,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM;AAAA,IACR;AAEA,UAAM,SAAS,OAAO,KACnB,OAAO,CAAC,EAAE,SAAS,MAAM,aAAa,CAAC,EACvC,KAAK,CAAC,EAAE,OAAO,OAAO,GAAG,EAAE,OAAO,OAAO,MAAM,SAAS,MAAM,EAC9D,IAAI,CAAC,eAAe,WAAW,QAAQ,IAAI;AAE9C,UAAM;AAAA,MACJ,GAAG,OAAO,KAAK,IAAI,CAAC,cAClB,OAAO,WAAW,IAAI,KAAK,IAC7B;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;",
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
  }
@@ -4,7 +4,7 @@ export type ProjectType = z.infer<typeof projectTypeSchema>;
4
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>;
@@ -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;