@solid-stack/builder 1.0.6 → 1.0.7

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 (257) hide show
  1. package/dist/bin.js +3430 -3
  2. package/dist/bin.js.map +1 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/commands/check/handler.d.ts.map +1 -1
  5. package/dist/commands/mesh/command.d.ts.map +1 -1
  6. package/dist/commands/mesh/commands/check/handler.d.ts +2 -2
  7. package/dist/commands/mesh/commands/check/handler.d.ts.map +1 -1
  8. package/dist/commands/mesh/commands/down/command.d.ts +3 -0
  9. package/dist/commands/mesh/commands/down/command.d.ts.map +1 -0
  10. package/dist/commands/mesh/commands/down/handler.d.ts +3 -0
  11. package/dist/commands/mesh/commands/down/handler.d.ts.map +1 -0
  12. package/dist/commands/mesh/commands/up/command.d.ts.map +1 -1
  13. package/dist/commands/mesh/commands/up/handler.d.ts.map +1 -1
  14. package/dist/commands/prune/command.d.ts +3 -0
  15. package/dist/commands/prune/command.d.ts.map +1 -0
  16. package/dist/commands/prune/handler.d.ts +5 -0
  17. package/dist/commands/prune/handler.d.ts.map +1 -0
  18. package/dist/commands/service/command.d.ts.map +1 -1
  19. package/dist/commands/service/commands/down/command.d.ts +3 -0
  20. package/dist/commands/service/commands/down/command.d.ts.map +1 -0
  21. package/dist/commands/service/commands/down/handler.d.ts +3 -0
  22. package/dist/commands/service/commands/down/handler.d.ts.map +1 -0
  23. package/dist/commands/service/commands/up/command.d.ts.map +1 -1
  24. package/dist/commands/service/commands/up/handler.d.ts +1 -1
  25. package/dist/commands/service/commands/up/handler.d.ts.map +1 -1
  26. package/dist/core/RunOptions.d.ts +2 -0
  27. package/dist/core/RunOptions.d.ts.map +1 -1
  28. package/dist/core/checkers/checkComposeContract.d.ts.map +1 -1
  29. package/dist/core/checkers/checkDockerfile.d.ts.map +1 -1
  30. package/dist/core/checkers/checkDockerfileContract.d.ts.map +1 -1
  31. package/dist/core/checkers/checkInfra.d.ts.map +1 -1
  32. package/dist/core/checkers/checkYamlFiles.d.ts.map +1 -1
  33. package/dist/core/checkers/constants.d.ts +3 -0
  34. package/dist/core/checkers/constants.d.ts.map +1 -0
  35. package/dist/core/checkers/explainComposeMergeFailure.d.ts.map +1 -1
  36. package/dist/core/checkers/runStep.d.ts +2 -1
  37. package/dist/core/checkers/runStep.d.ts.map +1 -1
  38. package/dist/core/compileEnvironment.d.ts.map +1 -1
  39. package/dist/core/composeCleanup.d.ts +9 -0
  40. package/dist/core/composeCleanup.d.ts.map +1 -0
  41. package/dist/core/mesh/MeshRunOptions.d.ts +10 -4
  42. package/dist/core/mesh/MeshRunOptions.d.ts.map +1 -1
  43. package/dist/core/mesh/checkers/checkMesh.d.ts +1 -1
  44. package/dist/core/mesh/checkers/checkMesh.d.ts.map +1 -1
  45. package/dist/core/mesh/checkers/checkMeshJson.d.ts.map +1 -1
  46. package/dist/core/mesh/checkers/checkMeshServices.d.ts.map +1 -1
  47. package/dist/core/mesh/checkers/checkMeshTester.d.ts.map +1 -1
  48. package/dist/core/mesh/compileMeshEnvironment.d.ts +2 -2
  49. package/dist/core/mesh/compileMeshEnvironment.d.ts.map +1 -1
  50. package/dist/core/mesh/getMeshJson.d.ts.map +1 -1
  51. package/dist/core/mesh/meshSchema.d.ts +353 -0
  52. package/dist/core/mesh/meshSchema.d.ts.map +1 -0
  53. package/dist/core/mesh/runners/runMeshDev.d.ts +1 -1
  54. package/dist/core/mesh/runners/runMeshDev.d.ts.map +1 -1
  55. package/dist/core/mesh/runners/runMeshProd.d.ts +1 -1
  56. package/dist/core/mesh/runners/runMeshProd.d.ts.map +1 -1
  57. package/dist/core/mesh/runners/runMeshTest.d.ts +1 -1
  58. package/dist/core/mesh/runners/runMeshTest.d.ts.map +1 -1
  59. package/dist/core/mesh/runners/runMeshTestE2e.d.ts +1 -1
  60. package/dist/core/mesh/runners/runMeshTestE2e.d.ts.map +1 -1
  61. package/dist/core/mesh/runners/runMeshTestUnit.d.ts +1 -1
  62. package/dist/core/mesh/runners/runMeshTestUnit.d.ts.map +1 -1
  63. package/dist/core/mesh/types.d.ts +32 -18
  64. package/dist/core/mesh/types.d.ts.map +1 -1
  65. package/dist/core/runCompose.d.ts +4 -1
  66. package/dist/core/runCompose.d.ts.map +1 -1
  67. package/dist/core/runners/runDev.d.ts +1 -1
  68. package/dist/core/runners/runDev.d.ts.map +1 -1
  69. package/dist/core/runners/runProd.d.ts +1 -1
  70. package/dist/core/runners/runProd.d.ts.map +1 -1
  71. package/dist/core/runners/runTest.d.ts +1 -1
  72. package/dist/core/runners/runTest.d.ts.map +1 -1
  73. package/dist/core/runners/runTestE2e.d.ts +1 -1
  74. package/dist/core/runners/runTestE2e.d.ts.map +1 -1
  75. package/dist/core/runners/runTestUnit.d.ts +1 -1
  76. package/dist/core/runners/runTestUnit.d.ts.map +1 -1
  77. package/dist/core/teardownCompose.d.ts +6 -1
  78. package/dist/core/teardownCompose.d.ts.map +1 -1
  79. package/dist/core/templates.d.ts.map +1 -1
  80. package/dist/errors/NotFoundError.d.ts +2 -2
  81. package/dist/errors/NotFoundError.d.ts.map +1 -1
  82. package/dist/errors/ScriptError.d.ts +6 -1
  83. package/dist/errors/ScriptError.d.ts.map +1 -1
  84. package/dist/index.d.ts +10 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +3429 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/templates/docker/docker-compose.dev.yml +4 -1
  89. package/dist/templates/docker/docker-compose.e2e.yml +3 -1
  90. package/dist/templates/docker/docker-compose.prod.yml +3 -1
  91. package/dist/templates/docker/docker-compose.standalone.yml +2 -1
  92. package/dist/templates/docker/docker-compose.test.yml +3 -1
  93. package/dist/types/index.d.ts +26 -10
  94. package/dist/types/index.d.ts.map +1 -1
  95. package/dist/utils/checkDependencies.d.ts.map +1 -1
  96. package/dist/utils/checkPortCollision.d.ts +4 -0
  97. package/dist/utils/checkPortCollision.d.ts.map +1 -0
  98. package/dist/utils/errorMessage.d.ts +2 -0
  99. package/dist/utils/errorMessage.d.ts.map +1 -0
  100. package/dist/utils/extractBuildDeps.d.ts.map +1 -1
  101. package/dist/utils/extractOverrides.d.ts.map +1 -1
  102. package/dist/utils/getBuildJson.d.ts.map +1 -1
  103. package/dist/utils/paths.d.ts +20 -0
  104. package/dist/utils/paths.d.ts.map +1 -0
  105. package/dist/utils/projectName.d.ts +20 -0
  106. package/dist/utils/projectName.d.ts.map +1 -0
  107. package/dist/utils/redactSecrets.d.ts +6 -0
  108. package/dist/utils/redactSecrets.d.ts.map +1 -0
  109. package/dist/utils/runState.d.ts +13 -0
  110. package/dist/utils/runState.d.ts.map +1 -0
  111. package/dist/utils/ymlMods/addDependenciesToAppService.d.ts.map +1 -1
  112. package/dist/utils/ymlMods/attachName.d.ts +3 -1
  113. package/dist/utils/ymlMods/attachName.d.ts.map +1 -1
  114. package/dist/utils/ymlMods/makeE2eDependOnApp.d.ts.map +1 -1
  115. package/dist/utils/ymlMods/normalizeDependsOn.d.ts +6 -0
  116. package/dist/utils/ymlMods/normalizeDependsOn.d.ts.map +1 -0
  117. package/dist/utils/ymlMods/renameServicesWithDependencies.d.ts.map +1 -1
  118. package/package.json +12 -6
  119. package/templates/docker/docker-compose.dev.yml +4 -1
  120. package/templates/docker/docker-compose.e2e.yml +3 -1
  121. package/templates/docker/docker-compose.prod.yml +3 -1
  122. package/templates/docker/docker-compose.standalone.yml +2 -1
  123. package/templates/docker/docker-compose.test.yml +3 -1
  124. package/dist/bin.cjs +0 -802
  125. package/dist/bin.cjs.map +0 -1
  126. package/dist/cli.js +0 -45
  127. package/dist/cli.js.map +0 -1
  128. package/dist/commands/check/command.js +0 -19
  129. package/dist/commands/check/command.js.map +0 -1
  130. package/dist/commands/check/handler.js +0 -7
  131. package/dist/commands/check/handler.js.map +0 -1
  132. package/dist/commands/checkInfra.d.ts +0 -8
  133. package/dist/commands/checkInfra.d.ts.map +0 -1
  134. package/dist/commands/checkInfra.js +0 -8
  135. package/dist/commands/checkInfra.js.map +0 -1
  136. package/dist/commands/mesh/command.js +0 -10
  137. package/dist/commands/mesh/command.js.map +0 -1
  138. package/dist/commands/mesh/commands/check/command.js +0 -21
  139. package/dist/commands/mesh/commands/check/command.js.map +0 -1
  140. package/dist/commands/mesh/commands/check/handler.js +0 -10
  141. package/dist/commands/mesh/commands/check/handler.js.map +0 -1
  142. package/dist/commands/mesh/commands/up/command.js +0 -28
  143. package/dist/commands/mesh/commands/up/command.js.map +0 -1
  144. package/dist/commands/mesh/commands/up/handler.js +0 -24
  145. package/dist/commands/mesh/commands/up/handler.js.map +0 -1
  146. package/dist/commands/service/command.js +0 -17
  147. package/dist/commands/service/command.js.map +0 -1
  148. package/dist/commands/service/commands/up/command.js +0 -26
  149. package/dist/commands/service/commands/up/command.js.map +0 -1
  150. package/dist/commands/service/commands/up/handler.js +0 -40
  151. package/dist/commands/service/commands/up/handler.js.map +0 -1
  152. package/dist/commands/service/commands/up/serviceUp.d.ts +0 -3
  153. package/dist/commands/service/commands/up/serviceUp.d.ts.map +0 -1
  154. package/dist/commands/service/commands/up/serviceUp.js +0 -62
  155. package/dist/commands/service/commands/up/serviceUp.js.map +0 -1
  156. package/dist/core/RunOptions.js +0 -2
  157. package/dist/core/RunOptions.js.map +0 -1
  158. package/dist/core/checkers/checkComposeContract.js +0 -29
  159. package/dist/core/checkers/checkComposeContract.js.map +0 -1
  160. package/dist/core/checkers/checkDockerfile.js +0 -19
  161. package/dist/core/checkers/checkDockerfile.js.map +0 -1
  162. package/dist/core/checkers/checkDockerfileContract.js +0 -18
  163. package/dist/core/checkers/checkDockerfileContract.js.map +0 -1
  164. package/dist/core/checkers/checkInfra.js +0 -16
  165. package/dist/core/checkers/checkInfra.js.map +0 -1
  166. package/dist/core/checkers/checkYamlFiles.js +0 -31
  167. package/dist/core/checkers/checkYamlFiles.js.map +0 -1
  168. package/dist/core/checkers/explainComposeMergeFailure.js +0 -63
  169. package/dist/core/checkers/explainComposeMergeFailure.js.map +0 -1
  170. package/dist/core/checkers/getDeclaredYamlFiles.js +0 -39
  171. package/dist/core/checkers/getDeclaredYamlFiles.js.map +0 -1
  172. package/dist/core/checkers/runStep.js +0 -32
  173. package/dist/core/checkers/runStep.js.map +0 -1
  174. package/dist/core/compileEnvironment.js +0 -110
  175. package/dist/core/compileEnvironment.js.map +0 -1
  176. package/dist/core/mesh/MeshRunOptions.js +0 -2
  177. package/dist/core/mesh/MeshRunOptions.js.map +0 -1
  178. package/dist/core/mesh/checkers/checkMesh.js +0 -15
  179. package/dist/core/mesh/checkers/checkMesh.js.map +0 -1
  180. package/dist/core/mesh/checkers/checkMeshJson.js +0 -19
  181. package/dist/core/mesh/checkers/checkMeshJson.js.map +0 -1
  182. package/dist/core/mesh/checkers/checkMeshServices.js +0 -29
  183. package/dist/core/mesh/checkers/checkMeshServices.js.map +0 -1
  184. package/dist/core/mesh/checkers/checkMeshTester.js +0 -59
  185. package/dist/core/mesh/checkers/checkMeshTester.js.map +0 -1
  186. package/dist/core/mesh/compileMeshEnvironment.js +0 -329
  187. package/dist/core/mesh/compileMeshEnvironment.js.map +0 -1
  188. package/dist/core/mesh/getMeshJson.js +0 -36
  189. package/dist/core/mesh/getMeshJson.js.map +0 -1
  190. package/dist/core/mesh/runners/runMeshDev.js +0 -25
  191. package/dist/core/mesh/runners/runMeshDev.js.map +0 -1
  192. package/dist/core/mesh/runners/runMeshProd.js +0 -25
  193. package/dist/core/mesh/runners/runMeshProd.js.map +0 -1
  194. package/dist/core/mesh/runners/runMeshTest.js +0 -48
  195. package/dist/core/mesh/runners/runMeshTest.js.map +0 -1
  196. package/dist/core/mesh/runners/runMeshTestE2e.js +0 -49
  197. package/dist/core/mesh/runners/runMeshTestE2e.js.map +0 -1
  198. package/dist/core/mesh/runners/runMeshTestUnit.js +0 -34
  199. package/dist/core/mesh/runners/runMeshTestUnit.js.map +0 -1
  200. package/dist/core/mesh/types.js +0 -2
  201. package/dist/core/mesh/types.js.map +0 -1
  202. package/dist/core/runCompose.js +0 -15
  203. package/dist/core/runCompose.js.map +0 -1
  204. package/dist/core/runDev.d.ts +0 -3
  205. package/dist/core/runDev.d.ts.map +0 -1
  206. package/dist/core/runDev.js +0 -17
  207. package/dist/core/runDev.js.map +0 -1
  208. package/dist/core/runProd.d.ts +0 -3
  209. package/dist/core/runProd.d.ts.map +0 -1
  210. package/dist/core/runProd.js +0 -17
  211. package/dist/core/runProd.js.map +0 -1
  212. package/dist/core/runTestE2e.d.ts +0 -3
  213. package/dist/core/runTestE2e.d.ts.map +0 -1
  214. package/dist/core/runTestE2e.js +0 -34
  215. package/dist/core/runTestE2e.js.map +0 -1
  216. package/dist/core/runTestUnit.d.ts +0 -3
  217. package/dist/core/runTestUnit.d.ts.map +0 -1
  218. package/dist/core/runTestUnit.js +0 -28
  219. package/dist/core/runTestUnit.js.map +0 -1
  220. package/dist/core/runners/runDev.js +0 -17
  221. package/dist/core/runners/runDev.js.map +0 -1
  222. package/dist/core/runners/runProd.js +0 -17
  223. package/dist/core/runners/runProd.js.map +0 -1
  224. package/dist/core/runners/runTest.js +0 -28
  225. package/dist/core/runners/runTest.js.map +0 -1
  226. package/dist/core/runners/runTestE2e.js +0 -34
  227. package/dist/core/runners/runTestE2e.js.map +0 -1
  228. package/dist/core/runners/runTestUnit.js +0 -28
  229. package/dist/core/runners/runTestUnit.js.map +0 -1
  230. package/dist/core/teardownCompose.js +0 -23
  231. package/dist/core/teardownCompose.js.map +0 -1
  232. package/dist/core/templates.js +0 -40
  233. package/dist/core/templates.js.map +0 -1
  234. package/dist/errors/NotFoundError.js +0 -9
  235. package/dist/errors/NotFoundError.js.map +0 -1
  236. package/dist/errors/ScriptError.js +0 -8
  237. package/dist/errors/ScriptError.js.map +0 -1
  238. package/dist/types/index.js +0 -2
  239. package/dist/types/index.js.map +0 -1
  240. package/dist/utils/checkDependencies.js +0 -9
  241. package/dist/utils/checkDependencies.js.map +0 -1
  242. package/dist/utils/extractBuildDeps.js +0 -32
  243. package/dist/utils/extractBuildDeps.js.map +0 -1
  244. package/dist/utils/extractOverrides.js +0 -28
  245. package/dist/utils/extractOverrides.js.map +0 -1
  246. package/dist/utils/getBuildJson.js +0 -39
  247. package/dist/utils/getBuildJson.js.map +0 -1
  248. package/dist/utils/ymlMods/addDependenciesToAppService.js +0 -16
  249. package/dist/utils/ymlMods/addDependenciesToAppService.js.map +0 -1
  250. package/dist/utils/ymlMods/attachName.js +0 -8
  251. package/dist/utils/ymlMods/attachName.js.map +0 -1
  252. package/dist/utils/ymlMods/makeE2eDependOnApp.js +0 -19
  253. package/dist/utils/ymlMods/makeE2eDependOnApp.js.map +0 -1
  254. package/dist/utils/ymlMods/renameServicesWithDependencies.js +0 -13
  255. package/dist/utils/ymlMods/renameServicesWithDependencies.js.map +0 -1
  256. package/dist/version.js +0 -12
  257. package/dist/version.js.map +0 -1
