@quadnix/octo-build 0.0.17 → 0.2.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 (195) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +117 -8
  3. package/dist/commands/apply/apply.command.d.ts +25 -0
  4. package/dist/commands/apply/apply.command.js +130 -0
  5. package/dist/commands/apply/apply.command.js.map +1 -0
  6. package/dist/commands/apply/index.d.ts +1 -0
  7. package/dist/commands/apply/index.js +2 -0
  8. package/dist/commands/apply/index.js.map +1 -0
  9. package/dist/commands/build/build.command.d.ts +1 -1
  10. package/dist/commands/build/build.command.js +4 -4
  11. package/dist/commands/build/build.command.js.map +1 -1
  12. package/dist/commands/build/main.d.ts +22 -0
  13. package/dist/commands/build/main.js +22 -0
  14. package/dist/commands/build/main.js.map +1 -1
  15. package/dist/commands/build/parsers/build-file.parser.d.ts +6 -0
  16. package/dist/commands/build/parsers/build-file.parser.js +6 -0
  17. package/dist/commands/build/parsers/build-file.parser.js.map +1 -1
  18. package/dist/commands/build/streams/stream-manager.d.ts +6 -0
  19. package/dist/commands/build/streams/stream-manager.js +7 -1
  20. package/dist/commands/build/streams/stream-manager.js.map +1 -1
  21. package/dist/commands/commit/commit.command.d.ts +23 -0
  22. package/dist/commands/commit/commit.command.js +81 -0
  23. package/dist/commands/commit/commit.command.js.map +1 -0
  24. package/dist/commands/commit/index.d.ts +1 -0
  25. package/dist/commands/commit/index.js +2 -0
  26. package/dist/commands/commit/index.js.map +1 -0
  27. package/dist/commands/create-anchor/create-anchor.command.js +1 -1
  28. package/dist/commands/create-anchor/create-anchor.command.js.map +1 -1
  29. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.d.ts +18 -3
  30. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js +29 -11
  31. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js.map +1 -1
  32. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/templates/anchors/anchor/anchor.schema.ts.ejs +9 -1
  33. package/dist/commands/create-app/create-app.command.d.ts +1 -1
  34. package/dist/commands/create-app/create-app.command.js +7 -3
  35. package/dist/commands/create-app/create-app.command.js.map +1 -1
  36. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.d.ts +17 -1
  37. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js +72 -16
  38. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js.map +1 -1
  39. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/README.md.ejs +73 -14
  40. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/gitignore.ejs +14 -0
  41. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/index.ts.ejs +19 -0
  42. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/package.json.ejs +9 -1
  43. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-dynamodb-service/octo.yaml.ejs +111 -0
  44. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/octo.yaml.ejs +28 -16
  45. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo.yaml.ejs +25 -3
  46. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/tsconfig.json.ejs +0 -3
  47. package/dist/commands/{create-resource/create-resource.command.d.ts → create-external-resource/create-external-resource.command.d.ts} +1 -1
  48. package/dist/commands/create-external-resource/create-external-resource.command.js +64 -0
  49. package/dist/commands/create-external-resource/create-external-resource.command.js.map +1 -0
  50. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.d.ts +17 -2
  51. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.js +36 -35
  52. package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/index.js.map +1 -0
  53. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/add.resource.action.ts.ejs +7 -16
  54. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/delete.resource.action.ts.ejs +21 -3
  55. package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/actions/update.resource.action.ts.ejs +63 -0
  56. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.ts.ejs +1 -2
  57. package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +28 -0
  58. package/dist/commands/create-external-resource/index.d.ts +1 -0
  59. package/dist/commands/create-external-resource/index.js +2 -0
  60. package/dist/commands/create-external-resource/index.js.map +1 -0
  61. package/dist/commands/create-model/create-model.command.js +1 -1
  62. package/dist/commands/create-model/create-model.command.js.map +1 -1
  63. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.d.ts +17 -2
  64. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js +26 -9
  65. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js.map +1 -1
  66. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/model.ts.ejs +41 -1
  67. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/schema.ts.ejs +6 -1
  68. package/dist/commands/create-module/create-module.command.js +1 -1
  69. package/dist/commands/create-module/create-module.command.js.map +1 -1
  70. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.d.ts +17 -2
  71. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js +27 -10
  72. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js.map +1 -1
  73. package/dist/commands/create-overlay/create-overlay.command.js +4 -3
  74. package/dist/commands/create-overlay/create-overlay.command.js.map +1 -1
  75. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.d.ts +17 -2
  76. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js +26 -9
  77. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js.map +1 -1
  78. package/dist/commands/{create-cdk/create-cdk.command.d.ts → create-terraform-resource/create-terraform-resource.command.d.ts} +3 -3
  79. package/dist/commands/{create-resource/create-resource.command.js → create-terraform-resource/create-terraform-resource.command.js} +17 -11
  80. package/dist/commands/create-terraform-resource/create-terraform-resource.command.js.map +1 -0
  81. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.d.ts +25 -0
  82. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js +71 -0
  83. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js.map +1 -0
  84. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.schema.ts.ejs +43 -0
  85. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.ts.ejs +1 -0
  86. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +83 -0
  87. package/dist/commands/create-terraform-resource/index.d.ts +1 -0
  88. package/dist/commands/create-terraform-resource/index.js +2 -0
  89. package/dist/commands/create-terraform-resource/index.js.map +1 -0
  90. package/dist/commands/generate/generate.command.d.ts +16 -0
  91. package/dist/commands/generate/generate.command.js +35 -0
  92. package/dist/commands/generate/generate.command.js.map +1 -0
  93. package/dist/commands/generate/index.d.ts +1 -0
  94. package/dist/commands/generate/index.js +2 -0
  95. package/dist/commands/generate/index.js.map +1 -0
  96. package/dist/commands/get-response/get-response.command.d.ts +18 -0
  97. package/dist/commands/get-response/get-response.command.js +39 -0
  98. package/dist/commands/get-response/get-response.command.js.map +1 -0
  99. package/dist/commands/get-response/index.d.ts +1 -0
  100. package/dist/commands/get-response/index.js +2 -0
  101. package/dist/commands/get-response/index.js.map +1 -0
  102. package/dist/commands/lock/index.d.ts +1 -0
  103. package/dist/commands/lock/index.js +2 -0
  104. package/dist/commands/lock/index.js.map +1 -0
  105. package/dist/commands/lock/lock.command.d.ts +18 -0
  106. package/dist/commands/lock/lock.command.js +31 -0
  107. package/dist/commands/lock/lock.command.js.map +1 -0
  108. package/dist/commands/run-action/index.d.ts +1 -0
  109. package/dist/commands/run-action/index.js +2 -0
  110. package/dist/commands/run-action/index.js.map +1 -0
  111. package/dist/commands/run-action/run-action.command.d.ts +12 -0
  112. package/dist/commands/run-action/run-action.command.js +40 -0
  113. package/dist/commands/run-action/run-action.command.js.map +1 -0
  114. package/dist/commands/unlock/index.d.ts +1 -0
  115. package/dist/commands/unlock/index.js +2 -0
  116. package/dist/commands/unlock/index.js.map +1 -0
  117. package/dist/commands/unlock/unlock.command.d.ts +18 -0
  118. package/dist/commands/unlock/unlock.command.js +35 -0
  119. package/dist/commands/unlock/unlock.command.js.map +1 -0
  120. package/dist/commands/validate/index.d.ts +1 -0
  121. package/dist/commands/validate/index.js +2 -0
  122. package/dist/commands/validate/index.js.map +1 -0
  123. package/dist/commands/validate/validate.command.d.ts +17 -0
  124. package/dist/commands/validate/validate.command.js +62 -0
  125. package/dist/commands/validate/validate.command.js.map +1 -0
  126. package/dist/index.js +20 -8
  127. package/dist/index.js.map +1 -1
  128. package/dist/resources/octo-v1.schema.json +108 -27
  129. package/dist/utilities/definition/yaml/yaml-definition.utility.d.ts +103 -13
  130. package/dist/utilities/definition/yaml/yaml-definition.utility.js +215 -68
  131. package/dist/utilities/definition/yaml/yaml-definition.utility.js.map +1 -1
  132. package/dist/utilities/octo/octo.utility.d.ts +65 -0
  133. package/dist/utilities/octo/octo.utility.js +178 -0
  134. package/dist/utilities/octo/octo.utility.js.map +1 -0
  135. package/dist/utilities/process/process.utility.d.ts +8 -0
  136. package/dist/utilities/process/process.utility.js +8 -0
  137. package/dist/utilities/process/process.utility.js.map +1 -1
  138. package/dist/utilities/project-index/project-index.utility.d.ts +27 -0
  139. package/dist/utilities/project-index/project-index.utility.js +71 -0
  140. package/dist/utilities/project-index/project-index.utility.js.map +1 -0
  141. package/dist/utilities/string/string.utility.d.ts +22 -0
  142. package/dist/utilities/string/string.utility.js +27 -0
  143. package/dist/utilities/string/string.utility.js.map +1 -1
  144. package/package.json +11 -8
  145. package/dist/commands/create-cdk/create-cdk.command.js +0 -70
  146. package/dist/commands/create-cdk/create-cdk.command.js.map +0 -1
  147. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.d.ts +0 -10
  148. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js +0 -107
  149. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js.map +0 -1
  150. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/README.md.ejs +0 -23
  151. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/eslint.config.js.ejs +0 -337
  152. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitignore.ejs +0 -82
  153. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitkeep.ejs +0 -0
  154. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/package.json.ejs +0 -57
  155. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/prettierrc.ejs +0 -5
  156. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.schema.ts.ejs +0 -19
  157. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.ts.ejs +0 -17
  158. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/factories/dummy-credentials.factory.ts.ejs +0 -28
  159. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.spec.ts.ejs +0 -90
  160. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.ts.ejs +0 -16
  161. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.schema.ts.ejs +0 -10
  162. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.ts.ejs +0 -3
  163. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/actions/add-dummy-app.model.action.ts.ejs +0 -59
  164. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/index.ts.ejs +0 -1
  165. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/actions/add-http-fetch.resource.action.ts.ejs +0 -55
  166. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/http-fetch.resource.ts.ejs +0 -12
  167. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.schema.ts.ejs +0 -35
  168. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.ts.ejs +0 -3
  169. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/utilities/dummy/dummy.utility.ts.ejs +0 -11
  170. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.build.json.ejs +0 -11
  171. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.json.ejs +0 -39
  172. package/dist/commands/create-cdk/index.d.ts +0 -1
  173. package/dist/commands/create-cdk/index.js +0 -2
  174. package/dist/commands/create-cdk/index.js.map +0 -1
  175. package/dist/commands/create-resource/create-resource.command.js.map +0 -1
  176. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.js.map +0 -1
  177. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/update-tags.resource.action.ts.ejs +0 -86
  178. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/validate.resource.action.ts.ejs +0 -40
  179. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +0 -12
  180. package/dist/commands/create-resource/index.d.ts +0 -1
  181. package/dist/commands/create-resource/index.js +0 -2
  182. package/dist/commands/create-resource/index.js.map +0 -1
  183. package/dist/commands/run/index.d.ts +0 -1
  184. package/dist/commands/run/index.js +0 -2
  185. package/dist/commands/run/index.js.map +0 -1
  186. package/dist/commands/run/run.command.d.ts +0 -11
  187. package/dist/commands/run/run.command.js +0 -96
  188. package/dist/commands/run/run.command.js.map +0 -1
  189. package/dist/commands/state/index.d.ts +0 -1
  190. package/dist/commands/state/index.js +0 -2
  191. package/dist/commands/state/index.js.map +0 -1
  192. package/dist/commands/state/state.command.d.ts +0 -14
  193. package/dist/commands/state/state.command.js +0 -79
  194. package/dist/commands/state/state.command.js.map +0 -1
  195. /package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.schema.ts.ejs +0 -0
