@qpqjs/cli 0.4.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 (185) hide show
  1. package/lib/commonjs/cli/runCli.js +2 -2
  2. package/lib/commonjs/cli/runCli.js.map +1 -1
  3. package/lib/commonjs/commands/checkCircular.js +2 -2
  4. package/lib/commonjs/commands/checkCircular.js.map +1 -1
  5. package/lib/commonjs/commands/goDev.js +2 -2
  6. package/lib/commonjs/commands/goDev.js.map +1 -1
  7. package/lib/commonjs/commands/goDevApi.js +6 -5
  8. package/lib/commonjs/commands/goDevApi.js.map +1 -1
  9. package/lib/commonjs/commands/goDevWeb.js +3 -3
  10. package/lib/commonjs/commands/goDevWeb.js.map +1 -1
  11. package/lib/commonjs/commands/goDocker.js +2 -2
  12. package/lib/commonjs/commands/goDocker.js.map +1 -1
  13. package/lib/commonjs/commands/hooks.js +2 -2
  14. package/lib/commonjs/commands/hooks.js.map +1 -1
  15. package/lib/commonjs/commands/migrate.js +2 -2
  16. package/lib/commonjs/commands/migrate.js.map +1 -1
  17. package/lib/commonjs/commands/prep.js +2 -2
  18. package/lib/commonjs/commands/prep.js.map +1 -1
  19. package/lib/commonjs/commands/scriptBuild.js +2 -2
  20. package/lib/commonjs/commands/scriptBuild.js.map +1 -1
  21. package/lib/commonjs/commands/scriptBuilderLayer.js +2 -2
  22. package/lib/commonjs/commands/scriptBuilderLayer.js.map +1 -1
  23. package/lib/commonjs/commands/scriptNew.js +2 -2
  24. package/lib/commonjs/commands/scriptNew.js.map +1 -1
  25. package/lib/commonjs/commands/setup.js +2 -2
  26. package/lib/commonjs/commands/setup.js.map +1 -1
  27. package/lib/commonjs/commands/synth.js +2 -2
  28. package/lib/commonjs/commands/synth.js.map +1 -1
  29. package/lib/commonjs/lib/{out.d.ts → Output.d.ts} +2 -1
  30. package/lib/commonjs/lib/Output.js +3 -0
  31. package/lib/commonjs/lib/Output.js.map +1 -0
  32. package/lib/commonjs/lib/clearResourcesPlan.js +2 -2
  33. package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -1
  34. package/lib/commonjs/lib/createOutput.d.ts +2 -0
  35. package/lib/commonjs/lib/{out.js → createOutput.js} +13 -4
  36. package/lib/commonjs/lib/createOutput.js.map +1 -0
  37. package/lib/commonjs/lib/deployPrompts.js +3 -3
  38. package/lib/commonjs/lib/deployPrompts.js.map +1 -1
  39. package/lib/commonjs/lib/hooks.js +2 -2
  40. package/lib/commonjs/lib/hooks.js.map +1 -1
  41. package/lib/commonjs/lib/killChildWithEscalation.js +2 -2
  42. package/lib/commonjs/lib/killChildWithEscalation.js.map +1 -1
  43. package/lib/commonjs/lib/killStaleListeners.js +3 -3
  44. package/lib/commonjs/lib/killStaleListeners.js.map +1 -1
  45. package/lib/commonjs/lib/prompts.js +2 -2
  46. package/lib/commonjs/lib/prompts.js.map +1 -1
  47. package/lib/commonjs/lib/qpqConfigs.d.ts +1 -0
  48. package/lib/commonjs/lib/qpqConfigs.js +9 -4
  49. package/lib/commonjs/lib/qpqConfigs.js.map +1 -1
  50. package/lib/commonjs/lib/requireDriverCapability.js +2 -2
  51. package/lib/commonjs/lib/requireDriverCapability.js.map +1 -1
  52. package/lib/commonjs/lib/resolveAppSelection.js +3 -3
  53. package/lib/commonjs/lib/resolveAppSelection.js.map +1 -1
  54. package/lib/commonjs/lib/resolveDeployment.js +3 -3
  55. package/lib/commonjs/lib/resolveDeployment.js.map +1 -1
  56. package/lib/commonjs/lib/runCommand.js +2 -2
  57. package/lib/commonjs/lib/runCommand.js.map +1 -1
  58. package/lib/commonjs/lib/runTasks.js +2 -2
  59. package/lib/commonjs/lib/runTasks.js.map +1 -1
  60. package/lib/commonjs/lib/timing.js +2 -2
  61. package/lib/commonjs/lib/timing.js.map +1 -1
  62. package/lib/commonjs/lib/typeWatcher.js +3 -3
  63. package/lib/commonjs/lib/typeWatcher.js.map +1 -1
  64. package/lib/commonjs/lib/userScriptBuilderLayer.js +1 -1
  65. package/lib/commonjs/lib/userScriptBuilderLayer.js.map +1 -1
  66. package/lib/commonjs/platforms/aws/awsCredentials.js +2 -2
  67. package/lib/commonjs/platforms/aws/awsCredentials.js.map +1 -1
  68. package/lib/commonjs/platforms/aws/clearResources.js +4 -3
  69. package/lib/commonjs/platforms/aws/clearResources.js.map +1 -1
  70. package/lib/commonjs/platforms/aws/go.js +2 -2
  71. package/lib/commonjs/platforms/aws/go.js.map +1 -1
  72. package/lib/commonjs/platforms/aws/goDocker.js +2 -2
  73. package/lib/commonjs/platforms/aws/goDocker.js.map +1 -1
  74. package/lib/commonjs/platforms/aws/publish.js +2 -2
  75. package/lib/commonjs/platforms/aws/publish.js.map +1 -1
  76. package/lib/commonjs/platforms/aws/remote.js +2 -2
  77. package/lib/commonjs/platforms/aws/remote.js.map +1 -1
  78. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js +2 -2
  79. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
  80. package/lib/commonjs/platforms/aws/stacks.js +4 -8
  81. package/lib/commonjs/platforms/aws/stacks.js.map +1 -1
  82. package/lib/commonjs/platforms/aws/teardown.js +2 -2
  83. package/lib/commonjs/platforms/aws/teardown.js.map +1 -1
  84. package/lib/commonjs/platforms/aws/viewsSync.js +2 -2
  85. package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -1
  86. package/lib/commonjs/platforms/docker/go.js +2 -2
  87. package/lib/commonjs/platforms/docker/go.js.map +1 -1
  88. package/lib/commonjs/platforms/docker/index.js +2 -2
  89. package/lib/commonjs/platforms/docker/index.js.map +1 -1
  90. package/lib/commonjs/platforms/index.js +2 -2
  91. package/lib/commonjs/platforms/index.js.map +1 -1
  92. package/lib/esm/cli/runCli.js +1 -1
  93. package/lib/esm/cli/runCli.js.map +1 -1
  94. package/lib/esm/commands/checkCircular.js +1 -1
  95. package/lib/esm/commands/checkCircular.js.map +1 -1
  96. package/lib/esm/commands/goDev.js +1 -1
  97. package/lib/esm/commands/goDev.js.map +1 -1
  98. package/lib/esm/commands/goDevApi.js +4 -4
  99. package/lib/esm/commands/goDevApi.js.map +1 -1
  100. package/lib/esm/commands/goDevWeb.js +2 -2
  101. package/lib/esm/commands/goDevWeb.js.map +1 -1
  102. package/lib/esm/commands/goDocker.js +1 -1
  103. package/lib/esm/commands/goDocker.js.map +1 -1
  104. package/lib/esm/commands/hooks.js +1 -1
  105. package/lib/esm/commands/hooks.js.map +1 -1
  106. package/lib/esm/commands/migrate.js +1 -1
  107. package/lib/esm/commands/migrate.js.map +1 -1
  108. package/lib/esm/commands/prep.js +1 -1
  109. package/lib/esm/commands/prep.js.map +1 -1
  110. package/lib/esm/commands/scriptBuild.js +1 -1
  111. package/lib/esm/commands/scriptBuild.js.map +1 -1
  112. package/lib/esm/commands/scriptBuilderLayer.js +1 -1
  113. package/lib/esm/commands/scriptBuilderLayer.js.map +1 -1
  114. package/lib/esm/commands/scriptNew.js +1 -1
  115. package/lib/esm/commands/scriptNew.js.map +1 -1
  116. package/lib/esm/commands/setup.js +1 -1
  117. package/lib/esm/commands/setup.js.map +1 -1
  118. package/lib/esm/commands/synth.js +1 -1
  119. package/lib/esm/commands/synth.js.map +1 -1
  120. package/lib/esm/lib/{out.d.ts → Output.d.ts} +2 -1
  121. package/lib/esm/lib/Output.js +2 -0
  122. package/lib/esm/lib/Output.js.map +1 -0
  123. package/lib/esm/lib/clearResourcesPlan.js +1 -1
  124. package/lib/esm/lib/clearResourcesPlan.js.map +1 -1
  125. package/lib/esm/lib/createOutput.d.ts +2 -0
  126. package/lib/esm/lib/{out.js → createOutput.js} +13 -4
  127. package/lib/esm/lib/createOutput.js.map +1 -0
  128. package/lib/esm/lib/deployPrompts.js +2 -2
  129. package/lib/esm/lib/deployPrompts.js.map +1 -1
  130. package/lib/esm/lib/hooks.js +1 -1
  131. package/lib/esm/lib/hooks.js.map +1 -1
  132. package/lib/esm/lib/killChildWithEscalation.js +1 -1
  133. package/lib/esm/lib/killChildWithEscalation.js.map +1 -1
  134. package/lib/esm/lib/killStaleListeners.js +2 -2
  135. package/lib/esm/lib/killStaleListeners.js.map +1 -1
  136. package/lib/esm/lib/prompts.js +1 -1
  137. package/lib/esm/lib/prompts.js.map +1 -1
  138. package/lib/esm/lib/qpqConfigs.d.ts +1 -0
  139. package/lib/esm/lib/qpqConfigs.js +7 -3
  140. package/lib/esm/lib/qpqConfigs.js.map +1 -1
  141. package/lib/esm/lib/requireDriverCapability.js +1 -1
  142. package/lib/esm/lib/requireDriverCapability.js.map +1 -1
  143. package/lib/esm/lib/resolveAppSelection.js +2 -2
  144. package/lib/esm/lib/resolveAppSelection.js.map +1 -1
  145. package/lib/esm/lib/resolveDeployment.js +2 -2
  146. package/lib/esm/lib/resolveDeployment.js.map +1 -1
  147. package/lib/esm/lib/runCommand.js +1 -1
  148. package/lib/esm/lib/runCommand.js.map +1 -1
  149. package/lib/esm/lib/runTasks.js +1 -1
  150. package/lib/esm/lib/runTasks.js.map +1 -1
  151. package/lib/esm/lib/timing.js +1 -1
  152. package/lib/esm/lib/timing.js.map +1 -1
  153. package/lib/esm/lib/typeWatcher.js +2 -2
  154. package/lib/esm/lib/typeWatcher.js.map +1 -1
  155. package/lib/esm/lib/userScriptBuilderLayer.js +1 -1
  156. package/lib/esm/lib/userScriptBuilderLayer.js.map +1 -1
  157. package/lib/esm/platforms/aws/awsCredentials.js +1 -1
  158. package/lib/esm/platforms/aws/awsCredentials.js.map +1 -1
  159. package/lib/esm/platforms/aws/clearResources.js +3 -2
  160. package/lib/esm/platforms/aws/clearResources.js.map +1 -1
  161. package/lib/esm/platforms/aws/go.js +1 -1
  162. package/lib/esm/platforms/aws/go.js.map +1 -1
  163. package/lib/esm/platforms/aws/goDocker.js +1 -1
  164. package/lib/esm/platforms/aws/goDocker.js.map +1 -1
  165. package/lib/esm/platforms/aws/publish.js +1 -1
  166. package/lib/esm/platforms/aws/publish.js.map +1 -1
  167. package/lib/esm/platforms/aws/remote.js +1 -1
  168. package/lib/esm/platforms/aws/remote.js.map +1 -1
  169. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js +1 -1
  170. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
  171. package/lib/esm/platforms/aws/stacks.js +5 -9
  172. package/lib/esm/platforms/aws/stacks.js.map +1 -1
  173. package/lib/esm/platforms/aws/teardown.js +1 -1
  174. package/lib/esm/platforms/aws/teardown.js.map +1 -1
  175. package/lib/esm/platforms/aws/viewsSync.js +1 -1
  176. package/lib/esm/platforms/aws/viewsSync.js.map +1 -1
  177. package/lib/esm/platforms/docker/go.js +1 -1
  178. package/lib/esm/platforms/docker/go.js.map +1 -1
  179. package/lib/esm/platforms/docker/index.js +1 -1
  180. package/lib/esm/platforms/docker/index.js.map +1 -1
  181. package/lib/esm/platforms/index.js +1 -1
  182. package/lib/esm/platforms/index.js.map +1 -1
  183. package/package.json +11 -11
  184. package/lib/commonjs/lib/out.js.map +0 -1
  185. package/lib/esm/lib/out.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"qpqConfigs.js","sourceRoot":"","sources":["../../../src/lib/qpqConfigs.ts"],"names":[],"mappings":";;;AAAA,sCAA2D;AAC3D,kDAAiE;AAEjE,2CAAuD;AAEvD,wEAAwE;AACxE,2EAA2E;AAC3E,uBAAuB;AAChB,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAa,EAAE,CAAC,IAAA,yCAA4B,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAAlI,QAAA,oBAAoB,wBAA8G;AAExI,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,MAAM,CAAC,YAAY,CAAC,GAAG,IAAA,2BAAe,EAAC,OAAO,CAAC,CAAC;IAChD,IAAI,YAAY,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,EAAE,CAAC,CAAC;IACxF,OAAO,mBAAY,CAAC,kBAAkB,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AACtF,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEF,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,4DAA4D;AACrD,MAAM,6BAA6B,GAAG,CAAC,OAAe,EAAE,YAAsB,EAAY,EAAE,CACjG,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAY,CAAC,uBAAuB,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AADtG,QAAA,6BAA6B,iCACyE","sourcesContent":["import { type QPQConfig, qpqCoreUtils } from '@qpqjs/core';\nimport { getWorkspaceServiceQpqConfig } from '@qpqjs/deploy-aws';\n\nimport { getRoot, getServiceNames } from './discovery';\n\n// Loads a service's live infrastructure.ts (qpq runs with ts-node hooks\n// registered, so requiring TS works and `@scope/*` imports resolve through\n// workspace symlinks).\nexport const loadServiceQpqConfig = (appName: string, service: string): QPQConfig => getWorkspaceServiceQpqConfig(getRoot(), appName, service);\n\nexport const getAppPrefix = (appName: string): string => {\n const [firstService] = getServiceNames(appName);\n if (firstService === undefined) throw new Error(`No services found for app ${appName}`);\n return qpqCoreUtils.getApplicationName(loadServiceQpqConfig(appName, firstService));\n};\n\n// The subset of the given services that opt into module-federation publishing,\n// i.e. declare defineFederatedModuleStore(...). Federation is a config setting,\n// not a directory convention (unlike views/ backends), so detecting it means\n// loading each service's config, which is why this lives here and not in the\n// directory-only discovery module. Used by the deploy drivers to decide which\n// backends to publish federated remotes for after a deploy.\nexport const getServiceNamesWithFederation = (appName: string, serviceNames: string[]): string[] =>\n serviceNames.filter((service) => !!qpqCoreUtils.getFederatedModuleStore(loadServiceQpqConfig(appName, service)));\n"]}
