@qpqjs/cli 0.3.0 → 0.5.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 (292) 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 +27 -23
  14. package/lib/commonjs/commands/goDevApi.js.map +1 -1
  15. package/lib/commonjs/commands/goDevWeb.js +14 -9
  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/Output.d.ts +12 -0
  43. package/lib/commonjs/lib/Output.js +3 -0
  44. package/lib/commonjs/lib/Output.js.map +1 -0
  45. package/lib/commonjs/lib/circularImports.d.ts +0 -1
  46. package/lib/commonjs/lib/circularImports.js +5 -6
  47. package/lib/commonjs/lib/circularImports.js.map +1 -1
  48. package/lib/commonjs/lib/clearResourcesPlan.d.ts +0 -1
  49. package/lib/commonjs/lib/clearResourcesPlan.js +12 -13
  50. package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -1
  51. package/lib/commonjs/lib/createOutput.d.ts +2 -0
  52. package/lib/commonjs/lib/createOutput.js +39 -0
  53. package/lib/commonjs/lib/createOutput.js.map +1 -0
  54. package/lib/commonjs/lib/deployPrompts.d.ts +2 -1
  55. package/lib/commonjs/lib/deployPrompts.js +16 -16
  56. package/lib/commonjs/lib/deployPrompts.js.map +1 -1
  57. package/lib/commonjs/lib/devServerEntry.js +5 -4
  58. package/lib/commonjs/lib/devServerEntry.js.map +1 -1
  59. package/lib/commonjs/lib/devServerPorts.js +2 -4
  60. package/lib/commonjs/lib/devServerPorts.js.map +1 -1
  61. package/lib/commonjs/lib/discovery.d.ts +0 -2
  62. package/lib/commonjs/lib/discovery.js +11 -44
  63. package/lib/commonjs/lib/discovery.js.map +1 -1
  64. package/lib/commonjs/lib/hooks.js +5 -3
  65. package/lib/commonjs/lib/hooks.js.map +1 -1
  66. package/lib/commonjs/lib/killChildWithEscalation.js +3 -1
  67. package/lib/commonjs/lib/killChildWithEscalation.js.map +1 -1
  68. package/lib/commonjs/lib/killStaleListeners.js +24 -37
  69. package/lib/commonjs/lib/killStaleListeners.js.map +1 -1
  70. package/lib/commonjs/lib/prompts.d.ts +1 -0
  71. package/lib/commonjs/lib/prompts.js +15 -2
  72. package/lib/commonjs/lib/prompts.js.map +1 -1
  73. package/lib/commonjs/lib/qpqConfigs.d.ts +1 -0
  74. package/lib/commonjs/lib/qpqConfigs.js +11 -6
  75. package/lib/commonjs/lib/qpqConfigs.js.map +1 -1
  76. package/lib/commonjs/lib/requireDriverCapability.d.ts +7 -0
  77. package/lib/commonjs/lib/requireDriverCapability.js +17 -0
  78. package/lib/commonjs/lib/requireDriverCapability.js.map +1 -0
  79. package/lib/commonjs/lib/resolveAppSelection.d.ts +1 -0
  80. package/lib/commonjs/lib/resolveAppSelection.js +19 -12
  81. package/lib/commonjs/lib/resolveAppSelection.js.map +1 -1
  82. package/lib/commonjs/lib/resolveCommandContext.d.ts +12 -0
  83. package/lib/commonjs/lib/resolveCommandContext.js +26 -0
  84. package/lib/commonjs/lib/resolveCommandContext.js.map +1 -0
  85. package/lib/commonjs/lib/resolveDeployment.d.ts +0 -1
  86. package/lib/commonjs/lib/resolveDeployment.js +15 -10
  87. package/lib/commonjs/lib/resolveDeployment.js.map +1 -1
  88. package/lib/commonjs/lib/runCommand.d.ts +20 -0
  89. package/lib/commonjs/lib/runCommand.js +64 -34
  90. package/lib/commonjs/lib/runCommand.js.map +1 -1
  91. package/lib/commonjs/lib/runTasks.js +8 -4
  92. package/lib/commonjs/lib/runTasks.js.map +1 -1
  93. package/lib/commonjs/lib/timing.js +5 -3
  94. package/lib/commonjs/lib/timing.js.map +1 -1
  95. package/lib/commonjs/lib/typeWatcher.d.ts +2 -1
  96. package/lib/commonjs/lib/typeWatcher.js +6 -13
  97. package/lib/commonjs/lib/typeWatcher.js.map +1 -1
  98. package/lib/commonjs/lib/userScriptBuilderLayer.d.ts +0 -2
  99. package/lib/commonjs/lib/userScriptBuilderLayer.js +7 -8
  100. package/lib/commonjs/lib/userScriptBuilderLayer.js.map +1 -1
  101. package/lib/commonjs/lib/views.js +3 -2
  102. package/lib/commonjs/lib/views.js.map +1 -1
  103. package/lib/commonjs/lib/webAddressingEnv.d.ts +0 -2
  104. package/lib/commonjs/lib/webAddressingEnv.js +4 -4
  105. package/lib/commonjs/lib/webAddressingEnv.js.map +1 -1
  106. package/lib/commonjs/platforms/aws/awsCredentials.js +3 -1
  107. package/lib/commonjs/platforms/aws/awsCredentials.js.map +1 -1
  108. package/lib/commonjs/platforms/aws/cdkApp.js +1 -1
  109. package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -1
  110. package/lib/commonjs/platforms/aws/clearResources.js +17 -26
  111. package/lib/commonjs/platforms/aws/clearResources.js.map +1 -1
  112. package/lib/commonjs/platforms/aws/getDeployEnv.d.ts +1 -0
  113. package/lib/commonjs/platforms/aws/getDeployEnv.js +12 -0
  114. package/lib/commonjs/platforms/aws/getDeployEnv.js.map +1 -0
  115. package/lib/commonjs/platforms/aws/go.js +17 -15
  116. package/lib/commonjs/platforms/aws/go.js.map +1 -1
  117. package/lib/commonjs/platforms/aws/goDocker.js +29 -26
  118. package/lib/commonjs/platforms/aws/goDocker.js.map +1 -1
  119. package/lib/commonjs/platforms/aws/goDockerManifest.js +6 -1
  120. package/lib/commonjs/platforms/aws/goDockerManifest.js.map +1 -1
  121. package/lib/commonjs/platforms/aws/publish.js +13 -11
  122. package/lib/commonjs/platforms/aws/publish.js.map +1 -1
  123. package/lib/commonjs/platforms/aws/remote.js +8 -7
  124. package/lib/commonjs/platforms/aws/remote.js.map +1 -1
  125. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js +4 -4
  126. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js.map +1 -1
  127. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js +4 -3
  128. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
  129. package/lib/commonjs/platforms/aws/stacks.d.ts +0 -1
  130. package/lib/commonjs/platforms/aws/stacks.js +17 -33
  131. package/lib/commonjs/platforms/aws/stacks.js.map +1 -1
  132. package/lib/commonjs/platforms/aws/teardown.js +9 -7
  133. package/lib/commonjs/platforms/aws/teardown.js.map +1 -1
  134. package/lib/commonjs/platforms/aws/viewsSync.js +23 -11
  135. package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -1
  136. package/lib/commonjs/platforms/docker/go.js +20 -18
  137. package/lib/commonjs/platforms/docker/go.js.map +1 -1
  138. package/lib/commonjs/platforms/docker/index.js +5 -4
  139. package/lib/commonjs/platforms/docker/index.js.map +1 -1
  140. package/lib/commonjs/platforms/docker/parseMounts.js +3 -2
  141. package/lib/commonjs/platforms/docker/parseMounts.js.map +1 -1
  142. package/lib/commonjs/platforms/index.js +4 -2
  143. package/lib/commonjs/platforms/index.js.map +1 -1
  144. package/lib/commonjs/platforms/types.d.ts +2 -2
  145. package/lib/commonjs/platforms/types.js.map +1 -1
  146. package/lib/esm/cli/commandMenu.js +5 -4
  147. package/lib/esm/cli/commandMenu.js.map +1 -1
  148. package/lib/esm/cli/runCli.js +15 -7
  149. package/lib/esm/cli/runCli.js.map +1 -1
  150. package/lib/esm/commands/checkCircular.js +15 -7
  151. package/lib/esm/commands/checkCircular.js.map +1 -1
  152. package/lib/esm/commands/clearResources.js +8 -14
  153. package/lib/esm/commands/clearResources.js.map +1 -1
  154. package/lib/esm/commands/go.js +3 -7
  155. package/lib/esm/commands/go.js.map +1 -1
  156. package/lib/esm/commands/goDev.js +4 -2
  157. package/lib/esm/commands/goDev.js.map +1 -1
  158. package/lib/esm/commands/goDevApi.js +24 -21
  159. package/lib/esm/commands/goDevApi.js.map +1 -1
  160. package/lib/esm/commands/goDevWeb.js +13 -9
  161. package/lib/esm/commands/goDevWeb.js.map +1 -1
  162. package/lib/esm/commands/goDocker.js +10 -13
  163. package/lib/esm/commands/goDocker.js.map +1 -1
  164. package/lib/esm/commands/hooks.js +4 -2
  165. package/lib/esm/commands/hooks.js.map +1 -1
  166. package/lib/esm/commands/migrate.js +9 -7
  167. package/lib/esm/commands/migrate.js.map +1 -1
  168. package/lib/esm/commands/prep.js +4 -2
  169. package/lib/esm/commands/prep.js.map +1 -1
  170. package/lib/esm/commands/publish.js +4 -7
  171. package/lib/esm/commands/publish.js.map +1 -1
  172. package/lib/esm/commands/scriptBuild.js +7 -5
  173. package/lib/esm/commands/scriptBuild.js.map +1 -1
  174. package/lib/esm/commands/scriptBuilderLayer.js +6 -4
  175. package/lib/esm/commands/scriptBuilderLayer.js.map +1 -1
  176. package/lib/esm/commands/scriptNew.js +7 -5
  177. package/lib/esm/commands/scriptNew.js.map +1 -1
  178. package/lib/esm/commands/setup.js +14 -22
  179. package/lib/esm/commands/setup.js.map +1 -1
  180. package/lib/esm/commands/synth.js +18 -22
  181. package/lib/esm/commands/synth.js.map +1 -1
  182. package/lib/esm/commands/teardown.js +8 -14
  183. package/lib/esm/commands/teardown.js.map +1 -1
  184. package/lib/esm/lib/CliError.d.ts +4 -0
  185. package/lib/esm/lib/CliError.js +11 -0
  186. package/lib/esm/lib/CliError.js.map +1 -0
  187. package/lib/esm/lib/Output.d.ts +12 -0
  188. package/lib/esm/lib/Output.js +2 -0
  189. package/lib/esm/lib/Output.js.map +1 -0
  190. package/lib/esm/lib/circularImports.d.ts +0 -1
  191. package/lib/esm/lib/circularImports.js +4 -4
  192. package/lib/esm/lib/circularImports.js.map +1 -1
  193. package/lib/esm/lib/clearResourcesPlan.d.ts +0 -1
  194. package/lib/esm/lib/clearResourcesPlan.js +12 -12
  195. package/lib/esm/lib/clearResourcesPlan.js.map +1 -1
  196. package/lib/esm/lib/createOutput.d.ts +2 -0
  197. package/lib/esm/lib/createOutput.js +35 -0
  198. package/lib/esm/lib/createOutput.js.map +1 -0
  199. package/lib/esm/lib/deployPrompts.d.ts +2 -1
  200. package/lib/esm/lib/deployPrompts.js +17 -17
  201. package/lib/esm/lib/deployPrompts.js.map +1 -1
  202. package/lib/esm/lib/devServerEntry.js +5 -4
  203. package/lib/esm/lib/devServerEntry.js.map +1 -1
  204. package/lib/esm/lib/devServerPorts.js +2 -3
  205. package/lib/esm/lib/devServerPorts.js.map +1 -1
  206. package/lib/esm/lib/discovery.d.ts +0 -2
  207. package/lib/esm/lib/discovery.js +10 -38
  208. package/lib/esm/lib/discovery.js.map +1 -1
  209. package/lib/esm/lib/hooks.js +5 -3
  210. package/lib/esm/lib/hooks.js.map +1 -1
  211. package/lib/esm/lib/killChildWithEscalation.js +3 -1
  212. package/lib/esm/lib/killChildWithEscalation.js.map +1 -1
  213. package/lib/esm/lib/killStaleListeners.js +24 -37
  214. package/lib/esm/lib/killStaleListeners.js.map +1 -1
  215. package/lib/esm/lib/prompts.d.ts +1 -0
  216. package/lib/esm/lib/prompts.js +13 -1
  217. package/lib/esm/lib/prompts.js.map +1 -1
  218. package/lib/esm/lib/qpqConfigs.d.ts +1 -0
  219. package/lib/esm/lib/qpqConfigs.js +9 -5
  220. package/lib/esm/lib/qpqConfigs.js.map +1 -1
  221. package/lib/esm/lib/requireDriverCapability.d.ts +7 -0
  222. package/lib/esm/lib/requireDriverCapability.js +13 -0
  223. package/lib/esm/lib/requireDriverCapability.js.map +1 -0
  224. package/lib/esm/lib/resolveAppSelection.d.ts +1 -0
  225. package/lib/esm/lib/resolveAppSelection.js +17 -11
  226. package/lib/esm/lib/resolveAppSelection.js.map +1 -1
  227. package/lib/esm/lib/resolveCommandContext.d.ts +12 -0
  228. package/lib/esm/lib/resolveCommandContext.js +12 -0
  229. package/lib/esm/lib/resolveCommandContext.js.map +1 -0
  230. package/lib/esm/lib/resolveDeployment.d.ts +0 -1
  231. package/lib/esm/lib/resolveDeployment.js +13 -8
  232. package/lib/esm/lib/resolveDeployment.js.map +1 -1
  233. package/lib/esm/lib/runCommand.d.ts +20 -0
  234. package/lib/esm/lib/runCommand.js +52 -31
  235. package/lib/esm/lib/runCommand.js.map +1 -1
  236. package/lib/esm/lib/runTasks.js +8 -4
  237. package/lib/esm/lib/runTasks.js.map +1 -1
  238. package/lib/esm/lib/timing.js +5 -3
  239. package/lib/esm/lib/timing.js.map +1 -1
  240. package/lib/esm/lib/typeWatcher.d.ts +2 -1
  241. package/lib/esm/lib/typeWatcher.js +6 -13
  242. package/lib/esm/lib/typeWatcher.js.map +1 -1
  243. package/lib/esm/lib/userScriptBuilderLayer.d.ts +0 -2
  244. package/lib/esm/lib/userScriptBuilderLayer.js +5 -5
  245. package/lib/esm/lib/userScriptBuilderLayer.js.map +1 -1
  246. package/lib/esm/lib/views.js +3 -2
  247. package/lib/esm/lib/views.js.map +1 -1
  248. package/lib/esm/lib/webAddressingEnv.d.ts +0 -2
  249. package/lib/esm/lib/webAddressingEnv.js +1 -1
  250. package/lib/esm/lib/webAddressingEnv.js.map +1 -1
  251. package/lib/esm/platforms/aws/awsCredentials.js +3 -1
  252. package/lib/esm/platforms/aws/awsCredentials.js.map +1 -1
  253. package/lib/esm/platforms/aws/cdkApp.js +1 -1
  254. package/lib/esm/platforms/aws/cdkApp.js.map +1 -1
  255. package/lib/esm/platforms/aws/clearResources.js +18 -26
  256. package/lib/esm/platforms/aws/clearResources.js.map +1 -1
  257. package/lib/esm/platforms/aws/getDeployEnv.d.ts +1 -0
  258. package/lib/esm/platforms/aws/getDeployEnv.js +8 -0
  259. package/lib/esm/platforms/aws/getDeployEnv.js.map +1 -0
  260. package/lib/esm/platforms/aws/go.js +17 -15
  261. package/lib/esm/platforms/aws/go.js.map +1 -1
  262. package/lib/esm/platforms/aws/goDocker.js +29 -26
  263. package/lib/esm/platforms/aws/goDocker.js.map +1 -1
  264. package/lib/esm/platforms/aws/goDockerManifest.js +6 -1
  265. package/lib/esm/platforms/aws/goDockerManifest.js.map +1 -1
  266. package/lib/esm/platforms/aws/publish.js +13 -11
  267. package/lib/esm/platforms/aws/publish.js.map +1 -1
  268. package/lib/esm/platforms/aws/remote.js +9 -7
  269. package/lib/esm/platforms/aws/remote.js.map +1 -1
  270. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js +2 -2
  271. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js.map +1 -1
  272. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js +4 -3
  273. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
  274. package/lib/esm/platforms/aws/stacks.d.ts +0 -1
  275. package/lib/esm/platforms/aws/stacks.js +20 -32
  276. package/lib/esm/platforms/aws/stacks.js.map +1 -1
  277. package/lib/esm/platforms/aws/teardown.js +9 -7
  278. package/lib/esm/platforms/aws/teardown.js.map +1 -1
  279. package/lib/esm/platforms/aws/viewsSync.js +22 -10
  280. package/lib/esm/platforms/aws/viewsSync.js.map +1 -1
  281. package/lib/esm/platforms/docker/go.js +21 -19
  282. package/lib/esm/platforms/docker/go.js.map +1 -1
  283. package/lib/esm/platforms/docker/index.js +5 -4
  284. package/lib/esm/platforms/docker/index.js.map +1 -1
  285. package/lib/esm/platforms/docker/parseMounts.js +3 -2
  286. package/lib/esm/platforms/docker/parseMounts.js.map +1 -1
  287. package/lib/esm/platforms/index.js +4 -2
  288. package/lib/esm/platforms/index.js.map +1 -1
  289. package/lib/esm/platforms/types.d.ts +2 -2
  290. package/lib/esm/platforms/types.js.map +1 -1
  291. package/package.json +28 -15
  292. package/templates/user-script/README.md +1 -1