@@ -0,0 +1,81 @@
1
+ import { resolve } from 'path';
2
+ import { Container, StateManagementService, TerraformUtility } from '@quadnix/octo';
3
+ import chalk from 'chalk';
4
+ import { OctoUtility } from '../../utilities/octo/octo.utility.js';
5
+ /**
6
+ * Step 4 of the octo lifecycle. See `Octo.commit()`.
7
+ *
8
+ * This is the command that ends a run, so a commit that succeeds releases the app lock. One that
9
+ * fails keeps it, and is run again with the same lock ID. Octo never unlocks on its own; the lock is
10
+ * the CLI's to take and to drop.
11
+ */
12
+ export const commitCommand = {
13
+ builder: (yargs) => {
14
+ return yargs
15
+ .option('terragruntDir', {
16
+ demandOption: true,
17
+ description: 'The generated Terragrunt directory, post apply (`terragrunt run --all -- apply`).',
18
+ type: 'string',
19
+ })
20
+ .option('lockId', {
21
+ demandOption: true,
22
+ description: 'The app lock ID from `octo lock`. Released when the commit succeeds.',
23
+ type: 'string',
24
+ })
25
+ .option('partial', {
26
+ default: false,
27
+ demandOption: false,
28
+ description: 'Record what did apply, leaving resources with missing outputs uncommitted. For a failed apply.',
29
+ type: 'boolean',
30
+ })
31
+ .option('terraformBinary', {
32
+ demandOption: false,
33
+ description: 'Override the terraform/tofu binary terragrunt should invoke (sets TG_TF_PATH).',
34
+ type: 'string',
35
+ })
36
+ .option('terragruntBinary', {
37
+ demandOption: false,
38
+ description: 'Override the terragrunt binary/path to invoke.',
39
+ type: 'string',
40
+ })
41
+ .option('timeoutInMs', {
42
+ demandOption: false,
43
+ description: 'Override the per-command timeout, in milliseconds.',
44
+ type: 'number',
45
+ });
46
+ },
47
+ command: 'commit',
48
+ describe: "Step 4: record the results of a Terraform apply back into Octo's state.",
49
+ handler: async (argv) => {
50
+ const { lockId, partial, terraformBinary, terragruntBinary, terragruntDir, timeoutInMs } = argv;
51
+ const resolvedDir = resolve(process.cwd(), terragruntDir);
52
+ await OctoUtility.runCommand('commit', async () => {
53
+ const { app, octo } = await OctoUtility.bootOcto();
54
+ const terraformUtility = await Container.getInstance().get(TerraformUtility, {
55
+ args: [{ terraformBinary, terragruntBinary, timeoutInMs }, true],
56
+ });
57
+ // Read outputs from every folder terragrunt discovers. A folder whose outputs cannot be read
58
+ // is warned and omitted rather than aborting the commit: octo rejects the commit itself if
59
+ // that folder held a module it tracks, and merely warns if it is a folder octo does not know.
60
+ const [outputs, moduleIds] = await Promise.all([
61
+ terraformUtility.output(resolvedDir, { json: true }),
62
+ terraformUtility.listModuleFolders(resolvedDir),
63
+ ]);
64
+ for (const moduleId of moduleIds) {
65
+ if (!outputs.has(moduleId)) {
66
+ console.error(chalk.yellow(`WARN [${moduleId}] Could not read terraform outputs`));
67
+ }
68
+ }
69
+ const { warnings } = await octo.commit(app, { lockId, outputs, partial });
70
+ for (const warning of warnings) {
71
+ console.error(chalk.yellow(`WARN ${warning.moduleId ? `[${warning.moduleId}] ` : ''}${warning.message}`));
72
+ }
73
+ // Release the lock once the run is recorded. A failed commit keeps it for the re-run.
74
+ const stateManagementService = await Container.getInstance().get(StateManagementService);
75
+ await stateManagementService.unlockApp(lockId);
76
+ // No verdict printed here - the listeners render the commit report on stderr, beside the
77
+ // warnings above.
78
+ });
79
+ },
80
+ };
81
+ //# sourceMappingURL=commit.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.command.js","sourceRoot":"","sources":["../../../src/commands/commit/commit.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAWnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,eAAe,EAAE;YACvB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,mFAAmF;YAChG,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,sEAAsE;YACnF,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,gGAAgG;YAC7G,IAAI,EAAE,SAAS;SAChB,CAAC;aACD,MAAM,CAAC,iBAAiB,EAAE;YACzB,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,gFAAgF;YAC7F,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,kBAAkB,EAAE;YAC1B,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,gDAAgD;YAC7D,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,aAAa,EAAE;YACrB,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,oDAAoD;YACjE,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,yEAAyE;IACnF,OAA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C1E,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC5G,CAAC;YAED,sFAAsF;YACtF,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YACzF,MAAM,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAE/C,yFAAyF;YACzF,kBAAkB;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1 @@
1
+ export { commitCommand } from './commit.command.js';
@@ -0,0 +1,2 @@
1
+ export { commitCommand } from './commit.command.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/commit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -33,7 +33,7 @@ export const createAnchorCommand = {
33
33
  .option('path', {
34
34
  alias: 'p',
35
35
  default: '.',
36
- description: 'Root directory path of the CDK.',
36
+ description: 'Root directory path of the project.',
37
37
  type: 'string',
38
38
  });