1
+ {"version":3,"file":"qpqConfigs.js","sourceRoot":"","sources":["../../../src/lib/qpqConf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aceServiceQpqConfig } from '@qpqjs/deploy-aws';\n\nimport { getRoot, getServiceNames } from './discovery';\n\n// Loads a service's live infrastructure.ts (qpq runs with ts-node hooks\n// registered, so requiring TS works and `@scope/*` imports resolve through\n// workspace symlinks).\nexport const loadServiceQpqConfig = (appName: string, service: string): QPQConfig => getWorkspaceServiceQpqConfig(getRoot(), appName, service);\n\n// App-wide facts (the application name, the domain stack) live on every service's config alike, so the first\n// service found stands in for the app. An app with no services has no config to read and that is an error.\nexport const loadFirstServiceQpqConfig = (appName: string): QPQConfig => {\n const [firstService] = getServiceNames(appName);\n if (firstService === undefined) {\n throw new Error(`No services found for app ${appName}`);\n }\n\n return loadServiceQpqConfig(appName, firstService);\n};\n\nexport const getAppPrefix = (appName: string): string => qpqCoreUtils.getApplicationName(loadFirstServiceQpqConfig(appName));\n\n// The subset of the given services that opt into module-federation publishing,\n// i.e. declare defineFederatedModuleStore(...). Federation is a config setting,\n// not a directory convention (unlike views/ backends), so detecting it means\n// loading each service's config, which is why this lives here and not in the\n// directory-only discovery module. Used by the deploy drivers to decide which\n// backends to publish federated remotes for after a deploy.\nexport const getServiceNamesWithFederation = (appName: string, serviceNames: string[]): string[] =>\n serviceNames.filter((service) => !!qpqCoreUtils.getFederatedModuleStore(loadServiceQpqConfig(appName, service)));\n"]}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requireDriverCapability = void 0;
4
4
  const CliError_1 = require("./CliError");
5
- const out_1 = require("./out");
6
- const out = (0, out_1.createOutput)('require-driver-capability');
5
+ const createOutput_1 = require("./createOutput");
6
+ const out = (0, createOutput_1.createOutput)('require-driver-capability');
7
7
  // Hands back a driver's optional capability, or stops the command with a message naming the
8
8
  // platform that lacks it. The capability name doubles as the strategy name in that message.