@@ -1,12 +1,14 @@
1
- // `qpq hooks <name>` — run the `qpq:<name>` script (or the plain `<name>`
1
+ // `qpq hooks <name>`, run the `qpq:<name>` script (or the plain `<name>`
2
2
  // script when no qpq:-prefixed one exists) of every app and workspace package
3
3
  // that defines one, in dependency order with parallel execution.
4
4
  // Wire the root package.json's lifecycle to it, e.g.
5
5
  // "postinstall": "qpq hooks postinstall". Use --jobs=1 to force serial runs.
6
6
  import { getArgValue } from '../lib/args';
7
+ import { createOutput } from '../lib/createOutput';
7
8
  import { getDefaultHookJobs } from '../lib/getDefaultHookJobs';
8
9
  import { runHookForAllPackages } from '../lib/hooks';
9
10
  import { assertNoFailures } from '../lib/runTasks';
11
+ const out = createOutput('hooks');
10
12
  const getJobs = (argv) => {
11
13
  const parsed = Number(getArgValue(argv, '--jobs'));
12
14
  if (Number.isFinite(parsed) && parsed >= 1) {
@@ -17,7 +19,7 @@ const getJobs = (argv) => {
17
19
  export const hooksCommand = async (argv) => {
18
20
  const [hook] = argv.filter((a) => !a.startsWith('--'));
19
21
  if (!hook) {
20
- console.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');
22
+ out.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');
21
23
  process.exit(1);
22
24
  }
23
25
  const failures = await 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,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,OAAO,GAAG,CAAC,IAAc,EAAU,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,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,kBAAkB,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,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,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,gBAAgB,CAAC,SAAS,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAC","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":[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AAQ,CAAC,CAAC;AAC9C,CAAC,CAAC","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 { createOutput } from '../lib/createOutput';\nimport { getDefaultHookJobs } from '../lib/getDefaultHookJobs';\nimport { runHookForAllPackages } from '../lib/hooks';\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"]}
@@ -1,4 +1,5 @@
1
- // `qpq migrate` — run every pending migration against the LOCAL dev store, once, then exit.
1
+ import { getDevServerDistPath } from '@qpqjs/core';
2
+ // `qpq migrate`, run every pending migration against the LOCAL dev store, once, then exit.
2
3
  //
3
4
  // Deployed, migrations are triggered by a stack update. Nothing locally ever deploys, so
4
5
  // without this a migration is first executed in a real environment, which is a poor place to
@@ -8,26 +9,27 @@
8
9
  // Migrations are recorded as they run, in the same store the deploy path uses, so running
9
10
  // this twice is a no-op the second time.
10
11
  import { getAppServiceQpqConfigs, getDevServerRspackConfig } from '@qpqjs/deploy-rspack';
11
- import { spawn } from 'child_process';
12
12
  import path from 'path';
13
13
  import { rspack } from '@rspack/core';
14
+ import { createOutput } from '../lib/createOutput';
14
15
  import { writeDevServerEntry } from '../lib/devServerEntry';
15
16
  import { getRoot } from '../lib/discovery';
16
17
  import { resolveAppSelection } from '../lib/resolveAppSelection';
17
18
  import { resolveDeployment } from '../lib/resolveDeployment';
18
- const MIGRATE_BUNDLE_PATH = path.join('dist', 'qpq', 'dev-server', 'migrate.js');
19
+ import { spawnCommand } from '../lib/runCommand';
20
+ const out = createOutput('migrate');
19
21
  export const migrateCommand = async (argv) => {
20
22
  const root = getRoot();
21
23
  const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });
22
24
  process.env.QPQ_DEV_APP = appName;
23
25
  await resolveDeployment(argv, appName);
24
- console.log(`Running local migrations for app [${appName}]`);
26
+ out.log(`Running local migrations for app [${appName}]`);
25
27
  const qpqConfigs = getAppServiceQpqConfigs(root, appName);
26
28
  const entry = writeDevServerEntry(root, appName, 'migrate');
27
29
  const rspackConfig = getDevServerRspackConfig({ root, entry, qpqConfigs });
28
30
  // Same bundle shape as the dev server, different output name so a running `go:dev:api`
29
31
  // watcher does not fight over the file.
30
- const bundlePath = path.join(root, MIGRATE_BUNDLE_PATH);
32
+ const bundlePath = path.join(getDevServerDistPath(root), 'migrate.js');
31
33
  const migrateConfig = {
32
34
  ...rspackConfig,
33
35
  output: { ...rspackConfig.output, filename: 'migrate.js' },
@@ -38,7 +40,7 @@ export const migrateCommand = async (argv) => {
38
40
  return reject(error);
39
41
  }
40
42
  if (stats?.hasErrors()) {
41
- console.error(stats.toString({ colors: true, all: false, errors: true }));
43
+ out.error(stats.toString({ colors: true, all: false, errors: true }));
42
44
  return reject(new Error('Failed to bundle migrations'));
43
45
  }
44
46
  resolve();
@@ -47,7 +49,7 @@ export const migrateCommand = async (argv) => {
47
49
  // The bundle exits non-zero on failure; mirror that so a shell chain or CI notices instead
48
50
  // of carrying on as though the data were migrated.
49
51
  const exitCode = await new Promise((resolve) => {
50
- const child = spawn('node', [bundlePath], { stdio: 'inherit', env: { ...process.env, QPQ_DEV_APP: appName } });
52
+ const child = spawnCommand('node', [bundlePath], { env: { QPQ_DEV_APP: appName } });
51
53
  child.on('exit', (code) => resolve(code ?? 1));
52
54
  });
53
55
  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,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACpE,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,OAAO,CAAC;IAClC,MAAM,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEvC,OAAO,CAAC,GAAG,CAAC,qCAAqC,OAAO,GAAG,CAAC,CAAC;IAE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AE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QAC/G,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,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,CAAC","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,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,2FAA2F;AAC3F,EAAE;AACF,yFAAyF;AACzF,6FAA6F;AAC7F,0FAA0F;AAC1F,4FAA4F;AAC5F,EAAE;AACF,0FAA0F;AAC1F,yCAAyC;AACzC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM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AC;YAED,IAAI,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC;gBACvB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBACtE,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;YAC1D,CAAC;YAED,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,2FAA2F;IAC3F,mDAAmD;IACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;QACrD,MAAM,KAAK,GAAG,YAAY,CAAC,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,IAAI,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,CAAC","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 { createOutput } from '../lib/createOutput';\nimport { writeDevServerEntry } from '../lib/devServerEntry';\nimport { getRoot } from '../lib/discovery';\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"]}
@@ -1,15 +1,17 @@
1
- // `qpq prep` — regenerates apps/<app>/tsconfig.federated.json (the TypeScript
1
+ // `qpq prep`, regenerates apps/<app>/tsconfig.federated.json (the TypeScript
2
2
  // path aliases for cross-view federated imports). Run after adding/removing a
3
3
  // `// federated.export` marker.
4
4
  import { writeFederatedTsconfigForApp } from '@qpqjs/deploy-rspack';
5
+ import { createOutput } from '../lib/createOutput';
5
6
  import { getAvailableApps, getRoot } from '../lib/discovery';
6
7
  import { resolveAppSelection } from '../lib/resolveAppSelection';
8
+ const out = createOutput('prep');
7
9
  export const prepCommand = async (argv) => {
8
10
  const selection = await resolveAppSelection({ argv, allowAll: true });
9
11
  const appNames = selection === 'all' ? getAvailableApps() : [selection];
10
12
  for (const appName of appNames) {
11
13
  const exposeCount = writeFederatedTsconfigForApp(getRoot(), appName);
12
- console.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);
14
+ out.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);
13
15
  }
14
16
  };
15
17
  //# sourceMappingURL=prep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prep.js","sourceRoot":"","sources":["../../../src/commands/prep.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,gCAAgC;AAChC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACjE,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAExE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,4BAA4B,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,eAAe,WAAW,8BAA8B,OAAO,0BAA0B,CAAC,CAAC;IACzG,CAAC;AACH,CAAC,CAAC","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,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACjE,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAExE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,4BAA4B,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QACrE,GAAG,CAAC,GAAG,CAAC,eAAe,WAAW,8BAA8B,OAAO,0BAA0B,CAAC,CAAC;IACrG,CAAC;AACH,CAAC,CAAC","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 { createOutput } from '../lib/createOutput';\nimport { getAvailableApps, getRoot } from '../lib/discovery';\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"]}
@@ -1,4 +1,4 @@
1
- // `qpq publish[:build|:upload|:deploy]` — build each backend service as a
1
+ // `qpq publish[:build|:upload|:deploy]`, build each backend service as a
2
2
  // module-federation remote and publish it into the platform's federated code
3
3
  // store, so the deployed backends federate their story code instead of running
4
4
  // the bundled copy. The mechanics live in the platform driver (AWS: S3-backed,
@@ -9,15 +9,12 @@
9
9
  // qpq publish --app docgen --service template
10
10
  import { getArgValue } from '../lib/args';
11
11
  import { getServiceNames } from '../lib/discovery';
12
- import { resolveAppSelection } from '../lib/resolveAppSelection';
13
- import { resolveDeployment } from '../lib/resolveDeployment';
14
- import { getPlatformDriver } from '../platforms';
12
+ import { resolveCommandContext } from '../lib/resolveCommandContext';
15
13
  const resolvePublishSelection = async (argv) => {
16
- const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });
17
- const { deployment } = await resolveDeployment(argv, appName);
14
+ const { appName, driver } = await resolveCommandContext(argv);
18
15
  const requestedService = getArgValue(argv, '--service');
