@qpqjs/cli 0.3.0 → 0.4.0

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 (284) hide show
  1. package/lib/commonjs/cli/commandMenu.js +5 -4
  2. package/lib/commonjs/cli/commandMenu.js.map +1 -1
  3. package/lib/commonjs/cli/runCli.js +15 -7
  4. package/lib/commonjs/cli/runCli.js.map +1 -1
  5. package/lib/commonjs/commands/checkCircular.js +15 -7
  6. package/lib/commonjs/commands/checkCircular.js.map +1 -1
  7. package/lib/commonjs/commands/clearResources.js +8 -14
  8. package/lib/commonjs/commands/clearResources.js.map +1 -1
  9. package/lib/commonjs/commands/go.js +3 -7
  10. package/lib/commonjs/commands/go.js.map +1 -1
  11. package/lib/commonjs/commands/goDev.js +4 -2
  12. package/lib/commonjs/commands/goDev.js.map +1 -1
  13. package/lib/commonjs/commands/goDevApi.js +23 -20
  14. package/lib/commonjs/commands/goDevApi.js.map +1 -1
  15. package/lib/commonjs/commands/goDevWeb.js +13 -8
  16. package/lib/commonjs/commands/goDevWeb.js.map +1 -1
  17. package/lib/commonjs/commands/goDocker.js +10 -13
  18. package/lib/commonjs/commands/goDocker.js.map +1 -1
  19. package/lib/commonjs/commands/hooks.js +4 -2
  20. package/lib/commonjs/commands/hooks.js.map +1 -1
  21. package/lib/commonjs/commands/migrate.js +11 -9
  22. package/lib/commonjs/commands/migrate.js.map +1 -1
  23. package/lib/commonjs/commands/prep.js +4 -2
  24. package/lib/commonjs/commands/prep.js.map +1 -1
  25. package/lib/commonjs/commands/publish.js +4 -7
  26. package/lib/commonjs/commands/publish.js.map +1 -1
  27. package/lib/commonjs/commands/scriptBuild.js +7 -5
  28. package/lib/commonjs/commands/scriptBuild.js.map +1 -1
  29. package/lib/commonjs/commands/scriptBuilderLayer.js +6 -4
  30. package/lib/commonjs/commands/scriptBuilderLayer.js.map +1 -1
  31. package/lib/commonjs/commands/scriptNew.js +7 -5
  32. package/lib/commonjs/commands/scriptNew.js.map +1 -1
  33. package/lib/commonjs/commands/setup.js +14 -22
  34. package/lib/commonjs/commands/setup.js.map +1 -1
  35. package/lib/commonjs/commands/synth.js +16 -20
  36. package/lib/commonjs/commands/synth.js.map +1 -1
  37. package/lib/commonjs/commands/teardown.js +8 -14
  38. package/lib/commonjs/commands/teardown.js.map +1 -1
  39. package/lib/commonjs/lib/CliError.d.ts +4 -0
  40. package/lib/commonjs/lib/CliError.js +14 -0
  41. package/lib/commonjs/lib/CliError.js.map +1 -0
  42. package/lib/commonjs/lib/circularImports.d.ts +0 -1
  43. package/lib/commonjs/lib/circularImports.js +5 -6
  44. package/lib/commonjs/lib/circularImports.js.map +1 -1
  45. package/lib/commonjs/lib/clearResourcesPlan.d.ts +0 -1
  46. package/lib/commonjs/lib/clearResourcesPlan.js +12 -13
  47. package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -1
  48. package/lib/commonjs/lib/deployPrompts.d.ts +2 -1
  49. package/lib/commonjs/lib/deployPrompts.js +16 -16
  50. package/lib/commonjs/lib/deployPrompts.js.map +1 -1
  51. package/lib/commonjs/lib/devServerEntry.js +5 -4
  52. package/lib/commonjs/lib/devServerEntry.js.map +1 -1
  53. package/lib/commonjs/lib/devServerPorts.js +2 -4
  54. package/lib/commonjs/lib/devServerPorts.js.map +1 -1
  55. package/lib/commonjs/lib/discovery.d.ts +0 -2
  56. package/lib/commonjs/lib/discovery.js +11 -44
  57. package/lib/commonjs/lib/discovery.js.map +1 -1
  58. package/lib/commonjs/lib/hooks.js +5 -3
  59. package/lib/commonjs/lib/hooks.js.map +1 -1
  60. package/lib/commonjs/lib/killChildWithEscalation.js +3 -1
  61. package/lib/commonjs/lib/killChildWithEscalation.js.map +1 -1
  62. package/lib/commonjs/lib/killStaleListeners.js +24 -37
  63. package/lib/commonjs/lib/killStaleListeners.js.map +1 -1
  64. package/lib/commonjs/lib/out.d.ts +11 -0
  65. package/lib/commonjs/lib/out.js +30 -0
  66. package/lib/commonjs/lib/out.js.map +1 -0
  67. package/lib/commonjs/lib/prompts.d.ts +1 -0
  68. package/lib/commonjs/lib/prompts.js +15 -2
  69. package/lib/commonjs/lib/prompts.js.map +1 -1
  70. package/lib/commonjs/lib/qpqConfigs.js +4 -4
  71. package/lib/commonjs/lib/qpqConfigs.js.map +1 -1
  72. package/lib/commonjs/lib/requireDriverCapability.d.ts +7 -0
  73. package/lib/commonjs/lib/requireDriverCapability.js +17 -0
  74. package/lib/commonjs/lib/requireDriverCapability.js.map +1 -0
  75. package/lib/commonjs/lib/resolveAppSelection.d.ts +1 -0
  76. package/lib/commonjs/lib/resolveAppSelection.js +19 -12
  77. package/lib/commonjs/lib/resolveAppSelection.js.map +1 -1
  78. package/lib/commonjs/lib/resolveCommandContext.d.ts +12 -0
  79. package/lib/commonjs/lib/resolveCommandContext.js +26 -0
  80. package/lib/commonjs/lib/resolveCommandContext.js.map +1 -0
  81. package/lib/commonjs/lib/resolveDeployment.d.ts +0 -1
  82. package/lib/commonjs/lib/resolveDeployment.js +15 -10
  83. package/lib/commonjs/lib/resolveDeployment.js.map +1 -1
  84. package/lib/commonjs/lib/runCommand.d.ts +20 -0
  85. package/lib/commonjs/lib/runCommand.js +64 -34
  86. package/lib/commonjs/lib/runCommand.js.map +1 -1
  87. package/lib/commonjs/lib/runTasks.js +8 -4
  88. package/lib/commonjs/lib/runTasks.js.map +1 -1
  89. package/lib/commonjs/lib/timing.js +5 -3
  90. package/lib/commonjs/lib/timing.js.map +1 -1
  91. package/lib/commonjs/lib/typeWatcher.d.ts +2 -1
  92. package/lib/commonjs/lib/typeWatcher.js +6 -13
  93. package/lib/commonjs/lib/typeWatcher.js.map +1 -1
  94. package/lib/commonjs/lib/userScriptBuilderLayer.d.ts +0 -2
  95. package/lib/commonjs/lib/userScriptBuilderLayer.js +7 -8
  96. package/lib/commonjs/lib/userScriptBuilderLayer.js.map +1 -1
  97. package/lib/commonjs/lib/views.js +3 -2
  98. package/lib/commonjs/lib/views.js.map +1 -1
  99. package/lib/commonjs/lib/webAddressingEnv.d.ts +0 -2
  100. package/lib/commonjs/lib/webAddressingEnv.js +4 -4
  101. package/lib/commonjs/lib/webAddressingEnv.js.map +1 -1
  102. package/lib/commonjs/platforms/aws/awsCredentials.js +3 -1
  103. package/lib/commonjs/platforms/aws/awsCredentials.js.map +1 -1
  104. package/lib/commonjs/platforms/aws/cdkApp.js +1 -1
  105. package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -1
  106. package/lib/commonjs/platforms/aws/clearResources.js +16 -26
  107. package/lib/commonjs/platforms/aws/clearResources.js.map +1 -1
  108. package/lib/commonjs/platforms/aws/getDeployEnv.d.ts +1 -0
  109. package/lib/commonjs/platforms/aws/getDeployEnv.js +12 -0
  110. package/lib/commonjs/platforms/aws/getDeployEnv.js.map +1 -0
  111. package/lib/commonjs/platforms/aws/go.js +17 -15
  112. package/lib/commonjs/platforms/aws/go.js.map +1 -1
  113. package/lib/commonjs/platforms/aws/goDocker.js +29 -26
  114. package/lib/commonjs/platforms/aws/goDocker.js.map +1 -1
  115. package/lib/commonjs/platforms/aws/goDockerManifest.js +6 -1
  116. package/lib/commonjs/platforms/aws/goDockerManifest.js.map +1 -1
  117. package/lib/commonjs/platforms/aws/publish.js +13 -11
  118. package/lib/commonjs/platforms/aws/publish.js.map +1 -1
  119. package/lib/commonjs/platforms/aws/remote.js +8 -7
  120. package/lib/commonjs/platforms/aws/remote.js.map +1 -1
  121. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js +4 -4
  122. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js.map +1 -1
  123. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js +4 -3
  124. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
  125. package/lib/commonjs/platforms/aws/stacks.d.ts +0 -1
  126. package/lib/commonjs/platforms/aws/stacks.js +21 -33
  127. package/lib/commonjs/platforms/aws/stacks.js.map +1 -1
  128. package/lib/commonjs/platforms/aws/teardown.js +9 -7
  129. package/lib/commonjs/platforms/aws/teardown.js.map +1 -1
  130. package/lib/commonjs/platforms/aws/viewsSync.js +23 -11
  131. package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -1
  132. package/lib/commonjs/platforms/docker/go.js +20 -18
  133. package/lib/commonjs/platforms/docker/go.js.map +1 -1
  134. package/lib/commonjs/platforms/docker/index.js +5 -4
  135. package/lib/commonjs/platforms/docker/index.js.map +1 -1
  136. package/lib/commonjs/platforms/docker/parseMounts.js +3 -2
  137. package/lib/commonjs/platforms/docker/parseMounts.js.map +1 -1
  138. package/lib/commonjs/platforms/index.js +4 -2
  139. package/lib/commonjs/platforms/index.js.map +1 -1
  140. package/lib/commonjs/platforms/types.d.ts +2 -2
  141. package/lib/commonjs/platforms/types.js.map +1 -1
  142. package/lib/esm/cli/commandMenu.js +5 -4
  143. package/lib/esm/cli/commandMenu.js.map +1 -1
  144. package/lib/esm/cli/runCli.js +15 -7
  145. package/lib/esm/cli/runCli.js.map +1 -1
  146. package/lib/esm/commands/checkCircular.js +15 -7
  147. package/lib/esm/commands/checkCircular.js.map +1 -1
  148. package/lib/esm/commands/clearResources.js +8 -14
  149. package/lib/esm/commands/clearResources.js.map +1 -1
  150. package/lib/esm/commands/go.js +3 -7
  151. package/lib/esm/commands/go.js.map +1 -1
  152. package/lib/esm/commands/goDev.js +4 -2
  153. package/lib/esm/commands/goDev.js.map +1 -1
  154. package/lib/esm/commands/goDevApi.js +21 -18
  155. package/lib/esm/commands/goDevApi.js.map +1 -1
  156. package/lib/esm/commands/goDevWeb.js +12 -8
  157. package/lib/esm/commands/goDevWeb.js.map +1 -1
  158. package/lib/esm/commands/goDocker.js +10 -13
  159. package/lib/esm/commands/goDocker.js.map +1 -1
  160. package/lib/esm/commands/hooks.js +4 -2
  161. package/lib/esm/commands/hooks.js.map +1 -1
  162. package/lib/esm/commands/migrate.js +9 -7
  163. package/lib/esm/commands/migrate.js.map +1 -1
  164. package/lib/esm/commands/prep.js +4 -2
  165. package/lib/esm/commands/prep.js.map +1 -1
  166. package/lib/esm/commands/publish.js +4 -7
  167. package/lib/esm/commands/publish.js.map +1 -1
  168. package/lib/esm/commands/scriptBuild.js +7 -5
  169. package/lib/esm/commands/scriptBuild.js.map +1 -1
  170. package/lib/esm/commands/scriptBuilderLayer.js +6 -4
  171. package/lib/esm/commands/scriptBuilderLayer.js.map +1 -1
  172. package/lib/esm/commands/scriptNew.js +7 -5
  173. package/lib/esm/commands/scriptNew.js.map +1 -1
  174. package/lib/esm/commands/setup.js +14 -22
  175. package/lib/esm/commands/setup.js.map +1 -1
  176. package/lib/esm/commands/synth.js +18 -22
  177. package/lib/esm/commands/synth.js.map +1 -1
  178. package/lib/esm/commands/teardown.js +8 -14
  179. package/lib/esm/commands/teardown.js.map +1 -1
  180. package/lib/esm/lib/CliError.d.ts +4 -0
  181. package/lib/esm/lib/CliError.js +11 -0
  182. package/lib/esm/lib/CliError.js.map +1 -0
  183. package/lib/esm/lib/circularImports.d.ts +0 -1
  184. package/lib/esm/lib/circularImports.js +4 -4
  185. package/lib/esm/lib/circularImports.js.map +1 -1
  186. package/lib/esm/lib/clearResourcesPlan.d.ts +0 -1
  187. package/lib/esm/lib/clearResourcesPlan.js +12 -12
  188. package/lib/esm/lib/clearResourcesPlan.js.map +1 -1
  189. package/lib/esm/lib/deployPrompts.d.ts +2 -1
  190. package/lib/esm/lib/deployPrompts.js +17 -17
  191. package/lib/esm/lib/deployPrompts.js.map +1 -1
  192. package/lib/esm/lib/devServerEntry.js +5 -4
  193. package/lib/esm/lib/devServerEntry.js.map +1 -1
  194. package/lib/esm/lib/devServerPorts.js +2 -3
  195. package/lib/esm/lib/devServerPorts.js.map +1 -1
  196. package/lib/esm/lib/discovery.d.ts +0 -2
  197. package/lib/esm/lib/discovery.js +10 -38
  198. package/lib/esm/lib/discovery.js.map +1 -1
  199. package/lib/esm/lib/hooks.js +5 -3
  200. package/lib/esm/lib/hooks.js.map +1 -1
  201. package/lib/esm/lib/killChildWithEscalation.js +3 -1
  202. package/lib/esm/lib/killChildWithEscalation.js.map +1 -1
  203. package/lib/esm/lib/killStaleListeners.js +24 -37
  204. package/lib/esm/lib/killStaleListeners.js.map +1 -1
  205. package/lib/esm/lib/out.d.ts +11 -0
  206. package/lib/esm/lib/out.js +26 -0
  207. package/lib/esm/lib/out.js.map +1 -0
  208. package/lib/esm/lib/prompts.d.ts +1 -0
  209. package/lib/esm/lib/prompts.js +13 -1
  210. package/lib/esm/lib/prompts.js.map +1 -1
  211. package/lib/esm/lib/qpqConfigs.js +4 -4
  212. package/lib/esm/lib/qpqConfigs.js.map +1 -1
  213. package/lib/esm/lib/requireDriverCapability.d.ts +7 -0
  214. package/lib/esm/lib/requireDriverCapability.js +13 -0
  215. package/lib/esm/lib/requireDriverCapability.js.map +1 -0
  216. package/lib/esm/lib/resolveAppSelection.d.ts +1 -0
  217. package/lib/esm/lib/resolveAppSelection.js +17 -11
  218. package/lib/esm/lib/resolveAppSelection.js.map +1 -1
  219. package/lib/esm/lib/resolveCommandContext.d.ts +12 -0
  220. package/lib/esm/lib/resolveCommandContext.js +12 -0
  221. package/lib/esm/lib/resolveCommandContext.js.map +1 -0
  222. package/lib/esm/lib/resolveDeployment.d.ts +0 -1
  223. package/lib/esm/lib/resolveDeployment.js +13 -8
  224. package/lib/esm/lib/resolveDeployment.js.map +1 -1
  225. package/lib/esm/lib/runCommand.d.ts +20 -0
  226. package/lib/esm/lib/runCommand.js +52 -31
  227. package/lib/esm/lib/runCommand.js.map +1 -1
  228. package/lib/esm/lib/runTasks.js +8 -4
  229. package/lib/esm/lib/runTasks.js.map +1 -1
  230. package/lib/esm/lib/timing.js +5 -3
  231. package/lib/esm/lib/timing.js.map +1 -1
  232. package/lib/esm/lib/typeWatcher.d.ts +2 -1
  233. package/lib/esm/lib/typeWatcher.js +6 -13
  234. package/lib/esm/lib/typeWatcher.js.map +1 -1
  235. package/lib/esm/lib/userScriptBuilderLayer.d.ts +0 -2
  236. package/lib/esm/lib/userScriptBuilderLayer.js +5 -5
  237. package/lib/esm/lib/userScriptBuilderLayer.js.map +1 -1
  238. package/lib/esm/lib/views.js +3 -2
  239. package/lib/esm/lib/views.js.map +1 -1
  240. package/lib/esm/lib/webAddressingEnv.d.ts +0 -2
  241. package/lib/esm/lib/webAddressingEnv.js +1 -1
  242. package/lib/esm/lib/webAddressingEnv.js.map +1 -1
  243. package/lib/esm/platforms/aws/awsCredentials.js +3 -1
  244. package/lib/esm/platforms/aws/awsCredentials.js.map +1 -1
  245. package/lib/esm/platforms/aws/cdkApp.js +1 -1
  246. package/lib/esm/platforms/aws/cdkApp.js.map +1 -1
  247. package/lib/esm/platforms/aws/clearResources.js +16 -25
  248. package/lib/esm/platforms/aws/clearResources.js.map +1 -1
  249. package/lib/esm/platforms/aws/getDeployEnv.d.ts +1 -0
  250. package/lib/esm/platforms/aws/getDeployEnv.js +8 -0
  251. package/lib/esm/platforms/aws/getDeployEnv.js.map +1 -0
  252. package/lib/esm/platforms/aws/go.js +17 -15
  253. package/lib/esm/platforms/aws/go.js.map +1 -1
  254. package/lib/esm/platforms/aws/goDocker.js +29 -26
  255. package/lib/esm/platforms/aws/goDocker.js.map +1 -1
  256. package/lib/esm/platforms/aws/goDockerManifest.js +6 -1
  257. package/lib/esm/platforms/aws/goDockerManifest.js.map +1 -1
  258. package/lib/esm/platforms/aws/publish.js +13 -11
  259. package/lib/esm/platforms/aws/publish.js.map +1 -1
  260. package/lib/esm/platforms/aws/remote.js +9 -7
  261. package/lib/esm/platforms/aws/remote.js.map +1 -1
  262. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js +2 -2
  263. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js.map +1 -1
  264. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js +4 -3
  265. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
  266. package/lib/esm/platforms/aws/stacks.d.ts +0 -1
  267. package/lib/esm/platforms/aws/stacks.js +22 -30
  268. package/lib/esm/platforms/aws/stacks.js.map +1 -1
  269. package/lib/esm/platforms/aws/teardown.js +9 -7
  270. package/lib/esm/platforms/aws/teardown.js.map +1 -1
  271. package/lib/esm/platforms/aws/viewsSync.js +22 -10
  272. package/lib/esm/platforms/aws/viewsSync.js.map +1 -1
  273. package/lib/esm/platforms/docker/go.js +21 -19
  274. package/lib/esm/platforms/docker/go.js.map +1 -1
  275. package/lib/esm/platforms/docker/index.js +5 -4
  276. package/lib/esm/platforms/docker/index.js.map +1 -1
  277. package/lib/esm/platforms/docker/parseMounts.js +3 -2
  278. package/lib/esm/platforms/docker/parseMounts.js.map +1 -1
  279. package/lib/esm/platforms/index.js +4 -2
  280. package/lib/esm/platforms/index.js.map +1 -1
  281. package/lib/esm/platforms/types.d.ts +2 -2
  282. package/lib/esm/platforms/types.js.map +1 -1
  283. package/package.json +28 -15
  284. package/templates/user-script/README.md +1 -1