39
39
  },
@@ -1 +1 @@
1
- {"version":3,"file":"create-anchor.command.js","sourceRoot":"","sources":["../../../src/commands/create-anchor/create-anchor.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,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,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC,CAAC;YAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,IAAI,kBAAkB,IAAI,MAAM,CAAC,CAAC,CAAC;QAE9E,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,wDAAwD,CAAC,EAAE;YACzF,SAAS,EAAE,oCAAoC;SAChD,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,oCAAoC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;gBAC3F,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"create-anchor.command.js","sourceRoot":"","sources":["../../../src/commands/create-anchor/create-anchor.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM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AAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC,CAAC;YAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,IAAI,kBAAkB,IAAI,MAAM,CAAC,CAAC,CAAC;QAE9E,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,wDAAwD,CAAC,EAAE;YACzF,SAAS,EAAE,oCAAoC;SAChD,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,oCAAoC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;gBAC3F,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -1,13 +1,28 @@
1
1
  import Generator, { type BaseOptions } from 'yeoman-generator';
2
+ /**
3
+ * @internal
4
+ */
2
5
  export default class extends Generator {
3
6
  private readonly anchorFamily;
4
7
  private readonly anchorName;
5
- private readonly cdkRootDir;
8
+ private readonly isModelAnchor;
6
9
  private readonly modelType;
7
10
  private readonly packageName;
8
- private readonly isModelAnchor;
11
+ private readonly projectRootDir;
12
+ /**
13
+ * @internal
14
+ */
9
15
  constructor(args: string[], opts: BaseOptions);
16
+ /**
17
+ * @internal
18
+ */
19
+ end(): void;
20
+ /**
21
+ * @internal
22
+ */
10
23
  initializing(): Promise<void>;
24
+ /**
25
+ * @internal
26
+ */
11
27
  writing(): Promise<void>;
12
- end(): void;
13
28
  }
@@ -1,22 +1,44 @@
1
1
  import { readdir } from 'fs/promises';
2
2
  import { join, resolve } from 'path';
3
3
  import Generator, {} from 'yeoman-generator';
4
+ import { ProjectIndexUtility } from '../../../../../utilities/project-index/project-index.utility.js';
4
5
  import { StringUtility } from '../../../../../utilities/string/string.utility.js';
6
+ /**
7
+ * @internal
8
+ */
5
9
  export default class extends Generator {
10
+ /**
11
+ * @internal
12
+ */
6
13
  constructor(args, opts) {
7
14
  super(args, opts);
8
15
  this.anchorName = args[0];
9
16
  this.anchorFamily = args[1];
10
17
  this.modelType = args[2];
11
18
  this.packageName = args[3];
12
- this.cdkRootDir = args[4];
19
+ this.projectRootDir = args[4];
13
20
  // Determine if this is a model anchor or overlay anchor.
14
21
  this.isModelAnchor = StringUtility.AVAILABLE_MODEL_TYPES.includes(this.modelType);
15
22
  }
23
+ /**
24
+ * @internal
25
+ */
26
+ end() {
27
+ const targetPath = resolve(join(this.projectRootDir, 'src', 'anchors', this.anchorFamily));
28
+ this.log('✅ Your anchor has been generated successfully!');
29
+ this.log(`📁 Anchor created at: ${targetPath}`);
30
+ ProjectIndexUtility.addImport(this.projectRootDir, `./anchors/${this.anchorFamily}/${this.anchorName}.anchor.js`);
31
+ this.log('📦 Next steps:');
32
+ this.log(` Address all "Fix me" in generated files`);
33
+ }
34
+ /**
35
+ * @internal
36
+ */
16
37
  async initializing() {
17
- const targetPath = resolve(join(this.cdkRootDir, 'src', 'anchors', this.anchorFamily));
18
- // Check if anchors already exists.
19
- let targetPathContents;
38
+ const targetPath = resolve(join(this.projectRootDir, 'src', 'anchors', this.anchorFamily));
39
+ // Check if anchors already exists. A missing directory is the normal case - it is every first
40
+ // anchor in a family - so it reads as "nothing to collide with", not as an error.
41
+ let targetPathContents = [];
20
42
  try {
21
43
  targetPathContents = await readdir(targetPath, { withFileTypes: true });
22
44
  }
@@ -34,6 +56,9 @@ export default class extends Generator {
34
56
  // Set the destination root to the anchor directory.
35
57
  this.destinationRoot(targetPath);
36
58
  }
59
+ /**
60
+ * @internal
61
+ */
37
62
  async writing() {
38
63
  // Create the anchor file.
39
64
  this.fs.copyTpl(this.templatePath('anchors/anchor/anchor.ts.ejs'), this.destinationPath(`${this.anchorName}.anchor.ts`), {
@@ -48,12 +73,5 @@ export default class extends Generator {
48
73
  modelTypePascal: StringUtility.toPascalCase(this.modelType),
49
74
  });
50
75
  }
51
- end() {
52
- const targetPath = resolve(join(this.cdkRootDir, 'src', 'anchors', this.anchorFamily));
53
- this.log('✅ Your anchor has been generated successfully!');
54
- this.log(`📁 Anchor created at: ${targetPath}`);
55
- this.log('📦 Next steps:');
56
- this.log(` Address all "Fix me" in generated files`);
57
- }
58
76
  }
59
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-anchor/generator-octo-anchor-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,SAAS,EAAE,EAAoB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAElF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;IASpC,YAAY,IAAc,EAAE,IAAiB;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAA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E,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,8BAA8B,CAAC,EACjD,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,UAAU,YAAY,CAAC,EACpD;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7D,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CACF,CAAC;QAEF,sBAAsB;QACtB,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,qCAAqC,CAAC,EACxD,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,UAAU,mBAAmB,CAAC,EAC3D;YACE,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7D,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,eAAe,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;SAC5D,CACF,CAAC;IACJ,CAAC;IAED,GAAG;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAEvF,IAAI,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IACzD,CAAC;CACF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-anchor/generator-octo-anchor-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MA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AC7D,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CACF,CAAC;QAEF,sBAAsB;QACtB,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,qCAAqC,CAAC,EACxD,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,UAAU,mBAAmB,CAAC,EAC3D;YACE,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7D,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,eAAe,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;SAC5D,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -1,5 +1,13 @@
1
1
  <% if (isModelAnchor) { -%>
2
- import { BaseAnchorSchema, type <%= modelTypePascal %>, Schema, Validate } from '@quadnix/octo';
2
+ <%# Sorted here rather than written in a fixed order: the model type is the only variable member,
3
+ and where it falls among the others depends on its name - `Region` sorts before `Schema`,
4
+ `Service` after it. A fixed order fails the generated app's own import/order and sort-imports
5
+ rules for half the model types. -%>
6
+ <% const anchorSchemaImports = ['BaseAnchorSchema', 'Schema', 'Validate', modelTypePascal]
7
+ .sort()
8
+ .map((member) => (member === modelTypePascal ? `type ${member}` : member))
9
+ .join(', '); -%>
10
+ import { <%= anchorSchemaImports %> } from '@quadnix/octo';
3
11
  <% } else { -%>
4
12
  import { type AOverlay, BaseAnchorSchema, type BaseOverlaySchema, Schema, Validate } from '@quadnix/octo';
5
13
  <% } -%>
@@ -4,8 +4,8 @@ export declare const createAppCommand: {
4
4
  command: string;
5
5
  describe: string;
6
6
  handler: (argv: ArgumentsCamelCase<{
7
- template: string;
8
7
  name: string;
9
8
  path: string;
9
+ template: string;
10
10
  }>) => Promise<void>;
11
11
  };
@@ -1,4 +1,4 @@
1
- import { dirname, resolve } from 'path';
1
+ import { dirname, join, resolve } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  import chalk from 'chalk';
4
4
  import { createEnv } from 'yeoman-environment';
@@ -8,7 +8,7 @@ export const createAppCommand = {
8
8
  return yargs
9
9
  .option('template', {
10
10
  alias: 't',
11
- choices: ['aws-ecs-server', 'aws-s3-website'],
11
+ choices: ['aws-dynamodb-service', 'aws-ecs-server', 'aws-s3-website'],
12
12
  demandOption: true,
13
13
  description: 'Template to use for creation.',
14
14
  type: 'string',
@@ -31,7 +31,11 @@ export const createAppCommand = {
31
31
  handler: async (argv) => {
32
32
  const { name, path, template } = argv;
33
33
  console.log(chalk.blue(`Creating app with template "${template}"...`));
34
- const env = createEnv();
34
+ // The environment's cwd is both what yeoman watches for a package.json change and where it runs
35
+ // the package manager install. It defaults to `process.cwd()` - the directory the user invoked
36
+ // from - so with the app written to a subdirectory the watch never fired, and the install was
37
+ // skipped with "No change to package.json was detected". It also anchors the paths yeoman logs.
38
+ const env = createEnv({ cwd: resolve(join(path, name)) });
35
39
  env.register(resolve(__dirname, 'generator-octo-app-template/generators/app/index.js'), {
36
40
  namespace: 'generator-octo-app-template:app',
37
41
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create-app.command.js","sourceRoot":"","sources":["../../../src/commands/create-app/create-app.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,UAAU,EAAE;YAClB,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,CAAC,gBAAgB,EAAE,gB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,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"create-app.command.js","sourceRoot":"","sources":["../../../src/commands/create-app/create-app.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,UAAU,EAAE;YAClB,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,CAAC,sBAAsB,EAAE,gBAAgB,EAAE,gBAAgB,CAAC;YACrE,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,+BAA+B;YAC5C,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,GAAG;YACV,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,gFAAgF;YAC7F,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,wCAAwC;IAClD,OAAO,EAAE,KAAK,EAAE,IAA0E,EAAiB,EAAE;QAC3G,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,+BAA+B,QAAQ,MAAM,CAAC,CAAC,CAAC;QAEvE,gGAAgG;QAChG,+FAA+F;QAC/F,8FAA8F;QAC9F,gGAAgG;QAChG,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1D,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,qDAAqD,CAAC,EAAE;YACtF,SAAS,EAAE,iCAAiC;SAC7C,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,iCAAiC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE;gBACvE,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,KAAK;aACnB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -1,10 +1,26 @@
1
1
  import Generator, { type BaseOptions } from 'yeoman-generator';
2
+ /**
3
+ * @internal
4
+ */
2
5
  export default class extends Generator {
3
6
  private readonly appName;
4
7
  private readonly appPath;
5
8
  private readonly appTemplate;
9
+ private installCommand;
10
+ /**
11
+ * @internal
12
+ */
6
13
  constructor(args: string[], opts: BaseOptions);
14
+ /**
15
+ * @internal
16
+ */
17
+ end(): void;
18
+ /**
19
+ * @internal
20
+ */
7
21
  initializing(): Promise<void>;
22
+ /**
23
+ * @internal
24
+ */
8
25
  writing(): Promise<void>;
9
- end(): void;
10
26
  }
@@ -1,13 +1,73 @@
1
1
  import { readdir, stat } from 'fs/promises';
2
2
  import { join, resolve } from 'path';
3
3
  import Generator, {} from 'yeoman-generator';
4
+ /**
5
+ * Every octo package is pre-1.0 and released independently, so a new app tracks the whole `0.x`
6
+ * line rather than naming a version that goes stale the next time one of them ships. Revisit on
7
+ * the first 1.0.
8
+ *
9
+ * @internal
10
+ */
11
+ const OCTO_VERSION_RANGE = '0.x.x';
12
+ /**
13
+ * @internal
14
+ */
4
15
  export default class extends Generator {
16
+ /**
17
+ * @internal
18
+ */
5
19
  constructor(args, opts) {
6
- super(args, opts);
20
+ super(args, opts, {
21
+ // The install runs after every file is written, so a failure here is a fully generated app
22
+ // whose dependencies did not install - not a failed generation. Left to yeoman the rejection
23
+ // would surface as "Failed to create app!", which is wrong, and the half-finished directory
24
+ // then blocks a retry. Report it and let the run finish; `end()` tells the user what to run.
25
+ customInstallTask: async (packageManagerName, defaultInstall) => {
26
+ // Undefined when yeoman cannot detect a package manager, which it then resolves to npm
27
+ // inside `defaultInstall` - too late for the name to reach this callback.
28
+ this.installCommand = `${packageManagerName ?? 'npm'} install`;
29
+ try {
30
+ await defaultInstall();
31
+ this.installCommand = undefined;
32
+ }
33
+ catch (error) {
34
+ this.log(`⚠️ Could not install dependencies: ${error.message}`);
35
+ this.log(` The app is complete - run "${this.installCommand}" in it once the cause is fixed.`);
36
+ }
37
+ },
38
+ });
7
39
  this.appName = args[0];
8
40
  this.appPath = args[1];
9
41
  this.appTemplate = args[2];
10
42
  }
43
+ /**
44
+ * @internal
45
+ */
46
+ end() {
47
+ const targetPath = resolve(join(this.appPath, this.appName));
48
+ this.log('✅ Your TypeScript app has been generated successfully!');
49
+ this.log(`📁 App created at: ${targetPath}`);
50
+ this.log('📦 Next steps:');
51
+ this.log(` cd ${targetPath}`);
52
+ // Only when the install did not happen - it runs as part of this command otherwise.
53
+ if (this.installCommand) {
54
+ this.log(` ${this.installCommand}`);
55
+ }
56
+ this.log(' Set the "env" values in octo.yaml.');
57
+ this.log(' npm run build');
58
+ // Scripts rather than bare commands: each one sets OCTO_DEFINITION_FILE_PATH and names the
59
+ // output directory, so the four steps cannot drift apart, and `npm run` puts node_modules/.bin
60
+ // on PATH - which is what the `octo run-action` callback terraform makes mid-apply needs.
61
+ this.log(' npm run octo:generate');
62
+ this.log(' npm run octo:validate # optional');
63
+ this.log(' LOCK_ID=$(npm run --silent octo:lock)');
64
+ this.log(' npm run octo:apply -- --lockId $LOCK_ID');
65
+ this.log(' npm run octo:commit -- --lockId $LOCK_ID');
66
+ this.log(' See README.md for the full flow.');
67
+ }
68
+ /**
69
+ * @internal
70
+ */
11
71
  async initializing() {
12
72
  const targetPath = resolve(join(this.appPath, this.appName));
13
73
  // Check if directory already exists and is not empty.
@@ -29,6 +89,9 @@ export default class extends Generator {
29
89
  // Set the destination root to the app directory.
30
90
  this.destinationRoot(targetPath);
31
91
  }
92
+ /**
93
+ * @internal
94
+ */
32
95
  async writing() {
33
96
  // Create eslint.config.js (ESLint v9 flat config)
34
97
  this.fs.copyTpl(this.templatePath('eslint.config.js.ejs'), this.destinationPath('eslint.config.js'));
@@ -41,10 +104,10 @@ export default class extends Generator {
41
104
  version: '0.0.1',
42
105
  });
43
106
  await this.addDependencies({
44
- '@quadnix/octo': '0.0.x',
45
- '@quadnix/octo-aws-cdk': '0.0.x',
46
- '@quadnix/octo-build': '0.0.x',
47
- '@quadnix/octo-event-listeners': '0.0.x',
107
+ '@quadnix/octo': OCTO_VERSION_RANGE,
108
+ '@quadnix/octo-aws-cdk': OCTO_VERSION_RANGE,
109
+ '@quadnix/octo-build': OCTO_VERSION_RANGE,
110
+ '@quadnix/octo-event-listeners': OCTO_VERSION_RANGE,
48
111
  });
49
112
  await this.addDevDependencies({
50
113
  '@eslint/js': '^9.33.0',
@@ -81,8 +144,11 @@ export default class extends Generator {
81
144
  this.fs.copyTpl(this.templatePath('tsconfig.build.json.ejs'), this.destinationPath('tsconfig.build.json'));
82
145
  // Create .octo directory
83
146
  this.fs.copyTpl(this.templatePath(`gitkeep.ejs`), this.destinationPath('.octo/.gitkeep'));
147
+ // Create src/index.ts. Without at least one TypeScript file, `npm run build` - the step the
148
+ // README and the next-steps banner both send users to - fails with "No inputs were found".
149
+ this.fs.copyTpl(this.templatePath('index.ts.ejs'), this.destinationPath('src/index.ts'));
84
150
  // Create src directory and main files
85
- if (this.appTemplate === 'aws-ecs-server') {
151
+ if (this.appTemplate === 'aws-dynamodb-service' || this.appTemplate === 'aws-ecs-server') {
86
152
  const templatePath = `src/${this.appTemplate}`;
87
153
  this.fs.copyTpl(this.templatePath(`${templatePath}/octo.yaml.ejs`), this.destinationPath('octo.yaml'));
88
154
  }
@@ -100,15 +166,5 @@ export default class extends Generator {
100
166
  throw new Error(`Unsupported app template: ${this.appTemplate}`);
101
167
  }
102
168
  }
103
- end() {
104
- const targetPath = resolve(join(this.appPath, this.appName));
105
- this.log('✅ Your TypeScript app has been generated successfully!');
106
- this.log(`📁 App created at: ${targetPath}`);
107
- this.log('📦 Next steps:');
108
- this.log(` cd ${targetPath}`);
109
- this.log(' npm install');
110
- this.log(' npm run build');
111
- this.log(' npm start');
112
- }
113
169
  }
114
170
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-app/generator-octo-app-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,SAAS,EAAE,EAAoB,MAAM,kBAAkB,CAAC;AAE/D,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;IAKpC,YAAY,IAAc,EAAE,IAAiB;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAA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AAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,GAAG,YAAY,yBAAyB,CAAC,EAC3D,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,EAC1C;gBACE,IAAI,EAAE,IAAI,CAAC,OAAO;aACnB,CACF,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,YAAY,gBAAgB,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;QACzG,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,GAAG;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7D,IAAI,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,CAAC,sBAAsB,UAAU,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3B,CAAC;CACF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-app/generator-octo-app-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,SAAS,EAAE,EAAoB,MAAM,kBAAkB,CAA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
3
3
 
4
4
  ## Octo Documentation
5
- [Official Docs](http://octo.quadnix.com/)
5
+ [Official Docs](https://octo.quadnix.com/)
6
6
 
7
7
  ## Installation
8
8
  ```bash
@@ -18,18 +18,53 @@ The `octo.yaml` is your Octo definition file.
18
18
  It contains all the modules you want to run,
19
19
  which will create your infrastructure resources as per the module's instructions.
20
20
 
21
- To run the definition file,
21
+ Octo generates Terragrunt module folders from your definition; Terraform/Tofu (via Terragrunt) is the
22
+ executor. The flow has four steps: generate, validate, apply, then commit the results back into Octo.
23
+
24
+ Each step is a script, so there is nothing to set up first:
25
+
22
26
  ```bash
23
- # First create a lock.
24
- node_modules/.bin/octo state lock -d octo.yaml
27
+ # 1. Generate the Terragrunt module folders into ./.octo-tf (folders are overwritten in place; state and unrelated folders survive).
28
+ npm run octo:generate
25
29
 
26
- # Then copy the lock output, a random unique string, and run the app with the lock ID.
27
- OCTO_APP_LOCK_ID=<lock_id> node_modules/.bin/octo run -d octo.yaml
30
+ # 2. (optional) Plan every module folder and report the plans against your intent.
31
+ # `validate` runs the plan itself; there is nothing to run beforehand.
32
+ npm run octo:validate
28
33
 
29
- # Lastly, unlock the app.
30
- node_modules/.bin/octo state unlock <lock_id> -d octo.yaml
34
+ # 3. Take the app lock. Apply and commit both require it, so that only one run writes state at a time.
35
+ LOCK_ID=$(npm run --silent octo:lock)
36
+
37
+ # 4. Apply, then record the applied outputs into Octo. A commit that succeeds releases the lock.
38
+ npm run octo:apply -- --lockId $LOCK_ID
39
+ npm run octo:commit -- --lockId $LOCK_ID
31
40
  ```
32
41
 
42
+ Generate and validate need no lock, because neither writes shared state. Apply and commit do, and
43
+ refuse to run without one.
44
+
45
+ If the apply fails partway, it prints the command that records what did apply and releases the
46
+ lock: `npm run octo:commit -- --lockId $LOCK_ID --partial`. Then fix what failed and run the four
47
+ steps again. If a commit fails, it keeps the lock: fix what it reported and run the same commit
48
+ again. A run that died holding the lock is finished through it, not released:
49
+ [Recovering a Failed Run](https://octo.quadnix.com/docs/using-octo/recovering-a-failed-run) has the
50
+ steps for every case.
51
+
52
+ `octo apply` plans first and refuses to proceed if the apply would destroy anything, printing what
53
+ would be destroyed. Run `npm run octo:validate` to see why each one is being destroyed, then re-run
54
+ the apply with `--auto-approve` and the same lock ID to go ahead:
55
+ `npm run octo:apply -- --lockId $LOCK_ID --auto-approve`. That flag is required for every destroy,
56
+ including the teardown flow below. If you decide not to go ahead, release the lock with
57
+ `npm run octo:unlock -- --lockId $LOCK_ID`.
58
+
59
+ Each script sets `OCTO_DEFINITION_FILE_PATH=octo.yaml` and points at `.octo-tf` for you. Edit the
60
+ scripts in `package.json` if your definition file or output directory is named differently. Running
61
+ the commands by hand works too — `node_modules/.bin/octo generate -o .octo-tf` with that variable
62
+ set — but the scripts are what keep the steps agreeing with each other.
63
+
64
+ > `octo run-action` is invoked automatically by Terraform mid-apply for resources whose lifecycle runs
65
+ > outside Terraform; you do not call it directly. `octo apply` hands it the definition file and the
66
+ > `octo` binary it needs, so it works the same whether you use the scripts or not.
67
+
33
68
  ## Development
34
69
  The rest of the setup is a TypeScript project for you to get started with developing new modules in Octo quickly.
35
70
  You can follow the official documentation to learn more.
@@ -42,14 +77,19 @@ npm run build
42
77
 
43
78
  ## Destroy
44
79
  Once you have your infrastructure created, and you wish all of them destroyed,
45
- its as simple as commenting out the necessary modules and re-running the app.
80
+ its as simple as commenting out the necessary modules and re-running the generate → apply → commit flow.
81
+ Octo rewrites a removed module's folder as an **empty** module — no resources, but the Terraform
82
+ configuration and providers intact — so Terragrunt still discovers it and destroys its resources on
83
+ the next apply. (The folder is never deleted: an emptied folder is what makes the destroy happen.)
84
+ After the destroy is committed, the leftover empty folder is benign — Octo warns about it and you can
85
+ delete it by hand.
46
86
 
47
87
  ### Step 1
48
88
  In `octo.yaml`, comment out all modules except the `app` and `account` modules.
49
89
  The app and account modules load AWS credentials to call AWS APIs, hence they remain uncommented.
50
90
 
51
- By commenting the `s3-website-service-module` module below,
52
- you are safely deleting the s3-website resources created by this module.
91
+ By commenting the `region-module` and `s3-website-service-module` modules below,
92
+ you are safely deleting the s3-website resources created by these modules.
53
93
 
54
94
  ```yaml
55
95
  modules:
@@ -64,14 +104,33 @@ modules:
64
104
  accountId: "${env.AWS_ACCOUNT_ID}"
65
105
  app: "${{app-module.model.app}}"
66
106
 
107
+ #- moduleId: region-module
108
+ # moduleClass: AwsServerlessRegionModule
109
+ # moduleInputs:
110
+ # account: "${{account-module.model.account}}"
111
+ # name: aws-s3-website
112
+ # regionId: aws-us-east-1
113
+
67
114
  #- moduleId: s3-website-service-module
68
115
  # moduleClass: AwsS3StaticWebsiteServiceModule
69
116
  # moduleInputs:
70
- # account: "${{account-module.model.account}}"
71
- # awsRegionId: us-east-1
72
117
  # bucketName: "${env.AWS_S3_WEBSITE_BUCKET_NAME}"
73
118
  # directoryPath: website
119
+ # region: "${{region-module.model.region}}"
74
120
  ```
75
121
 
76
122
  ### Step 2
77
- Then, simply re-build (if necessary) and run your app again.
123
+ Then, re-build (if necessary) and re-run the generate → apply → commit flow from "Running the Definition file",
124
+ passing `--auto-approve` to the apply step - a teardown destroys resources, and `octo apply` refuses to
125
+ destroy anything without it.
126
+
127
+ ```bash
128
+ npm run octo:generate
129
+ LOCK_ID=$(npm run --silent octo:lock)
130
+ npm run octo:apply -- --lockId $LOCK_ID --auto-approve
131
+ npm run octo:commit -- --lockId $LOCK_ID
132
+ ```
133
+
134
+ The commit is not optional here. A resource whose lifecycle runs outside Terraform is deleted by its
135
+ own delete action, and `octo commit` is what runs it — Terraform cannot, because the resource's
136
+ configuration is gone by the time it would.
@@ -10,6 +10,20 @@ dist/
10
10
  build/
11
11
  *.tsbuildinfo
12
12
 
13
+ # Octo generated Terraform / Terragrunt artifacts.
14
+ # `.octo/` and `.octo-tf/` are NOT ignored - model state, resource state, terraform state, and the
15
+ # generated Terraform belong in the repo, so a change to them shows up in review. What apply leaves
16
+ # behind does not. The `terraform.tfstate` in a module folder is one of those leftovers: octo checks
17
+ # it out of `.octo/` before every terraform command and back in after, so the copy under `.octo/` is
18
+ # the one that is kept.
19
+ .terragrunt-cache/
20
+ *.tfstate*
21
+ !.octo/*.tfstate
22
+ .octo/local-state.lock
23
+ # The journal: files per command, archived per lock, which would land in every pull request.
24
+ .octo/journal.*
25
+ .octo/archives/
26
+
13
27
  # Environment variables
14
28
  .env
15
29
  .env.local