19
16
  const serviceNames = requestedService ? [requestedService] : getServiceNames(appName);
20
- return { driver: getPlatformDriver(deployment.platform), appName, serviceNames };
17
+ return { driver, appName, serviceNames };
21
18
  };
22
19
  export const publishCommand = async (argv) => {
23
20
  const { driver, appName, serviceNames } = await 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,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAqB,MAAM,cAAc,CAAC;AAQpE,MAAM,uBAAuB,GAAG,KAAK,EAAE,IAAc,EAA6B,EAAE;IAClF,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAEtF,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACnF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,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,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,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,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,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,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,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,CAAC","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,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAk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AAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,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,CAAC","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"]}
@@ -1,13 +1,15 @@
1
- // `qpq script:build <dir> [--out <dir>] [--source-map]` — bundle a user-script project
1
+ // `qpq script:build <dir> [--out <dir>] [--source-map]`, bundle a user-script project
2
2
  // into one main.js that askUserScriptExecute can load from a drive. `--source-map`
3
3
  // embeds the map in main.js; no separate .map file is ever written.
4
4
  import { buildUserScript, checkUserScriptOutput, UserScriptBuildError } from '@qpqjs/user-script';
5
5
  import path from 'path';
6
6
  import { getArgValue, getPositionalArgs, hasArgFlag } from '../lib/args';
7
+ import { createOutput } from '../lib/createOutput';
8
+ const out = createOutput('script:build');
7
9
  export const scriptBuildCommand = async (argv) => {
8
10
  const [projectDir] = getPositionalArgs(argv, ['--out']);
9
11
  if (!projectDir) {
10
- console.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');
12
+ out.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');
11
13
  process.exit(1);
12
14
  }
13
15
  const outDir = getArgValue(argv, '--out') ?? path.join(projectDir, 'dist');
@@ -15,12 +17,12 @@ export const scriptBuildCommand = async (argv) => {
15
17
  const result = await buildUserScript({ projectDir, outDir, sourceMap: hasArgFlag(argv, '--source-map') });
16
18
  // A developer's own build is checked in this process; a platform build asks the sandbox.
17
19
  const exports = checkUserScriptOutput(result.entryPath);
18
- console.log(`script:build: wrote ${result.entryPath}`);
19
- console.log(` exports: ${exports.join(', ')}`);
20
+ out.log(`script:build: wrote ${result.entryPath}`);
21
+ out.log(` exports: ${exports.join(', ')}`);
20
22
  }
21
23
  catch (error) {
22
24
  if (error instanceof UserScriptBuildError) {
23
- console.error(`script:build: ${error.code}: ${error.message}`);
25
+ out.error(`script:build: ${error.code}: ${error.message}`);
24
26
  process.exit(1);
25
27
  }
26
28
  throw error;
@@ -1 +1 @@
1
- {"version":3,"file":"scriptBuild.js","sourceRoot":"","sources":["../../../src/commands/scriptBuild.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,mFAAmF;AACnF,oEAAoE;AACpE,OAAO,EAAE,eAAe,EAA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;QAClB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC","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,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAElG,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,GAAG,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACxE,MAAM,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,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,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAE3E,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QAC1G,yFAAyF;QACzF,MAAM,OAAO,GAAG,qBAAqB,CAAC,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,oBAAoB,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,CAAC","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/createOutput';\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"]}
@@ -1,4 +1,4 @@
1
- // `qpq script:builder-layer [--arch arm64|x86_64]` — produce the lambda layer that gives
1
+ // `qpq script:builder-layer [--arch arm64|x86_64]`, produce the lambda layer that gives
2
2
  // a service rspack, for services that registered defineUserScriptBuilder. The directory
3
3
  // is the one getUserScriptBuilderApiLayer points at, so nothing is told a path. Run from
4
4
  // the app's qpq:predeploy hook, which go:docker fires before the workspace is built, so
@@ -7,7 +7,9 @@
7
7
  import { JavascriptRuntimeArchitecture } from '@qpqjs/core';
8
8
  import { getUserScriptBuilderLayerDir } from '@qpqjs/user-script';
9
9
  import { getArgValue } from '../lib/args';
10
+ import { createOutput } from '../lib/createOutput';
10
11
  import { buildUserScriptBuilderLayer } from '../lib/userScriptBuilderLayer';
12
+ const out = createOutput('script:builder-layer');
11
13
  const ARCH_FLAG = '--arch';
12
14
  const DEFAULT_ARCHITECTURE = JavascriptRuntimeArchitecture.Arm64;
13
15
  /* eslint-disable @typescript-eslint/no-require-imports */
@@ -18,7 +20,7 @@ const parseArchitecture = (argv) => {
18
20
  const requested = getArgValue(argv, ARCH_FLAG) ?? DEFAULT_ARCHITECTURE;
19
21
  const known = Object.values(JavascriptRuntimeArchitecture);
20
22
  if (!known.includes(requested)) {
21
- console.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);
23
+ out.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);
22
24
  process.exit(1);
23
25
  }
24
26
  return requested;
@@ -27,8 +29,8 @@ export const scriptBuilderLayerCommand = async (argv) => {
27
29
  const architecture = parseArchitecture(argv);
28
30
  const rspackVersion = getRspackVersion();
29
31
  const outDir = getUserScriptBuilderLayerDir();
30
- console.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);
32
+ out.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);
31
33
  const nodeDir = buildUserScriptBuilderLayer({ outDir, architecture, rspackVersion });
32
- console.log(`script:builder-layer: wrote ${nodeDir}`);
34
+ out.log(`script:builder-layer: wrote ${nodeDir}`);
33
35
  };