@@ -13,10 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.goDevWebCommand = void 0;
16
- // `qpq go:dev:web` — boots every views microfrontend's Rspack dev server
16
+ // `qpq go:dev:web`, boots every views microfrontend's Rspack dev server
17
17
  // in-process (shell is the MF host app, plus all remotes on their own ports).
18
18
  // Everything is served dynamically; remotes resolve at runtime via
19
- // mf-manifest.json on localhost ports. Programmatic — no per-views
19
+ // mf-manifest.json on localhost ports. Programmatic, no per-views
20
20
  // rspack.config.ts or npm serve script needed.
21
21
  //
22
22
  // Usage:
@@ -33,9 +33,11 @@ const devServerPorts_1 = require("../lib/devServerPorts");
33
33
  const discovery_1 = require("../lib/discovery");
34
34
  const keepOtherDevServersFlag_1 = require("../lib/keepOtherDevServersFlag");
35
35
  const killStaleListeners_1 = require("../lib/killStaleListeners");
36
+ const out_1 = require("../lib/out");
36
37
  const resolveAppSelection_1 = require("../lib/resolveAppSelection");
37
38
  const resolveDeployment_1 = require("../lib/resolveDeployment");
38
39
  const webAddressingEnv_1 = require("../lib/webAddressingEnv");