9
9
  const requireDriverCapability = (context, capability, hint = '') => {
@@ -1 +1 @@
1
- {"version":3,"file":"requireDriverCapability.js","sourceRoot":"","sources":["../../../src/lib/requireDriverCapability.ts"],"names":[],"mappings":";;;AAEA,yCAAsC;AACtC,+BAAqC;AAErC,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,2BAA2B,CAAC,CAAC;AAMtD,4FAA4F;AAC5F,4FAA4F;AACrF,MAAM,uBAAuB,GAAG,CACrC,OAAuB,EACvB,UAAa,EACb,OAAe,EAAE,EACkB,EAAE;IACrC,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAElD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAQ,CAAC,QAAQ,OAAO,CAAC,UAAU,CAAC,QAAQ,qBAAqB,UAAU,aAAa,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9H,CAAC;IAED,OAAO,cAAmD,CAAC;AAC7D,CAAC,CAAC;AAZW,QAAA,uBAAuB,2BAYlC","sourcesContent":["import { QpqPlatformDriver } from '../platforms';\nimport { CommandContext } from './resolveCommandContext';\nimport { CliError } from './CliError';\nimport { createOutput } from './out';\n\nconst out = createOutput('require-driver-capability');\n\ntype OptionalCapability = {\n [K in keyof QpqPlatformDriver]-?: undefined extends QpqPlatformDriver[K] ? K : never;\n}[keyof QpqPlatformDriver];\n\n// Hands back a driver's optional capability, or stops the command with a message naming the\n// platform that lacks it. The capability name doubles as the strategy name in that message.\nexport const requireDriverCapability = <K extends OptionalCapability>(\n context: CommandContext,\n capability: K,\n hint: string = '',\n): NonNullable<QpqPlatformDriver[K]> => {\n const implementation = context.driver[capability];\n\n if (!implementation) {\n throw new CliError(`The '${context.deployment.platform}' platform has no ${capability} strategy.${hint ? ` ${hint}` : ''}`);\n }\n\n return implementation as NonNullable<QpqPlatformDriver[K]>;\n};\n"]}
1
+ {"version":3,"file":"requireDriverCapability.js","sourceRoot":"","sources":["../../../src/lib/requireDriverCapability.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AACtC,iDAA8C;AAG9C,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,2BAA2B,CAAC,CAAC;AAMtD,4FAA4F;AAC5F,4FAA4F;AACrF,MAAM,uBAAuB,GAAG,CACrC,OAAuB,EACvB,UAAa,EACb,OAAe,EAAE,EACkB,EAAE;IACrC,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAElD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAQ,CAAC,QAAQ,OAAO,CAAC,UAAU,CAAC,QAAQ,qBAAqB,UAAU,aAAa,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9H,CAAC;IAED,OAAO,cAAmD,CAAC;AAC7D,CAAC,CAAC;AAZW,QAAA,uBAAuB,2BAYlC","sourcesContent":["import { QpqPlatformDriver } from '../platforms';\nimport { CliError } from './CliError';\nimport { createOutput } from './createOutput';\nimport { CommandContext } from './resolveCommandContext';\n\nconst out = createOutput('require-driver-capability');\n\ntype OptionalCapability = {\n [K in keyof QpqPlatformDriver]-?: undefined extends QpqPlatformDriver[K] ? K : never;\n}[keyof QpqPlatformDriver];\n\n// Hands back a driver's optional capability, or stops the command with a message naming the\n// platform that lacks it. The capability name doubles as the strategy name in that message.\nexport const requireDriverCapability = <K extends OptionalCapability>(\n context: CommandContext,\n capability: K,\n hint: string = '',\n): NonNullable<QpqPlatformDriver[K]> => {\n const implementation = context.driver[capability];\n\n if (!implementation) {\n throw new CliError(`The '${context.deployment.platform}' platform has no ${capability} strategy.${hint ? ` ${hint}` : ''}`);\n }\n\n return implementation as NonNullable<QpqPlatformDriver[K]>;\n};\n"]}
@@ -22,11 +22,11 @@ exports.resolveAppSelection = exports.getRequestedAppName = void 0;
22
22
  // Commands that can meaningfully run for every app may pass allowAll to accept
23
23
  // `--app all` (returned as the literal 'all').
24
24
  const args_1 = require("./args");
25
+ const CliError_1 = require("./CliError");
26
+ const createOutput_1 = require("./createOutput");
25
27
  const discovery_1 = require("./discovery");
26
28
  const prompts_1 = require("./prompts");
27
- const CliError_1 = require("./CliError");
28
- const out_1 = require("./out");
29
- const out = (0, out_1.createOutput)('resolve-app-selection');
29
+ const out = (0, createOutput_1.createOutput)('resolve-app-selection');
30
30
  const exitWithAppList = (requested, availableApps) => {
31
31
  throw new CliError_1.CliError([
32
32
  ...(requested ? [`Unknown app '${requested}'.`] : []),
@@ -1 +1 @@
1
- {"version":3,"file":"resolveAppSelection.js","sourceRoot":"","sources":["../../../src/lib/resolveAppSelection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA+E;AAC/E,iEAAiE;AACjE,2CAA2C;AAC3C,+EAA+E;AAC/E,kFAAkF;AAClF,kDAAkD;AAClD,qCAAqC;AACrC,6DAA6D;AAC7D,6EAA6E;AAC7E,+EAA+E;AAC/E,+CAA+C;AAC/C,iCAAqC;AACrC,2CAA+C;AAC/C,uCAAyC;AACzC,yCAAsC;AACtC,+BAAqC;AAErC,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,uBAAuB,CAAC,CAAC;AAUlD,MAAM,eAAe,GAAG,CAAC,SAA6B,EAAE,aAAuB,EAAS,EAAE;IACxF,MAAM,IAAI,mBAAQ,CAChB;QACE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,eAAe,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACzC,wDAAwD,aAAa,CAAC,CAAC,CAAC,IAAI;KAC7E,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,gGAAgG;AAChG,gEAAgE;AACzD,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,MAAe,EAAsB,EAAE,CACzF,IAAA,kBAAW,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,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QAAA,mBAAmB,uBAyB9B","sourcesContent":["// One app-selection contract for every app-facing command (prep / synth / go /\n// go:dev / go:dev:api / go:dev:web / publish). Resolution order:\n// 1. --app <name> / --app=<name> on argv\n// 2. npm_config_app (npm run x --app foo, no --)\n// 3. an env var the command already honours (QPQ_DEV_APP / DEPLOY_APP_NAME)\n// 4. exactly one app under apps/ -> auto-select\n// 5. interactive prompt (TTY only)\n// 6. otherwise: print the valid app list and exit non-zero\n// An unknown name (from any source) also prints the list and exits non-zero.\n// Commands that can meaningfully run for every app may pass allowAll to accept\n// `--app all` (returned as the literal 'all').\nimport { getArgValue } from './args';\nimport { getAvailableApps } from './discovery';\nimport { promptSelect } from './prompts';\nimport { CliError } from './CliError';\nimport { createOutput } from './out';\n\nconst out = createOutput('resolve-app-selection');\n\nexport type ResolveAppOptions = {\n argv: string[];\n // Env var this command historically honours (e.g. QPQ_DEV_APP, DEPLOY_APP_NAME).\n envVar?: string;\n // Accept `--app all` and return 'all'.\n allowAll?: boolean;\n};\n\nconst exitWithAppList = (requested: string | undefined, availableApps: string[]): never => {\n throw new CliError(\n [\n ...(requested ? [`Unknown app '${requested}'.`] : []),\n `Valid apps: ${availableApps.join(', ')}`,\n `Pass one with --app <name> (e.g. qpq <command> --app ${availableApps[0]}).`,\n ].join('\\n'),\n );\n};\n\n// The app a caller named, from the sources above the auto-select and the prompt (--app, the npm\n// config flag, the command's env var); undefined when none did.\nexport const getRequestedAppName = (argv: string[], envVar?: string): string | undefined =>\n getArgValue(argv, '--app') || process.env.npm_config_app || (envVar ? process.env[envVar] : undefined);\n\nexport const resolveAppSelection = async (options: ResolveAppOptions): Promise<string> => {\n const availableApps = getAvailableApps();\n if (availableApps.length === 0) {\n throw new CliError('No apps found under apps/.');\n }\n\n const requested = getRequestedAppName(options.argv, options.envVar);\n\n if (requested) {\n if (options.allowAll && requested === 'all') return 'all';\n if (!availableApps.includes(requested)) exitWithAppList(requested, availableApps);\n return requested;\n }\n\n const [onlyApp] = availableApps;\n if (availableApps.length === 1 && onlyApp !== undefined) {\n out.log(`Using app: ${onlyApp}`);\n return onlyApp;\n }\n\n if (process.stdin.isTTY) {\n return promptSelect('Select app', options.allowAll ? [...availableApps, 'all'] : availableApps);\n }\n\n return exitWithAppList(undefined, availableApps);\n};\n"]}
1
+ {"version":3,"file":"resolveAppSelection.js","sourceRoot":"","sources":["../../../src/lib/resolveAppSelection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA+E;AAC/E,iEAAiE;AACjE,2CAA2C;AAC3C,+EAA+E;AAC/E,kFAAkF;AAClF,kDAAkD;AAClD,qCAAqC;AACrC,6DAA6D;AAC7D,6EAA6E;AAC7E,+EAA+E;AAC/E,+CAA+C;AAC/C,iCAAqC;AACrC,yCAAsC;AACtC,iDAA8C;AAC9C,2CAA+C;AAC/C,uCAAyC;AAEzC,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,uBAAuB,CAAC,CAAC;AAUlD,MAAM,eAAe,GAAG,CAAC,SAA6B,EAAE,aAAuB,EAAS,EAAE;IACxF,MAAM,IAAI,mBAAQ,CAChB;QACE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,eAAe,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACzC,wDAAwD,aAAa,CAAC,CAAC,CAAC,IAAI;KAC7E,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,gGAAgG;AAChG,gEAAgE;AACzD,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,MAAe,EAAsB,EAAE,CACzF,IAAA,kBAAW,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAD5F,QAAA,mBAAmB,uBACyE;AAElG,MAAM,mBAAmB,GAAG,CAAO,OAA0B,EAAmB,EAAE;IACvF,MAAM,aAAa,GAAG,IAAA,4BAAgB,GAAE,CAAC;IACzC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,mBAAQ,CAAC,4BAA4B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,2BAAmB,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpE,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,OAAO,CAAC,QAAQ,IAAI,SAAS,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAC1D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAClF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC;IAChC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxD,GAAG,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;QACjC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,IAAA,sBAAY,EAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAClG,CAAC;IAED,OAAO,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACnD,CAAC,CAAA,CAAC;AAzBW,QAAA,mBAAmB,uBAyB9B","sourcesContent":["// One app-selection contract for every app-facing command (prep / synth / go /\n// go:dev / go:dev:api / go:dev:web / publish). Resolution order:\n// 1. --app <name> / --app=<name> on argv\n// 2. npm_config_app (npm run x --app foo, no --)\n// 3. an env var the command already honours (QPQ_DEV_APP / DEPLOY_APP_NAME)\n// 4. exactly one app under apps/ -> auto-select\n// 5. interactive prompt (TTY only)\n// 6. otherwise: print the valid app list and exit non-zero\n// An unknown name (from any source) also prints the list and exits non-zero.\n// Commands that can meaningfully run for every app may pass allowAll to accept\n// `--app all` (returned as the literal 'all').\nimport { getArgValue } from './args';\nimport { CliError } from './CliError';\nimport { createOutput } from './createOutput';\nimport { getAvailableApps } from './discovery';\nimport { promptSelect } from './prompts';\n\nconst out = createOutput('resolve-app-selection');\n\nexport type ResolveAppOptions = {\n argv: string[];\n // Env var this command historically honours (e.g. QPQ_DEV_APP, DEPLOY_APP_NAME).\n envVar?: string;\n // Accept `--app all` and return 'all'.\n allowAll?: boolean;\n};\n\nconst exitWithAppList = (requested: string | undefined, availableApps: string[]): never => {\n throw new CliError(\n [\n ...(requested ? [`Unknown app '${requested}'.`] : []),\n `Valid apps: ${availableApps.join(', ')}`,\n `Pass one with --app <name> (e.g. qpq <command> --app ${availableApps[0]}).`,\n ].join('\\n'),\n );\n};\n\n// The app a caller named, from the sources above the auto-select and the prompt (--app, the npm\n// config flag, the command's env var); undefined when none did.\nexport const getRequestedAppName = (argv: string[], envVar?: string): string | undefined =>\n getArgValue(argv, '--app') || process.env.npm_config_app || (envVar ? process.env[envVar] : undefined);\n\nexport const resolveAppSelection = async (options: ResolveAppOptions): Promise<string> => {\n const availableApps = getAvailableApps();\n if (availableApps.length === 0) {\n throw new CliError('No apps found under apps/.');\n }\n\n const requested = getRequestedAppName(options.argv, options.envVar);\n\n if (requested) {\n if (options.allowAll && requested === 'all') return 'all';\n if (!availableApps.includes(requested)) exitWithAppList(requested, availableApps);\n return requested;\n }\n\n const [onlyApp] = availableApps;\n if (availableApps.length === 1 && onlyApp !== undefined) {\n out.log(`Using app: ${onlyApp}`);\n return onlyApp;\n }\n\n if (process.stdin.isTTY) {\n return promptSelect('Select app', options.allowAll ? [...availableApps, 'all'] : availableApps);\n }\n\n return exitWithAppList(undefined, availableApps);\n};\n"]}
@@ -14,11 +14,11 @@ const config_aws_1 = require("@qpqjs/config-aws");
14
14
  const core_1 = require("@qpqjs/core");
15
15
  const platforms_1 = require("../platforms");
16
16
  const args_1 = require("./args");
17
+ const CliError_1 = require("./CliError");
18
+ const createOutput_1 = require("./createOutput");
17
19
  const discovery_1 = require("./discovery");
18
20
  const prompts_1 = require("./prompts");
19
- const CliError_1 = require("./CliError");
20
- const out_1 = require("./out");
21
- const out = (0, out_1.createOutput)('resolve-deployment');
21
+ const out = (0, createOutput_1.createOutput)('resolve-deployment');
22
22
  const DEPLOYMENT_FLAG = '--deployment';
23
23
  // Which entry to use: the flag, then DEPLOY_NAME (set by a parent qpq command or CI: a
24
24
  // selector, never a value), then the sole entry, then a prompt. Headless with several
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDeployment.js","sourceRoot":"","sources":["../../../src/lib/resolveDeployment.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAyG;AACzG,sCAAgE;AAEhE,4CAAiD;AACjD,iCAAqC;AACrC,2CAAsC;AACtC,uCAAyC;AACzC,yCAAsC;AACtC,+BAAqC;AAErC,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,oBAAoB,CAAC,CAAC;AAE/C,MAAM,eAAe,GAAG,cAAc,CAAC;AAOvC,uFAAuF;AACvF,sFAAsF;AACtF,4DAA4D;AAC5D,MAAM,oBAAoB,GAAG,CAAO,IAAc,EAAE,OAAe,EAAE,eAAyB,EAAmB,EAAE;IACjH,MAAM,SAAS,GAAG,IAAA,kBAAW,EAAC,IAAI,EAAE,eAAe,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAe,CAAC,UAAU,CAAC,CAAC;IAEhG,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,m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C,CAAC;IACxD,IAAA,6BAAiB,EAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAErF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;AACxC,CAAC,CAAA,CAAC;AAZW,QAAA,iBAAiB,qBAY5B","sourcesContent":["import { getQpqAppDeployConfig, getQpqAppDeployConfigPath, primeDeploymentEnv } from '@qpqjs/config-aws';\nimport { QpqAppDeployment, QpqDeployEnvVar } from '@qpqjs/core';\n\nimport { getPlatformDriver } from '../platforms';\nimport { getArgValue } from './args';\nimport { getRoot } from './discovery';\nimport { promptSelect } from './prompts';\nimport { CliError } from './CliError';\nimport { createOutput } from './out';\n\nconst out = createOutput('resolve-deployment');\n\nconst DEPLOYMENT_FLAG = '--deployment';\n\nexport type ResolvedDeployment = {\n deploymentName: string;\n deployment: QpqAppDeployment;\n};\n\n// Which entry to use: the flag, then DEPLOY_NAME (set by a parent qpq command or CI: a\n// selector, never a value), then the sole entry, then a prompt. Headless with several\n// entries and no selection is an error rather than a guess.\nconst selectDeploymentName = async (argv: string[], appName: string, configuredNames: string[]): Promise<string> => {\n const requested = getArgValue(argv, DEPLOYMENT_FLAG) || process.env[QpqDeployEnvVar.deployName];\n\n if (requested) {\n if (!configuredNames.includes(requested)) {\n throw new CliError(\n `Unknown deployment '${requested}' in ${getQpqAppDeployConfigPath(getRoot(), appName)}. Configured: ${configuredNames.join(', ')}`,\n );\n }\n return requested;\n }\n\n const [onlyName] = configuredNames;\n if (configuredNames.length === 1 && onlyName !== undefined) {\n out.log(`Using deployment: ${onlyName}`);\n return onlyName;\n }\n\n if (process.stdin.isTTY) {\n return promptSelect('Select deployment', configuredNames);\n }\n\n throw new CliError(`No deployment selected. Pass ${DEPLOYMENT_FLAG} <name>. Configured: ${configuredNames.join(', ')}`);\n};\n\n/**\n * Selects an entry of the app's deploy.config.json and writes it into process.env\n * (identity, environment, feature, settings) before any service config is loaded.\n * The file is the source of truth: nothing in the shell overrides a value in it.\n * The platform driver validates its own settings, so an aws entry missing its\n * account or region fails here, not inside cdk.\n */\nexport const resolveDeployment = async (argv: string[], appName: string): Promise<ResolvedDeployment> => {\n const { deployments } = getQpqAppDeployConfig(getRoot(), appName);\n const deploymentName = await selectDeploymentName(argv, appName, Object.keys(deployments));\n const deployment = deployments[deploymentName];\n if (!deployment) {\n throw new Error(`Deployment [${deploymentName}] is not in ${appName}'s deploy.config.json`);\n }\n\n primeDeploymentEnv(appName, deploymentName, deployment);\n getPlatformDriver(deployment.platform).prepareDeployment(deploymentName, deployment);\n\n return { deploymentName, deployment };\n};\n"]}
1
+ {"version":3,"file":"resolveDeployment.js","sourceRoot":"","sources":["../../../src/lib/resolveDeployment.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAyG;AACzG,sCAAgE;AAEhE,4CAAiD;AACjD,iCAAqC;AACrC,yCAAsC;AACtC,iDAA8C;AAC9C,2CAAsC;AACtC,uCAAyC;AAEzC,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,oBAAoB,CAAC,CAAC;AAE/C,MAAM,eAAe,GAAG,cAAc,CAAC;AAOvC,uFAAuF;AACvF,sFAAsF;AACtF,4DAA4D;AAC5D,MAAM,oBAAoB,GAAG,CAAO,IAAc,EAAE,OAAe,EAAE,eAAyB,EAAmB,EAAE;IACjH,MAAM,SAAS,GAAG,IAAA,kBAAW,EAAC,IAAI,EAAE,eAAe,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAe,CAAC,UAAU,CAAC,CAAC;IAEhG,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,mBAAQ,CAChB,uBAAuB,SAAS,QAAQ,IAAA,sCAAyB,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,CAAC,iBAAiB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACn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EAAE,CAAC;AACxC,CAAC,CAAA,CAAC;AAZW,QAAA,iBAAiB,qBAY5B","sourcesContent":["import { getQpqAppDeployConfig, getQpqAppDeployConfigPath, primeDeploymentEnv } from '@qpqjs/config-aws';\nimport { QpqAppDeployment, QpqDeployEnvVar } from '@qpqjs/core';\n\nimport { getPlatformDriver } from '../platforms';\nimport { getArgValue } from './args';\nimport { CliError } from './CliError';\nimport { createOutput } from './createOutput';\nimport { getRoot } from './discovery';\nimport { promptSelect } from './prompts';\n\nconst out = createOutput('resolve-deployment');\n\nconst DEPLOYMENT_FLAG = '--deployment';\n\nexport type ResolvedDeployment = {\n deploymentName: string;\n deployment: QpqAppDeployment;\n};\n\n// Which entry to use: the flag, then DEPLOY_NAME (set by a parent qpq command or CI: a\n// selector, never a value), then the sole entry, then a prompt. Headless with several\n// entries and no selection is an error rather than a guess.\nconst selectDeploymentName = async (argv: string[], appName: string, configuredNames: string[]): Promise<string> => {\n const requested = getArgValue(argv, DEPLOYMENT_FLAG) || process.env[QpqDeployEnvVar.deployName];\n\n if (requested) {\n if (!configuredNames.includes(requested)) {\n throw new CliError(\n `Unknown deployment '${requested}' in ${getQpqAppDeployConfigPath(getRoot(), appName)}. Configured: ${configuredNames.join(', ')}`,\n );\n }\n return requested;\n }\n\n const [onlyName] = configuredNames;\n if (configuredNames.length === 1 && onlyName !== undefined) {\n out.log(`Using deployment: ${onlyName}`);\n return onlyName;\n }\n\n if (process.stdin.isTTY) {\n return promptSelect('Select deployment', configuredNames);\n }\n\n throw new CliError(`No deployment selected. Pass ${DEPLOYMENT_FLAG} <name>. Configured: ${configuredNames.join(', ')}`);\n};\n\n/**\n * Selects an entry of the app's deploy.config.json and writes it into process.env\n * (identity, environment, feature, settings) before any service config is loaded.\n * The file is the source of truth: nothing in the shell overrides a value in it.\n * The platform driver validates its own settings, so an aws entry missing its\n * account or region fails here, not inside cdk.\n */\nexport const resolveDeployment = async (argv: string[], appName: string): Promise<ResolvedDeployment> => {\n const { deployments } = getQpqAppDeployConfig(getRoot(), appName);\n const deploymentName = await selectDeploymentName(argv, appName, Object.keys(deployments));\n const deployment = deployments[deploymentName];\n if (!deployment) {\n throw new Error(`Deployment [${deploymentName}] is not in ${appName}'s deploy.config.json`);\n }\n\n primeDeploymentEnv(appName, deploymentName, deployment);\n getPlatformDriver(deployment.platform).prepareDeployment(deploymentName, deployment);\n\n return { deploymentName, deployment };\n};\n"]}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runCommandPrefixed = exports.nextPrefixColor = exports.runCommandBestEffort = exports.runCommand = exports.sleepSync = exports.runCommandCaptureSync = exports.runCommandSync = exports.spawnCommand = void 0;
4
4
  const child_process_1 = require("child_process");
5
- const out_1 = require("./out");
6
- const out = (0, out_1.createOutput)('run-command');
5
+ const createOutput_1 = require("./createOutput");
6
+ const out = (0, createOutput_1.createOutput)('run-command');
7
7
  // Shell only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run without a shell so
8
8
  // the already-array args are passed straight to the program and can't be re-interpreted by
9
9
  // `sh -c`, no command injection via interpolated values (stack names, CI-supplied env, etc.).
@@ -1 +1 @@
1
- {"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/lib/runCommand.ts"],"names":[],"mappings":";;;AAAA,iDAA6E;AAE7E,+BAAqC;AAErC,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,aAAa,CAAC,CAAC;AAgBxC,8FAA8F;AAC9F,2FAA2F;AAC3F,8FAA8F;AAC9F,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAE9C,MAAM,cAAc,GAAG,CAAC,OAA4B,EAAE,EAAE;;IAAC,OAAA,CAAC;QACxD,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,MAAA,OAAO,CAAC,GAAG,mCAAI,OAAO,CAAC,GAAG,EAAE;QACjC,GAAG,kCAAO,OAAO,CAAC,GAAG,GAAK,CAAC,MAAA,OAAO,CAAC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stream';\nimport { createOutput } from './out';\n\nconst out = createOutput('run-command');\n\nexport type RunCommandOptions = {\n // Extra environment variables merged over the parent process env.\n env?: Record<string, string>;\n // Working directory for the child (defaults to cwd).\n cwd?: string;\n // Echo the command before running it.\n logCommand?: boolean;\n};\n\nexport type SpawnCommandOptions = RunCommandOptions & {\n // Defaults to inheriting the parent's stdio.\n stdio?: StdioOptions;\n};\n\n// Shell only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run without a shell so\n// the already-array args are passed straight to the program and can't be re-interpreted by\n// `sh -c`, no command injection via interpolated values (stack names, CI-supplied env, etc.).\nconst useShell = process.platform === 'win32';\n\nconst toSpawnOptions = (options: SpawnCommandOptions) => ({\n shell: useShell,\n cwd: options.cwd ?? process.cwd(),\n env: { ...process.env, ...(options.env ?? {}) },\n});\n\n/**\n * Starts a long-running child (a dev server, a watcher) and hands back its handle; the caller\n * owns its lifetime. Every process the cli starts goes through here or one of the runners\n * below, so the shell and env rules are in one place.\n */\nexport const spawnCommand = (command: string, args: string[], options: SpawnCommandOptions = {}): ChildProcess =>\n spawn(\n command,\n args.filter((a) => !!a),\n { stdio: options.stdio ?? 'inherit', ...toSpawnOptions(options) },\n );\n\n/** Runs a command to completion, inheriting stdio; throws on a non-zero exit. For code that cannot await. */\nexport const runCommandSync = (command: string, args: string[], options: RunCommandOptions = {}): void => {\n const validArgs = args.filter((a) => !!a);\n const result = spawnSync(command, validArgs, { stdio: 'inherit', ...toSpawnOptions(options) });\n\n if (result.error) throw result.error;\n if (result.status) throw new Error(`${command} ${validArgs.join(' ')} exited with code ${result.status}`);\n};\n\n/**\n * Runs a command to completion and returns its stdout (stderr is dropped); throws when it\n * cannot start or exits non-zero. For the short probes (`ps`, `lsof`, `npm --version`) whose\n * output decides what the cli does next.\n */\nexport const runCommandCaptureSync = (command: string, args: string[], options: RunCommandOptions = {}): string => {\n const validArgs = args.filter((a) => !!a);\n const result = spawnSync(command, validArgs, { stdio: ['ignore', 'pipe', 'ignore'], encoding: 'utf8', ...toSpawnOptions(options) });\n\n if (result.error) throw result.error;\n if (result.status) throw new Error(`${command} ${validArgs.join(' ')} exited with code ${result.status}`);\n\n return result.stdout;\n};\n\n/** Blocks the current thread for `ms`; only for the short polls in synchronous cleanup code. */\nexport const sleepSync = (ms: number): void => {\n Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);\n};\n\n// Spawn a command, inheriting stdio, resolving on success. A non-zero exit\n// REJECTS so a failed build/deploy stops the run.\nexport const runCommand = (command: string, args: string[], options: RunCommandOptions = {}): Promise<void> =>\n new Promise((resolve, reject) => {\n const validArgs = args.filter((a) => !!a);\n\n if (options.logCommand) {\n out.log(`Running command: ${command} ${validArgs.join(' ')}`);\n }\n\n const child = spawnCommand(command, validArgs, options);\n\n child.on('error', (error) => reject(error));\n\n child.on('exit', (code, signal) => {\n if (signal) return reject(new Error(`${command} was killed with signal ${signal}`));\n if (code) return reject(new Error(`${command} ${validArgs.join(' ')} exited with code ${code}`));\n return resolve();\n });\n });\n\n// Run a command for its side effect only, swallowing both its output and its\n// exit code, for best-effort cleanup steps (e.g. `docker rm -f` of a container\n// that may not exist) that must never fail the run. Without a shell there's no\n// `>/dev/null 2>&1 || true`, so quieting and non-failing happen here instead.\nexport const runCommandBestEffort = (command: string, args: string[], options: RunCommandOptions = {}): Promise<void> =>\n new Promise((resolve) => {\n const validArgs = args.filter((a) => !!a);\n\n const child = spawnCommand(command, validArgs, { ...options, stdio: 'ignore' });\n\n child.on('error', () => resolve());\n child.on('exit', () => resolve());\n });\n\nexport type RunCommandPrefixedOptions = {\n env?: Record<string, string>;\n cwd?: string;\n // ANSI color code for the prefix (see nextPrefixColor).\n color?: number;\n};\n\nconst PREFIX_COLORS = [36, 32, 33, 35, 34, 96, 92, 93, 95, 94];\nlet colorIndex = 0;\n\n// Hand each concurrent task a distinct prefix color so interleaved output is\n// scannable.\nexport const nextPrefixColor = (): number => {\n const color = PREFIX_COLORS[colorIndex % PREFIX_COLORS.length] ?? 0;\n colorIndex += 1;\n return color;\n};\n\n// Like runCommand, but pipes output and prefixes every line with a colored\n// [label], for running many commands concurrently without unreadable\n// interleaving. Rejects on non-zero exit.\nexport const runCommandPrefixed = (label: string, command: string, args: string[], options: RunCommandPrefixedOptions = {}): Promise<void> =>\n new Promise((resolve, reject) => {\n const validArgs = args.filter((a) => !!a);\n const prefix = `\\x1b[${options.color ?? 36}m[${label}]\\x1b[0m `;\n\n const child = spawnCommand(command, validArgs, { ...options, stdio: ['ignore', 'pipe', 'pipe'] });\n\n const attach = (stream: Readable, out: NodeJS.WriteStream): void => {\n let buffered = '';\n stream.on('data', (chunk: Buffer) => {\n buffered += chunk.toString();\n const lines = buffered.split('\\n');\n buffered = lines.pop() ?? '';\n lines.forEach((line) => out.write(`${prefix}${line}\\n`));\n });\n stream.on('end', () => {\n if (buffered) out.write(`${prefix}${buffered}\\n`);\n });\n };\n\n attach(child.stdout as Readable, process.stdout);\n attach(child.stderr as Readable, process.stderr);\n\n child.on('error', (error) => reject(error));\n\n child.on('exit', (code, signal) => {\n if (signal) return reject(new Error(`[${label}] ${command} was killed with signal ${signal}`));\n if (code) return reject(new Error(`[${label}] ${command} exited with code ${code}`));\n return resolve();\n });\n });\n"]}
1
+ {"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/lib/runCommand.ts"],"names":[],"mappings":";;;AAAA,iDAA6E;AAG7E,iDAA8C;AAE9C,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,aAAa,CAAC,CAAC;AAgBxC,8FAA8F;AAC9F,2FAA2F;AAC3F,8FAA8F;AAC9F,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAE9C,MAAM,cAAc,GAAG,CAAC,OAA4B,EAAE,EAAE;;IAAC,OAAA,CAAC;QACxD,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,MAAA,OAAO,CAAC,GAAG,mCAAI,OAAO,CAAC,GAAG,EAAE;QACjC,GAAG,kCAAO,O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, spawn, spawnSync, StdioOptions } from 'child_process';\nimport type { Readable } from 'stream';\n\nimport { createOutput } from './createOutput';\n\nconst out = createOutput('run-command');\n\nexport type RunCommandOptions = {\n // Extra environment variables merged over the parent process env.\n env?: Record<string, string>;\n // Working directory for the child (defaults to cwd).\n cwd?: string;\n // Echo the command before running it.\n logCommand?: boolean;\n};\n\nexport type SpawnCommandOptions = RunCommandOptions & {\n // Defaults to inheriting the parent's stdio.\n stdio?: StdioOptions;\n};\n\n// Shell only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run without a shell so\n// the already-array args are passed straight to the program and can't be re-interpreted by\n// `sh -c`, no command injection via interpolated values (stack names, CI-supplied env, etc.).\nconst useShell = process.platform === 'win32';\n\nconst toSpawnOptions = (options: SpawnCommandOptions) => ({\n shell: useShell,\n cwd: options.cwd ?? process.cwd(),\n env: { ...process.env, ...(options.env ?? {}) },\n});\n\n/**\n * Starts a long-running child (a dev server, a watcher) and hands back its handle; the caller\n * owns its lifetime. Every process the cli starts goes through here or one of the runners\n * below, so the shell and env rules are in one place.\n */\nexport const spawnCommand = (command: string, args: string[], options: SpawnCommandOptions = {}): ChildProcess =>\n spawn(\n command,\n args.filter((a) => !!a),\n { stdio: options.stdio ?? 'inherit', ...toSpawnOptions(options) },\n );\n\n/** Runs a command to completion, inheriting stdio; throws on a non-zero exit. For code that cannot await. */\nexport const runCommandSync = (command: string, args: string[], options: RunCommandOptions = {}): void => {\n const validArgs = args.filter((a) => !!a);\n const result = spawnSync(command, validArgs, { stdio: 'inherit', ...toSpawnOptions(options) });\n\n if (result.error) throw result.error;\n if (result.status) throw new Error(`${command} ${validArgs.join(' ')} exited with code ${result.status}`);\n};\n\n/**\n * Runs a command to completion and returns its stdout (stderr is dropped); throws when it\n * cannot start or exits non-zero. For the short probes (`ps`, `lsof`, `npm --version`) whose\n * output decides what the cli does next.\n */\nexport const runCommandCaptureSync = (command: string, args: string[], options: RunCommandOptions = {}): string => {\n const validArgs = args.filter((a) => !!a);\n const result = spawnSync(command, validArgs, { stdio: ['ignore', 'pipe', 'ignore'], encoding: 'utf8', ...toSpawnOptions(options) });\n\n if (result.error) throw result.error;\n if (result.status) throw new Error(`${command} ${validArgs.join(' ')} exited with code ${result.status}`);\n\n return result.stdout;\n};\n\n/** Blocks the current thread for `ms`; only for the short polls in synchronous cleanup code. */\nexport const sleepSync = (ms: number): void => {\n Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);\n};\n\n// Spawn a command, inheriting stdio, resolving on success. A non-zero exit\n// REJECTS so a failed build/deploy stops the run.\nexport const runCommand = (command: string, args: string[], options: RunCommandOptions = {}): Promise<void> =>\n new Promise((resolve, reject) => {\n const validArgs = args.filter((a) => !!a);\n\n if (options.logCommand) {\n out.log(`Running command: ${command} ${validArgs.join(' ')}`);\n }\n\n const child = spawnCommand(command, validArgs, options);\n\n child.on('error', (error) => reject(error));\n\n child.on('exit', (code, signal) => {\n if (signal) return reject(new Error(`${command} was killed with signal ${signal}`));\n if (code) return reject(new Error(`${command} ${validArgs.join(' ')} exited with code ${code}`));\n return resolve();\n });\n });\n\n// Run a command for its side effect only, swallowing both its output and its\n// exit code, for best-effort cleanup steps (e.g. `docker rm -f` of a container\n// that may not exist) that must never fail the run. Without a shell there's no\n// `>/dev/null 2>&1 || true`, so quieting and non-failing happen here instead.\nexport const runCommandBestEffort = (command: string, args: string[], options: RunCommandOptions = {}): Promise<void> =>\n new Promise((resolve) => {\n const validArgs = args.filter((a) => !!a);\n\n const child = spawnCommand(command, validArgs, { ...options, stdio: 'ignore' });\n\n child.on('error', () => resolve());\n child.on('exit', () => resolve());\n });\n\nexport type RunCommandPrefixedOptions = {\n env?: Record<string, string>;\n cwd?: string;\n // ANSI color code for the prefix (see nextPrefixColor).\n color?: number;\n};\n\nconst PREFIX_COLORS = [36, 32, 33, 35, 34, 96, 92, 93, 95, 94];\nlet colorIndex = 0;\n\n// Hand each concurrent task a distinct prefix color so interleaved output is\n// scannable.\nexport const nextPrefixColor = (): number => {\n const color = PREFIX_COLORS[colorIndex % PREFIX_COLORS.length] ?? 0;\n colorIndex += 1;\n return color;\n};\n\n// Like runCommand, but pipes output and prefixes every line with a colored\n// [label], for running many commands concurrently without unreadable\n// interleaving. Rejects on non-zero exit.\nexport const runCommandPrefixed = (label: string, command: string, args: string[], options: RunCommandPrefixedOptions = {}): Promise<void> =>\n new Promise((resolve, reject) => {\n const validArgs = args.filter((a) => !!a);\n const prefix = `\\x1b[${options.color ?? 36}m[${label}]\\x1b[0m `;\n\n const child = spawnCommand(command, validArgs, { ...options, stdio: ['ignore', 'pipe', 'pipe'] });\n\n const attach = (stream: Readable, out: NodeJS.WriteStream): void => {\n let buffered = '';\n stream.on('data', (chunk: Buffer) => {\n buffered += chunk.toString();\n const lines = buffered.split('\\n');\n buffered = lines.pop() ?? '';\n lines.forEach((line) => out.write(`${prefix}${line}\\n`));\n });\n stream.on('end', () => {\n if (buffered) out.write(`${prefix}${buffered}\\n`);\n });\n };\n\n attach(child.stdout as Readable, process.stdout);\n attach(child.stderr as Readable, process.stderr);\n\n child.on('error', (error) => reject(error));\n\n child.on('exit', (code, signal) => {\n if (signal) return reject(new Error(`[${label}] ${command} was killed with signal ${signal}`));\n if (code) return reject(new Error(`[${label}] ${command} exited with code ${code}`));\n return resolve();\n });\n });\n"]}
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.assertNoFailures = exports.runDependencyTasks = exports.runTasks = void 0;
13
- const out_1 = require("./out");
14
- const out = (0, out_1.createOutput)('run-tasks');
13
+ const createOutput_1 = require("./createOutput");
14
+ const out = (0, createOutput_1.createOutput)('run-tasks');
15
15
  // Run tasks with at most `limit` in flight; never rejects, failures come back
16
16
  // labelled so a whole wave can finish before we report what broke.
17
17
  const runTasks = (tasks, limit) => __awaiter(void 0, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":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;QAC5B,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AA7EW,QAAA,kBAAkB,sBA6E7B;AAEK,MAAM,gBAAgB,GAAG,CAAC,SAAiB,EAAE,QAAuB,EAAQ,EAAE;IACnF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAClC,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS,cAAc,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACzF,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,KAAK,QAAQ,CAAC,MAAM,iBAAiB,CAAC,CAAC;AACrE,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B","sourcesContent":["import { createOutput } from './out';\n\nconst out = createOutput('run-tasks');\nexport type Task = { label: string; run: () => Promise<void> };\nexport type TaskFailure = { label: string; error: Error };\n\n// Run tasks with at most `limit` in flight; never rejects, failures come back\n// labelled so a whole wave can finish before we report what broke.\nexport const runTasks = async (tasks: Task[], limit: number): Promise<TaskFailure[]> => {\n const failures: TaskFailure[] = [];\n let nextIndex = 0;\n\n const workerCount = Math.max(1, Math.min(limit, tasks.length));\n await Promise.all(\n Array.from({ length: workerCount }, async () => {\n while (nextIndex < tasks.length) {\n const task = tasks[nextIndex];\n nextIndex += 1;\n if (!task) continue;\n try {\n await task.run();\n } catch (error) {\n failures.push({ label: task.label, error: error as Error });\n }\n }\n }),\n );\n\n return failures;\n};\n\nexport type DependencyTask = Task & {\n // Unique id other tasks reference in `deps` (e.g. a package name).\n id: string;\n // Ids of tasks that must succeed before this one starts. Ids not present in\n // the task list should be filtered out by the caller.\n deps: string[];\n};\n\n// Run tasks with at most `limit` in flight, but a task only starts once every\n// task in its `deps` has succeeded. A failure doesn't stop unrelated tasks;\n// dependents of the failed task are skipped (logged, not returned as failures,\n// the root cause already is). Never rejects. Tasks left unstartable by a\n// dependency cycle come back as failures.\nexport const runDependencyTasks = async (tasks: DependencyTask[], limit: number): Promise<TaskFailure[]> => {\n const failures: TaskFailure[] = [];\n const succeeded = new Set<string>();\n const failed = new Set<string>();\n const started = new Set<string>();\n const pipelines: Array<Promise<void>> = [];\n\n let slots = Math.max(1, limit);\n const waiting: Array<() => void> = [];\n\n const acquire = async (): Promise<void> => {\n if (slots > 0) {\n slots -= 1;\n return;\n }\n await new Promise<void>((resolve) => waiting.push(resolve));\n };\n\n const release = (): void => {\n const next = waiting.shift();\n if (next) {\n next();\n } else {\n slots += 1;\n }\n };\n\n const runOne = async (task: DependencyTask): Promise<void> => {\n await acquire();\n try {\n await task.run();\n succeeded.add(task.id);\n } catch (error) {\n failed.add(task.id);\n failures.push({ label: task.label, error: error as Error });\n } finally {\n release();\n }\n launchReady();\n };\n\n // Repeatedly sweep until stable: launching one task or cascading one skip can\n // unblock (or block) tasks earlier in the list.\n const launchReady = (): void => {\n let changed = true;\n while (changed) {\n changed = false;\n for (const task of tasks) {\n if (started.has(task.id)) continue;\n if (task.deps.some((dep) => failed.has(dep))) {\n started.add(task.id);\n failed.add(task.id); // cascade so transitive dependents skip too\n out.log(`Skipping ${task.label} (a dependency failed)`);\n changed = true;\n } else if (task.deps.every((dep) => succeeded.has(dep))) {\n started.add(task.id);\n pipelines.push(runOne(task));\n changed = true;\n }\n }\n }\n };\n\n launchReady();\n // runOne re-invokes launchReady as tasks finish, pushing newly unblocked\n // pipelines while earlier ones are being awaited; drain until it stays empty.\n while (pipelines.length > 0) {\n await Promise.all(pipelines.splice(0, pipelines.length));\n }\n\n for (const task of tasks) {\n if (!started.has(task.id)) {\n failures.push({ label: task.label, error: new Error('unstartable: dependency cycle') });\n }\n }\n\n return failures;\n};\n\nexport const assertNoFailures = (phaseName: string, failures: TaskFailure[]): void => {\n if (failures.length === 0) return;\n out.error(`\\n${phaseName} failed for:`);\n failures.forEach((failure) => out.error(` ${failure.label}: ${failure.error.message}`));\n throw new Error(`${phaseName}: ${failures.length} task(s) failed`);\n};\n"]}
1
+ {"version":3,"file":"runTasks.js","sourceRoot":"","sources":["../../../src/lib/runTasks.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8C;AAE9C,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,WAAW,CAAC,CAAC;AAItC,8EAA8E;AAC9E,mEAAmE;AAC5D,MAAM,QAAQ,GAAG,CAAO,KAAa,EAAE,KAAa,EAA0B,EAAE;IACrF,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,GAAS,EAAE;QAC7C,OAAO,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;YAC9B,SAAS,IAAI,CAAC,CAAC;YACf,IAAI,CAA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O,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACzF,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,KAAK,QAAQ,CAAC,MAAM,iBAAiB,CAAC,CAAC;AACrE,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B","sourcesContent":["import { createOutput } from './createOutput';\n\nconst out = createOutput('run-tasks');\nexport type Task = { label: string; run: () => Promise<void> };\nexport type TaskFailure = { label: string; error: Error };\n\n// Run tasks with at most `limit` in flight; never rejects, failures come back\n// labelled so a whole wave can finish before we report what broke.\nexport const runTasks = async (tasks: Task[], limit: number): Promise<TaskFailure[]> => {\n const failures: TaskFailure[] = [];\n let nextIndex = 0;\n\n const workerCount = Math.max(1, Math.min(limit, tasks.length));\n await Promise.all(\n Array.from({ length: workerCount }, async () => {\n while (nextIndex < tasks.length) {\n const task = tasks[nextIndex];\n nextIndex += 1;\n if (!task) continue;\n try {\n await task.run();\n } catch (error) {\n failures.push({ label: task.label, error: error as Error });\n }\n }\n }),\n );\n\n return failures;\n};\n\nexport type DependencyTask = Task & {\n // Unique id other tasks reference in `deps` (e.g. a package name).\n id: string;\n // Ids of tasks that must succeed before this one starts. Ids not present in\n // the task list should be filtered out by the caller.\n deps: string[];\n};\n\n// Run tasks with at most `limit` in flight, but a task only starts once every\n// task in its `deps` has succeeded. A failure doesn't stop unrelated tasks;\n// dependents of the failed task are skipped (logged, not returned as failures,\n// the root cause already is). Never rejects. Tasks left unstartable by a\n// dependency cycle come back as failures.\nexport const runDependencyTasks = async (tasks: DependencyTask[], limit: number): Promise<TaskFailure[]> => {\n const failures: TaskFailure[] = [];\n const succeeded = new Set<string>();\n const failed = new Set<string>();\n const started = new Set<string>();\n const pipelines: Array<Promise<void>> = [];\n\n let slots = Math.max(1, limit);\n const waiting: Array<() => void> = [];\n\n const acquire = async (): Promise<void> => {\n if (slots > 0) {\n slots -= 1;\n return;\n }\n await new Promise<void>((resolve) => waiting.push(resolve));\n };\n\n const release = (): void => {\n const next = waiting.shift();\n if (next) {\n next();\n } else {\n slots += 1;\n }\n };\n\n const runOne = async (task: DependencyTask): Promise<void> => {\n await acquire();\n try {\n await task.run();\n succeeded.add(task.id);\n } catch (error) {\n failed.add(task.id);\n failures.push({ label: task.label, error: error as Error });\n } finally {\n release();\n }\n launchReady();\n };\n\n // Repeatedly sweep until stable: launching one task or cascading one skip can\n // unblock (or block) tasks earlier in the list.\n const launchReady = (): void => {\n let changed = true;\n while (changed) {\n changed = false;\n for (const task of tasks) {\n if (started.has(task.id)) continue;\n if (task.deps.some((dep) => failed.has(dep))) {\n started.add(task.id);\n failed.add(task.id); // cascade so transitive dependents skip too\n out.log(`Skipping ${task.label} (a dependency failed)`);\n changed = true;\n } else if (task.deps.every((dep) => succeeded.has(dep))) {\n started.add(task.id);\n pipelines.push(runOne(task));\n changed = true;\n }\n }\n }\n };\n\n launchReady();\n // runOne re-invokes launchReady as tasks finish, pushing newly unblocked\n // pipelines while earlier ones are being awaited; drain until it stays empty.\n while (pipelines.length > 0) {\n await Promise.all(pipelines.splice(0, pipelines.length));\n }\n\n for (const task of tasks) {\n if (!started.has(task.id)) {\n failures.push({ label: task.label, error: new Error('unstartable: dependency cycle') });\n }\n }\n\n return failures;\n};\n\nexport const assertNoFailures = (phaseName: string, failures: TaskFailure[]): void => {\n if (failures.length === 0) return;\n out.error(`\\n${phaseName} failed for:`);\n failures.forEach((failure) => out.error(` ${failure.label}: ${failure.error.message}`));\n throw new Error(`${phaseName}: ${failures.length} task(s) failed`);\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.logTimeEnd = exports.logTimeStart = void 0;
4
- const out_1 = require("./out");
5
- const out = (0, out_1.createOutput)('timing');
4
+ const createOutput_1 = require("./createOutput");
5
+ const out = (0, createOutput_1.createOutput)('timing');
6
6
  const logTimeStart = (name) => out.time(name);
7
7
  exports.logTimeStart = logTimeStart;
8
8
  const logTimeEnd = (name) => {
@@ -1 +1 @@
1
- {"version":3,"file":"timing.js","sourceRoot":"","sources":["../../../src/lib/timing.ts"],"names":[],"mappings":";;;AAAA,+BAAqC;AAErC,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,YAAY,GAAG,CAAC,IAAY,EAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAtD,QAAA,YAAY,gBAA0C;AAE5D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAQ,EAAE;IAC/C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAClD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB","sourcesContent":["import { createOutput } from './out';\n\nconst out = createOutput('timing');\nexport const logTimeStart = (name: string): void => out.time(name);\n\nexport const logTimeEnd = (name: string): void => {\n out.log('When:', new Date().toLocaleTimeString());\n out.timeEnd(name);\n};\n"]}
1
+ {"version":3,"file":"timing.js","sourceRoot":"","sources":["../../../src/lib/timing.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAE9C,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,YAAY,GAAG,CAAC,IAAY,EAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAtD,QAAA,YAAY,gBAA0C;AAE5D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAQ,EAAE;IAC/C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAClD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB","sourcesContent":["import { createOutput } from './createOutput';\n\nconst out = createOutput('timing');\nexport const logTimeStart = (name: string): void => out.time(name);\n\nexport const logTimeEnd = (name: string): void => {\n out.log('When:', new Date().toLocaleTimeString());\n out.timeEnd(name);\n};\n"]}
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.startTypeWatcher = void 0;
7
- const runCommand_1 = require("./runCommand");
8
7
  const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
9
8
  const fs_1 = __importDefault(require("fs"));
10
9
  const path_1 = __importDefault(require("path"));
11
- const out_1 = require("./out");
12
- const out = (0, out_1.createOutput)('type-watcher');
10
+ const createOutput_1 = require("./createOutput");
11
+ const runCommand_1 = require("./runCommand");
12
+ const out = (0, createOutput_1.createOutput)('type-watcher');
13
13
  // Routine tsc watch status lines; everything else is worth showing.
14
14
  const routineTscPatterns = [/Starting compilation in watch mode/, /File change detected/, /Found 0 errors/];
15
15
  const isRoutineTscLine = (line) => routineTscPatterns.some((pattern) => pattern.test(line));
@@ -1 +1 @@
1
- {"version":3,"file":"typeWatcher.js","sourceRoot":"","sources":["../../../src/lib/typeWatcher.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAU5C,wDAA+D;AAG/D,4CAAoB;AACpB,gDAAwB;AACxB,+BAAqC;AAErC,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,cAAc,CAAC,CAAC;AAEzC,oEAAoE;AACpE,MAAM,kBAAkB,GAAG,CAAC,oCAAoC,EAAE,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;AAE5G,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAE7G,uE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C,CAAC;IACxE,MAAM,KAAK,GAAG,IAAA,yBAAY,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,YAAY,EAAE,SAAS,EAAE,uBAAuB,EAAE,UAAU,CAAC,EAAE;QAChH,GAAG,EAAE,IAAI;QACT,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IAEH,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC3C,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE3C,GAAG,CAAC,GAAG,CAAC,qCAAqC,YAAY,CAAC,MAAM,gDAAgD,CAAC,CAAC;IAElH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAlBW,QAAA,gBAAgB,oBAkB3B","sourcesContent":["import { spawnCommand } from './runCommand';\n// Keeps workspace packages' declaration output (dist/*.d.ts) fresh while\n// `qpq go:dev` runs. The rspack dev builds bundle workspace source directly,\n// so this watcher only feeds the editor and validate-ts, which resolve\n// cross-package types through each package's built declarations.\n//\n// One `tsc -b --watch` over every workspace package that ships types; routine\n// watch chatter is dropped so only real compile errors reach the shared\n// terminal. Opt out with `--no-types`.\nimport { Nullable } from '@qpqjs/core';\nimport { getWorkspacePackageDirs } from '@qpqjs/deploy-rspack';\n\nimport { ChildProcess } from 'child_process';\nimport fs from 'fs';\nimport path from 'path';\nimport { createOutput } from './out';\n\nconst out = createOutput('type-watcher');\n\n// Routine tsc watch status lines; everything else is worth showing.\nconst routineTscPatterns = [/Starting compilation in watch mode/, /File change detected/, /Found 0 errors/];\n\nconst isRoutineTscLine = (line: string): boolean => routineTscPatterns.some((pattern) => pattern.test(line));\n\n// Forwards non-routine tsc output line by line under a [types] prefix.\nconst forwardTscOutput = (chunk: Buffer): void => {\n for (const line of chunk.toString().split('\\n')) {\n if (line.trim().length === 0 || isRoutineTscLine(line)) {\n continue;\n }\n out.log(`[types] ${line}`);\n }\n};\n\n// A workspace package wants declaration watching when it has a tsconfig and\n// publishes types from its build output. Packages bundled by rspack (views,\n// service handlers) don't ship types and are skipped.\nconst isTypedWorkspacePackage = (dir: string): boolean => {\n if (!fs.existsSync(path.join(dir, 'tsconfig.json'))) {\n return false;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));\n return !!(packageJson.types || packageJson.typings);\n};\n\nexport const startTypeWatcher = (root: string): Nullable<ChildProcess> => {\n const projectDirs = getWorkspacePackageDirs(root).filter(isTypedWorkspacePackage);\n if (projectDirs.length === 0) {\n return null;\n }\n\n const relativeDirs = projectDirs.map((dir) => path.relative(root, dir));\n const child = spawnCommand('npx', ['tsc', '-b', ...relativeDirs, '--watch', '--preserveWatchOutput', '--pretty'], {\n cwd: root,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n child.stdout?.on('data', forwardTscOutput);\n child.stderr?.on('data', forwardTscOutput);\n\n out.log(`Type watcher: tsc -b --watch over ${relativeDirs.length} workspace packages (disable with --no-types).`);\n\n return child;\n};\n"]}
1
+ {"version":3,"file":"typeWatcher.js","sourceRoot":"","sources":["../../../src/lib/typeWatcher.ts"],"names":[],"mappings":";;;;;;AASA,wDAA+D;AAG/D,4CAAoB;AACpB,gDAAwB;AAExB,iDAA8C;AAC9C,6CAA4C;AAE5C,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,cAAc,CAAC,CAAC;AAEzC,oEAAoE;AACpE,MAAM,kBAAkB,GAAG,CAAC,oCAAoC,EAAE,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;AAE5G,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAE7G,uEAAuE;AACvE,MAAM,gB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KAAK,GAAG,IAAA,yBAAY,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,YAAY,EAAE,SAAS,EAAE,uBAAuB,EAAE,UAAU,CAAC,EAAE;QAChH,GAAG,EAAE,IAAI;QACT,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IAEH,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC3C,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE3C,GAAG,CAAC,GAAG,CAAC,qCAAqC,YAAY,CAAC,MAAM,gDAAgD,CAAC,CAAC;IAElH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAlBW,QAAA,gBAAgB,oBAkB3B","sourcesContent":["// Keeps workspace packages' declaration output (dist/*.d.ts) fresh while\n// `qpq go:dev` runs. The rspack dev builds bundle workspace source directly,\n// so this watcher only feeds the editor and validate-ts, which resolve\n// cross-package types through each package's built declarations.\n//\n// One `tsc -b --watch` over every workspace package that ships types; routine\n// watch chatter is dropped so only real compile errors reach the shared\n// terminal. Opt out with `--no-types`.\nimport { Nullable } from '@qpqjs/core';\nimport { getWorkspacePackageDirs } from '@qpqjs/deploy-rspack';\n\nimport { ChildProcess } from 'child_process';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { createOutput } from './createOutput';\nimport { spawnCommand } from './runCommand';\n\nconst out = createOutput('type-watcher');\n\n// Routine tsc watch status lines; everything else is worth showing.\nconst routineTscPatterns = [/Starting compilation in watch mode/, /File change detected/, /Found 0 errors/];\n\nconst isRoutineTscLine = (line: string): boolean => routineTscPatterns.some((pattern) => pattern.test(line));\n\n// Forwards non-routine tsc output line by line under a [types] prefix.\nconst forwardTscOutput = (chunk: Buffer): void => {\n for (const line of chunk.toString().split('\\n')) {\n if (line.trim().length === 0 || isRoutineTscLine(line)) {\n continue;\n }\n out.log(`[types] ${line}`);\n }\n};\n\n// A workspace package wants declaration watching when it has a tsconfig and\n// publishes types from its build output. Packages bundled by rspack (views,\n// service handlers) don't ship types and are skipped.\nconst isTypedWorkspacePackage = (dir: string): boolean => {\n if (!fs.existsSync(path.join(dir, 'tsconfig.json'))) {\n return false;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));\n return !!(packageJson.types || packageJson.typings);\n};\n\nexport const startTypeWatcher = (root: string): Nullable<ChildProcess> => {\n const projectDirs = getWorkspacePackageDirs(root).filter(isTypedWorkspacePackage);\n if (projectDirs.length === 0) {\n return null;\n }\n\n const relativeDirs = projectDirs.map((dir) => path.relative(root, dir));\n const child = spawnCommand('npx', ['tsc', '-b', ...relativeDirs, '--watch', '--preserveWatchOutput', '--pretty'], {\n cwd: root,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n child.stdout?.on('data', forwardTscOutput);\n child.stderr?.on('data', forwardTscOutput);\n\n out.log(`Type watcher: tsc -b --watch over ${relativeDirs.length} workspace packages (disable with --no-types).`);\n\n return child;\n};\n"]}
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildUserScriptBuilderLayer = exports.getBuilderLayerInstallArgs = void 0;
7
- const runCommand_1 = require("./runCommand");
8
7
  const core_1 = require("@qpqjs/core");
9
8
  const user_script_1 = require("@qpqjs/user-script");
10
9
  const fs_1 = __importDefault(require("fs"));
11
10
  const path_1 = __importDefault(require("path"));
11
+ const runCommand_1 = require("./runCommand");
12
12
  const MIN_NPM_MAJOR = 9;
13
13
  // Lambda's layer layout: /opt/nodejs/node_modules is on the function's module path.
14
14
  const LAYER_NODE_DIR = 'nodejs';
@@ -1 +1 @@
1
- {"version":3,"file":"userScriptBuilderLayer.js","sourceRoot":"","sources":["../../../src/lib/userScriptBuilderLayer.ts"],"names":[],"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CAAC,IAAI,EAAE,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9H,IAAI,SAAS,CAAC,MAAM,KAAK,+CAAiC,CAAC,MAAM,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,8CAA8C,+CAAiC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzI,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AA1BW,QAAA,2BAA2B,+BA0BtC","sourcesContent":["import { runCommandCaptureSync, runCommandSync } from './runCommand';\nimport { JavascriptRuntimeArchitecture } from '@qpqjs/core';\nimport { USER_SCRIPT_BUILDER_LAYER_MODULES } from '@qpqjs/user-script';\n\nimport fs from 'fs';\nimport path from 'path';\n\nconst MIN_NPM_MAJOR = 9;\n\n// Lambda's layer layout: /opt/nodejs/node_modules is on the function's module path.\nconst LAYER_NODE_DIR = 'nodejs';\n\nconst npmCpuByArchitecture: Record<JavascriptRuntimeArchitecture, 'arm64' | 'x64'> = {\n [JavascriptRuntimeArchitecture.Arm64]: 'arm64',\n [JavascriptRuntimeArchitecture.X86_64]: 'x64',\n};\n\nexport type BuilderLayerInstallOptions = {\n outDir: string;\n architecture: JavascriptRuntimeArchitecture;\n rspackVersion: string;\n};\n\n/** The npm cpu name for a lambda architecture. */\nconst getBuilderLayerCpu = (architecture: JavascriptRuntimeArchitecture): 'arm64' | 'x64' => npmCpuByArchitecture[architecture];\n\n/**\n * The npm argv that installs rspack for linux and the lambda's cpu into the layer's\n * nodejs directory. Pure, so the exact invocation is testable without running npm.\n */\nexport const getBuilderLayerInstallArgs = ({ outDir, architecture, rspackVersion }: BuilderLayerInstallOptions): string[] => [\n 'install',\n '--prefix',\n path.join(outDir, LAYER_NODE_DIR),\n '--os=linux',\n `--cpu=${getBuilderLayerCpu(architecture)}`,\n '--libc=glibc',\n '--omit=dev',\n '--no-save',\n '--no-package-lock',\n '--no-audit',\n '--no-fund',\n `@rspack/core@${rspackVersion}`,\n];\n\nconst parseMajor = (version: string): number => parseInt(version.split('.')[0] ?? '', 10);\n\nexport type BuilderLayerRunners = {\n getNpmVersion: () => string;\n runNpm: (args: string[]) => void;\n};\n\nconst defaultRunners: BuilderLayerRunners = {\n getNpmVersion: () => runCommandCaptureSync('npm', ['--version']).trim(),\n runNpm: (args) => {\n runCommandSync('npm', args);\n },\n};\n\n/**\n * Produces the user-script builder layer directory: `<outDir>/nodejs/node_modules` holding\n * rspack and its linux binding for the lambda's cpu. Empties `outDir` first and verifies\n * the binding landed. Needs npm 9 or later for the `--os`/`--cpu` flags.\n */\nexport const buildUserScriptBuilderLayer = (options: BuilderLayerInstallOptions, runners: BuilderLayerRunners = defaultRunners): string => {\n const npmVersion = runners.getNpmVersion();\n if (parseMajor(npmVersion) < MIN_NPM_MAJOR) {\n throw new Error(`script:builder-layer needs npm ${MIN_NPM_MAJOR} or later for --os/--cpu installs; found ${npmVersion}`);\n }\n\n const nodeDir = path.join(options.outDir, LAYER_NODE_DIR);\n fs.rmSync(options.outDir, { recursive: true, force: true });\n fs.mkdirSync(nodeDir, { recursive: true });\n fs.writeFileSync(path.join(nodeDir, 'package.json'), JSON.stringify({ name: 'user-script-builder-layer', private: true }, null, 2));\n\n runners.runNpm(getBuilderLayerInstallArgs(options));\n\n const bindingDir = path.join(nodeDir, 'node_modules', '@rspack', `binding-linux-${getBuilderLayerCpu(options.architecture)}-gnu`);\n if (!fs.existsSync(bindingDir)) {\n throw new Error(`script:builder-layer: expected the rspack binding at [${bindingDir}] after install; the layer would not load on lambda`);\n }\n\n const installed = USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => fs.existsSync(path.join(nodeDir, 'node_modules', name)));\n if (installed.length !== USER_SCRIPT_BUILDER_LAYER_MODULES.length) {\n throw new Error(\n `script:builder-layer: the layer is missing ${USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => !installed.includes(name)).join(', ')}`,\n );\n }\n\n return nodeDir;\n};\n"]}
1
+ {"version":3,"file":"userScriptBuilderLayer.js","sourceRoot":"","sources":["../../../src/lib/userScriptBuilderLayer.ts"],"names":[],"mappings":";;;;;;AAAA,sCAA4D;AAC5D,oDAAuE;AAEvE,4CAAoB;AACpB,gDAAwB;AAExB,6CAAqE;AAErE,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,oFAAoF;AACpF,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEhC,MAAM,oBAAoB,GAA2D;IACnF,CAAC,oCAA6B,CAAC,KAAK,CAAC,EAAE,OAAO;IAC9C,CAAC,oCAA6B,CAAC,MAAM,CAAC,EAAE,KAAK;CAC9C,CAAC;AAQF,kDAAkD;AAClD,MAAM,kBAAkB,GAAG,CAAC,YAA2C,EAAmB,EAAE,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;AAEhI;;;GAGG;AACI,MAAM,0BAA0B,GAAG,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAA8B,EAAY,EAAE,CAAC;IAC3H,SAAS;IACT,UAAU;IACV,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC;IACjC,YAAY;IACZ,SAAS,kBAAkB,CAAC,YAAY,CAAC,EAAE;IAC3C,cAAc;IACd,YAAY;IACZ,WAAW;IACX,mBAAmB;IACnB,YAAY;IACZ,WAAW;IACX,gBAAgB,aAAa,EAAE;CAChC,CAAC;AAbW,QAAA,0BAA0B,8BAarC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAe,EAAU,EAAE,WAAC,OAAA,QAAQ,CAAC,MAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,mCAAI,EAAE,EAAE,EAAE,CAAC,CAAA,EAAA,CAAC;AAO1F,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OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClI,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,yDAAyD,UAAU,qDAAqD,CAAC,CAAC;IAC5I,CAAC;IAED,MAAM,SAAS,GAAG,+CAAiC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9H,IAAI,SAAS,CAAC,MAAM,KAAK,+CAAiC,CAAC,MAAM,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,8CAA8C,+CAAiC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzI,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AA1BW,QAAA,2BAA2B,+BA0BtC","sourcesContent":["import { JavascriptRuntimeArchitecture } from '@qpqjs/core';\nimport { USER_SCRIPT_BUILDER_LAYER_MODULES } from '@qpqjs/user-script';\n\nimport fs from 'fs';\nimport path from 'path';\n\nimport { runCommandCaptureSync, runCommandSync } from './runCommand';\n\nconst MIN_NPM_MAJOR = 9;\n\n// Lambda's layer layout: /opt/nodejs/node_modules is on the function's module path.\nconst LAYER_NODE_DIR = 'nodejs';\n\nconst npmCpuByArchitecture: Record<JavascriptRuntimeArchitecture, 'arm64' | 'x64'> = {\n [JavascriptRuntimeArchitecture.Arm64]: 'arm64',\n [JavascriptRuntimeArchitecture.X86_64]: 'x64',\n};\n\nexport type BuilderLayerInstallOptions = {\n outDir: string;\n architecture: JavascriptRuntimeArchitecture;\n rspackVersion: string;\n};\n\n/** The npm cpu name for a lambda architecture. */\nconst getBuilderLayerCpu = (architecture: JavascriptRuntimeArchitecture): 'arm64' | 'x64' => npmCpuByArchitecture[architecture];\n\n/**\n * The npm argv that installs rspack for linux and the lambda's cpu into the layer's\n * nodejs directory. Pure, so the exact invocation is testable without running npm.\n */\nexport const getBuilderLayerInstallArgs = ({ outDir, architecture, rspackVersion }: BuilderLayerInstallOptions): string[] => [\n 'install',\n '--prefix',\n path.join(outDir, LAYER_NODE_DIR),\n '--os=linux',\n `--cpu=${getBuilderLayerCpu(architecture)}`,\n '--libc=glibc',\n '--omit=dev',\n '--no-save',\n '--no-package-lock',\n '--no-audit',\n '--no-fund',\n `@rspack/core@${rspackVersion}`,\n];\n\nconst parseMajor = (version: string): number => parseInt(version.split('.')[0] ?? '', 10);\n\nexport type BuilderLayerRunners = {\n getNpmVersion: () => string;\n runNpm: (args: string[]) => void;\n};\n\nconst defaultRunners: BuilderLayerRunners = {\n getNpmVersion: () => runCommandCaptureSync('npm', ['--version']).trim(),\n runNpm: (args) => {\n runCommandSync('npm', args);\n },\n};\n\n/**\n * Produces the user-script builder layer directory: `<outDir>/nodejs/node_modules` holding\n * rspack and its linux binding for the lambda's cpu. Empties `outDir` first and verifies\n * the binding landed. Needs npm 9 or later for the `--os`/`--cpu` flags.\n */\nexport const buildUserScriptBuilderLayer = (options: BuilderLayerInstallOptions, runners: BuilderLayerRunners = defaultRunners): string => {\n const npmVersion = runners.getNpmVersion();\n if (parseMajor(npmVersion) < MIN_NPM_MAJOR) {\n throw new Error(`script:builder-layer needs npm ${MIN_NPM_MAJOR} or later for --os/--cpu installs; found ${npmVersion}`);\n }\n\n const nodeDir = path.join(options.outDir, LAYER_NODE_DIR);\n fs.rmSync(options.outDir, { recursive: true, force: true });\n fs.mkdirSync(nodeDir, { recursive: true });\n fs.writeFileSync(path.join(nodeDir, 'package.json'), JSON.stringify({ name: 'user-script-builder-layer', private: true }, null, 2));\n\n runners.runNpm(getBuilderLayerInstallArgs(options));\n\n const bindingDir = path.join(nodeDir, 'node_modules', '@rspack', `binding-linux-${getBuilderLayerCpu(options.architecture)}-gnu`);\n if (!fs.existsSync(bindingDir)) {\n throw new Error(`script:builder-layer: expected the rspack binding at [${bindingDir}] after install; the layer would not load on lambda`);\n }\n\n const installed = USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => fs.existsSync(path.join(nodeDir, 'node_modules', name)));\n if (installed.length !== USER_SCRIPT_BUILDER_LAYER_MODULES.length) {\n throw new Error(\n `script:builder-layer: the layer is missing ${USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => !installed.includes(name)).join(', ')}`,\n );\n }\n\n return nodeDir;\n};\n"]}
@@ -11,8 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.isAwsCredentialsValid = void 0;
13
13
  const client_sts_1 = require("@aws-sdk/client-sts");
14
- const out_1 = require("../../lib/out");
15
- const out = (0, out_1.createOutput)('aws:aws-credentials');
14
+ const createOutput_1 = require("../../lib/createOutput");
15
+ const out = (0, createOutput_1.createOutput)('aws:aws-credentials');
16
16
  const isAwsCredentialsValid = () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  try {
18
18
  const client = new client_sts_1.STSClient({
@@ -1 +1 @@
1
- {"version":3,"file":"awsCredentials.js","sourceRoot":"","sources":["../../../../src/platforms/aws/awsCredentials.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0E;AAE1E,uCAA6C;AAE7C,MAAM,GAAG,GAAG,IAAA,kBAAY,EAAC,qBAAqB,CAAC,CAAC;AAEzC,MAAM,qBAAqB,GAAG,GAA2B,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC;YAC3B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,WAAW;SAChF,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,qCAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAA,CAAC;AAXW,QAAA,qBAAqB,yBAWhC","sourcesContent":["import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts';\n\nimport { createOutput } from '../../lib/out';\n\nconst out = createOutput('aws:aws-credentials');\n\nexport const isAwsCredentialsValid = async (): Promise<boolean> => {\n try {\n const client = new STSClient({\n region: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1',\n });\n await client.send(new GetCallerIdentityCommand({}));\n return true;\n } catch (error) {\n out.log('Error validating AWS credentials:', error);\n return false;\n }\n};\n"]}
1
+ {"version":3,"file":"awsCredentials.js","sourceRoot":"","sources":["../../../../src/platforms/aws/awsCredentials.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0E;AAE1E,yDAAsD;AAEtD,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,qBAAqB,CAAC,CAAC;AAEzC,MAAM,qBAAqB,GAAG,GAA2B,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC;YAC3B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,WAAW;SAChF,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,qCAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAA,CAAC;AAXW,QAAA,qBAAqB,yBAWhC","sourcesContent":["import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts';\n\nimport { createOutput } from '../../lib/createOutput';\n\nconst out = createOutput('aws:aws-credentials');\n\nexport const isAwsCredentialsValid = async (): Promise<boolean> => {\n try {\n const client = new STSClient({\n region: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1',\n });\n await client.send(new GetCallerIdentityCommand({}));\n return true;\n } catch (error) {\n out.log('Error validating AWS credentials:', error);\n return false;\n }\n};\n"]}
@@ -22,12 +22,13 @@ const actionprocessor_aws_1 = require("@qpqjs/actionprocessor-aws");
22
22
  // same naming utils the deployed runtime uses, so what gets emptied is
23
23
  // exactly what the app reads and writes.
24
24
  const config_aws_1 = require("@qpqjs/config-aws");
25
+ const core_1 = require("@qpqjs/core");
25
26
  const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
26
27
  const client_s3_1 = require("@aws-sdk/client-s3");
27
- const out_1 = require("../../lib/out");
28
+ const createOutput_1 = require("../../lib/createOutput");
28
29
  const qpqConfigs_1 = require("../../lib/qpqConfigs");
29
30
  const awsCredentials_1 = require("./awsCredentials");
30
- const out = (0, out_1.createOutput)('aws:clear-resources');
31
+ const out = (0, createOutput_1.createOutput)('aws:clear-resources');
31
32
  // Log a progress heartbeat roughly every this-many removals, so a large
32
33
  // resource visibly ticks along instead of looking hung.
33
34
  const PROGRESS_EVERY = 2000;
@@ -90,7 +91,7 @@ const truncateTable = (tableName, region) => __awaiter(void 0, void 0, void 0, f
90
91
  requests = unprocessed;
91
92
  if (requests.length > 0) {
92
93
  // Throttled - back off briefly before retrying the leftovers.
93
- yield new Promise((resolve) => setTimeout(resolve, 250));
94
+ yield (0, core_1.sleep)(250);
94
95
  }
95
96
  }
96
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"clearResources.js","sourceRoot":"","sources":["../../../../src/platforms/aws/clearResources.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,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C;IACzC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAnBW,QAAA,iBAAiB,qBAmB5B","sourcesContent":["import { resolveStorageDriveBucketName } from '@qpqjs/actionprocessor-aws';\n// AWS implementation of `qpq clear-resources`: empty (never delete) the\n// selected data resources. Storage drives are S3 buckets - emptied including\n// every object version and delete marker, so versioned buckets come out clean\n// too. Key value stores are DynamoDB tables - truncated by scanning keys only\n// and batch-deleting. The stacks and the resources themselves are untouched,\n// so this is the \"reset my data\" counterpart to `qpq teardown`.\n//\n// Runtime names are resolved from each service's live qpq config with the\n// same naming utils the deployed runtime uses, so what gets emptied is\n// exactly what the app reads and writes.\nimport { awsNamingUtils, qpqConfigAwsUtils } from '@qpqjs/config-aws';\nimport { QPQConfig, qpqCoreUtils } from '@qpqjs/core';\n\nimport {\n BatchWriteItemCommand,\n DescribeTableCommand,\n DynamoDBClient,\n ResourceNotFoundException,\n ScanCommand,\n WriteRequest,\n} from '@aws-sdk/client-dynamodb';\nimport { DeleteObjectsCommand, ListObjectVersionsCommand, NoSuchBucket, ObjectIdentifier, S3Client } from '@aws-sdk/client-s3';\n\nimport { ClearableResource, ClearResourcesPlan } from '../../lib/clearResourcesPlan';\nimport { createOutput } from '../../lib/out';\nimport { loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { isAwsCredentialsValid } from './awsCredentials';\n\nconst out = createOutput('aws:clear-resources');\n\n// Log a progress heartbeat roughly every this-many removals, so a large\n// resource visibly ticks along instead of looking hung.\nconst PROGRESS_EVERY = 2000;\n\n// Empty a bucket including all versions + delete markers. Returns the number\n// of objects/versions removed.\nconst emptyBucket = async (bucketName: string, region: string): Promise<number> => {\n const s3 = new S3Client({ region });\n let removed = 0;\n let lastReported = 0;\n let keyMarker: string | undefined;\n let versionIdMarker: string | undefined;\n\n do {\n const page = await s3.send(new ListObjectVersionsCommand({ Bucket: bucketName, KeyMarker: keyMarker, VersionIdMarker: versionIdMarker }));\n\n const objects: ObjectIdentifier[] = [...(page.Versions ?? []), ...(page.DeleteMarkers ?? [])].map((v) => ({\n Key: v.Key!,\n VersionId: v.VersionId,\n }));\n\n if (objects.length > 0) {\n await s3.send(new DeleteObjectsCommand({ Bucket: bucketName, Delete: { Objects: objects, Quiet: true } }));\n removed += objects.length;\n }\n\n if (removed - lastReported >= PROGRESS_EVERY) {\n out.log(` ... ${removed} objects/versions so far`);\n lastReported = removed;\n }\n\n keyMarker = page.IsTruncated ? page.NextKeyMarker : undefined;\n versionIdMarker = page.IsTruncated ? page.NextVersionIdMarker : undefined;\n } while (keyMarker || versionIdMarker);\n\n return removed;\n};\n\n// Truncate a table: scan key attributes only, batch-delete 25 at a time,\n// retrying unprocessed items. Returns the number of items removed.\nconst truncateTable = async (tableName: string, region: string): Promise<number> => {\n const dynamo = new DynamoDBClient({ region });\n\n const described = await dynamo.send(new DescribeTableCommand({ TableName: tableName }));\n const keyAttributes = (described.Table?.KeySchema ?? []).map((k) => k.AttributeName!);\n\n // Alias every key attribute - a raw name could collide with a reserved word.\n const projection = keyAttributes.map((_, i) => `#k${i}`).join(', ');\n const attributeNames = Object.fromEntries(keyAttributes.map((attribute, i) => [`#k${i}`, attribute]));\n\n let removed = 0;\n let lastReported = 0;\n let exclusiveStartKey: Record<string, any> | undefined;\n\n do {\n const page = await dynamo.send(\n new ScanCommand({\n TableName: tableName,\n ProjectionExpression: projection,\n ExpressionAttributeNames: attributeNames,\n ExclusiveStartKey: exclusiveStartKey,\n }),\n );\n\n const items = page.Items ?? [];\n\n for (let i = 0; i < items.length; i += 25) {\n let requests: WriteRequest[] = items.slice(i, i + 25).map((item) => ({ DeleteRequest: { Key: item } }));\n\n while (requests.length > 0) {\n const result = await dynamo.send(new BatchWriteItemCommand({ RequestItems: { [tableName]: requests } }));\n removed += requests.length;\n\n const unprocessed = result.UnprocessedItems?.[tableName] ?? [];\n removed -= unprocessed.length;\n requests = unprocessed;\n\n if (requests.length > 0) {\n // Throttled - back off briefly before retrying the leftovers.\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n }\n }\n\n if (removed - lastReported >= PROGRESS_EVERY) {\n out.log(` ... ${removed} items so far`);\n lastReported = removed;\n }\n\n exclusiveStartKey = page.LastEvaluatedKey;\n } while (exclusiveStartKey);\n\n return removed;\n};\n\nconst clearResource = async (appName: string, resource: ClearableResource): Promise<void> => {\n const qpqConfig = loadServiceQpqConfig(appName, resource.service);\n const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);\n\n if (resource.kind === 'storageDrive') {\n const bucketName = resolveStorageDriveBucketName(resource.resourceName, qpqConfig);\n out.log(` emptying s3://${bucketName} ...`);\n try {\n const removed = await emptyBucket(bucketName, region);\n out.log(` emptied s3://${bucketName} (${removed} objects/versions)`);\n } catch (error) {\n if (error instanceof NoSuchBucket) {\n out.log(` skipped s3://${bucketName} (bucket does not exist - not deployed?)`);\n return;\n }\n throw error;\n }\n return;\n }\n\n // 'kvs' matches the resourceType every runtime KVS action processor passes,\n // giving the deployed '-qpqkvs' table name suffix.\n const tableName = awsNamingUtils.getKvsDynamoTableNameFromConfig(resource.resourceName, qpqConfig, 'kvs');\n out.log(` truncating ${tableName} ...`);\n try {\n const removed = await truncateTable(tableName, region);\n out.log(` truncated ${tableName} (${removed} items)`);\n } catch (error) {\n if (error instanceof ResourceNotFoundException) {\n out.log(` skipped ${tableName} (table does not exist - not deployed?)`);\n return;\n }\n throw error;\n }\n};\n\nexport const awsClearResources = async (appName: string, plan: ClearResourcesPlan): Promise<void> => {\n if (plan.kind === 'cancelled') {\n return;\n }\n\n if ((await isAwsCredentialsValid()) === false) {\n out.log('Credentials are expired or invalid.');\n return;\n }\n\n out.log('\\nEmptying resources:');\n\n // Sequential on purpose: predictable output, and no burst of parallel scans\n // against provisioned-throughput tables.\n for (const resource of plan.resources) {\n await clearResource(appName, resource);\n }\n\n out.log('Done.');\n};\n"]}
1
+ {"version":3,"file":"clearResources.js","sourceRoot":"","sources":["../../../../src/platforms/aws/clearResources.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAA2E;AAC3E,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,gEAAgE;AAChE,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,yCAAyC;AACzC,kDAAsE;AACtE,sCAA6D;AAE7D,8DAOkC;AAClC,kDAA+H;AAG/H,yDAAsD;AACtD,qDAA4D;AAC5D,qDAAyD;AAEzD,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,qBAAqB,CAAC,CAAC;AAEhD,wEAAwE;AACxE,wDAAwD;AACxD,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,6EAA6E;AAC7E,+BAA+B;AAC/B,MAAM,WAAW,GAAG,CAAO,UAAkB,EAAE,MAAc,EAAmB,EAAE;;IAChF,MAAM,EAAE,GAAG,IAAI,oBAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACpC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,SAA6B,CAAC;IAClC,IAAI,eAAmC,CAAC;IAExC,GAAG,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,qCAAyB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;QAE1I,MAAM,OAAO,GAAuB,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,QAAQ,mCAAI,EAAE,CAAC,EAAE,GAAG,CAAC,MAAA,IAAI,CAAC,aAAa,mCAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAA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AC,qCAAqC,CAAC,CAAC;QAC/C,OAAO;IACT,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAEjC,4EAA4E;IAC5E,yCAAyC;IACzC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAnBW,QAAA,iBAAiB,qBAmB5B","sourcesContent":["import { resolveStorageDriveBucketName } from '@qpqjs/actionprocessor-aws';\n// AWS implementation of `qpq clear-resources`: empty (never delete) the\n// selected data resources. Storage drives are S3 buckets - emptied including\n// every object version and delete marker, so versioned buckets come out clean\n// too. Key value stores are DynamoDB tables - truncated by scanning keys only\n// and batch-deleting. The stacks and the resources themselves are untouched,\n// so this is the \"reset my data\" counterpart to `qpq teardown`.\n//\n// Runtime names are resolved from each service's live qpq config with the\n// same naming utils the deployed runtime uses, so what gets emptied is\n// exactly what the app reads and writes.\nimport { awsNamingUtils, qpqConfigAwsUtils } from '@qpqjs/config-aws';\nimport { QPQConfig, qpqCoreUtils, sleep } from '@qpqjs/core';\n\nimport {\n BatchWriteItemCommand,\n DescribeTableCommand,\n DynamoDBClient,\n ResourceNotFoundException,\n ScanCommand,\n WriteRequest,\n} from '@aws-sdk/client-dynamodb';\nimport { DeleteObjectsCommand, ListObjectVersionsCommand, NoSuchBucket, ObjectIdentifier, S3Client } from '@aws-sdk/client-s3';\n\nimport { ClearableResource, ClearResourcesPlan } from '../../lib/clearResourcesPlan';\nimport { createOutput } from '../../lib/createOutput';\nimport { loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { isAwsCredentialsValid } from './awsCredentials';\n\nconst out = createOutput('aws:clear-resources');\n\n// Log a progress heartbeat roughly every this-many removals, so a large\n// resource visibly ticks along instead of looking hung.\nconst PROGRESS_EVERY = 2000;\n\n// Empty a bucket including all versions + delete markers. Returns the number\n// of objects/versions removed.\nconst emptyBucket = async (bucketName: string, region: string): Promise<number> => {\n const s3 = new S3Client({ region });\n let removed = 0;\n let lastReported = 0;\n let keyMarker: string | undefined;\n let versionIdMarker: string | undefined;\n\n do {\n const page = await s3.send(new ListObjectVersionsCommand({ Bucket: bucketName, KeyMarker: keyMarker, VersionIdMarker: versionIdMarker }));\n\n const objects: ObjectIdentifier[] = [...(page.Versions ?? []), ...(page.DeleteMarkers ?? [])].map((v) => ({\n Key: v.Key!,\n VersionId: v.VersionId,\n }));\n\n if (objects.length > 0) {\n await s3.send(new DeleteObjectsCommand({ Bucket: bucketName, Delete: { Objects: objects, Quiet: true } }));\n removed += objects.length;\n }\n\n if (removed - lastReported >= PROGRESS_EVERY) {\n out.log(` ... ${removed} objects/versions so far`);\n lastReported = removed;\n }\n\n keyMarker = page.IsTruncated ? page.NextKeyMarker : undefined;\n versionIdMarker = page.IsTruncated ? page.NextVersionIdMarker : undefined;\n } while (keyMarker || versionIdMarker);\n\n return removed;\n};\n\n// Truncate a table: scan key attributes only, batch-delete 25 at a time,\n// retrying unprocessed items. Returns the number of items removed.\nconst truncateTable = async (tableName: string, region: string): Promise<number> => {\n const dynamo = new DynamoDBClient({ region });\n\n const described = await dynamo.send(new DescribeTableCommand({ TableName: tableName }));\n const keyAttributes = (described.Table?.KeySchema ?? []).map((k) => k.AttributeName!);\n\n // Alias every key attribute - a raw name could collide with a reserved word.\n const projection = keyAttributes.map((_, i) => `#k${i}`).join(', ');\n const attributeNames = Object.fromEntries(keyAttributes.map((attribute, i) => [`#k${i}`, attribute]));\n\n let removed = 0;\n let lastReported = 0;\n let exclusiveStartKey: Record<string, any> | undefined;\n\n do {\n const page = await dynamo.send(\n new ScanCommand({\n TableName: tableName,\n ProjectionExpression: projection,\n ExpressionAttributeNames: attributeNames,\n ExclusiveStartKey: exclusiveStartKey,\n }),\n );\n\n const items = page.Items ?? [];\n\n for (let i = 0; i < items.length; i += 25) {\n let requests: WriteRequest[] = items.slice(i, i + 25).map((item) => ({ DeleteRequest: { Key: item } }));\n\n while (requests.length > 0) {\n const result = await dynamo.send(new BatchWriteItemCommand({ RequestItems: { [tableName]: requests } }));\n removed += requests.length;\n\n const unprocessed = result.UnprocessedItems?.[tableName] ?? [];\n removed -= unprocessed.length;\n requests = unprocessed;\n\n if (requests.length > 0) {\n // Throttled - back off briefly before retrying the leftovers.\n await sleep(250);\n }\n }\n }\n\n if (removed - lastReported >= PROGRESS_EVERY) {\n out.log(` ... ${removed} items so far`);\n lastReported = removed;\n }\n\n exclusiveStartKey = page.LastEvaluatedKey;\n } while (exclusiveStartKey);\n\n return removed;\n};\n\nconst clearResource = async (appName: string, resource: ClearableResource): Promise<void> => {\n const qpqConfig = loadServiceQpqConfig(appName, resource.service);\n const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);\n\n if (resource.kind === 'storageDrive') {\n const bucketName = resolveStorageDriveBucketName(resource.resourceName, qpqConfig);\n out.log(` emptying s3://${bucketName} ...`);\n try {\n const removed = await emptyBucket(bucketName, region);\n out.log(` emptied s3://${bucketName} (${removed} objects/versions)`);\n } catch (error) {\n if (error instanceof NoSuchBucket) {\n out.log(` skipped s3://${bucketName} (bucket does not exist - not deployed?)`);\n return;\n }\n throw error;\n }\n return;\n }\n\n // 'kvs' matches the resourceType every runtime KVS action processor passes,\n // giving the deployed '-qpqkvs' table name suffix.\n const tableName = awsNamingUtils.getKvsDynamoTableNameFromConfig(resource.resourceName, qpqConfig, 'kvs');\n out.log(` truncating ${tableName} ...`);\n try {\n const removed = await truncateTable(tableName, region);\n out.log(` truncated ${tableName} (${removed} items)`);\n } catch (error) {\n if (error instanceof ResourceNotFoundException) {\n out.log(` skipped ${tableName} (table does not exist - not deployed?)`);\n return;\n }\n throw error;\n }\n};\n\nexport const awsClearResources = async (appName: string, plan: ClearResourcesPlan): Promise<void> => {\n if (plan.kind === 'cancelled') {\n return;\n }\n\n if ((await isAwsCredentialsValid()) === false) {\n out.log('Credentials are expired or invalid.');\n return;\n }\n\n out.log('\\nEmptying resources:');\n\n // Sequential on purpose: predictable output, and no burst of parallel scans\n // against provisioned-throughput tables.\n for (const resource of plan.resources) {\n await clearResource(appName, resource);\n }\n\n out.log('Done.');\n};\n"]}
@@ -25,10 +25,10 @@ const deploy_aws_1 = require("@qpqjs/deploy-aws");
25
25
  const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
26
26
  const path_1 = __importDefault(require("path"));
27
27
  const synth_1 = require("../../commands/synth");
28
+ const createOutput_1 = require("../../lib/createOutput");
28
29
  const discovery_1 = require("../../lib/discovery");
29
30
  const getDefaultHookJobs_1 = require("../../lib/getDefaultHookJobs");
30
31
  const hooks_1 = require("../../lib/hooks");
31
- const out_1 = require("../../lib/out");
32
32
  const qpqConfigs_1 = require("../../lib/qpqConfigs");
33
33
  const runTasks_1 = require("../../lib/runTasks");
34
34
  const timing_1 = require("../../lib/timing");
@@ -37,7 +37,7 @@ const awsCredentials_1 = require("./awsCredentials");
37
37
  const publish_1 = require("./publish");
38
38
  const stacks_1 = require("./stacks");
39
39
  const viewsSync_1 = require("./viewsSync");
40
- const out = (0, out_1.createOutput)('aws:go');
40
+ const out = (0, createOutput_1.createOutput)('aws:go');
41
41
  const buildAndDeploy = (serviceName, needsSynth, needsBuildApi, needsInfStack, needsApiStack, needsWebStack, needsViewStack, appName) => __awaiter(void 0, void 0, void 0, function* () {
42
42
  if (needsSynth) {
43
43
  out.log('Synth QPQ Configs');
@@ -1 +1 @@
1
- {"version":3,"file":"go.js","sourceRoot":"","sources":["../../../../src/platforms/aws/go.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAC9E,4EAA4E;AAC5E,uDAAuD;AACvD,sCAA8C;AAC9C,kDAAsD;AACtD,wDAAyE;AAEzE,gDAAwB;AAExB,gDAAoD;AAEpD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CAAC;IAClD,CAAC;IAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAO,GAAG,EAAE,OAAO,EAAE,EAAE;YAC3C,MAAM,GAAG,CAAC;YACV,OAAO,cAAc,CACnB,OAAO,EACP,KAAK,KAAK,CAAC,EACX,KAAK,KAAK,CAAC,IAAI,cAAc,EAC7B,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,KAAK,KAAK,CAAC,EAC9C,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,KAAK,KAAK,CAAC,EAC9C,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,KAAK,KAAK,CAAC,EAC9C,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,KAAK,OAAO,CAAC,EAChD,OAAO,CACR,CAAC;QACJ,CAAC,CAAA,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxB,CAAC;IAED,yEAAyE;IACzE,0EAA0E;IAC1E,uDAAuD;IACvD,IAAI,SAAS,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAClC,MAAM,iBAAiB,GAAG,IAAA,0CAA6B,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC3E,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,GAAG,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YAC/C,MAAM,IAAA,oBAAU,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,IAAA,mBAAU,EAAC,WAAW,CAAC,CAAC;AAC1B,CAAC,CAAA,CAAC;AAnFW,QAAA,KAAK,SAmFhB","sourcesContent":["// AWS sequential deploy (`qpq go`). Per service it: synths the QPQ config,\n// rspack-bundles the backend (programmatic, no per-service rspack.config.ts),\n// deploys the inf/api/web CDK stacks (cdk runs the generic workspace app via\n// --app), bundles views (rspack, production) and syncs them to S3. Finally, any\n// service that opts into module federation has its federated remote published\n// (built + uploaded + manifest flipped), so a deploy that ships new backend\n// code also republishes the code the lambdas federate.\nimport { QpqDeployEnvVar } from '@qpqjs/core';\nimport { qpqDeployAwsUtils } from '@qpqjs/deploy-aws';\nimport { getServiceRspackConfig, runRspack } from '@qpqjs/deploy-rspack';\n\nimport path from 'path';\n\nimport { synthCommand } from '../../commands/synth';\nimport { DeployPlan } from '../../lib/deployPrompts';\nimport { getServiceDirectory, getServiceNamesWithViews } from '../../lib/discovery';\nimport { getDefaultHookJobs } from '../../lib/getDefaultHookJobs';\nimport { runAppHook, runHookForAppPackages } from '../../lib/hooks';\nimport { createOutput } from '../../lib/out';\nimport { getServiceNamesWithFederation, loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { assertNoFailures } from '../../lib/runTasks';\nimport { logTimeEnd, logTimeStart } from '../../lib/timing';\nimport { bundleViews } from '../../lib/views';\nimport { isAwsCredentialsValid } from './awsCredentials';\nimport { awsPublish } from './publish';\nimport { deployAccountStack, deployBootstrapStack, deployDomainStack, deployServiceStack } from './stacks';\nimport { syncViewsToS3 } from './viewsSync';\n\nconst out = createOutput('aws:go');\n\nconst buildAndDeploy = async (\n serviceName: string,\n needsSynth: boolean,\n needsBuildApi: boolean,\n needsInfStack: boolean,\n needsApiStack: boolean,\n needsWebStack: boolean,\n needsViewStack: boolean,\n appName: string,\n): Promise<void> => {\n if (needsSynth) {\n out.log('Synth QPQ Configs');\n await synthCommand([serviceName, '--app', appName]);\n }\n\n const qpqConfigForService = loadServiceQpqConfig(appName, serviceName);\n\n if (needsBuildApi) {\n out.log('Building Api: ', serviceName);\n await runRspack(getServiceRspackConfig(qpqConfigForService, path.join(getServiceDirectory(appName, serviceName), 'service')));\n }\n\n if (needsInfStack) {\n out.log('Deploy Inf: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getInfStackName(qpqConfigForService), appName);\n }\n\n if (needsApiStack) {\n out.log('Deploy Api: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getApiStackName(qpqConfigForService), appName);\n }\n\n if (needsWebStack) {\n out.log('Deploy Web: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getWebStackName(qpqConfigForService), appName);\n }\n\n if (needsViewStack && getServiceNamesWithViews(appName).includes(serviceName)) {\n out.log('Building Views: ', serviceName);\n await bundleViews(appName, serviceName);\n await syncViewsToS3(appName, serviceName);\n }\n};\n\nexport const awsGo = async (appName: string, plan: DeployPlan): Promise<void> => {\n if (plan.kind === 'cancelled') {\n return;\n }\n\n logTimeStart('totalTime');\n\n if (plan.kind === 'account') {\n await deployAccountStack(plan.appName);\n logTimeEnd('totalTime');\n return;\n }\n\n if (plan.kind === 'bootstrap') {\n // Feature bootstraps deploy into a shared account, leave the account-level\n // guardrails stack alone (deploy it explicitly via the 'account' option).\n if (process.env[QpqDeployEnvVar.featureName]) {\n out.log('Skipping account stack for feature deploy');\n } else {\n await deployAccountStack(plan.appName);\n }\n if (plan.includeDomain) {\n await deployDomainStack(plan.appName);\n }\n await deployBootstrapStack(plan.appName);\n logTimeEnd('totalTime');\n return;\n }\n\n const { services, stacks } = plan;\n const shouldBuildApi = stacks !== 'views';\n\n out.log('\\n\\nRunning automated deploy\\n\\n');\n out.log('Executing for services');\n out.log(services.join(', '));\n\n if ((await isAwsCredentialsValid()) === false) {\n out.log('Credentials are expired or invalid.');\n return;\n }\n\n const allStacks = stacks === 'all';\n\n await runAppHook(appName, 'predeploy');\n\n // Workspace packages resolve through their built dist/ (package.json main),\n // so bundles would ship stale code unless every lib is tsc'd first.\n out.log('Building workspace packages');\n assertNoFailures('Workspace build', await runHookForAppPackages('build', appName, getDefaultHookJobs()));\n\n // Views uploads resolve bucket names from the shell service's config.\n if (allStacks || stacks === 'views') {\n await synthCommand(['shell', '--app', appName]);\n }\n\n for (let phase = 0; phase <= 5; phase += 1) {\n await services.reduce(async (cur, service) => {\n await cur;\n return buildAndDeploy(\n service,\n phase === 0,\n phase === 1 && shouldBuildApi,\n phase === 2 && (allStacks || stacks === 'inf'),\n phase === 3 && (allStacks || stacks === 'api'),\n phase === 4 && (allStacks || stacks === 'web'),\n phase === 5 && (allStacks || stacks === 'views'),\n appName,\n );\n }, Promise.resolve());\n }\n\n // Publishing federated remotes only matters once the new backend code is\n // live, so it's gated on the api stack having been (re)deployed. Services\n // without defineFederatedModuleStore(...) are skipped.\n if (allStacks || stacks === 'api') {\n const federatedServices = getServiceNamesWithFederation(appName, services);\n if (federatedServices.length > 0) {\n out.log('\\n\\nPublishing federated backends\\n');\n await awsPublish(appName, federatedServices);\n }\n }\n\n logTimeEnd('totalTime');\n};\n"]}
1
+ {"version":3,"file":"go.js","sourceRoot":"","sources":["../../../../src/platforms/aws/go.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAC9E,4EAA4E;AAC5E,uDAAuD;AACvD,sCAA8C;AAC9C,kDAAsD;AACtD,wDAAyE;AAEzE,gDAAwB;AAExB,gDAAoD;AACpD,yDAAsD;AAEtD,mDAAoF;AACpF,qEAAkE;AAClE,2CAAoE;AACpE,qDAA2F;AAC3F,iDAAsD;AACtD,6CAA4D;AAC5D,2CAA8C;AAC9C,qDAAyD;AACzD,uCAAuC;AACvC,qCAA2G;AAC3G,2CAA4C;AAE5C,MAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,QAAQ,CAAC,CAAC;AAEnC,MAAM,cAAc,GAAG,CACrB,WAAmB,EACnB,UAAmB,EACnB,aAAsB,EACtB,aAAsB,EACtB,aAAsB,EACtB,aAAsB,EACtB,cAAuB,EACvB,OAAe,EACA,EAAE;IACjB,IAAI,UAAU,EAAE,CAAC;QACf,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC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AK,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,KAAK,KAAK,CAAC,EAC9C,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,KAAK,OAAO,CAAC,EAChD,OAAO,CACR,CAAC;QACJ,CAAC,CAAA,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxB,CAAC;IAED,yEAAyE;IACzE,0EAA0E;IAC1E,uDAAuD;IACvD,IAAI,SAAS,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAClC,MAAM,iBAAiB,GAAG,IAAA,0CAA6B,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC3E,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,GAAG,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YAC/C,MAAM,IAAA,oBAAU,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,IAAA,mBAAU,EAAC,WAAW,CAAC,CAAC;AAC1B,CAAC,CAAA,CAAC;AAnFW,QAAA,KAAK,SAmFhB","sourcesContent":["// AWS sequential deploy (`qpq go`). Per service it: synths the QPQ config,\n// rspack-bundles the backend (programmatic, no per-service rspack.config.ts),\n// deploys the inf/api/web CDK stacks (cdk runs the generic workspace app via\n// --app), bundles views (rspack, production) and syncs them to S3. Finally, any\n// service that opts into module federation has its federated remote published\n// (built + uploaded + manifest flipped), so a deploy that ships new backend\n// code also republishes the code the lambdas federate.\nimport { QpqDeployEnvVar } from '@qpqjs/core';\nimport { qpqDeployAwsUtils } from '@qpqjs/deploy-aws';\nimport { getServiceRspackConfig, runRspack } from '@qpqjs/deploy-rspack';\n\nimport path from 'path';\n\nimport { synthCommand } from '../../commands/synth';\nimport { createOutput } from '../../lib/createOutput';\nimport { DeployPlan } from '../../lib/deployPrompts';\nimport { getServiceDirectory, getServiceNamesWithViews } from '../../lib/discovery';\nimport { getDefaultHookJobs } from '../../lib/getDefaultHookJobs';\nimport { runAppHook, runHookForAppPackages } from '../../lib/hooks';\nimport { getServiceNamesWithFederation, loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { assertNoFailures } from '../../lib/runTasks';\nimport { logTimeEnd, logTimeStart } from '../../lib/timing';\nimport { bundleViews } from '../../lib/views';\nimport { isAwsCredentialsValid } from './awsCredentials';\nimport { awsPublish } from './publish';\nimport { deployAccountStack, deployBootstrapStack, deployDomainStack, deployServiceStack } from './stacks';\nimport { syncViewsToS3 } from './viewsSync';\n\nconst out = createOutput('aws:go');\n\nconst buildAndDeploy = async (\n serviceName: string,\n needsSynth: boolean,\n needsBuildApi: boolean,\n needsInfStack: boolean,\n needsApiStack: boolean,\n needsWebStack: boolean,\n needsViewStack: boolean,\n appName: string,\n): Promise<void> => {\n if (needsSynth) {\n out.log('Synth QPQ Configs');\n await synthCommand([serviceName, '--app', appName]);\n }\n\n const qpqConfigForService = loadServiceQpqConfig(appName, serviceName);\n\n if (needsBuildApi) {\n out.log('Building Api: ', serviceName);\n await runRspack(getServiceRspackConfig(qpqConfigForService, path.join(getServiceDirectory(appName, serviceName), 'service')));\n }\n\n if (needsInfStack) {\n out.log('Deploy Inf: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getInfStackName(qpqConfigForService), appName);\n }\n\n if (needsApiStack) {\n out.log('Deploy Api: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getApiStackName(qpqConfigForService), appName);\n }\n\n if (needsWebStack) {\n out.log('Deploy Web: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getWebStackName(qpqConfigForService), appName);\n }\n\n if (needsViewStack && getServiceNamesWithViews(appName).includes(serviceName)) {\n out.log('Building Views: ', serviceName);\n await bundleViews(appName, serviceName);\n await syncViewsToS3(appName, serviceName);\n }\n};\n\nexport const awsGo = async (appName: string, plan: DeployPlan): Promise<void> => {\n if (plan.kind === 'cancelled') {\n return;\n }\n\n logTimeStart('totalTime');\n\n if (plan.kind === 'account') {\n await deployAccountStack(plan.appName);\n logTimeEnd('totalTime');\n return;\n }\n\n if (plan.kind === 'bootstrap') {\n // Feature bootstraps deploy into a shared account, leave the account-level\n // guardrails stack alone (deploy it explicitly via the 'account' option).\n if (process.env[QpqDeployEnvVar.featureName]) {\n out.log('Skipping account stack for feature deploy');\n } else {\n await deployAccountStack(plan.appName);\n }\n if (plan.includeDomain) {\n await deployDomainStack(plan.appName);\n }\n await deployBootstrapStack(plan.appName);\n logTimeEnd('totalTime');\n return;\n }\n\n const { services, stacks } = plan;\n const shouldBuildApi = stacks !== 'views';\n\n out.log('\\n\\nRunning automated deploy\\n\\n');\n out.log('Executing for services');\n out.log(services.join(', '));\n\n if ((await isAwsCredentialsValid()) === false) {\n out.log('Credentials are expired or invalid.');\n return;\n }\n\n const allStacks = stacks === 'all';\n\n await runAppHook(appName, 'predeploy');\n\n // Workspace packages resolve through their built dist/ (package.json main),\n // so bundles would ship stale code unless every lib is tsc'd first.\n out.log('Building workspace packages');\n assertNoFailures('Workspace build', await runHookForAppPackages('build', appName, getDefaultHookJobs()));\n\n // Views uploads resolve bucket names from the shell service's config.\n if (allStacks || stacks === 'views') {\n await synthCommand(['shell', '--app', appName]);\n }\n\n for (let phase = 0; phase <= 5; phase += 1) {\n await services.reduce(async (cur, service) => {\n await cur;\n return buildAndDeploy(\n service,\n phase === 0,\n phase === 1 && shouldBuildApi,\n phase === 2 && (allStacks || stacks === 'inf'),\n phase === 3 && (allStacks || stacks === 'api'),\n phase === 4 && (allStacks || stacks === 'web'),\n phase === 5 && (allStacks || stacks === 'views'),\n appName,\n );\n }, Promise.resolve());\n }\n\n // Publishing federated remotes only matters once the new backend code is\n // live, so it's gated on the api stack having been (re)deployed. Services\n // without defineFederatedModuleStore(...) are skipped.\n if (allStacks || stacks === 'api') {\n const federatedServices = getServiceNamesWithFederation(appName, services);\n if (federatedServices.length > 0) {\n out.log('\\n\\nPublishing federated backends\\n');\n await awsPublish(appName, federatedServices);\n }\n }\n\n logTimeEnd('totalTime');\n};\n"]}
@@ -64,10 +64,10 @@ const fs_1 = __importDefault(require("fs"));
64
64
  const os_1 = __importDefault(require("os"));
65
65
  const path_1 = __importDefault(require("path"));
66
66
  const synth_1 = require("../../commands/synth");
67
+ const createOutput_1 = require("../../lib/createOutput");
67
68
  const discovery_1 = require("../../lib/discovery");
68
69
  const getDefaultHookJobs_1 = require("../../lib/getDefaultHookJobs");
69
70
  const hooks_1 = require("../../lib/hooks");
70
- const out_1 = require("../../lib/out");
71
71
  const qpqConfigs_1 = require("../../lib/qpqConfigs");
72
72
  const runCommand_1 = require("../../lib/runCommand");
73
73
  const runTasks_1 = require("../../lib/runTasks");
@@ -80,7 +80,7 @@ const goDockerManifest_1 = require("./goDockerManifest");
80
80
  const remote_1 = require("./remote");
81
81
  const stacks_1 = require("./stacks");
82
82
  const viewsSync_1 = require("./viewsSync");
83
- const out = (0, out_1.createOutput)('aws:go-docker');
83
+ const out = (0, createOutput_1.createOutput)('aws:go-docker');
84
84
  const IMAGE_TAG = 'qpq-cdk-deployer';
85
85
  const AWS_CLI_IMAGE = 'amazon/aws-cli';
86
86
  const BUILD_CONCURRENCY = Number(process.env.GO_DOCKER_BUILD_CONCURRENCY) || os_1.default.availableParallelism();