34
36
  //# 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,uDAAuD;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,oBAAoB,GAAG,6BAA6B,CAAC,KAAK,CAAC;AAEjE,0DAA0D;AAC1D,sFAAsF;AACtF,yEAAyE;AACzE,MAAM,gBAAgB,GAAG,GAAW,EAAE,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,OAAiB,CAAC;AAE9F,MAAM,iBAAiB,GAAG,CAAC,IAAc,EAAiC,EAAE;IAC1E,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,oBAAoB,CAAC;IACvE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC;IAC3D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAA0C,CAAC,EAAE,CAAC;QAChE,OAAO,CAAC,KAAK,CAAC,iCAAiC,SAAS,KAAK,SAAS,sBAAsB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,SAA0C,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IAC/E,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,4BAA4B,EAAE,CAAC;IAE9C,OAAO,CAAC,GAAG,CAAC,iDAAiD,aAAa,cAAc,YAAY,SAAS,MAAM,EAAE,CAAC,CAAC;IACvH,MAAM,OAAO,GAAG,2BAA2B,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC","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,"file":"scriptBuilderLayer.js","sourceRoot":"","sources":["../../../src/commands/scriptBuilderLayer.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,wFAAwF;AACxF,yFAAyF;AACzF,wFAAwF;AACxF,yFAAyF;AACzF,uDAAuD;AACvD,OAAO,EAAE,6BAA6B,EA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9C,GAAG,CAAC,GAAG,CAAC,iDAAiD,aAAa,cAAc,YAAY,SAAS,MAAM,EAAE,CAAC,CAAC;IACnH,MAAM,OAAO,GAAG,2BAA2B,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;IACrF,GAAG,CAAC,GAAG,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC","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/createOutput';\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"]}