package/dist/bin.cjs DELETED
@@ -1,802 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- var commander = require('commander');
5
- var pc7 = require('picocolors');
6
- var child_process = require('child_process');
7
- var fs = require('fs');
8
- var path5 = require('path');
9
- var module$1 = require('module');
10
- var z2 = require('zod');
11
- var yaml = require('yaml');
12
- var url = require('url');
13
-
14
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
15
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
-
17
- var pc7__default = /*#__PURE__*/_interopDefault(pc7);
18
- var fs__default = /*#__PURE__*/_interopDefault(fs);
19
- var path5__default = /*#__PURE__*/_interopDefault(path5);
20
- var z2__default = /*#__PURE__*/_interopDefault(z2);
21
-
22
- // src/errors/ScriptError.ts
23
- var ScriptError = class extends Error {
24
- constructor(message) {
25
- super(message);
26
- this.name = "ScriptError";
27
- Object.setPrototypeOf(this, new.target.prototype);
28
- }
29
- };
30
-
31
- // src/commands/checkInfra.ts
32
- function findServiceDefiners(projectDir, serviceName) {
33
- const dirsToScan = [
34
- path5__default.default.join(projectDir, ".docker/core"),
35
- path5__default.default.join(projectDir, ".docker/mocks"),
36
- path5__default.default.join(projectDir, ".docker/overrides")
37
- ];
38
- const hits = [];
39
- for (const dir of dirsToScan) {
40
- if (!fs.existsSync(dir)) continue;
41
- for (const file of fs.readdirSync(dir)) {
42
- if (!file.endsWith(".yml") && !file.endsWith(".yaml")) continue;
43
- const filePath = path5__default.default.join(dir, file);
44
- const content = fs.readFileSync(filePath, "utf-8");
45
- const hasBlock = new RegExp(`^\\s{2}${serviceName}:\\s*$`, "m").test(content);
46
- if (!hasBlock) continue;
47
- const hasImageOrBuild = new RegExp(
48
- `^\\s{2}${serviceName}:[\\s\\S]*?^\\s{4,}(image|build):`,
49
- "m"
50
- ).test(content);
51
- hits.push(
52
- ` - ${filePath}${hasImageOrBuild ? " (defines image/build)" : " (no image/build here)"}`
53
- );
54
- }
55
- }
56
- return hits;
57
- }
58
- function explainComposeMergeFailure(projectDir, ctx, rawOutput) {
59
- const lines = [];
60
- const serviceMatch = rawOutput.match(
61
- /service "([^"]+)" has neither an image nor a build context specified/
62
- );
63
- const envMissingMatch = /env file .* not found|no such file or directory.*\.env/i.test(rawOutput);
64
- lines.push(`Environment : ${ctx.envName}`);
65
- lines.push(`Compose files merged :`);
66
- (ctx.filesUsed ?? []).filter((f) => f !== "-f").forEach((f) => lines.push(` - ${f}`));
67
- lines.push("");
68
- if (serviceMatch && serviceMatch[1]) {
69
- const serviceName = serviceMatch[1];
70
- lines.push(
71
- `ROOT CAUSE: Service "${serviceName}" is referenced in the merged stack above, but none of those`
72
- );
73
- lines.push(
74
- `files provide an "image:" or "build:" for it \u2014 Docker Compose cannot start it as-is.`
75
- );
76
- lines.push("");
77
- lines.push(
78
- `Every file under .docker/ that defines a "${serviceName}:" service block:`
79
- );
80
- const definers = findServiceDefiners(projectDir, serviceName);
81
- if (definers.length > 0) {
82
- definers.forEach((d) => lines.push(d));
83
- } else {
84
- lines.push(
85
- ` (none found \u2014 check spelling/indentation of "${serviceName}:" in your yml files)`
86
- );
87
- }
88
- } else if (envMissingMatch) {
89
- lines.push(`ROOT CAUSE: A referenced .env file could not be found.`);
90
- lines.push("");
91
- lines.push("HOW TO FIX:");
92
- lines.push(
93
- ` - Create the missing env file at the project root (e.g. .env.dev, .env.prod, .env.test)`
94
- );
95
- } else {
96
- lines.push(
97
- "Docker Compose failed to resolve this merged stack. Common causes:"
98
- );
99
- lines.push(
100
- ` - A "\${VAR}" substitution with no default and no value set in the shell or an env_file.`
101
- );
102
- lines.push(` - A YAML syntax error in one of the files listed above.`);
103
- lines.push(` - A duplicate or conflicting key across two merged files.`);
104
- }
105
- lines.push("");
106
- lines.push("Raw Docker Compose / Conftest output:");
107
- lines.push("-".repeat(60));
108
- lines.push(rawOutput.trim());
109
- lines.push("-".repeat(60));
110
- return lines.join("\n");
111
- }
112
- function runStep(command, projectDir, ctx) {
113
- const result = child_process.spawnSync(command, {
114
- shell: true,
115
- cwd: projectDir,
116
- stdio: ["inherit", "pipe", "pipe"],
117
- encoding: "utf-8"
118
- });
119
- const stdout = result.stdout ?? "";
120
- const stderr = result.stderr ?? "";
121
- if (stdout) process.stdout.write(stdout);
122
- if (stderr) process.stderr.write(stderr);
123
- if (result.status !== 0) {
124
- console.error("\n" + "=".repeat(60));
125
- console.error(pc7__default.default.red(`\u{1F6A8} INFRASTRUCTURE CHECK FAILED \u{1F6A8}`));
126
- console.error("=".repeat(60));
127
- console.error(`Failed Step : ${ctx.stepName}`);
128
- if (ctx.targetFile) {
129
- console.error(`Target File : ${ctx.targetFile} <-- FIX THIS FILE`);
130
- }
131
- console.error("=".repeat(60));
132
- if (ctx.envName) {
133
- console.error("\n" + explainComposeMergeFailure(projectDir, ctx, stdout + stderr));
134
- }
135
- console.error("");
136
- throw new ScriptError(`Infrastructure check failed at step: ${ctx.stepName}`);
137
- }
138
- }
139
- function checkInfra(projectDir = process.cwd()) {
140
- const dockerfilePath = path5__default.default.join(projectDir, "Dockerfile");
141
- if (!fs.existsSync(dockerfilePath)) {
142
- console.log(pc7__default.default.yellow("\u26A0\uFE0F No Dockerfile found in project directory. Skipping Dockerfile checks."));
143
- return;
144
- }
145
- console.log(pc7__default.default.cyan("\n\u{1F50D} 1. Linting Dockerfile..."));
146
- runStep(
147
- "docker run --rm -i hadolint/hadolint hadolint --failure-threshold error - < Dockerfile",
148
- projectDir,
149
- { stepName: "Dockerfile Linting", targetFile: "Dockerfile" }
150
- );
151
- const policyDockerfileDir = path5__default.default.join(projectDir, "policy/dockerfile");
152
- if (fs.existsSync(policyDockerfileDir)) {
153
- console.log(pc7__default.default.cyan("\n\u{1F50D} 2. Validating Dockerfile Contract..."));
154
- runStep(
155
- `docker run --rm -v "${projectDir}:/project" -w /project openpolicyagent/conftest test Dockerfile -p policy/dockerfile/`,
156
- projectDir,
157
- { stepName: "Dockerfile Contract", targetFile: "Dockerfile" }
158
- );
159
- }
160
- console.log(pc7__default.default.green("\n\u2705 All infrastructure and contract checks passed.\n"));
161
- }
162
- var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bin.cjs', document.baseURI).href)));
163
- var pkg = require2("../package.json");
164
- var packageSchema = z2.z.object({
165
- version: z2.z.string().min(1, "Version string cannot be empty")
166
- });
167
- var parsedPkg = packageSchema.parse(pkg);
168
- var version = parsedPkg.version;
169
- var extractBuildDeps = (buildJson, projectDir = process.cwd()) => {
170
- if (!buildJson || typeof buildJson !== "object") {
171
- return [];
172
- }
173
- if (!("dependencies" in buildJson) || !buildJson.dependencies) {
174
- return [];
175
- }
176
- const schema = z2__default.default.object({
177
- dependencies: z2__default.default.record(
178
- z2__default.default.string(),
179
- z2__default.default.object({
180
- path: z2__default.default.string(),
181
- service: z2__default.default.string()
182
- })
183
- )
184
- });
185
- const result = schema.safeParse(buildJson);
186
- if (!result.success) {
187
- throw new ScriptError(
188
- `Invalid build.json structure for dependencies: ${result.error.message}`
189
- );
190
- }
191
- const dependenciesData = result.data.dependencies;
192
- const dependencies = Object.entries(dependenciesData || {}).map(
193
- ([name, service]) => {
194
- return {
195
- path: path5__default.default.resolve(projectDir, service.path),
196
- name,
197
- serviceName: service.service
198
- };
199
- }
200
- );
201
- return dependencies;
202
- };
203
- var extractOverrides = (buildJson, projectDir = process.cwd()) => {
204
- if (!buildJson || typeof buildJson !== "object") {
205
- return {};
206
- }
207
- if (!("overrides" in buildJson) || !buildJson.overrides) {
208
- return {};
209
- }
210
- const schema = z2__default.default.object({
211
- overrides: z2__default.default.record(
212
- z2__default.default.string(),
213
- z2__default.default.object({
214
- path: z2__default.default.string()
215
- })
216
- )
217
- });
218
- const result = schema.safeParse(buildJson);
219
- if (!result.success) {
220
- throw new ScriptError(
221
- `Invalid build.json structure for overrides: ${result.error.message}`
222
- );
223
- }
224
- const resolvedOverrides = {};
225
- for (const [key, value] of Object.entries(result.data.overrides)) {
226
- resolvedOverrides[key] = {
227
- path: path5__default.default.resolve(projectDir, value.path)
228
- };
229
- }
230
- return resolvedOverrides;
231
- };
232
-
233
- // src/errors/NotFoundError.ts
234
- var NotFoundError = class extends ScriptError {
235
- constructor(message) {
236
- super(message);
237
- this.name = "NotFoundError";
238
- Object.setPrototypeOf(this, new.target.prototype);
239
- }
240
- };
241
-
242
- // src/utils/getBuildJson.ts
243
- var getBuildJson = (projectDir = process.cwd()) => {
244
- const buildJsonPath = path5__default.default.join(projectDir, "build.json");
245
- if (!fs.existsSync(buildJsonPath)) {
246
- throw new NotFoundError(
247
- `Build JSON file not found at ${buildJsonPath}. Please make sure build.json exists in the project root.`
248
- );
249
- }
250
- let buildJson;
251
- try {
252
- const rawData = fs.readFileSync(buildJsonPath, "utf-8");
253
- buildJson = JSON.parse(rawData);
254
- } catch (error) {
255
- throw new ScriptError(
256
- `Failed to parse build.json: ${error instanceof Error ? error.message : String(error)}`
257
- );
258
- }
259
- if (buildJson && typeof buildJson === "object" && "services" in buildJson) {
260
- const services = buildJson.services;
261
- if (services && typeof services === "object") {
262
- for (const serviceConfig of Object.values(services)) {
263
- if (serviceConfig && typeof serviceConfig === "object" && "depends_on" in serviceConfig) {
264
- const dependsOn = serviceConfig.depends_on;
265
- if (Array.isArray(dependsOn)) {
266
- serviceConfig.depends_on = dependsOn.reduce(
267
- (acc, dep) => {
268
- acc[dep] = { condition: "service_started" };
269
- return acc;
270
- },
271
- {}
272
- );
273
- }
274
- }
275
- }
276
- }
277
- }
278
- return buildJson;
279
- };
280
-
281
- // src/utils/ymlMods/addDependenciesToAppService.ts
282
- var addDependenciesToAppService = (yml, dependencies) => {
283
- if (!yml || !yml.services || !yml.services.app) {
284
- throw new ScriptError("Invalid YAML structure. Missing 'services.app' field.");
285
- }
286
- if (!dependencies || dependencies.length === 0) {
287
- return;
288
- }
289
- yml.services.app.depends_on = yml.services.app.depends_on || {};
290
- dependencies.forEach((dep) => {
291
- yml.services.app.depends_on[dep.name] = {
292
- condition: "service_healthy"
293
- };
294
- });
295
- };
296
-
297
- // src/utils/ymlMods/attachName.ts
298
- var attachName = (yml, buildJson) => {
299
- if (!yml) {
300
- throw new ScriptError("Invalid YAML structure. Missing 'yml' field.");
301
- }
302
- yml.name = buildJson.name || yml.name;
303
- };
304
-
305
- // src/utils/ymlMods/makeE2eDependOnApp.ts
306
- var makeE2eDependOnApp = (yml) => {
307
- if (!yml || !yml.services) {
308
- throw new ScriptError("Invalid YAML structure. Missing 'services' field.");
309
- }
310
- if (!yml.services.tester) {
311
- throw new ScriptError("Tester service not found");
312
- }
313
- if (!yml.services.app) {
314
- throw new ScriptError("App service not found");
315
- }
316
- yml.services.tester.depends_on = {
317
- ...yml.services.tester.depends_on,
318
- app: {
319
- condition: "service_healthy"
320
- }
321
- };
322
- };
323
-
324
- // src/utils/ymlMods/renameServicesWithDependencies.ts
325
- var renameServicesWithDependencies = (yml, dependencies) => {
326
- if (!yml || !yml.services) {
327
- throw new Error("Invalid YAML structure. Missing 'services' field.");
328
- }
329
- if (!dependencies || dependencies.length === 0) {
330
- return;
331
- }
332
- yml.services = Object.fromEntries(
333
- Object.entries(yml.services).map(([name, service]) => {
334
- const dependency = dependencies.find((d) => d.serviceName === name);
335
- return [dependency ? dependency.name : name, service];
336
- })
337
- );
338
- };
339
- var cachedTemplatesDir = null;
340
- function getTemplatesDir() {
341
- if (process.env.BUILDER_TEMPLATES_DIR && fs__default.default.existsSync(process.env.BUILDER_TEMPLATES_DIR)) {
342
- return process.env.BUILDER_TEMPLATES_DIR;
343
- }
344
- if (cachedTemplatesDir && fs__default.default.existsSync(cachedTemplatesDir)) {
345
- return cachedTemplatesDir;
346
- }
347
- const currentDir = typeof __dirname !== "undefined" ? __dirname : path5__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bin.cjs', document.baseURI).href))));
348
- const candidates = [
349
- // When executing compiled output in dist/ (e.g. dist/templates)
350
- path5__default.default.resolve(currentDir, "templates"),
351
- path5__default.default.resolve(currentDir, "../templates"),
352
- // When executing from src/ (e.g. src/core/templates.ts -> ../../templates)
353
- path5__default.default.resolve(currentDir, "../../templates"),
354
- // Fallback relative to cwd
355
- path5__default.default.resolve(process.cwd(), "templates")
356
- ];
357
- for (const cand of candidates) {
358
- if (fs__default.default.existsSync(cand) && fs__default.default.existsSync(path5__default.default.join(cand, "docker"))) {
359
- cachedTemplatesDir = cand;
360
- return cand;
361
- }
362
- }
363
- throw new Error(
364
- `Templates directory not found. Searched candidates:
365
- ${candidates.join("\n")}`
366
- );
367
- }
368
- function getDockerComposeTemplate(filename) {
369
- const templatesDir = getTemplatesDir();
370
- const filePath = path5__default.default.join(templatesDir, "docker", filename);
371
- if (!fs__default.default.existsSync(filePath)) {
372
- throw new Error(`Docker compose template not found: ${filePath}`);
373
- }
374
- return filePath;
375
- }
376
-
377
- // src/core/compileEnvironment.ts
378
- var compileEnvironment = (environment, projectDir = process.cwd()) => {
379
- const buildJson = getBuildJson(projectDir);
380
- const overrides = extractOverrides(buildJson, projectDir);
381
- const dependencies = extractBuildDeps(buildJson, projectDir);
382
- const baseComposePath = getDockerComposeTemplate("docker-compose.base.yml");
383
- const baseComposeDevPath = getDockerComposeTemplate("docker-compose.dev.yml");
384
- const baseComposeProdPath = getDockerComposeTemplate("docker-compose.prod.yml");
385
- const baseComposeTestPath = getDockerComposeTemplate("docker-compose.test.yml");
386
- const baseComposeE2ePath = getDockerComposeTemplate("docker-compose.e2e.yml");
387
- const baseComposeStandalonePath = getDockerComposeTemplate("docker-compose.standalone.yml");
388
- const projectName = buildJson.name || path5__default.default.basename(projectDir);
389
- const composeFlags = [
390
- "compose",
391
- "-p",
392
- projectName,
393
- "--project-directory",
394
- projectDir,
395
- "-f",
396
- baseComposePath
397
- ];
398
- const envFile = path5__default.default.resolve(projectDir, `.env.${environment}`);
399
- const hasEnvFile = fs.existsSync(envFile);
400
- switch (environment) {
401
- case "dev":
402
- if (hasEnvFile) {
403
- composeFlags.push("--env-file", envFile);
404
- }
405
- composeFlags.push("-f", baseComposeDevPath);
406
- if (overrides.dev) {
407
- composeFlags.push("-f", overrides.dev.path);
408
- }
409
- composeFlags.push("-f", baseComposeStandalonePath);
410
- break;
411
- case "test":
412
- if (hasEnvFile) {
413
- composeFlags.push("--env-file", envFile);
414
- }
415
- composeFlags.push("-f", baseComposeTestPath);
416
- if (overrides.test) {
417
- composeFlags.push("-f", overrides.test.path);
418
- }
419
- break;
420
- case "prod":
421
- if (hasEnvFile) {
422
- composeFlags.push("--env-file", envFile);
423
- }
424
- composeFlags.push("-f", baseComposeProdPath);
425
- if (overrides.prod) {
426
- composeFlags.push("-f", overrides.prod.path);
427
- }
428
- if (dependencies.length > 0) {
429
- composeFlags.push(...dependencies.flatMap((dep) => ["-f", dep.path]));
430
- }
431
- composeFlags.push("-f", baseComposeStandalonePath);
432
- break;
433
- case "e2e":
434
- if (hasEnvFile) {
435
- composeFlags.push("--env-file", envFile);
436
- }
437
- composeFlags.push("-f", baseComposeProdPath);
438
- if (overrides.prod) {
439
- composeFlags.push("-f", overrides.prod.path);
440
- }
441
- if (dependencies.length > 0) {
442
- composeFlags.push(...dependencies.flatMap((dep) => ["-f", dep.path]));
443
- }
444
- composeFlags.push("-f", baseComposeE2ePath);
445
- if (overrides.e2e) {
446
- composeFlags.push("-f", overrides.e2e.path);
447
- }
448
- break;
449
- }
450
- composeFlags.push("config");
451
- const result = child_process.spawnSync("docker", composeFlags, {
452
- cwd: projectDir,
453
- encoding: "utf-8"
454
- });
455
- if (result.error) {
456
- throw new ScriptError(
457
- `Failed to run docker compose: ${result.error.message}`
458
- );
459
- }
460
- if (result.status !== 0) {
461
- throw new ScriptError(
462
- `\u274C Failed to merge compose files:
463
- ${result.stderr || result.stdout}`
464
- );
465
- }
466
- const mergedYamlConfig = result.stdout;
467
- const yml = yaml.parse(mergedYamlConfig);
468
- if (environment === "prod" || environment === "e2e") {
469
- renameServicesWithDependencies(yml, dependencies);
470
- addDependenciesToAppService(yml, dependencies);
471
- }
472
- if (environment === "e2e") {
473
- makeE2eDependOnApp(yml);
474
- }
475
- attachName(yml, buildJson);
476
- const finalYamlConfig = yaml.stringify(yml);
477
- return finalYamlConfig;
478
- };
479
- function checkDependencies() {
480
- const dockerCheck = child_process.spawnSync("command -v docker", { shell: true });
481
- if (dockerCheck.status !== 0) {
482
- throw new ScriptError(
483
- "Error: docker is not installed or not in PATH. Please install Docker first."
484
- );
485
- }
486
- }
487
- function runCompose(args, yamlConfig, projectDir) {
488
- const runResult = child_process.spawnSync(
489
- "docker",
490
- ["compose", "--project-directory", projectDir, "-f", "-", ...args],
491
- {
492
- cwd: projectDir,
493
- input: yamlConfig,
494
- stdio: ["pipe", "inherit", "inherit"],
495
- encoding: "utf-8"
496
- }
497
- );
498
- if (runResult.error) {
499
- throw new ScriptError(
500
- `Failed to run docker compose: ${runResult.error.message}`
501
- );
502
- }
503
- return runResult.status ?? (runResult.error ? 1 : 0);
504
- }
505
- function teardownCompose(yamlConfig, projectDir) {
506
- const downResult = child_process.spawnSync(
507
- "docker",
508
- [
509
- "compose",
510
- "--project-directory",
511
- projectDir,
512
- "-f",
513
- "-",
514
- "down",
515
- "-v",
516
- "--remove-orphans"
517
- ],
518
- {
519
- cwd: projectDir,
520
- input: yamlConfig,
521
- stdio: ["pipe", "inherit", "inherit"],
522
- encoding: "utf-8"
523
- }
524
- );
525
- if (downResult.error) {
526
- console.error(
527
- pc7__default.default.red(`Failed to run docker compose down: ${downResult.error.message}`)
528
- );
529
- }
530
- }
531
-
532
- // src/core/runTestUnit.ts
533
- var runTestUnit = (options) => {
534
- console.log(pc7__default.default.bold(pc7__default.default.blue(`
535
- ========================================`)));
536
- console.log(pc7__default.default.bold(pc7__default.default.blue(`\u{1F9EA} STAGE: UNIT & ISOLATED TESTS`)));
537
- console.log(pc7__default.default.bold(pc7__default.default.blue(`========================================
538
- `)));
539
- const finalYamlConfig = compileEnvironment("test", options.projectDir);
540
- if (options.debug) {
541
- console.log(
542
- pc7__default.default.yellow("Final merged YAML configuration:\n"),
543
- finalYamlConfig
544
- );
545
- }
546
- let status = 0;
547
- try {
548
- status = runCompose(
549
- ["up", "--build", "--abort-on-container-exit"],
550
- finalYamlConfig,
551
- options.projectDir
552
- );
553
- } finally {
554
- teardownCompose(finalYamlConfig, options.projectDir);
555
- }
556
- if (status === 0) {
557
- console.log(pc7__default.default.bold(pc7__default.default.green(`
558
- \u2705 Unit tests passed successfully.
559
- `)));
560
- } else {
561
- console.error(pc7__default.default.red(`
562
- \u274C Unit tests failed with exit code ${status}.
563
- `));
564
- }
565
- return status;
566
- };
567
- var runTestE2e = (options) => {
568
- console.log(pc7__default.default.bold(pc7__default.default.blue(`
569
- ========================================`)));
570
- console.log(pc7__default.default.bold(pc7__default.default.blue(`\u{1F6A6} STAGE: INTEGRATED E2E TESTS`)));
571
- console.log(pc7__default.default.bold(pc7__default.default.blue(`========================================
572
- `)));
573
- const finalYamlConfig = compileEnvironment("e2e", options.projectDir);
574
- if (options.debug) {
575
- console.log(
576
- pc7__default.default.yellow("Final merged YAML configuration:\n"),
577
- finalYamlConfig
578
- );
579
- }
580
- let status = 0;
581
- try {
582
- status = runCompose(
583
- [
584
- "up",
585
- "--build",
586
- "--abort-on-container-exit",
587
- "--exit-code-from",
588
- "tester"
589
- ],
590
- finalYamlConfig,
591
- options.projectDir
592
- );
593
- } finally {
594
- teardownCompose(finalYamlConfig, options.projectDir);
595
- }
596
- if (status === 0) {
597
- console.log(pc7__default.default.bold(pc7__default.default.green(`
598
- \u2705 E2E tests passed successfully.
599
- `)));
600
- } else {
601
- console.error(pc7__default.default.red(`
602
- \u274C E2E tests failed with exit code ${status}.
603
- `));
604
- }
605
- return status;
606
- };
607
- var runDev = (options) => {
608
- console.log(pc7__default.default.cyan(`\u{1F680} Starting DEV environment...`));
609
- const finalYamlConfig = compileEnvironment("dev", options.projectDir);
610
- if (options.debug) {
611
- console.log(
612
- pc7__default.default.yellow("Final merged YAML configuration:\n"),
613
- finalYamlConfig
614
- );
615
- }
616
- const upArgs = ["up", "--build"];
617
- if (options.detach) {
618
- upArgs.push("-d");
619
- }
620
- const status = runCompose(upArgs, finalYamlConfig, options.projectDir);
621
- return status;
622
- };
623
- var runProd = (options) => {
624
- console.log(pc7__default.default.cyan(`\u{1F3ED} Starting PROD environment...`));
625
- const finalYamlConfig = compileEnvironment("prod", options.projectDir);
626
- if (options.debug) {
627
- console.log(
628
- pc7__default.default.yellow("Final merged YAML configuration:\n"),
629
- finalYamlConfig
630
- );
631
- }
632
- const upArgs = ["up", "--build"];
633
- if (options.detach) {
634
- upArgs.push("-d");
635
- }
636
- const status = runCompose(upArgs, finalYamlConfig, options.projectDir);
637
- return status;
638
- };
639
-
640
- // src/commands/service/commands/up/serviceUp.ts
641
- async function handleServiceUp(rawStage, options = {}) {
642
- const projectDir = options.projectDir || process.cwd();
643
- const stage = (rawStage || "dev").toLowerCase();
644
- checkDependencies();
645
- checkInfra(projectDir);
646
- const runOptions = {
647
- projectDir,
648
- debug: options.debug || false,
649
- detach: options.detach || false
650
- };
651
- if (stage === "dev") {
652
- const status = runDev(runOptions);
653
- return status;
654
- }
655
- if (stage === "prod") {
656
- const status = runProd(runOptions);
657
- return status;
658
- }
659
- if (stage === "test-unit") {
660
- const status = runTestUnit(runOptions);
661
- return status;
662
- }
663
- if (stage === "test-e2e") {
664
- const status = runTestE2e(runOptions);
665
- return status;
666
- }
667
- if (stage === "test") {
668
- console.log(pc7__default.default.bold(pc7__default.default.blue(`
669
- ========================================`)));
670
- console.log(pc7__default.default.bold(pc7__default.default.blue(`\u{1F9EA} [1/2] STAGE: UNIT & ISOLATED TESTS`)));
671
- console.log(pc7__default.default.bold(pc7__default.default.blue(`========================================
672
- `)));
673
- const unitStatus = runTestUnit(runOptions);
674
- if (unitStatus !== 0) {
675
- console.error(
676
- pc7__default.default.red(
677
- `
678
- \u274C [1/2] Unit tests failed with exit code ${unitStatus}. Aborting E2E tests.
679
- `
680
- )
681
- );
682
- return unitStatus;
683
- }
684
- console.log(
685
- pc7__default.default.bold(pc7__default.default.green(`
686
- \u2705 [1/2] Unit tests passed successfully.
687
- `))
688
- );
689
- console.log(pc7__default.default.bold(pc7__default.default.blue(`========================================`)));
690
- console.log(pc7__default.default.bold(pc7__default.default.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED E2E TESTS`)));
691
- console.log(pc7__default.default.bold(pc7__default.default.blue(`========================================
692
- `)));
693
- const e2eStatus = runTestE2e(runOptions);
694
- if (e2eStatus !== 0) {
695
- console.error(
696
- pc7__default.default.red(`
697
- \u274C [2/2] E2E tests failed with exit code ${e2eStatus}.
698
- `)
699
- );
700
- return e2eStatus;
701
- }
702
- console.log(
703
- pc7__default.default.bold(pc7__default.default.green(`
704
- \u2705 [2/2] E2E tests passed successfully.
705
- `))
706
- );
707
- console.log(
708
- pc7__default.default.bold(
709
- pc7__default.default.green(`\u{1F389} All test stages (unit + e2e) completed successfully!
710
- `)
711
- )
712
- );
713
- return 0;
714
- }
715
- throw new ScriptError(
716
- `Unknown environment stage: "${rawStage}". Supported stages: dev, prod, test, test-unit, test-e2e`
717
- );
718
- }
719
-
720
- // src/commands/service/commands/up/command.ts
721
- var registerUpCommand = (cmd) => {
722
- cmd.command("up [stage]").description(
723
- "Start or test a service environment (dev, prod, test, test-unit, test-e2e)"
724
- ).option("--skip-check", "Skip infrastructure and contract checks").option("--debug", "Output the merged Docker Compose YAML configuration").option("-d, --detach", "Run containers in the background").option(
725
- "--dry-run",
726
- "Preview generated compose configuration without starting containers"
727
- ).option(
728
- "-C, --project-dir <dir>",
729
- "Service project directory (defaults to cwd)"
730
- ).option("--unit", "Run only unit tests (when stage is test)").option("--e2e", "Run only e2e tests (when stage is test)").addHelpText(
731
- "after",
732
- `
733
- Examples:
734
- $ builder service up dev
735
- $ builder service up prod
736
- $ builder service up test`
737
- ).action(
738
- async (stage = "dev", options = {}) => {
739
- const exitCode = await handleServiceUp(stage, {
740
- projectDir: options.projectDir,
741
- debug: options.debug,
742
- detach: options.detach
743
- });
744
- if (exitCode !== 0) {
745
- process.exit(exitCode);
746
- }
747
- }
748
- );
749
- };
750
-
751
- // src/commands/service/command.ts
752
- var registerServiceCommand = (cmd) => {
753
- const service = cmd.command("service").description("Manage and run services");
754
- registerUpCommand(service);
755
- };
756
-
757
- // src/cli.ts
758
- function createCli() {
759
- const program = new commander.Command();
760
- program.name("builder").description("CLI build tool and orchestrator for Solid Stack services").version(version, "-v, --version", "Output the current version");
761
- registerServiceCommand(program);
762
- program.command("check").description("Run infrastructure and contract checks (hadolint, conftest)").option(
763
- "-C, --project-dir <dir>",
764
- "Service project directory (defaults to cwd)"
765
- ).action((options = {}) => {
766
- const projectDir = options.projectDir || process.cwd();
767
- checkInfra(projectDir);
768
- });
769
- return program;
770
- }
771
- async function runCli(argv = process.argv) {
772
- const cli = createCli();
773
- try {
774
- await cli.parseAsync(argv);
775
- } catch (err) {
776
- if (err?.code === "commander.helpDisplayed" || err?.code === "commander.version") {
777
- return;
778
- }
779
- if (err instanceof ScriptError) {
780
- console.error(pc7__default.default.red(`
781
- \u274C ${err.message}
782
- `));
783
- } else {
784
- const message = err instanceof Error ? err.message : String(err);
785
- console.error(pc7__default.default.red(`
786
- \u274C Error: ${message}
787
- `));
788
- }
789
- if (process.env.VITEST) {
790
- throw err;
791
- }
792
- process.exit(1);
793
- }
794
- }
795
-
796
- // src/bin.ts
797
- runCli().catch((err) => {
798
- console.error(err);
799
- process.exit(1);
800
- });
801
- //# sourceMappingURL=bin.cjs.map
802
- //# sourceMappingURL=bin.cjs.map