40
+ const out = (0, out_1.createOutput)('go:dev:web');
39
41
  const goDevWebCommand = (argv_1, ...args_3) => __awaiter(void 0, [argv_1, ...args_3], void 0, function* (argv, options = {}) {
40
42
  var _a;
41
43
  const root = (0, discovery_1.getRoot)();
@@ -55,7 +57,7 @@ const goDevWebCommand = (argv_1, ...args_3) => __awaiter(void 0, [argv_1, ...arg
55
57
  if (only)
56
58
  views = views.filter((v) => only.includes(v.service));
57
59
  if (views.length === 0) {
58
- console.error('No views projects found.');
60
+ out.error('No views projects found.');
59
61
  process.exit(1);
60
62
  }
61
63
  // See goDevApi for why this is opt-out rather than always-on.
@@ -66,14 +68,14 @@ const goDevWebCommand = (argv_1, ...args_3) => __awaiter(void 0, [argv_1, ...arg
66
68
  (0, killStaleListeners_1.killStaleListeners)(views.map((v) => v.port), killStaleListeners_1.isQpqCliCommand);
67
69
  }
68
70
  // Every RspackDevServer.start() registers its own SIGINT/SIGTERM handler on
69
- // process — with a dozen views servers in one process that trips node's
71
+ // process, with a dozen views servers in one process that trips node's
70
72
  // default 10-listener warning. Size the limit to the fleet.
71
73
  process.setMaxListeners(Math.max(process.getMaxListeners(), views.length * 2 + 10));
72
74
  // Service names are padded to a common width so the "(started)" chips align.
73
75
  const serviceColumnWidth = Math.max(...views.map((v) => v.service.length));
74
- console.log(`Starting ${views.length} views dev servers for [${appName}]:`);
76
+ out.log(`Starting ${views.length} views dev servers for [${appName}]:`);
75
77
  for (const v of views)
76
- console.log(` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)}`);
78
+ out.log(` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)}`);
77
79
  const servers = [];
78
80
  let shuttingDown = false;
79
81
  const shutdown = (code) => {
@@ -88,11 +90,13 @@ const goDevWebCommand = (argv_1, ...args_3) => __awaiter(void 0, [argv_1, ...arg
88
90
  // below it MUST go through logBelowList to keep the offset accurate.
89
91
  let linesBelowList = 0;
90
92
  const logBelowList = (line) => {
91
- console.log(line);
93
+ out.log(line);
92
94
  linesBelowList += 1;
93
95
  };
94
96
  const markStarted = (index) => {
95
97
  const v = views[index];
98
+ if (!v)
99
+ return;
96
100
  if (!process.stdout.isTTY) {
97
101
  logBelowList(` ${v.service} started`);
98
102
  return;
@@ -103,11 +107,12 @@ const goDevWebCommand = (argv_1, ...args_3) => __awaiter(void 0, [argv_1, ...arg
103
107
  };
104
108
  const pollUntilStarted = (index) => {
105
109
  const attempt = () => {
110
+ var _a;
106
111
  if (shuttingDown)
107
112
  return;
108
113
  const req = http_1.default.get({
109
114
  host: 'localhost',
110
- port: views[index].port,
115
+ port: (_a = views[index]) === null || _a === void 0 ? void 0 : _a.port,
111
116
  path: '/',
112
117
  timeout: 1000,
113
118
  }, (res) => {
@@ -1 +1 @@
1
- {"version":3,"file":"goDevWeb.js","sourceRoot":"","sources":["../../../src/commands/goDevWeb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,mEAAmE;AACnE,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,SAAS;AACT,mBAAmB;AACnB,uCAAuC;AACvC,gCAAgC;AAChC,wDAAkG;AAElG,gDAAwB;AACxB,uCAAsC;AACtC,mDAAqD;AAErD,sCAA0C;AAC1C,sCAAyC;AACzC,0DAA2D;AAC3D,gDAA2C;AAC3C,4EAA6E;AAC7E,kEAAmG;AACnG,oEAAiE;AACjE,gEAA6D;AAC7D,8DAA8D;AAWvD,MAAM,eAAe,GAAG,oBAAqE,EAAE,2DAAhE,IAAc,EAAE,UAA2B,EAAE;;IACjF,MAAM,IAAI,GAAG,IAAA,mBAAO,GAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAE3E,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC;IACtC,OAAO,CAAC,G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` — boots every views microfrontend's Rspack dev server\n// in-process (shell is the MF host app, plus all remotes on their own ports).\n// Everything is served dynamically; remotes resolve at runtime via\n// mf-manifest.json on localhost ports. Programmatic — no per-views\n// rspack.config.ts or npm serve script needed.\n//\n// Usage:\n// qpq go:dev:web\n// qpq go:dev:web --only shell,design\n// qpq go:dev:web --app <name>\nimport { getAllViews, getAppServiceQpqConfigs, getViewsRspackConfig } from '@qpqjs/deploy-rspack';\n\nimport http from 'http';\nimport { rspack } from '@rspack/core';\nimport { RspackDevServer } from '@rspack/dev-server';\n\nimport { getArgValue } from '../lib/args';\nimport { hasArgFlag } from '../lib/args';\nimport { readDevServerPorts } from '../lib/devServerPorts';\nimport { getRoot } from '../lib/discovery';\nimport { KEEP_OTHER_DEV_SERVERS_FLAG } from '../lib/keepOtherDevServersFlag';\nimport { isQpqCliCommand, killStaleListeners, reportPortHolders } from '../lib/killStaleListeners';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { setWebAddressingEnv } from '../lib/webAddressingEnv';\n\nexport type GoDevWebOptions = {\n // The in-place \"(started)\" chip rewrite assumes this command owns the\n // terminal; when stdout is shared with the API dev server (combined\n // `qpq go:dev`) the cursor math breaks. The plain-line fallback is just a\n // wall of \" auth started\" noise interleaved with the API output, so drop\n // the ready status altogether there.\n hideStartedStatus?: boolean;\n};\n\nexport const goDevWebCommand = async (argv: string[], options: GoDevWebOptions = {}): Promise<void> => {\n const root = getRoot();\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n\n process.env.LOCAL_DEV_SERVER = 'true';\n process.env.NODE_ENV = 'development';\n await resolveDeployment(argv, appName);\n\n // Local pages address the api dev server and each other by port on localhost.\n const devServerPorts = readDevServerPorts(appName);\n setWebAddressingEnv(getAppServiceQpqConfigs(root, appName), {\n api: devServerPorts.api,\n webSocket: devServerPorts.webSocket,\n mapHostPort: (port) => port,\n });\n\n const only = getArgValue(argv, '--only')\n ?.split(',')\n .map((s) => s.trim());\n\n let views = getAllViews(root, appName);\n if (only) views = views.filter((v) => only.includes(v.service));\n if (views.length === 0) {\n console.error('No views projects found.');\n process.exit(1);\n }\n\n // See goDevApi for why this is opt-out rather than always-on.\n if (hasArgFlag(argv, KEEP_OTHER_DEV_SERVERS_FLAG)) {\n reportPortHolders(views.map((v) => v.port));\n } else {\n killStaleListeners(\n views.map((v) => v.port),\n isQpqCliCommand,\n );\n }\n\n // Every RspackDevServer.start() registers its own SIGINT/SIGTERM handler on\n // process — with a dozen views servers in one process that trips node's\n // default 10-listener warning. Size the limit to the fleet.\n process.setMaxListeners(Math.max(process.getMaxListeners(), views.length * 2 + 10));\n\n // Service names are padded to a common width so the \"(started)\" chips align.\n const serviceColumnWidth = Math.max(...views.map((v) => v.service.length));\n\n console.log(`Starting ${views.length} views dev servers for [${appName}]:`);\n for (const v of views) console.log(` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)}`);\n\n const servers: RspackDevServer[] = [];\n let shuttingDown = false;\n\n const shutdown = (code: number): void => {\n if (shuttingDown) return;\n shuttingDown = true;\n Promise.allSettled(servers.map((server) => server.stop())).then(() => process.exit(code));\n };\n\n // The URL list above gets a yellow \"(started)\" chip appended in place as\n // each dev server begins answering HTTP. The in-place rewrite moves the\n // cursor up past everything printed since the list, so every line printed\n // below it MUST go through logBelowList to keep the offset accurate.\n let linesBelowList = 0;\n\n const logBelowList = (line: string): void => {\n console.log(line);\n linesBelowList += 1;\n };\n\n const markStarted = (index: number): void => {\n const v = views[index];\n if (!process.stdout.isTTY) {\n logBelowList(` ${v.service} started`);\n return;\n }\n const line = ` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)} \\x1b[33m(started)\\x1b[0m`;\n const up = linesBelowList + (views.length - index);\n process.stdout.write(`\\x1b[${up}F\\x1b[2K${line}\\x1b[${up}E`);\n };\n\n const pollUntilStarted = (index: number): void => {\n const attempt = (): void => {\n if (shuttingDown) return;\n const req = http.get(\n {\n host: 'localhost',\n port: views[index].port,\n path: '/',\n timeout: 1000,\n },\n (res) => {\n res.resume();\n markStarted(index);\n },\n );\n req.on('error', () => setTimeout(attempt, 500));\n req.on('timeout', () => req.destroy());\n };\n attempt();\n };\n\n for (const [index, view] of views.entries()) {\n const config = getViewsRspackConfig(view.viewsDir);\n const compiler = rspack(config);\n const server = new RspackDevServer(config.devServer || { port: view.port }, compiler);\n servers.push(server);\n\n try {\n await server.start();\n } catch (e) {\n logBelowList(` [${view.service}] failed to start: ${(e as Error).message} — shutting down all views servers.`);\n shutdown(1);\n return;\n }\n\n // markStarted is the only consumer of the ready signal, so there is\n // nothing to poll for when the status is hidden.\n if (!options.hideStartedStatus) pollUntilStarted(index);\n }\n\n process.on('SIGINT', () => shutdown(0));\n process.on('SIGTERM', () => shutdown(0));\n};\n"]}
1
+ {"version":3,"file":"goDevWeb.js","sourceRoot":"","sources":["../../../src/commands/goDevWeb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wEAAwE;AACxE,8EAA8E;AAC9E,mEAAmE;AACnE,kEAAkE;AAClE,+CAA+C;AAC/C,EAAE;AACF,SAAS;AACT,mBAAmB;AACnB,uCAAuC;AACvC,gCAAgC;AAChC,wDAAkG;AAElG,gDAAwB;AACxB,uCAAsC;AACtC,mDAAqD;AAErD,sCAA0C;AAC1C,sCAAyC;AACzC,0DAA2D;AAC3D,gDAA2C;AAC3C,4EAA6E;AAC7E,kEAAmG;AACnG,oCAA0C;AAC1C,oEAAiE;AACjE,gEAA6D;AAC7D,8DAA8D;AAE9D,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,YAAY,CAAC,CAAC;AAWhC,MAAM,eAAe,GAAG,oBAAqE,EAAE,2DAAhE,IAAc,EAAE,UAA2B,EAAE;;IACjF,MAAM,IAAI,GAAG,IAAA,mBAAO,GAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,E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GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAA,CAAC;AA1HW,QAAA,eAAe,mBA0H1B","sourcesContent":["// `qpq go:dev:web`, boots every views microfrontend's Rspack dev server\n// in-process (shell is the MF host app, plus all remotes on their own ports).\n// Everything is served dynamically; remotes resolve at runtime via\n// mf-manifest.json on localhost ports. Programmatic, no per-views\n// rspack.config.ts or npm serve script needed.\n//\n// Usage:\n// qpq go:dev:web\n// qpq go:dev:web --only shell,design\n// qpq go:dev:web --app <name>\nimport { getAllViews, getAppServiceQpqConfigs, getViewsRspackConfig } from '@qpqjs/deploy-rspack';\n\nimport http from 'http';\nimport { rspack } from '@rspack/core';\nimport { RspackDevServer } from '@rspack/dev-server';\n\nimport { getArgValue } from '../lib/args';\nimport { hasArgFlag } from '../lib/args';\nimport { readDevServerPorts } from '../lib/devServerPorts';\nimport { getRoot } from '../lib/discovery';\nimport { KEEP_OTHER_DEV_SERVERS_FLAG } from '../lib/keepOtherDevServersFlag';\nimport { isQpqCliCommand, killStaleListeners, reportPortHolders } from '../lib/killStaleListeners';\nimport { createOutput } from '../lib/out';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { setWebAddressingEnv } from '../lib/webAddressingEnv';\n\nconst out = createOutput('go:dev:web');\n\nexport type GoDevWebOptions = {\n // The in-place \"(started)\" chip rewrite assumes this command owns the\n // terminal; when stdout is shared with the API dev server (combined\n // `qpq go:dev`) the cursor math breaks. The plain-line fallback is just a\n // wall of \" auth started\" noise interleaved with the API output, so drop\n // the ready status altogether there.\n hideStartedStatus?: boolean;\n};\n\nexport const goDevWebCommand = async (argv: string[], options: GoDevWebOptions = {}): Promise<void> => {\n const root = getRoot();\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n\n process.env.LOCAL_DEV_SERVER = 'true';\n process.env.NODE_ENV = 'development';\n await resolveDeployment(argv, appName);\n\n // Local pages address the api dev server and each other by port on localhost.\n const devServerPorts = readDevServerPorts(appName);\n setWebAddressingEnv(getAppServiceQpqConfigs(root, appName), {\n api: devServerPorts.api,\n webSocket: devServerPorts.webSocket,\n mapHostPort: (port) => port,\n });\n\n const only = getArgValue(argv, '--only')\n ?.split(',')\n .map((s) => s.trim());\n\n let views = getAllViews(root, appName);\n if (only) views = views.filter((v) => only.includes(v.service));\n if (views.length === 0) {\n out.error('No views projects found.');\n process.exit(1);\n }\n\n // See goDevApi for why this is opt-out rather than always-on.\n if (hasArgFlag(argv, KEEP_OTHER_DEV_SERVERS_FLAG)) {\n reportPortHolders(views.map((v) => v.port));\n } else {\n killStaleListeners(\n views.map((v) => v.port),\n isQpqCliCommand,\n );\n }\n\n // Every RspackDevServer.start() registers its own SIGINT/SIGTERM handler on\n // process, with a dozen views servers in one process that trips node's\n // default 10-listener warning. Size the limit to the fleet.\n process.setMaxListeners(Math.max(process.getMaxListeners(), views.length * 2 + 10));\n\n // Service names are padded to a common width so the \"(started)\" chips align.\n const serviceColumnWidth = Math.max(...views.map((v) => v.service.length));\n\n out.log(`Starting ${views.length} views dev servers for [${appName}]:`);\n for (const v of views) out.log(` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)}`);\n\n const servers: RspackDevServer[] = [];\n let shuttingDown = false;\n\n const shutdown = (code: number): void => {\n if (shuttingDown) return;\n shuttingDown = true;\n Promise.allSettled(servers.map((server) => server.stop())).then(() => process.exit(code));\n };\n\n // The URL list above gets a yellow \"(started)\" chip appended in place as\n // each dev server begins answering HTTP. The in-place rewrite moves the\n // cursor up past everything printed since the list, so every line printed\n // below it MUST go through logBelowList to keep the offset accurate.\n let linesBelowList = 0;\n\n const logBelowList = (line: string): void => {\n out.log(line);\n linesBelowList += 1;\n };\n\n const markStarted = (index: number): void => {\n const v = views[index];\n if (!v) return;\n if (!process.stdout.isTTY) {\n logBelowList(` ${v.service} started`);\n return;\n }\n const line = ` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)} \\x1b[33m(started)\\x1b[0m`;\n const up = linesBelowList + (views.length - index);\n process.stdout.write(`\\x1b[${up}F\\x1b[2K${line}\\x1b[${up}E`);\n };\n\n const pollUntilStarted = (index: number): void => {\n const attempt = (): void => {\n if (shuttingDown) return;\n const req = http.get(\n {\n host: 'localhost',\n port: views[index]?.port,\n path: '/',\n timeout: 1000,\n },\n (res) => {\n res.resume();\n markStarted(index);\n },\n );\n req.on('error', () => setTimeout(attempt, 500));\n req.on('timeout', () => req.destroy());\n };\n attempt();\n };\n\n for (const [index, view] of views.entries()) {\n const config = getViewsRspackConfig(view.viewsDir);\n const compiler = rspack(config);\n const server = new RspackDevServer(config.devServer || { port: view.port }, compiler);\n servers.push(server);\n\n try {\n await server.start();\n } catch (e) {\n logBelowList(` [${view.service}] failed to start: ${(e as Error).message} — shutting down all views servers.`);\n shutdown(1);\n return;\n }\n\n // markStarted is the only consumer of the ready signal, so there is\n // nothing to poll for when the status is hidden.\n if (!options.hideStartedStatus) pollUntilStarted(index);\n }\n\n process.on('SIGINT', () => shutdown(0));\n process.on('SIGTERM', () => shutdown(0));\n};\n"]}
@@ -10,34 +10,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.goDockerCommand = void 0;
13
- // `qpq go:docker` — asks the same questions as `qpq go`, then runs the
13
+ // `qpq go:docker`, asks the same questions as `qpq go`, then runs the
14
14
  // platform driver's parallel containerized deploy (drivers without a docker
15
15
  // strategy don't offer one). `--build-only` and `--from-build` split that run
16
16
  // into a build half and a deploy half that can run on different machines.
17
17
  const deployPrompts_1 = require("../lib/deployPrompts");
18
18
  const goDockerMode_1 = require("../lib/goDockerMode");
19
- const resolveAppSelection_1 = require("../lib/resolveAppSelection");
20
- const resolveDeployment_1 = require("../lib/resolveDeployment");
21
- const platforms_1 = require("../platforms");
19
+ const out_1 = require("../lib/out");
20
+ const requireDriverCapability_1 = require("../lib/requireDriverCapability");
21
+ const resolveCommandContext_1 = require("../lib/resolveCommandContext");
22
+ const out = (0, out_1.createOutput)('go:docker');
22
23
  const goDockerCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
23
24
  var _a;
24
25
  const mode = (0, goDockerMode_1.resolveGoDockerMode)(argv);
25
- const appName = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, envVar: 'DEPLOY_APP_NAME' });
26
- const { deployment } = yield (0, resolveDeployment_1.resolveDeployment)(argv, appName);
27
- const driver = (0, platforms_1.getPlatformDriver)(deployment.platform);
28
- if (!driver.goDocker) {
29
- console.error(`Platform '${deployment.platform}' has no dockerized deploy — use qpq go instead.`);
30
- process.exit(1);
31
- }
26
+ const context = yield (0, resolveCommandContext_1.resolveCommandContext)(argv);
27
+ const goDocker = (0, requireDriverCapability_1.requireDriverCapability)(context, 'goDocker', 'Use qpq go instead.');
28
+ const { appName } = context;
32
29
  // Positional args (`qpq go:docker all all`) run prompt-free; otherwise ask.
33
30
  const plan = (_a = (0, deployPrompts_1.buildDeployPlanFromArgs)(appName, argv)) !== null && _a !== void 0 ? _a : (yield (0, deployPrompts_1.promptDeployPlan)(appName));
34
31
  // account, domain and bootstrap stacks deploy host-side through the workspace
35
32
  // CDK app in one step; there is no saved build to split them across.
36
33
  if (mode !== 'full' && (plan.kind === 'account' || plan.kind === 'bootstrap')) {
37
- console.error(`${goDockerMode_1.BUILD_ONLY_FLAG} and ${goDockerMode_1.FROM_BUILD_FLAG} apply to service deploys only; account, domain and bootstrap deploy in one step.`);
34
+ out.error(`${goDockerMode_1.BUILD_ONLY_FLAG} and ${goDockerMode_1.FROM_BUILD_FLAG} apply to service deploys only; account, domain and bootstrap deploy in one step.`);
38
35
  process.exit(1);
39
36
  }
40
- yield driver.goDocker(appName, plan, mode);
37
+ yield goDocker(appName, plan, mode);
41
38
  });
42
39
  exports.goDockerCommand = goDockerCommand;
43
40
  //# sourceMappingURL=goDocker.js.map
@@ -1 +1 @@
1
-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AAC;IAClB,CAAC;IAED,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAA,CAAC;AAtBW,QAAA,eAAe,mBAsB1B","sourcesContent":["// `qpq go:docker` — asks the same questions as `qpq go`, then runs the\n// platform driver's parallel containerized deploy (drivers without a docker\n// strategy don't offer one). `--build-only` and `--from-build` split that run\n// into a build half and a deploy half that can run on different machines.\nimport { buildDeployPlanFromArgs, promptDeployPlan } from '../lib/deployPrompts';\nimport { BUILD_ONLY_FLAG, FROM_BUILD_FLAG, resolveGoDockerMode } from '../lib/goDockerMode';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { getPlatformDriver } from '../platforms';\n\nexport const goDockerCommand = async (argv: string[]): Promise<void> => {\n const mode = resolveGoDockerMode(argv);\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { deployment } = await resolveDeployment(argv, appName);\n const driver = getPlatformDriver(deployment.platform);\n\n if (!driver.goDocker) {\n console.error(`Platform '${deployment.platform}' has no dockerized deploy — use qpq go instead.`);\n process.exit(1);\n }\n\n // Positional args (`qpq go:docker all all`) run prompt-free; otherwise ask.\n const plan = buildDeployPlanFromArgs(appName, argv) ?? (await promptDeployPlan(appName));\n\n // account, domain and bootstrap stacks deploy host-side through the workspace\n // CDK app in one step; there is no saved build to split them across.\n if (mode !== 'full' && (plan.kind === 'account' || plan.kind === 'bootstrap')) {\n console.error(`${BUILD_ONLY_FLAG} and ${FROM_BUILD_FLAG} apply to service deploys only; account, domain and bootstrap deploy in one step.`);\n process.exit(1);\n }\n\n await driver.goDocker(appName, plan, mode);\n};\n"]}
1
+ {"version":3,"file":"goDocker.js","sourceRoot":"","sources":["../../../src/commands/goDocker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sEAAsE;AACtE,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,wDAAiF;AACjF,sDAA4F;AAC5F,oCAA0C;AAC1C,4EAAyE;AACzE,wEAAqE;AAErE,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,WAAW,CAAC,CAAC;AAE/B,MAAM,eAAe,GAAG,CAAO,IAAc,EAAiB,EAAE;;IACrE,MAAM,IAAI,GAAG,IAAA,kCAAmB,EAAC,IAAI,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,MAAM,IAAA,6CAAqB,EAAC,IAAI,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,IAAA,iDAAuB,EAAC,OAAO,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC;IACrF,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,4EAA4E;IAC5E,MAAM,IAAI,GAAG,MAAA,IAAA,uCAAuB,EAAC,OAAO,EAAE,IAAI,CAAC,mCAAI,CAAC,MAAM,IAAA,gCAAgB,EAAC,OAAO,CAAC,CAAC,CAAC;IAEzF,8EAA8E;IAC9E,qEAAqE;IACrE,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,EAAE,CAAC;QAC9E,GAAG,CAAC,KAAK,CAAC,GAAG,8BAAe,QAAQ,8BAAe,mFAAmF,CAAC,CAAC;QACxI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC,CAAA,CAAC;AAjBW,QAAA,eAAe,mBAiB1B","sourcesContent":["// `qpq go:docker`, asks the same questions as `qpq go`, then runs the\n// platform driver's parallel containerized deploy (drivers without a docker\n// strategy don't offer one). `--build-only` and `--from-build` split that run\n// into a build half and a deploy half that can run on different machines.\nimport { buildDeployPlanFromArgs, promptDeployPlan } from '../lib/deployPrompts';\nimport { BUILD_ONLY_FLAG, FROM_BUILD_FLAG, resolveGoDockerMode } from '../lib/goDockerMode';\nimport { createOutput } from '../lib/out';\nimport { requireDriverCapability } from '../lib/requireDriverCapability';\nimport { resolveCommandContext } from '../lib/resolveCommandContext';\n\nconst out = createOutput('go:docker');\n\nexport const goDockerCommand = async (argv: string[]): Promise<void> => {\n const mode = resolveGoDockerMode(argv);\n const context = await resolveCommandContext(argv);\n const goDocker = requireDriverCapability(context, 'goDocker', 'Use qpq go instead.');\n const { appName } = context;\n\n // Positional args (`qpq go:docker all all`) run prompt-free; otherwise ask.\n const plan = buildDeployPlanFromArgs(appName, argv) ?? (await promptDeployPlan(appName));\n\n // account, domain and bootstrap stacks deploy host-side through the workspace\n // CDK app in one step; there is no saved build to split them across.\n if (mode !== 'full' && (plan.kind === 'account' || plan.kind === 'bootstrap')) {\n out.error(`${BUILD_ONLY_FLAG} and ${FROM_BUILD_FLAG} apply to service deploys only; account, domain and bootstrap deploy in one step.`);\n process.exit(1);\n }\n\n await goDocker(appName, plan, mode);\n};\n"]}
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.hooksCommand = void 0;
13
- // `qpq hooks <name>` — run the `qpq:<name>` script (or the plain `<name>`
13
+ // `qpq hooks <name>`, run the `qpq:<name>` script (or the plain `<name>`
14
14
  // script when no qpq:-prefixed one exists) of every app and workspace package
15
15
  // that defines one, in dependency order with parallel execution.
16
16
  // Wire the root package.json's lifecycle to it, e.g.
@@ -18,7 +18,9 @@ exports.hooksCommand = void 0;
18
18
  const args_1 = require("../lib/args");
19
19
  const getDefaultHookJobs_1 = require("../lib/getDefaultHookJobs");
20
20
  const hooks_1 = require("../lib/hooks");
21
+ const out_1 = require("../lib/out");
21
22
  const runTasks_1 = require("../lib/runTasks");
23
+ const out = (0, out_1.createOutput)('hooks');
22
24
  const getJobs = (argv) => {
23
25
  const parsed = Number((0, args_1.getArgValue)(argv, '--jobs'));
24
26
  if (Number.isFinite(parsed) && parsed >= 1) {
@@ -29,7 +31,7 @@ const getJobs = (argv) => {
29
31
  const hooksCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
30
32
  const [hook] = argv.filter((a) => !a.startsWith('--'));
31
33
  if (!hook) {
32
- console.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');
34
+ out.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');
33
35
  process.exit(1);
34
36
  }
35
37
  const failures = yield (0, hooks_1.runHookForAllPackages)(hook, getJobs(argv));
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,iEAAiE;AACjE,qDAAqD;AACrD,6EAA6E;AAC7E,sCAA0C;AAC1C,kEAA+D;AAC/D,wCAAqD;AACrD,8CAAmD;AAEnD,MAAM,OAAO,GAAG,CAAC,IAAc,EAAU,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAA,kBAAW,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,IAAA,uCAAkB,GAAE,CAAC;AAC9B,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAO,IAAc,EAAiB,EAAE;IAClE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,+GAA+G,CAAC,CAAC;QAC/H,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,IAAA,2BAAgB,EAAC,SAAS,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAA,CAAC;AAVW,QAAA,YAAY,gBAUvB","sourcesContent":["// `qpq hooks <name>` — run the `qpq:<name>` script (or the plain `<name>`\n// script when no qpq:-prefixed one exists) of every app and workspace package\n// that defines one, in dependency order with parallel execution.\n// Wire the root package.json's lifecycle to it, e.g.\n// \"postinstall\": \"qpq hooks postinstall\". Use --jobs=1 to force serial runs.\nimport { getArgValue } from '../lib/args';\nimport { getDefaultHookJobs } from '../lib/getDefaultHookJobs';\nimport { runHookForAllPackages } from '../lib/hooks';\nimport { assertNoFailures } from '../lib/runTasks';\n\nconst getJobs = (argv: string[]): number => {\n const parsed = Number(getArgValue(argv, '--jobs'));\n if (Number.isFinite(parsed) && parsed >= 1) {\n return Math.floor(parsed);\n }\n return getDefaultHookJobs();\n};\n\nexport const hooksCommand = async (argv: string[]): Promise<void> => {\n const [hook] = argv.filter((a) => !a.startsWith('--'));\n\n if (!hook) {\n console.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');\n process.exit(1);\n }\n\n const failures = await runHookForAllPackages(hook, getJobs(argv));\n assertNoFailures(`hooks ${hook}`, failures);\n};\n"]}
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,iEAAiE;AACjE,qDAAqD;AACrD,6EAA6E;AAC7E,sCAA0C;AAC1C,kEAA+D;AAC/D,wCAAqD;AACrD,oCAA0C;AAC1C,8CAAmD;AAEnD,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,OAAO,CAAC,CAAC;AAElC,MAAM,OAAO,GAAG,CAAC,IAAc,EAAU,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAA,kBAAW,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,IAAA,uCAAkB,GAAE,CAAC;AAC9B,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAO,IAAc,EAAiB,EAAE;IAClE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,GAAG,CAAC,KAAK,CAAC,+GAA+G,CAAC,CAAC;QAC3H,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,IAAA,2BAAgB,EAAC,SAAS,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAA,CAAC;AAVW,QAAA,YAAY,gBAUvB","sourcesContent":["// `qpq hooks <name>`, run the `qpq:<name>` script (or the plain `<name>`\n// script when no qpq:-prefixed one exists) of every app and workspace package\n// that defines one, in dependency order with parallel execution.\n// Wire the root package.json's lifecycle to it, e.g.\n// \"postinstall\": \"qpq hooks postinstall\". Use --jobs=1 to force serial runs.\nimport { getArgValue } from '../lib/args';\nimport { getDefaultHookJobs } from '../lib/getDefaultHookJobs';\nimport { runHookForAllPackages } from '../lib/hooks';\nimport { createOutput } from '../lib/out';\nimport { assertNoFailures } from '../lib/runTasks';\n\nconst out = createOutput('hooks');\n\nconst getJobs = (argv: string[]): number => {\n const parsed = Number(getArgValue(argv, '--jobs'));\n if (Number.isFinite(parsed) && parsed >= 1) {\n return Math.floor(parsed);\n }\n return getDefaultHookJobs();\n};\n\nexport const hooksCommand = async (argv: string[]): Promise<void> => {\n const [hook] = argv.filter((a) => !a.startsWith('--'));\n\n if (!hook) {\n out.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');\n process.exit(1);\n }\n\n const failures = await runHookForAllPackages(hook, getJobs(argv));\n assertNoFailures(`hooks ${hook}`, failures);\n};\n"]}
@@ -13,7 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.migrateCommand = void 0;
16
- // `qpq migrate` — run every pending migration against the LOCAL dev store, once, then exit.
16
+ const core_1 = require("@qpqjs/core");
17
+ // `qpq migrate`, run every pending migration against the LOCAL dev store, once, then exit.
17
18
  //
18
19
  // Deployed, migrations are triggered by a stack update. Nothing locally ever deploys, so
19
20
  // without this a migration is first executed in a real environment, which is a poor place to
@@ -23,34 +24,35 @@ exports.migrateCommand = void 0;
23
24
  // Migrations are recorded as they run, in the same store the deploy path uses, so running
24
25
  // this twice is a no-op the second time.
25
26
  const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
26
- const child_process_1 = require("child_process");
27
27
  const path_1 = __importDefault(require("path"));
28
- const core_1 = require("@rspack/core");
28
+ const core_2 = require("@rspack/core");
29
29
  const devServerEntry_1 = require("../lib/devServerEntry");
30
30
  const discovery_1 = require("../lib/discovery");
31
+ const out_1 = require("../lib/out");
31
32
  const resolveAppSelection_1 = require("../lib/resolveAppSelection");
32
33
  const resolveDeployment_1 = require("../lib/resolveDeployment");
33
- const MIGRATE_BUNDLE_PATH = path_1.default.join('dist', 'qpq', 'dev-server', 'migrate.js');
34
+ const runCommand_1 = require("../lib/runCommand");
35
+ const out = (0, out_1.createOutput)('migrate');
34
36
  const migrateCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
35
37
  const root = (0, discovery_1.getRoot)();
36
38
  const appName = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, envVar: 'QPQ_DEV_APP' });
37
39
  process.env.QPQ_DEV_APP = appName;
38
40
  yield (0, resolveDeployment_1.resolveDeployment)(argv, appName);
39
- console.log(`Running local migrations for app [${appName}]`);
41
+ out.log(`Running local migrations for app [${appName}]`);
40
42
  const qpqConfigs = (0, deploy_rspack_1.getAppServiceQpqConfigs)(root, appName);
41
43
  const entry = (0, devServerEntry_1.writeDevServerEntry)(root, appName, 'migrate');
42
44
  const rspackConfig = (0, deploy_rspack_1.getDevServerRspackConfig)({ root, entry, qpqConfigs });
43
45
  // Same bundle shape as the dev server, different output name so a running `go:dev:api`
44
46
  // watcher does not fight over the file.
45
- const bundlePath = path_1.default.join(root, MIGRATE_BUNDLE_PATH);
47
+ const bundlePath = path_1.default.join((0, core_1.getDevServerDistPath)(root), 'migrate.js');
46
48
  const migrateConfig = Object.assign(Object.assign({}, rspackConfig), { output: Object.assign(Object.assign({}, rspackConfig.output), { filename: 'migrate.js' }) });
47
49
  yield new Promise((resolve, reject) => {
48
- (0, core_1.rspack)(migrateConfig, (error, stats) => {
50
+ (0, core_2.rspack)(migrateConfig, (error, stats) => {
49
51
  if (error) {
50
52
  return reject(error);
51
53
  }
52
54
  if (stats === null || stats === void 0 ? void 0 : stats.hasErrors()) {
53
- console.error(stats.toString({ colors: true, all: false, errors: true }));
55
+ out.error(stats.toString({ colors: true, all: false, errors: true }));
54
56
  return reject(new Error('Failed to bundle migrations'));
55
57
  }
56
58
  resolve();
@@ -59,7 +61,7 @@ const migrateCommand = (argv) => __awaiter(void 0, void 0, void 0, function* ()
59
61
  // The bundle exits non-zero on failure; mirror that so a shell chain or CI notices instead
60
62
  // of carrying on as though the data were migrated.
61
63
  const exitCode = yield new Promise((resolve) => {
62
- const child = (0, child_process_1.spawn)('node', [bundlePath], { stdio: 'inherit', env: Object.assign(Object.assign({}, process.env), { QPQ_DEV_APP: appName }) });
64
+ const child = (0, runCommand_1.spawnCommand)('node', [bundlePath], { env: { QPQ_DEV_APP: appName } });
63
65
  child.on('exit', (code) => resolve(code !== null && code !== void 0 ? code : 1));
64
66
  });
65
67
  if (exitCode !== 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/commands/migrate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4FAA4F;AAC5F,EAAE;AACF,yFAAyF;AACzF,6FAA6F;AAC7F,0FAA0F;AAC1F,4FAA4F;AAC5F,EAAE;AACF,0FAA0F;AAC1F,yCAAyC;AACzC,wDAAyF;AAEzF,iDAAsC;AACtC,gDAAwB;AACxB,uCAAsC;AAEtC,0DAA4D;AAC5D,gDAA2C;AAC3C,oEAAiE;AACjE,gEAA6D;AAE7D,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAE1E,MAAM,cAAc,GAAG,CAAO,IAAc,EAAiB,EAAE;IACpE,MAAM,IAAI,GAAG,IAAA,mBAAO,GAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,OAAO,CAAC;IAClC,MAAM,IAAA,qCAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEvC,OAAO,CAAC,GAAG,CAAC,qCAAqC,OAAO,GAAG,CAAC,CAAC;IAE7D,MAAM,UAAU,GAAG,IAAA,uCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,KAAK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,KAAE,WAAW,EAAE,OAAO,GAAE,EAAE,CAAC,CAAC;QAC/G,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,CAAC;AACH,CAAC,CAAA,CAAC;AA7CW,QAAA,cAAc,kBA6CzB","sourcesContent":["// `qpq migrate` — run every pending migration against the LOCAL dev store, once, then exit.\n//\n// Deployed, migrations are triggered by a stack update. Nothing locally ever deploys, so\n// without this a migration is first executed in a real environment, which is a poor place to\n// discover what it does. This bundles exactly what `go:dev:api` bundles and runs the same\n// queue path, so a local run rehearses the deployed one rather than a convenient lookalike.\n//\n// Migrations are recorded as they run, in the same store the deploy path uses, so running\n// this twice is a no-op the second time.\nimport { getAppServiceQpqConfigs, getDevServerRspackConfig } from '@qpqjs/deploy-rspack';\n\nimport { spawn } from 'child_process';\nimport path from 'path';\nimport { rspack } from '@rspack/core';\n\nimport { writeDevServerEntry } from '../lib/devServerEntry';\nimport { getRoot } from '../lib/discovery';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\n\nconst MIGRATE_BUNDLE_PATH = path.join('dist', 'qpq', 'dev-server', 'migrate.js');\n\nexport const migrateCommand = async (argv: string[]): Promise<void> => {\n const root = getRoot();\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n process.env.QPQ_DEV_APP = appName;\n await resolveDeployment(argv, appName);\n\n console.log(`Running local migrations for app [${appName}]`);\n\n const qpqConfigs = getAppServiceQpqConfigs(root, appName);\n const entry = writeDevServerEntry(root, appName, 'migrate');\n const rspackConfig = getDevServerRspackConfig({ root, entry, qpqConfigs });\n\n // Same bundle shape as the dev server, different output name so a running `go:dev:api`\n // watcher does not fight over the file.\n const bundlePath = path.join(root, MIGRATE_BUNDLE_PATH);\n const migrateConfig = {\n ...rspackConfig,\n output: { ...rspackConfig.output, filename: 'migrate.js' },\n };\n\n await new Promise<void>((resolve, reject) => {\n rspack(migrateConfig as any, (error, stats) => {\n if (error) {\n return reject(error);\n }\n\n if (stats?.hasErrors()) {\n console.error(stats.toString({ colors: true, all: false, errors: true }));\n return reject(new Error('Failed to bundle migrations'));\n }\n\n resolve();\n });\n });\n\n // The bundle exits non-zero on failure; mirror that so a shell chain or CI notices instead\n // of carrying on as though the data were migrated.\n const exitCode = await new Promise<number>((resolve) => {\n const child = spawn('node', [bundlePath], { stdio: 'inherit', env: { ...process.env, QPQ_DEV_APP: appName } });\n child.on('exit', (code) => resolve(code ?? 1));\n });\n\n if (exitCode !== 0) {\n process.exitCode = exitCode;\n }\n};\n"]}
1
+ {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/commands/migrate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAmD;AACnD,2FAA2F;AAC3F,EAAE;AACF,yFAAyF;AACzF,6FAA6F;AAC7F,0FAA0F;AAC1F,4FAA4F;AAC5F,EAAE;AACF,0FAA0F;AAC1F,yCAAyC;AACzC,wDAAyF;AAEzF,gDAAwB;AACxB,uCAAsC;AAEtC,0DAA4D;AAC5D,gDAA2C;AAC3C,oCAA0C;AAC1C,oEAAiE;AACjE,gEAA6D;AAC7D,kDAAiD;AAEjD,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,SAAS,CAAC,CAAC;AAE7B,MAAM,cAAc,GAAG,CAAO,IAAc,EAAiB,EAAE;IACpE,MAAM,IAAI,GAAG,IAAA,mBAAO,GAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAA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AC;IACL,CAAC,CAAC,CAAC;IAEH,2FAA2F;IAC3F,mDAAmD;IACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;QACrD,MAAM,KAAK,GAAG,IAAA,yBAAY,EAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QACpF,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,CAAC;AACH,CAAC,CAAA,CAAC;AA7CW,QAAA,cAAc,kBA6CzB","sourcesContent":["import { getDevServerDistPath } from '@qpqjs/core';\n// `qpq migrate`, run every pending migration against the LOCAL dev store, once, then exit.\n//\n// Deployed, migrations are triggered by a stack update. Nothing locally ever deploys, so\n// without this a migration is first executed in a real environment, which is a poor place to\n// discover what it does. This bundles exactly what `go:dev:api` bundles and runs the same\n// queue path, so a local run rehearses the deployed one rather than a convenient lookalike.\n//\n// Migrations are recorded as they run, in the same store the deploy path uses, so running\n// this twice is a no-op the second time.\nimport { getAppServiceQpqConfigs, getDevServerRspackConfig } from '@qpqjs/deploy-rspack';\n\nimport path from 'path';\nimport { rspack } from '@rspack/core';\n\nimport { writeDevServerEntry } from '../lib/devServerEntry';\nimport { getRoot } from '../lib/discovery';\nimport { createOutput } from '../lib/out';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { spawnCommand } from '../lib/runCommand';\n\nconst out = createOutput('migrate');\n\nexport const migrateCommand = async (argv: string[]): Promise<void> => {\n const root = getRoot();\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n process.env.QPQ_DEV_APP = appName;\n await resolveDeployment(argv, appName);\n\n out.log(`Running local migrations for app [${appName}]`);\n\n const qpqConfigs = getAppServiceQpqConfigs(root, appName);\n const entry = writeDevServerEntry(root, appName, 'migrate');\n const rspackConfig = getDevServerRspackConfig({ root, entry, qpqConfigs });\n\n // Same bundle shape as the dev server, different output name so a running `go:dev:api`\n // watcher does not fight over the file.\n const bundlePath = path.join(getDevServerDistPath(root), 'migrate.js');\n const migrateConfig = {\n ...rspackConfig,\n output: { ...rspackConfig.output, filename: 'migrate.js' },\n };\n\n await new Promise<void>((resolve, reject) => {\n rspack(migrateConfig as any, (error, stats) => {\n if (error) {\n return reject(error);\n }\n\n if (stats?.hasErrors()) {\n out.error(stats.toString({ colors: true, all: false, errors: true }));\n return reject(new Error('Failed to bundle migrations'));\n }\n\n resolve();\n });\n });\n\n // The bundle exits non-zero on failure; mirror that so a shell chain or CI notices instead\n // of carrying on as though the data were migrated.\n const exitCode = await new Promise<number>((resolve) => {\n const child = spawnCommand('node', [bundlePath], { env: { QPQ_DEV_APP: appName } });\n child.on('exit', (code) => resolve(code ?? 1));\n });\n\n if (exitCode !== 0) {\n process.exitCode = exitCode;\n }\n};\n"]}
@@ -10,18 +10,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.prepCommand = void 0;
13
- // `qpq prep` — regenerates apps/<app>/tsconfig.federated.json (the TypeScript
13
+ // `qpq prep`, regenerates apps/<app>/tsconfig.federated.json (the TypeScript
14
14
  // path aliases for cross-view federated imports). Run after adding/removing a
15
15
  // `// federated.export` marker.
16
16
  const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
17
17
  const discovery_1 = require("../lib/discovery");
18
+ const out_1 = require("../lib/out");
18
19
  const resolveAppSelection_1 = require("../lib/resolveAppSelection");
20
+ const out = (0, out_1.createOutput)('prep');
19
21
  const prepCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
20
22
  const selection = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, allowAll: true });
21
23
  const appNames = selection === 'all' ? (0, discovery_1.getAvailableApps)() : [selection];
22
24
  for (const appName of appNames) {
23
25
  const exposeCount = (0, deploy_rspack_1.writeFederatedTsconfigForApp)((0, discovery_1.getRoot)(), appName);
24
- console.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);
26
+ out.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);
25
27
  }
26
28
  });
27
29
  exports.prepCommand = prepCommand;
@@ -1 +1 @@
1
- {"version":3,"file":"prep.js","sourceRoot":"","sources":["../../../src/commands/prep.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,gCAAgC;AAChC,wDAAoE;AAEpE,gDAA6D;AAC7D,oEAAiE;AAE1D,MAAM,WAAW,GAAG,CAAO,IAAc,EAAiB,EAAE;IACjE,MAAM,SAAS,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,IAAA,4BAAgB,GAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAExE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,IAAA,4CAA4B,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,eAAe,WAAW,8BAA8B,OAAO,0BAA0B,CAAC,CAAC;IACzG,CAAC;AACH,CAAC,CAAA,CAAC;AARW,QAAA,WAAW,eAQtB","sourcesContent":["// `qpq prep` — regenerates apps/<app>/tsconfig.federated.json (the TypeScript\n// path aliases for cross-view federated imports). Run after adding/removing a\n// `// federated.export` marker.\nimport { writeFederatedTsconfigForApp } from '@qpqjs/deploy-rspack';\n\nimport { getAvailableApps, getRoot } from '../lib/discovery';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\n\nexport const prepCommand = async (argv: string[]): Promise<void> => {\n const selection = await resolveAppSelection({ argv, allowAll: true });\n const appNames = selection === 'all' ? getAvailableApps() : [selection];\n\n for (const appName of appNames) {\n const exposeCount = writeFederatedTsconfigForApp(getRoot(), appName);\n console.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);\n }\n};\n"]}
1
+ {"version":3,"file":"prep.js","sourceRoot":"","sources":["../../../src/commands/prep.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,gCAAgC;AAChC,wDAAoE;AAEpE,gDAA6D;AAC7D,oCAA0C;AAC1C,oEAAiE;AAEjE,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,MAAM,CAAC,CAAC;AAE1B,MAAM,WAAW,GAAG,CAAO,IAAc,EAAiB,EAAE;IACjE,MAAM,SAAS,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,IAAA,4BAAgB,GAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAExE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,IAAA,4CAA4B,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,CAAC,CAAC;QACrE,GAAG,CAAC,GAAG,CAAC,eAAe,WAAW,8BAA8B,OAAO,0BAA0B,CAAC,CAAC;IACrG,CAAC;AACH,CAAC,CAAA,CAAC;AARW,QAAA,WAAW,eAQtB","sourcesContent":["// `qpq prep`, regenerates apps/<app>/tsconfig.federated.json (the TypeScript\n// path aliases for cross-view federated imports). Run after adding/removing a\n// `// federated.export` marker.\nimport { writeFederatedTsconfigForApp } from '@qpqjs/deploy-rspack';\n\nimport { getAvailableApps, getRoot } from '../lib/discovery';\nimport { createOutput } from '../lib/out';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\n\nconst out = createOutput('prep');\n\nexport const prepCommand = async (argv: string[]): Promise<void> => {\n const selection = await resolveAppSelection({ argv, allowAll: true });\n const appNames = selection === 'all' ? getAvailableApps() : [selection];\n\n for (const appName of appNames) {\n const exposeCount = writeFederatedTsconfigForApp(getRoot(), appName);\n out.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);\n }\n};\n"]}
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.publishDeployCommand = exports.publishUploadCommand = exports.publishBuildCommand = exports.publishCommand = void 0;
13
- // `qpq publish[:build|:upload|:deploy]` — build each backend service as a
13
+ // `qpq publish[:build|:upload|:deploy]`, build each backend service as a
14
14
  // module-federation remote and publish it into the platform's federated code
15
15
  // store, so the deployed backends federate their story code instead of running
16
16
  // the bundled copy. The mechanics live in the platform driver (AWS: S3-backed,
@@ -21,15 +21,12 @@ exports.publishDeployCommand = exports.publishUploadCommand = exports.publishBui
21
21
  // qpq publish --app docgen --service template
22
22
  const args_1 = require("../lib/args");
23
23
  const discovery_1 = require("../lib/discovery");
24
- const resolveAppSelection_1 = require("../lib/resolveAppSelection");
25
- const resolveDeployment_1 = require("../lib/resolveDeployment");
26
- const platforms_1 = require("../platforms");
24
+ const resolveCommandContext_1 = require("../lib/resolveCommandContext");
27
25
  const resolvePublishSelection = (argv) => __awaiter(void 0, void 0, void 0, function* () {
28
- const appName = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, envVar: 'DEPLOY_APP_NAME' });
29
- const { deployment } = yield (0, resolveDeployment_1.resolveDeployment)(argv, appName);
26
+ const { appName, driver } = yield (0, resolveCommandContext_1.resolveCommandContext)(argv);
30
27
  const requestedService = (0, args_1.getArgValue)(argv, '--service');
31
28
  const serviceNames = requestedService ? [requestedService] : (0, discovery_1.getServiceNames)(appName);
32
- return { driver: (0, platforms_1.getPlatformDriver)(deployment.platform), appName, serviceNames };
29
+ return { driver, appName, serviceNames };
33
30
  });
34
31
  const publishCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
35
32
  const { driver, appName, serviceNames } = yield resolvePublishSelection(argv);
@@ -1 +1 @@
1
- {"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/commands/publish.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,8BAA8B;AAC9B,EAAE;AACF,SAAS;AACT,+DAA+D;AAC/D,gDAAgD;AAChD,sCAA0C;AAC1C,gDAAmD;AACnD,oEAAiE;AACjE,gEAA6D;AAC7D,4CAAoE;AAQpE,MAAM,uBAAuB,GAAG,CAAO,IAAc,EAA6B,EAAE;IAClF,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,IAAA,kBAAW,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAA,2BAAe,EAAC,OAAO,CAAC,CAAC;IAEtF,OAAO,EAAE,MAAM,EAAE,IAAA,6BAAiB,EAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACnF,CAAC,CAAA,CAAC;AAEK,MAAM,cAAc,GAAG,CAAO,IAAc,EAAiB,EAAE;IACpE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAC9C,CAAC,CAAA,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEK,MAAM,mBAAmB,GAAG,CAAO,IAAc,EAAiB,EAAE;IACzE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACnD,CAAC,CAAA,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEK,MAAM,oBAAoB,GAAG,CAAO,IAAc,EAAiB,EAAE;IAC1E,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC,CAAA,CAAC;AAHW,QAAA,oBAAoB,wBAG/B;AAEK,MAAM,oBAAoB,GAAG,CAAO,IAAc,EAAiB,EAAE;IAC1E,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC,CAAA,CAAC;AAHW,QAAA,oBAAoB,wBAG/B","sourcesContent":["// `qpq publish[:build|:upload|:deploy]` — build each backend service as a\n// module-federation remote and publish it into the platform's federated code\n// store, so the deployed backends federate their story code instead of running\n// the bundled copy. The mechanics live in the platform driver (AWS: S3-backed,\n// see platforms/aws/publish).\n//\n// Usage:\n// qpq publish --app docgen (all services)\n// qpq publish --app docgen --service template\nimport { getArgValue } from '../lib/args';\nimport { getServiceNames } from '../lib/discovery';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { getPlatformDriver, QpqPlatformDriver } from '../platforms';\n\ntype PublishSelection = {\n driver: QpqPlatformDriver;\n appName: string;\n serviceNames: string[];\n};\n\nconst resolvePublishSelection = async (argv: string[]): Promise<PublishSelection> => {\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { deployment } = await resolveDeployment(argv, appName);\n\n const requestedService = getArgValue(argv, '--service');\n const serviceNames = requestedService ? [requestedService] : getServiceNames(appName);\n\n return { driver: getPlatformDriver(deployment.platform), appName, serviceNames };\n};\n\nexport const publishCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publish(appName, serviceNames);\n};\n\nexport const publishBuildCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishBuild(appName, serviceNames);\n};\n\nexport const publishUploadCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishUpload(appName, serviceNames);\n};\n\nexport const publishDeployCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishDeploy(appName, serviceNames);\n};\n"]}
1
+ {"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/commands/publish.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAyE;AACzE,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,8BAA8B;AAC9B,EAAE;AACF,SAAS;AACT,+DAA+D;AAC/D,gDAAgD;AAChD,sCAA0C;AAC1C,gDAAmD;AACnD,wEAAqE;AASrE,MAAM,uBAAuB,GAAG,CAAO,IAAc,EAA6B,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AAc,EAAiB,EAAE;IAC1E,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC,CAAA,CAAC;AAHW,QAAA,oBAAoB,wBAG/B","sourcesContent":["// `qpq publish[:build|:upload|:deploy]`, build each backend service as a\n// module-federation remote and publish it into the platform's federated code\n// store, so the deployed backends federate their story code instead of running\n// the bundled copy. The mechanics live in the platform driver (AWS: S3-backed,\n// see platforms/aws/publish).\n//\n// Usage:\n// qpq publish --app docgen (all services)\n// qpq publish --app docgen --service template\nimport { getArgValue } from '../lib/args';\nimport { getServiceNames } from '../lib/discovery';\nimport { resolveCommandContext } from '../lib/resolveCommandContext';\nimport { QpqPlatformDriver } from '../platforms';\n\ntype PublishSelection = {\n driver: QpqPlatformDriver;\n appName: string;\n serviceNames: string[];\n};\n\nconst resolvePublishSelection = async (argv: string[]): Promise<PublishSelection> => {\n const { appName, driver } = await resolveCommandContext(argv);\n\n const requestedService = getArgValue(argv, '--service');\n const serviceNames = requestedService ? [requestedService] : getServiceNames(appName);\n\n return { driver, appName, serviceNames };\n};\n\nexport const publishCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publish(appName, serviceNames);\n};\n\nexport const publishBuildCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishBuild(appName, serviceNames);\n};\n\nexport const publishUploadCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishUpload(appName, serviceNames);\n};\n\nexport const publishDeployCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishDeploy(appName, serviceNames);\n};\n"]}
@@ -13,17 +13,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.scriptBuildCommand = void 0;
16
- // `qpq script:build <dir> [--out <dir>] [--source-map]` — bundle a user-script project
16
+ // `qpq script:build <dir> [--out <dir>] [--source-map]`, bundle a user-script project
17
17
  // into one main.js that askUserScriptExecute can load from a drive. `--source-map`
18
18
  // embeds the map in main.js; no separate .map file is ever written.
19
19
  const user_script_1 = require("@qpqjs/user-script");
20
20
  const path_1 = __importDefault(require("path"));
21
21
  const args_1 = require("../lib/args");
22
+ const out_1 = require("../lib/out");
23
+ const out = (0, out_1.createOutput)('script:build');
22
24
  const scriptBuildCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
23
25
  var _a;
24
26
  const [projectDir] = (0, args_1.getPositionalArgs)(argv, ['--out']);
25
27
  if (!projectDir) {
26
- console.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');
28
+ out.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');
27
29
  process.exit(1);
28
30
  }
29
31
  const outDir = (_a = (0, args_1.getArgValue)(argv, '--out')) !== null && _a !== void 0 ? _a : path_1.default.join(projectDir, 'dist');
@@ -31,12 +33,12 @@ const scriptBuildCommand = (argv) => __awaiter(void 0, void 0, void 0, function*
31
33
  const result = yield (0, user_script_1.buildUserScript)({ projectDir, outDir, sourceMap: (0, args_1.hasArgFlag)(argv, '--source-map') });
32
34
  // A developer's own build is checked in this process; a platform build asks the sandbox.
33
35
  const exports = (0, user_script_1.checkUserScriptOutput)(result.entryPath);
34
- console.log(`script:build: wrote ${result.entryPath}`);
35
- console.log(` exports: ${exports.join(', ')}`);
36
+ out.log(`script:build: wrote ${result.entryPath}`);
37
+ out.log(` exports: ${exports.join(', ')}`);
36
38
  }
37
39
  catch (error) {
38
40
  if (error instanceof user_script_1.UserScriptBuildError) {
39
- console.error(`script:build: ${error.code}: ${error.message}`);
41
+ out.error(`script:build: ${error.code}: ${error.message}`);
40
42
  process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,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC;AAtBW,QAAA,kBAAkB,sBAsB7B","sourcesContent":["// `qpq script:build <dir> [--out <dir>] [--source-map]` — bundle a user-script project\n// into one main.js that askUserScriptExecute can load from a drive. `--source-map`\n// embeds the map in main.js; no separate .map file is ever written.\nimport { buildUserScript, checkUserScriptOutput, UserScriptBuildError } from '@qpqjs/user-script';\n\nimport path from 'path';\n\nimport { getArgValue, getPositionalArgs, hasArgFlag } from '../lib/args';\n\nexport const scriptBuildCommand = async (argv: string[]): Promise<void> => {\n const [projectDir] = getPositionalArgs(argv, ['--out']);\n if (!projectDir) {\n console.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');\n process.exit(1);\n }\n\n const outDir = getArgValue(argv, '--out') ?? path.join(projectDir, 'dist');\n\n try {\n const result = await buildUserScript({ projectDir, outDir, sourceMap: hasArgFlag(argv, '--source-map') });\n // A developer's own build is checked in this process; a platform build asks the sandbox.\n const exports = checkUserScriptOutput(result.entryPath);\n console.log(`script:build: wrote ${result.entryPath}`);\n console.log(` exports: ${exports.join(', ')}`);\n } catch (error) {\n if (error instanceof UserScriptBuildError) {\n console.error(`script:build: ${error.code}: ${error.message}`);\n process.exit(1);\n }\n throw error;\n }\n};\n"]}
1
+ {"version":3,"file":"scriptBuild.js","sourceRoot":"","sources":["../../../src/commands/scriptBuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sFAAsF;AACtF,mFAAmF;AACnF,oEAAoE;AACpE,oDAAkG;AAElG,gDAAwB;AAExB,sCAAyE;AACzE,oCAA0C;AAE1C,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,cAAc,CAAC,CAAC;AAElC,MAAM,kBAAkB,GAAG,CAAO,IAAc,EAAiB,EAAE;;IACxE,MAAM,CAAC,UAAU,CAAC,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,GAAG,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,MAAA,IAAA,kBAAW,EAAC,IAAI,EAAE,OAAO,CAAC,mCAAI,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAE3E,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,6BAAe,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAA,iBAAU,EAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QAC1G,yFAAyF;QACzF,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxD,GAAG,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACnD,GAAG,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,kCAAoB,EAAE,CAAC;YAC1C,GAAG,CAAC,KAAK,CAAC,iBAAiB,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC;AAtBW,QAAA,kBAAkB,sBAsB7B","sourcesContent":["// `qpq script:build <dir> [--out <dir>] [--source-map]`, bundle a user-script project\n// into one main.js that askUserScriptExecute can load from a drive. `--source-map`\n// embeds the map in main.js; no separate .map file is ever written.\nimport { buildUserScript, checkUserScriptOutput, UserScriptBuildError } from '@qpqjs/user-script';\n\nimport path from 'path';\n\nimport { getArgValue, getPositionalArgs, hasArgFlag } from '../lib/args';\nimport { createOutput } from '../lib/out';\n\nconst out = createOutput('script:build');\n\nexport const scriptBuildCommand = async (argv: string[]): Promise<void> => {\n const [projectDir] = getPositionalArgs(argv, ['--out']);\n if (!projectDir) {\n out.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');\n process.exit(1);\n }\n\n const outDir = getArgValue(argv, '--out') ?? path.join(projectDir, 'dist');\n\n try {\n const result = await buildUserScript({ projectDir, outDir, sourceMap: hasArgFlag(argv, '--source-map') });\n // A developer's own build is checked in this process; a platform build asks the sandbox.\n const exports = checkUserScriptOutput(result.entryPath);\n out.log(`script:build: wrote ${result.entryPath}`);\n out.log(` exports: ${exports.join(', ')}`);\n } catch (error) {\n if (error instanceof UserScriptBuildError) {\n out.error(`script:build: ${error.code}: ${error.message}`);\n process.exit(1);\n }\n throw error;\n }\n};\n"]}
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.scriptBuilderLayerCommand = void 0;
13
- // `qpq script:builder-layer [--arch arm64|x86_64]` — produce the lambda layer that gives
13
+ // `qpq script:builder-layer [--arch arm64|x86_64]`, produce the lambda layer that gives
14
14
  // a service rspack, for services that registered defineUserScriptBuilder. The directory
15
15
  // is the one getUserScriptBuilderApiLayer points at, so nothing is told a path. Run from
16
16
  // the app's qpq:predeploy hook, which go:docker fires before the workspace is built, so
@@ -19,7 +19,9 @@ exports.scriptBuilderLayerCommand = void 0;
19
19
  const core_1 = require("@qpqjs/core");
20
20
  const user_script_1 = require("@qpqjs/user-script");
21
21
  const args_1 = require("../lib/args");
22
+ const out_1 = require("../lib/out");
22
23
  const userScriptBuilderLayer_1 = require("../lib/userScriptBuilderLayer");
24
+ const out = (0, out_1.createOutput)('script:builder-layer');
23
25
  const ARCH_FLAG = '--arch';
24
26
  const DEFAULT_ARCHITECTURE = core_1.JavascriptRuntimeArchitecture.Arm64;
25
27
  /* eslint-disable @typescript-eslint/no-require-imports */
@@ -31,7 +33,7 @@ const parseArchitecture = (argv) => {
31
33
  const requested = (_a = (0, args_1.getArgValue)(argv, ARCH_FLAG)) !== null && _a !== void 0 ? _a : DEFAULT_ARCHITECTURE;
32
34
  const known = Object.values(core_1.JavascriptRuntimeArchitecture);
33
35
  if (!known.includes(requested)) {
34
- console.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);
36
+ out.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);
35
37
  process.exit(1);
36
38
  }
37
39
  return requested;
@@ -40,9 +42,9 @@ const scriptBuilderLayerCommand = (argv) => __awaiter(void 0, void 0, void 0, fu
40
42
  const architecture = parseArchitecture(argv);
41
43
  const rspackVersion = getRspackVersion();
42
44
  const outDir = (0, user_script_1.getUserScriptBuilderLayerDir)();
43
- console.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);
45
+ out.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);
44
46
  const nodeDir = (0, userScriptBuilderLayer_1.buildUserScriptBuilderLayer)({ outDir, architecture, rspackVersion });
45
- console.log(`script:builder-layer: wrote ${nodeDir}`);
47
+ out.log(`script:builder-layer: wrote ${nodeDir}`);
46
48
  });
47
49
  exports.scriptBuilderLayerCommand = scriptBuilderLayerCommand;
48
50
  //# sourceMappingURL=scriptBuilderLayer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scriptBuilderLayer.js","sourceRoot":"","sources":["../../../src/commands/scriptBuilderLayer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yFAAyF;AACzF,wFAAwF;AACxF,yFAAyF;AACzF,wFAAwF;AACxF,yFAAyF;AACzF,uDA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B,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC,CAAA,CAAC;AARW,QAAA,yBAAyB,6BAQpC","sourcesContent":["// `qpq script:builder-layer [--arch arm64|x86_64]` — produce the lambda layer that gives\n// a service rspack, for services that registered defineUserScriptBuilder. The directory\n// is the one getUserScriptBuilderApiLayer points at, so nothing is told a path. Run from\n// the app's qpq:predeploy hook, which go:docker fires before the workspace is built, so\n// this command deliberately loads no service config (that would import unbuilt packages)\n// and takes the lambda architecture as a flag instead.\nimport { JavascriptRuntimeArchitecture } from '@qpqjs/core';\nimport { getUserScriptBuilderLayerDir } from '@qpqjs/user-script';\n\nimport { getArgValue } from '../lib/args';\nimport { buildUserScriptBuilderLayer } from '../lib/userScriptBuilderLayer';\n\nconst ARCH_FLAG = '--arch';\nconst DEFAULT_ARCHITECTURE = JavascriptRuntimeArchitecture.Arm64;\n\n/* eslint-disable @typescript-eslint/no-require-imports */\n// The rspack the CLI itself resolves is the one the dev server builds with; the layer\n// pins the same version so a script builds identically on both runtimes.\nconst getRspackVersion = (): string => require('@rspack/core/package.json').version as string;\n\nconst parseArchitecture = (argv: string[]): JavascriptRuntimeArchitecture => {\n const requested = getArgValue(argv, ARCH_FLAG) ?? DEFAULT_ARCHITECTURE;\n const known = Object.values(JavascriptRuntimeArchitecture);\n if (!known.includes(requested as JavascriptRuntimeArchitecture)) {\n console.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);\n process.exit(1);\n }\n return requested as JavascriptRuntimeArchitecture;\n};\n\nexport const scriptBuilderLayerCommand = async (argv: string[]): Promise<void> => {\n const architecture = parseArchitecture(argv);\n const rspackVersion = getRspackVersion();\n const outDir = getUserScriptBuilderLayerDir();\n\n console.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);\n const nodeDir = buildUserScriptBuilderLayer({ outDir, architecture, rspackVersion });\n console.log(`script:builder-layer: wrote ${nodeDir}`);\n};\n"]}
1
+ {"version":3,"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AG,IAAA,0CAA4B,GAAE,CAAC;IAE9C,GAAG,CAAC,GAAG,CAAC,iDAAiD,aAAa,cAAc,YAAY,SAAS,MAAM,EAAE,CAAC,CAAC;IACnH,MAAM,OAAO,GAAG,IAAA,oDAA2B,EAAC,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;IACrF,GAAG,CAAC,GAAG,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC,CAAA,CAAC;AARW,QAAA,yBAAyB,6BAQpC","sourcesContent":["// `qpq script:builder-layer [--arch arm64|x86_64]`, produce the lambda layer that gives\n// a service rspack, for services that registered defineUserScriptBuilder. The directory\n// is the one getUserScriptBuilderApiLayer points at, so nothing is told a path. Run from\n// the app's qpq:predeploy hook, which go:docker fires before the workspace is built, so\n// this command deliberately loads no service config (that would import unbuilt packages)\n// and takes the lambda architecture as a flag instead.\nimport { JavascriptRuntimeArchitecture } from '@qpqjs/core';\nimport { getUserScriptBuilderLayerDir } from '@qpqjs/user-script';\n\nimport { getArgValue } from '../lib/args';\nimport { createOutput } from '../lib/out';\nimport { buildUserScriptBuilderLayer } from '../lib/userScriptBuilderLayer';\n\nconst out = createOutput('script:builder-layer');\n\nconst ARCH_FLAG = '--arch';\nconst DEFAULT_ARCHITECTURE = JavascriptRuntimeArchitecture.Arm64;\n\n/* eslint-disable @typescript-eslint/no-require-imports */\n// The rspack the CLI itself resolves is the one the dev server builds with; the layer\n// pins the same version so a script builds identically on both runtimes.\nconst getRspackVersion = (): string => require('@rspack/core/package.json').version as string;\n\nconst parseArchitecture = (argv: string[]): JavascriptRuntimeArchitecture => {\n const requested = getArgValue(argv, ARCH_FLAG) ?? DEFAULT_ARCHITECTURE;\n const known = Object.values(JavascriptRuntimeArchitecture);\n if (!known.includes(requested as JavascriptRuntimeArchitecture)) {\n out.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);\n process.exit(1);\n }\n return requested as JavascriptRuntimeArchitecture;\n};\n\nexport const scriptBuilderLayerCommand = async (argv: string[]): Promise<void> => {\n const architecture = parseArchitecture(argv);\n const rspackVersion = getRspackVersion();\n const outDir = getUserScriptBuilderLayerDir();\n\n out.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);\n const nodeDir = buildUserScriptBuilderLayer({ outDir, architecture, rspackVersion });\n out.log(`script:builder-layer: wrote ${nodeDir}`);\n};\n"]}
@@ -13,23 +13,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.scriptNewCommand = void 0;
16
- // `qpq script:new <dir>` — write the user-script template project into a new
16
+ // `qpq script:new <dir>`, write the user-script template project into a new
17
17
  // directory. See templates/user-script/README.md for what a script is.
18
18
  const path_1 = __importDefault(require("path"));
19
19
  const args_1 = require("../lib/args");
20
+ const out_1 = require("../lib/out");
20
21
  const userScriptTemplate_1 = require("../lib/userScriptTemplate");
22
+ const out = (0, out_1.createOutput)('script:new');
21
23
  const scriptNewCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
22
24
  const [targetDir] = (0, args_1.getPositionalArgs)(argv, []);
23
25
  if (!targetDir) {
24
- console.error('Usage: qpq script:new <dir>');
26
+ out.error('Usage: qpq script:new <dir>');
25
27
  process.exit(1);
26
28
  }
27
29
  const written = (0, userScriptTemplate_1.createUserScriptProject)(targetDir);
28
- console.log(`script:new: wrote ${written.length} files to ${path_1.default.resolve(targetDir)}`);
30
+ out.log(`script:new: wrote ${written.length} files to ${path_1.default.resolve(targetDir)}`);
29
31
  for (const file of written) {
30
- console.log(` ${file}`);
32
+ out.log(` ${file}`);
31
33
  }
32
- console.log(`Next: cd ${targetDir} && npm run build`);
34
+ out.log(`Next: cd ${targetDir} && npm run build`);
33
35
  });
34
36
  exports.scriptNewCommand = scriptNewCommand;
35
37
  //# sourceMappingURL=scriptNew.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scriptNew.js","sourceRoot":"","sources":["../../../src/commands/scriptNew.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6EAA6E;AAC7E,uEAAuE;AACvE,gDAAwB;AAExB,sCAAgD;AAChD,kEAAoE;AAE7D,MAAM,gBAAgB,GAAG,CAAO,IAAc,EAAiB,EAAE;IACtE,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAChD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,4CAAuB,EAAC,SAAS,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,CAAC,MAAM,aAAa,cAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACvF,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,YAAY,SAAS,mBAAmB,CAAC,CAAC;AACxD,CAAC,CAAA,CAAC;AAdW,QAAA,gBAAgB,oBAc3B","sourcesContent":["// `qpq script:new <dir>` — write the user-script template project into a new\n// directory. See templates/user-script/README.md for what a script is.\nimport path from 'path';\n\nimport { getPositionalArgs } from '../lib/args';\nimport { createUserScriptProject } from '../lib/userScriptTemplate';\n\nexport const scriptNewCommand = async (argv: string[]): Promise<void> => {\n const [targetDir] = getPositionalArgs(argv, []);\n if (!targetDir) {\n console.error('Usage: qpq script:new <dir>');\n process.exit(1);\n }\n\n const written = createUserScriptProject(targetDir);\n\n console.log(`script:new: wrote ${written.length} files to ${path.resolve(targetDir)}`);\n for (const file of written) {\n console.log(` ${file}`);\n }\n console.log(`Next: cd ${targetDir} && npm run build`);\n};\n"]}
1
+ {"version":3,"file":"scriptNew.js","sourceRoot":"","sources":["../../../src/commands/scriptNew.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4EAA4E;AAC5E,uEAAuE;AACvE,gDAAwB;AAExB,sCAAgD;AAChD,oCAA0C;AAC1C,kEAAoE;AAEpE,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,YAAY,CAAC,CAAC;AAEhC,MAAM,gBAAgB,GAAG,CAAO,IAAc,EAAiB,EAAE;IACtE,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAChD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,4CAAuB,EAAC,SAAS,CAAC,CAAC;IAEnD,GAAG,CAAC,GAAG,CAAC,qBAAqB,OAAO,CAAC,MAAM,aAAa,cAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnF,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACvB,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,YAAY,SAAS,mBAAmB,CAAC,CAAC;AACpD,CAAC,CAAA,CAAC;AAdW,QAAA,gBAAgB,oBAc3B","sourcesContent":["// `qpq script:new <dir>`, write the user-script template project into a new\n// directory. See templates/user-script/README.md for what a script is.\nimport path from 'path';\n\nimport { getPositionalArgs } from '../lib/args';\nimport { createOutput } from '../lib/out';\nimport { createUserScriptProject } from '../lib/userScriptTemplate';\n\nconst out = createOutput('script:new');\n\nexport const scriptNewCommand = async (argv: string[]): Promise<void> => {\n const [targetDir] = getPositionalArgs(argv, []);\n if (!targetDir) {\n out.error('Usage: qpq script:new <dir>');\n process.exit(1);\n }\n\n const written = createUserScriptProject(targetDir);\n\n out.log(`script:new: wrote ${written.length} files to ${path.resolve(targetDir)}`);\n for (const file of written) {\n out.log(` ${file}`);\n }\n out.log(`Next: cd ${targetDir} && npm run build`);\n};\n"]}