@@ -1,19 +1,21 @@
1
- // `qpq script:new <dir>` — write the user-script template project into a new
1
+ // `qpq script:new <dir>`, write the user-script template project into a new
2
2
  // directory. See templates/user-script/README.md for what a script is.
3
3
  import path from 'path';
4
4
  import { getPositionalArgs } from '../lib/args';
5
+ import { createOutput } from '../lib/createOutput';
5
6
  import { createUserScriptProject } from '../lib/userScriptTemplate';
7
+ const out = createOutput('script:new');
6
8
  export const scriptNewCommand = async (argv) => {
7
9
  const [targetDir] = getPositionalArgs(argv, []);
8
10
  if (!targetDir) {
9
- console.error('Usage: qpq script:new <dir>');
11
+ out.error('Usage: qpq script:new <dir>');
10
12
  process.exit(1);
11
13
  }
12
14
  const written = createUserScriptProject(targetDir);
13
- console.log(`script:new: wrote ${written.length} files to ${path.resolve(targetDir)}`);
15
+ out.log(`script:new: wrote ${written.length} files to ${path.resolve(targetDir)}`);
14
16
  for (const file of written) {
15
- console.log(` ${file}`);
17
+ out.log(` ${file}`);
16
18
  }
17
- console.log(`Next: cd ${targetDir} && npm run build`);
19
+ out.log(`Next: cd ${targetDir} && npm run build`);
18
20
  };
19
21
  //# 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,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACtE,MAAM,CAAC,SAAS,CAAC,GAAG,iBAAiB,CAAC,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,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,CAAC,MAAM,aAAa,IAAI,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,CAAC","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,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACtE,MAAM,CAAC,SAAS,CAAC,GAAG,iBAAiB,CAAC,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,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEnD,GAAG,CAAC,GAAG,CAAC,qBAAqB,OAAO,CAAC,MAAM,aAAa,IAAI,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,CAAC","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/createOutput';\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"]}
@@ -1,20 +1,13 @@
1
- // `qpq setup` — takes a cloud environment from empty to deployed, in order, with
2
- // every step checked first so the menu shows what is already in place and a
3
- // rerun on a half-set-up account is safe. The platform (from the deployment's
4
- // entry in deploy.config.json) contributes the steps.
5
- // --check print each step's status and exit, run nothing
6
- // --yes run every step without the menu
7
- // --only a,b run only the named step ids (no menu)
8
1
  import { getArgValue } from '../lib/args';
2
+ import { createOutput } from '../lib/createOutput';
9
3
  import { promptCheckbox } from '../lib/prompts';
10
- import { resolveAppSelection } from '../lib/resolveAppSelection';
11
- import { resolveDeployment } from '../lib/resolveDeployment';
12
- import { getPlatformDriver } from '../platforms';
4
+ import { resolveCommandContext } from '../lib/resolveCommandContext';
5
+ const out = createOutput('setup');
13
6
  const statusLabel = (result) => (result === null ? '?' : result.done ? 'done' : 'todo');
14
7
  const printChecklist = (checked) => {
15
8
  for (const { step, result } of checked) {
16
9
  const detail = result?.detail ? ` ${result.detail}` : '';
17
- console.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);
10
+ out.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);
18
11
  }
19
12
  };
20
13
  const checkAll = async (steps) => {
@@ -51,38 +44,37 @@ const selectFromArgs = (steps, argv) => {
51
44
  const ids = only.split(',').map((id) => id.trim());
52
45
  const unknown = ids.filter((id) => !steps.some((step) => step.id === id));
53
46
  if (unknown.length > 0) {
54
- console.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);
47
+ out.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);
55
48
  process.exit(1);
56
49
  }
57
50
  return steps.filter((step) => ids.includes(step.id));
58
51
  };
59
52
  export const setupCommand = async (argv) => {
60
- const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });
61
- const { deploymentName, deployment } = await resolveDeployment(argv, appName);
62
- const driver = getPlatformDriver(deployment.platform);
53
+ const { appName, deploymentName, deployment, driver } = await resolveCommandContext(argv);
54
+ // Nothing to set up is a normal outcome here, not a refused command.
63
55
  if (!driver.setupSteps) {
64
- console.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);
56
+ out.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);
65
57
  return;
66
58
  }
67
59
  const steps = await driver.setupSteps(appName, deploymentName);
68
- console.log(`\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\n`);
60
+ out.log(`\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\n`);
69
61
  const checked = await checkAll(steps);
70
62
  printChecklist(checked);
71
- console.log('');
63
+ out.log('');
72
64
  if (argv.includes('--check')) {
73
65
  return;
74
66
  }
75
67
  const toRun = selectFromArgs(steps, argv) ?? (await chooseSteps(checked));
76
68
  if (toRun.length === 0) {
77
- console.log('Nothing selected.');
69
+ out.log('Nothing selected.');
78
70
  return;
79
71
  }
80
72
  for (const step of toRun) {
81
- console.log(`\n== ${step.name}\n`);
73
+ out.log(`\n== ${step.name}\n`);
82
74
  await step.run();
83
75
  }
84
- console.log('\nSetup complete. Final state:\n');
76
+ out.log('\nSetup complete. Final state:\n');
85
77
  printChecklist(await checkAll(steps));
86
- console.log(`\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);
78
+ out.log(`\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);
87
79
  };
88
80
  //# sourceMappingURL=setup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,4EAA4E;AAC5E,8EAA8E;AAC9E,sDAAsD;AACtD,gEAAgE;AAChE,iDAAiD;AACjD,uDAAuD;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,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AED,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAE/D,OAAO,CAAC,GAAG,CAAC,oBAAoB,OAAO,kBAAkB,cAAc,MAAM,UAAU,CAAC,QAAQ,KAAK,CAAC,CAAC;IACvG,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,cAAc,CAAC,OAAO,CAAC,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,OAAO;IACT,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QACnC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAChD,cAAc,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,qEAAqE,OAAO,iBAAiB,cAAc,EAAE,CAAC,CAAC;AAC7H,CAAC,CAAC","sourcesContent":["// `qpq setup` — takes a cloud environment from empty to deployed, in order, with\n// every step checked first so the menu shows what is already in place and a\n// rerun on a half-set-up account is safe. The platform (from the deployment's\n// entry in deploy.config.json) contributes the steps.\n// --check print each step's status and exit, run nothing\n// --yes run every step without the menu\n// --only a,b run only the named step ids (no menu)\nimport { getArgValue } from '../lib/args';\nimport { promptCheckbox } from '../lib/prompts';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { SetupCheckResult, SetupStep } from '../lib/setupStep';\nimport { getPlatformDriver } from '../platforms';\n\ntype CheckedStep = { step: SetupStep; result: SetupCheckResult | null };\n\nconst statusLabel = (result: SetupCheckResult | null): string => (result === null ? '?' : result.done ? 'done' : 'todo');\n\nconst printChecklist = (checked: CheckedStep[]): void => {\n for (const { step, result } of checked) {\n const detail = result?.detail ? ` ${result.detail}` : '';\n console.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);\n }\n};\n\nconst checkAll = async (steps: SetupStep[]): Promise<CheckedStep[]> => {\n const checked: CheckedStep[] = [];\n for (const step of steps) {\n try {\n checked.push({ step, result: await step.check() });\n } catch (error) {\n checked.push({ step, result: { done: false, detail: `check failed: ${error instanceof Error ? error.message : String(error)}` } });\n }\n }\n return checked;\n};\n\n// Steps not yet done are preselected; done ones can still be picked to rerun.\nconst chooseSteps = async (checked: CheckedStep[]): Promise<SetupStep[]> => {\n const chosen = await promptCheckbox(\n 'Setup steps to run (space toggles, enter runs in order)',\n checked.map(({ step, result }) => ({\n name: `[${statusLabel(result).padEnd(4)}] ${step.name}`,\n value: step,\n checked: !result?.done,\n description: result?.detail,\n })),\n );\n\n // Always run in checklist order, whatever order they were ticked in.\n return checked.map(({ step }) => step).filter((step) => chosen.includes(step));\n};\n\nconst selectFromArgs = (steps: SetupStep[], argv: string[]): SetupStep[] | null => {\n if (argv.includes('--yes')) {\n return steps;\n }\n\n const only = getArgValue(argv, '--only');\n if (!only) {\n return null;\n }\n\n const ids = only.split(',').map((id) => id.trim());\n const unknown = ids.filter((id) => !steps.some((step) => step.id === id));\n if (unknown.length > 0) {\n console.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);\n process.exit(1);\n }\n\n return steps.filter((step) => ids.includes(step.id));\n};\n\nexport const setupCommand = async (argv: string[]): Promise<void> => {\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { deploymentName, deployment } = await resolveDeployment(argv, appName);\n const driver = getPlatformDriver(deployment.platform);\n\n if (!driver.setupSteps) {\n console.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);\n return;\n }\n\n const steps = await driver.setupSteps(appName, deploymentName);\n\n console.log(`\\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\\n`);\n const checked = await checkAll(steps);\n printChecklist(checked);\n console.log('');\n\n if (argv.includes('--check')) {\n return;\n }\n\n const toRun = selectFromArgs(steps, argv) ?? (await chooseSteps(checked));\n if (toRun.length === 0) {\n console.log('Nothing selected.');\n return;\n }\n\n for (const step of toRun) {\n console.log(`\\n== ${step.name}\\n`);\n await step.run();\n }\n\n console.log('\\nSetup complete. Final state:\\n');\n printChecklist(await checkAll(steps));\n console.log(`\\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);\n};\n"]}
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;AAIlC,MAAM,WAAW,GAAG,CAAC,MAAkC,EAAU,EAAE,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5H,MAAM,cAAc,GAAG,CAAC,OAAsB,EA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QACvB,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC7B,OAAO;IACT,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,GAAG,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QAC/B,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAC5C,cAAc,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,GAAG,CAAC,GAAG,CAAC,qEAAqE,OAAO,iBAAiB,cAAc,EAAE,CAAC,CAAC;AACzH,CAAC,CAAC","sourcesContent":["// `qpq setup`, takes a cloud environment from empty to deployed, in order, with\n// every step checked first so the menu shows what is already in place and a\n// rerun on a half-set-up account is safe. The platform (from the deployment's\n// entry in deploy.config.json) contributes the steps.\n// --check print each step's status and exit, run nothing\n// --yes run every step without the menu\n// --only a,b run only the named step ids (no menu)\nimport { Nullable } from '@qpqjs/core';\n\nimport { getArgValue } from '../lib/args';\nimport { createOutput } from '../lib/createOutput';\nimport { promptCheckbox } from '../lib/prompts';\nimport { resolveCommandContext } from '../lib/resolveCommandContext';\nimport { SetupCheckResult, SetupStep } from '../lib/setupStep';\n\nconst out = createOutput('setup');\n\ntype CheckedStep = { step: SetupStep; result: Nullable<SetupCheckResult> };\n\nconst statusLabel = (result: Nullable<SetupCheckResult>): string => (result === null ? '?' : result.done ? 'done' : 'todo');\n\nconst printChecklist = (checked: CheckedStep[]): void => {\n for (const { step, result } of checked) {\n const detail = result?.detail ? ` ${result.detail}` : '';\n out.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);\n }\n};\n\nconst checkAll = async (steps: SetupStep[]): Promise<CheckedStep[]> => {\n const checked: CheckedStep[] = [];\n for (const step of steps) {\n try {\n checked.push({ step, result: await step.check() });\n } catch (error) {\n checked.push({ step, result: { done: false, detail: `check failed: ${error instanceof Error ? error.message : String(error)}` } });\n }\n }\n return checked;\n};\n\n// Steps not yet done are preselected; done ones can still be picked to rerun.\nconst chooseSteps = async (checked: CheckedStep[]): Promise<SetupStep[]> => {\n const chosen = await promptCheckbox(\n 'Setup steps to run (space toggles, enter runs in order)',\n checked.map(({ step, result }) => ({\n name: `[${statusLabel(result).padEnd(4)}] ${step.name}`,\n value: step,\n checked: !result?.done,\n description: result?.detail,\n })),\n );\n\n // Always run in checklist order, whatever order they were ticked in.\n return checked.map(({ step }) => step).filter((step) => chosen.includes(step));\n};\n\nconst selectFromArgs = (steps: SetupStep[], argv: string[]): Nullable<SetupStep[]> => {\n if (argv.includes('--yes')) {\n return steps;\n }\n\n const only = getArgValue(argv, '--only');\n if (!only) {\n return null;\n }\n\n const ids = only.split(',').map((id) => id.trim());\n const unknown = ids.filter((id) => !steps.some((step) => step.id === id));\n if (unknown.length > 0) {\n out.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);\n process.exit(1);\n }\n\n return steps.filter((step) => ids.includes(step.id));\n};\n\nexport const setupCommand = async (argv: string[]): Promise<void> => {\n const { appName, deploymentName, deployment, driver } = await resolveCommandContext(argv);\n\n // Nothing to set up is a normal outcome here, not a refused command.\n if (!driver.setupSteps) {\n out.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);\n return;\n }\n\n const steps = await driver.setupSteps(appName, deploymentName);\n\n out.log(`\\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\\n`);\n const checked = await checkAll(steps);\n printChecklist(checked);\n out.log('');\n\n if (argv.includes('--check')) {\n return;\n }\n\n const toRun = selectFromArgs(steps, argv) ?? (await chooseSteps(checked));\n if (toRun.length === 0) {\n out.log('Nothing selected.');\n return;\n }\n\n for (const step of toRun) {\n out.log(`\\n== ${step.name}\\n`);\n await step.run();\n }\n\n out.log('\\nSetup complete. Final state:\\n');\n printChecklist(await checkAll(steps));\n out.log(`\\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);\n};\n"]}
@@ -1,60 +1,56 @@
1
- // `qpq synth [service]` — synthesizes each backend service's QPQ config to
1
+ // `qpq synth [service]`, synthesizes each backend service's QPQ config to
2
2
  // dist/apps/<app>/infrastructure/<module>-config.json.
3
3
  //
4
4
  // Runs with ts-node hooks registered (see runCli), which transpiles each
5
5
  // service's infrastructure.ts on require. Cross-package `@scope/*` imports
6
6
  // resolve through the workspace node_modules symlinks to already-built dist.
7
- import { qpqCoreUtils } from '@qpqjs/core';
7
+ import { getInfrastructureConfigPath, qpqCoreUtils, QpqDeployEnvVar } from '@qpqjs/core';
8
8
  import fs from 'fs';
9
9
  import path from 'path';
10
10
  import { getPositionalArgs } from '../lib/args';
11
+ import { createOutput } from '../lib/createOutput';
11
12
  import { getAvailableApps, getRoot, getServiceNamesWithSubdir } from '../lib/discovery';
12
13
  import { loadServiceQpqConfig } from '../lib/qpqConfigs';
13
- import { resolveAppSelection } from '../lib/resolveAppSelection';
14
+ import { getRequestedAppName, resolveAppSelection } from '../lib/resolveAppSelection';
14
15
  import { resolveDeployment } from '../lib/resolveDeployment';
16
+ const out = createOutput('synth');
15
17
  const processConfig = (folderName, appName) => {
16
- console.log(`Processing infrastructure: [${folderName}] for app [${appName}]`);
18
+ out.log(`Processing infrastructure: [${folderName}] for app [${appName}]`);
17
19
  const qpqConfig = loadServiceQpqConfig(appName, folderName);
18
20
  const moduleName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
19
- const directoryPath = path.join(getRoot(), 'dist', 'apps', appName, 'infrastructure');
21
+ const directoryPath = getInfrastructureConfigPath(getRoot(), appName);
20
22
  fs.mkdirSync(directoryPath, { recursive: true });
21
23
  fs.writeFileSync(path.join(directoryPath, `${moduleName}-config.json`), JSON.stringify(qpqConfig, null, 2));
22
- console.log(` -> ${appName}/infrastructure/${moduleName}-config.json`);
24
+ out.log(` -> ${appName}/infrastructure/${moduleName}-config.json`);
23
25
  };
24
26
  export const synthCommand = async (argv) => {
25
27
  const [specifiedServiceName] = getPositionalArgs(argv, ['--app', '--deployment']);
26
- const hasExplicitApp = argv.includes('--app') || argv.some((a) => a.startsWith('--app=')) || !!process.env.npm_config_app || !!process.env.DEPLOY_APP_NAME;
27
28
  let appNames;
28
- if (specifiedServiceName && !hasExplicitApp) {
29
- // A bare service name is unambiguous — synth it in whichever app owns it.
29
+ if (specifiedServiceName && !getRequestedAppName(argv, QpqDeployEnvVar.deployAppName)) {
30
+ // A bare service name is unambiguous, synth it in whichever app owns it.
30
31
  const appWithService = getAvailableApps().find((appName) => getServiceNamesWithSubdir(appName, 'service').includes(specifiedServiceName));
31
32
  if (!appWithService) {
32
- console.error(`Service '${specifiedServiceName}' not found in any app`);
33
+ out.error(`Service '${specifiedServiceName}' not found in any app`);
33
34
  process.exit(1);
34
35
  }
35
36
  appNames = [appWithService];
36
37
  }
37
38
  else {
38
- const selection = await resolveAppSelection({
39
- argv,
40
- envVar: 'DEPLOY_APP_NAME',
41
- allowAll: true,
42
- });
39
+ const selection = await resolveAppSelection({ argv, envVar: QpqDeployEnvVar.deployAppName, allowAll: true });
43
40
  appNames = selection === 'all' ? getAvailableApps() : [selection];
44
41
  }
45
- console.log(`QPQ synthesizing apps: ${appNames.join(', ')}`);
42
+ out.log(`QPQ synthesizing apps: ${appNames.join(', ')}`);
46
43
  for (const appName of appNames) {
47
44
  // Service configs read the deployment env vars at require time, so the
48
45
  // deployment is resolved (and primed) before any infrastructure.ts loads.
49
46
  await resolveDeployment(argv, appName);
50
47
  // Validate a specified service against the app's discovered services before it
51
- // reaches loadServiceQpqConfig -> require. The bare-service-name branch above
52
- // already checks this; the --app/env branch used to skip it, letting a typo hit
53
- // a cryptic module-resolution error and a `../` value normalize into an arbitrary
54
- // require target. Both paths now validate identically.
48
+ // reaches loadServiceQpqConfig -> require, exactly as the bare-service-name branch
49
+ // above does: an unchecked typo hits a cryptic module-resolution error and a `../`
50
+ // value normalizes into an arbitrary require target.
55
51
  const appServices = getServiceNamesWithSubdir(appName, 'service');
56
52
  if (specifiedServiceName && !appServices.includes(specifiedServiceName)) {
57
- console.error(`Service '${specifiedServiceName}' not found in app '${appName}'`);
53
+ out.error(`Service '${specifiedServiceName}' not found in app '${appName}'`);
58
54
  process.exitCode = 1;
59
55
  continue;
60
56
  }
@@ -64,7 +60,7 @@ export const synthCommand = async (argv) => {
64
60
  processConfig(folderName, appName);
65
61
  }
66
62
  catch (error) {
67
- console.error(`Failed to process ${folderName} in ${appName}:`, error);
63
+ out.error(`Failed to process ${folderName} in ${appName}:`, error);
68
64
  process.exitCode = 1;
69
65
  }
70
66
  }