@guardian/cdk 0.0.0-canary-20260805130549

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 (622) hide show
  1. package/README.md +50 -0
  2. package/bin/gu-cdk +5 -0
  3. package/lib/aspects/cfn-include-reporter.d.ts +9 -0
  4. package/lib/aspects/cfn-include-reporter.d.ts.map +1 -0
  5. package/lib/aspects/cfn-include-reporter.js +18 -0
  6. package/lib/aspects/cfn-include-reporter.js.map +1 -0
  7. package/lib/aspects/cfn-parameter-reporter.d.ts +9 -0
  8. package/lib/aspects/cfn-parameter-reporter.d.ts.map +1 -0
  9. package/lib/aspects/cfn-parameter-reporter.js +21 -0
  10. package/lib/aspects/cfn-parameter-reporter.js.map +1 -0
  11. package/lib/aspects/metadata.d.ts +8 -0
  12. package/lib/aspects/metadata.d.ts.map +1 -0
  13. package/lib/aspects/metadata.js +28 -0
  14. package/lib/aspects/metadata.js.map +1 -0
  15. package/lib/bin/aws-credential-provider.d.ts +3 -0
  16. package/lib/bin/aws-credential-provider.d.ts.map +1 -0
  17. package/lib/bin/aws-credential-provider.js +9 -0
  18. package/lib/bin/aws-credential-provider.js.map +1 -0
  19. package/lib/bin/commands/account-readiness/index.d.ts +11 -0
  20. package/lib/bin/commands/account-readiness/index.d.ts.map +1 -0
  21. package/lib/bin/commands/account-readiness/index.js +26 -0
  22. package/lib/bin/commands/account-readiness/index.js.map +1 -0
  23. package/lib/bin/commands/account-readiness/ssm.d.ts +12 -0
  24. package/lib/bin/commands/account-readiness/ssm.d.ts.map +1 -0
  25. package/lib/bin/commands/account-readiness/ssm.js +76 -0
  26. package/lib/bin/commands/account-readiness/ssm.js.map +1 -0
  27. package/lib/bin/commands/aws-cdk-version.d.ts +3 -0
  28. package/lib/bin/commands/aws-cdk-version.d.ts.map +1 -0
  29. package/lib/bin/commands/aws-cdk-version.js +9 -0
  30. package/lib/bin/commands/aws-cdk-version.js.map +1 -0
  31. package/lib/bin/commands/new-project/index.d.ts +14 -0
  32. package/lib/bin/commands/new-project/index.d.ts.map +1 -0
  33. package/lib/bin/commands/new-project/index.js +134 -0
  34. package/lib/bin/commands/new-project/index.js.map +1 -0
  35. package/lib/bin/commands/new-project/template/.gitignore.template +11 -0
  36. package/lib/bin/commands/new-project/template/README.md +5 -0
  37. package/lib/bin/commands/new-project/template/bin/.ignore +2 -0
  38. package/lib/bin/commands/new-project/template/cdk.json +7 -0
  39. package/lib/bin/commands/new-project/template/eslint.config.mjs +6 -0
  40. package/lib/bin/commands/new-project/template/jest.setup.js +2 -0
  41. package/lib/bin/commands/new-project/template/tsconfig.json.template +12 -0
  42. package/lib/bin/commands/new-project/utils/app.d.ts +23 -0
  43. package/lib/bin/commands/new-project/utils/app.d.ts.map +1 -0
  44. package/lib/bin/commands/new-project/utils/app.js +36 -0
  45. package/lib/bin/commands/new-project/utils/app.js.map +1 -0
  46. package/lib/bin/commands/new-project/utils/imports.d.ts +11 -0
  47. package/lib/bin/commands/new-project/utils/imports.d.ts.map +1 -0
  48. package/lib/bin/commands/new-project/utils/imports.js +107 -0
  49. package/lib/bin/commands/new-project/utils/imports.js.map +1 -0
  50. package/lib/bin/commands/new-project/utils/init.d.ts +13 -0
  51. package/lib/bin/commands/new-project/utils/init.d.ts.map +1 -0
  52. package/lib/bin/commands/new-project/utils/init.js +113 -0
  53. package/lib/bin/commands/new-project/utils/init.js.map +1 -0
  54. package/lib/bin/commands/new-project/utils/snapshot.d.ts +21 -0
  55. package/lib/bin/commands/new-project/utils/snapshot.d.ts.map +1 -0
  56. package/lib/bin/commands/new-project/utils/snapshot.js +41 -0
  57. package/lib/bin/commands/new-project/utils/snapshot.js.map +1 -0
  58. package/lib/bin/commands/new-project/utils/stack.d.ts +21 -0
  59. package/lib/bin/commands/new-project/utils/stack.d.ts.map +1 -0
  60. package/lib/bin/commands/new-project/utils/stack.js +40 -0
  61. package/lib/bin/commands/new-project/utils/stack.js.map +1 -0
  62. package/lib/bin/commands/new-project/utils/utils.d.ts +12 -0
  63. package/lib/bin/commands/new-project/utils/utils.d.ts.map +1 -0
  64. package/lib/bin/commands/new-project/utils/utils.js +16 -0
  65. package/lib/bin/commands/new-project/utils/utils.js.map +1 -0
  66. package/lib/bin/index.d.ts +3 -0
  67. package/lib/bin/index.d.ts.map +1 -0
  68. package/lib/bin/index.js +124 -0
  69. package/lib/bin/index.js.map +1 -0
  70. package/lib/constants/__mocks__/library-info.d.ts +6 -0
  71. package/lib/constants/__mocks__/library-info.d.ts.map +1 -0
  72. package/lib/constants/__mocks__/library-info.js +11 -0
  73. package/lib/constants/__mocks__/library-info.js.map +1 -0
  74. package/lib/constants/__mocks__/tracking-tag.d.ts +5 -0
  75. package/lib/constants/__mocks__/tracking-tag.d.ts.map +1 -0
  76. package/lib/constants/__mocks__/tracking-tag.js +9 -0
  77. package/lib/constants/__mocks__/tracking-tag.js.map +1 -0
  78. package/lib/constants/access.d.ts +18 -0
  79. package/lib/constants/access.d.ts.map +1 -0
  80. package/lib/constants/access.js +22 -0
  81. package/lib/constants/access.js.map +1 -0
  82. package/lib/constants/context-keys.d.ts +7 -0
  83. package/lib/constants/context-keys.d.ts.map +1 -0
  84. package/lib/constants/context-keys.js +10 -0
  85. package/lib/constants/context-keys.js.map +1 -0
  86. package/lib/constants/fastly-aws-account-id.d.ts +8 -0
  87. package/lib/constants/fastly-aws-account-id.d.ts.map +1 -0
  88. package/lib/constants/fastly-aws-account-id.js +11 -0
  89. package/lib/constants/fastly-aws-account-id.js.map +1 -0
  90. package/lib/constants/index.d.ts +9 -0
  91. package/lib/constants/index.d.ts.map +1 -0
  92. package/lib/constants/index.js +25 -0
  93. package/lib/constants/index.js.map +1 -0
  94. package/lib/constants/library-info.d.ts +28 -0
  95. package/lib/constants/library-info.d.ts.map +1 -0
  96. package/lib/constants/library-info.js +46 -0
  97. package/lib/constants/library-info.js.map +1 -0
  98. package/lib/constants/metadata-keys.d.ts +9 -0
  99. package/lib/constants/metadata-keys.d.ts.map +1 -0
  100. package/lib/constants/metadata-keys.js +12 -0
  101. package/lib/constants/metadata-keys.js.map +1 -0
  102. package/lib/constants/regex-pattern.d.ts +5 -0
  103. package/lib/constants/regex-pattern.d.ts.map +1 -0
  104. package/lib/constants/regex-pattern.js +11 -0
  105. package/lib/constants/regex-pattern.js.map +1 -0
  106. package/lib/constants/ssm-parameter-paths.d.ts +24 -0
  107. package/lib/constants/ssm-parameter-paths.d.ts.map +1 -0
  108. package/lib/constants/ssm-parameter-paths.js +56 -0
  109. package/lib/constants/ssm-parameter-paths.js.map +1 -0
  110. package/lib/constants/tracking-tag.d.ts +5 -0
  111. package/lib/constants/tracking-tag.d.ts.map +1 -0
  112. package/lib/constants/tracking-tag.js +10 -0
  113. package/lib/constants/tracking-tag.js.map +1 -0
  114. package/lib/constructs/acm/certificate.d.ts +24 -0
  115. package/lib/constructs/acm/certificate.d.ts.map +1 -0
  116. package/lib/constructs/acm/certificate.js +34 -0
  117. package/lib/constructs/acm/certificate.js.map +1 -0
  118. package/lib/constructs/acm/index.d.ts +2 -0
  119. package/lib/constructs/acm/index.d.ts.map +1 -0
  120. package/lib/constructs/acm/index.js +18 -0
  121. package/lib/constructs/acm/index.js.map +1 -0
  122. package/lib/constructs/autoscaling/asg.d.ts +75 -0
  123. package/lib/constructs/autoscaling/asg.d.ts.map +1 -0
  124. package/lib/constructs/autoscaling/asg.js +103 -0
  125. package/lib/constructs/autoscaling/asg.js.map +1 -0
  126. package/lib/constructs/autoscaling/index.d.ts +3 -0
  127. package/lib/constructs/autoscaling/index.d.ts.map +1 -0
  128. package/lib/constructs/autoscaling/index.js +19 -0
  129. package/lib/constructs/autoscaling/index.js.map +1 -0
  130. package/lib/constructs/autoscaling/user-data.d.ts +28 -0
  131. package/lib/constructs/autoscaling/user-data.d.ts.map +1 -0
  132. package/lib/constructs/autoscaling/user-data.js +66 -0
  133. package/lib/constructs/autoscaling/user-data.js.map +1 -0
  134. package/lib/constructs/cloudwatch/alarm.d.ts +35 -0
  135. package/lib/constructs/cloudwatch/alarm.d.ts.map +1 -0
  136. package/lib/constructs/cloudwatch/alarm.js +37 -0
  137. package/lib/constructs/cloudwatch/alarm.js.map +1 -0
  138. package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts +17 -0
  139. package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts.map +1 -0
  140. package/lib/constructs/cloudwatch/api-gateway-alarms.js +39 -0
  141. package/lib/constructs/cloudwatch/api-gateway-alarms.js.map +1 -0
  142. package/lib/constructs/cloudwatch/ec2-alarms.d.ts +36 -0
  143. package/lib/constructs/cloudwatch/ec2-alarms.d.ts.map +1 -0
  144. package/lib/constructs/cloudwatch/ec2-alarms.js +102 -0
  145. package/lib/constructs/cloudwatch/ec2-alarms.js.map +1 -0
  146. package/lib/constructs/cloudwatch/index.d.ts +5 -0
  147. package/lib/constructs/cloudwatch/index.d.ts.map +1 -0
  148. package/lib/constructs/cloudwatch/index.js +21 -0
  149. package/lib/constructs/cloudwatch/index.js.map +1 -0
  150. package/lib/constructs/cloudwatch/lambda-alarms.d.ts +43 -0
  151. package/lib/constructs/cloudwatch/lambda-alarms.d.ts.map +1 -0
  152. package/lib/constructs/cloudwatch/lambda-alarms.js +54 -0
  153. package/lib/constructs/cloudwatch/lambda-alarms.js.map +1 -0
  154. package/lib/constructs/cloudwatch/no-monitoring.d.ts +4 -0
  155. package/lib/constructs/cloudwatch/no-monitoring.d.ts.map +1 -0
  156. package/lib/constructs/cloudwatch/no-monitoring.js +3 -0
  157. package/lib/constructs/cloudwatch/no-monitoring.js.map +1 -0
  158. package/lib/constructs/core/identity.d.ts +16 -0
  159. package/lib/constructs/core/identity.d.ts.map +1 -0
  160. package/lib/constructs/core/identity.js +21 -0
  161. package/lib/constructs/core/identity.js.map +1 -0
  162. package/lib/constructs/core/index.d.ts +5 -0
  163. package/lib/constructs/core/index.d.ts.map +1 -0
  164. package/lib/constructs/core/index.js +21 -0
  165. package/lib/constructs/core/index.js.map +1 -0
  166. package/lib/constructs/core/migrating.d.ts +11 -0
  167. package/lib/constructs/core/migrating.d.ts.map +1 -0
  168. package/lib/constructs/core/migrating.js +3 -0
  169. package/lib/constructs/core/migrating.js.map +1 -0
  170. package/lib/constructs/core/parameters/acm.d.ts +7 -0
  171. package/lib/constructs/core/parameters/acm.d.ts.map +1 -0
  172. package/lib/constructs/core/parameters/acm.js +17 -0
  173. package/lib/constructs/core/parameters/acm.js.map +1 -0
  174. package/lib/constructs/core/parameters/anghammarad.d.ts +20 -0
  175. package/lib/constructs/core/parameters/anghammarad.d.ts.map +1 -0
  176. package/lib/constructs/core/parameters/anghammarad.js +35 -0
  177. package/lib/constructs/core/parameters/anghammarad.js.map +1 -0
  178. package/lib/constructs/core/parameters/base.d.ts +20 -0
  179. package/lib/constructs/core/parameters/base.d.ts.map +1 -0
  180. package/lib/constructs/core/parameters/base.js +33 -0
  181. package/lib/constructs/core/parameters/base.js.map +1 -0
  182. package/lib/constructs/core/parameters/ec2.d.ts +7 -0
  183. package/lib/constructs/core/parameters/ec2.d.ts.map +1 -0
  184. package/lib/constructs/core/parameters/ec2.js +16 -0
  185. package/lib/constructs/core/parameters/ec2.js.map +1 -0
  186. package/lib/constructs/core/parameters/fastly.d.ts +13 -0
  187. package/lib/constructs/core/parameters/fastly.d.ts.map +1 -0
  188. package/lib/constructs/core/parameters/fastly.js +28 -0
  189. package/lib/constructs/core/parameters/fastly.js.map +1 -0
  190. package/lib/constructs/core/parameters/index.d.ts +9 -0
  191. package/lib/constructs/core/parameters/index.d.ts.map +1 -0
  192. package/lib/constructs/core/parameters/index.js +25 -0
  193. package/lib/constructs/core/parameters/index.js.map +1 -0
  194. package/lib/constructs/core/parameters/log-shipping.d.ts +8 -0
  195. package/lib/constructs/core/parameters/log-shipping.d.ts.map +1 -0
  196. package/lib/constructs/core/parameters/log-shipping.js +23 -0
  197. package/lib/constructs/core/parameters/log-shipping.js.map +1 -0
  198. package/lib/constructs/core/parameters/s3.d.ts +25 -0
  199. package/lib/constructs/core/parameters/s3.d.ts.map +1 -0
  200. package/lib/constructs/core/parameters/s3.js +58 -0
  201. package/lib/constructs/core/parameters/s3.js.map +1 -0
  202. package/lib/constructs/core/parameters/vpc.d.ts +17 -0
  203. package/lib/constructs/core/parameters/vpc.d.ts.map +1 -0
  204. package/lib/constructs/core/parameters/vpc.js +35 -0
  205. package/lib/constructs/core/parameters/vpc.js.map +1 -0
  206. package/lib/constructs/core/stack.d.ts +166 -0
  207. package/lib/constructs/core/stack.d.ts.map +1 -0
  208. package/lib/constructs/core/stack.js +183 -0
  209. package/lib/constructs/core/stack.js.map +1 -0
  210. package/lib/constructs/dns/dns-records.d.ts +37 -0
  211. package/lib/constructs/dns/dns-records.d.ts.map +1 -0
  212. package/lib/constructs/dns/dns-records.js +75 -0
  213. package/lib/constructs/dns/dns-records.js.map +1 -0
  214. package/lib/constructs/dns/index.d.ts +2 -0
  215. package/lib/constructs/dns/index.d.ts.map +1 -0
  216. package/lib/constructs/dns/index.js +18 -0
  217. package/lib/constructs/dns/index.js.map +1 -0
  218. package/lib/constructs/dynamodb/dynamodb.d.ts +31 -0
  219. package/lib/constructs/dynamodb/dynamodb.d.ts.map +1 -0
  220. package/lib/constructs/dynamodb/dynamodb.js +18 -0
  221. package/lib/constructs/dynamodb/dynamodb.js.map +1 -0
  222. package/lib/constructs/dynamodb/index.d.ts +2 -0
  223. package/lib/constructs/dynamodb/index.d.ts.map +1 -0
  224. package/lib/constructs/dynamodb/index.js +18 -0
  225. package/lib/constructs/dynamodb/index.js.map +1 -0
  226. package/lib/constructs/ec2/index.d.ts +3 -0
  227. package/lib/constructs/ec2/index.d.ts.map +1 -0
  228. package/lib/constructs/ec2/index.js +19 -0
  229. package/lib/constructs/ec2/index.js.map +1 -0
  230. package/lib/constructs/ec2/security-groups/base.d.ts +60 -0
  231. package/lib/constructs/ec2/security-groups/base.d.ts.map +1 -0
  232. package/lib/constructs/ec2/security-groups/base.js +57 -0
  233. package/lib/constructs/ec2/security-groups/base.js.map +1 -0
  234. package/lib/constructs/ec2/security-groups/index.d.ts +2 -0
  235. package/lib/constructs/ec2/security-groups/index.d.ts.map +1 -0
  236. package/lib/constructs/ec2/security-groups/index.js +18 -0
  237. package/lib/constructs/ec2/security-groups/index.js.map +1 -0
  238. package/lib/constructs/ec2/vpc.d.ts +26 -0
  239. package/lib/constructs/ec2/vpc.d.ts.map +1 -0
  240. package/lib/constructs/ec2/vpc.js +76 -0
  241. package/lib/constructs/ec2/vpc.js.map +1 -0
  242. package/lib/constructs/ecs/ecs-task.d.ts +139 -0
  243. package/lib/constructs/ecs/ecs-task.d.ts.map +1 -0
  244. package/lib/constructs/ecs/ecs-task.js +169 -0
  245. package/lib/constructs/ecs/ecs-task.js.map +1 -0
  246. package/lib/constructs/ecs/index.d.ts +2 -0
  247. package/lib/constructs/ecs/index.d.ts.map +1 -0
  248. package/lib/constructs/ecs/index.js +18 -0
  249. package/lib/constructs/ecs/index.js.map +1 -0
  250. package/lib/constructs/iam/fastly-logs-iam.d.ts +38 -0
  251. package/lib/constructs/iam/fastly-logs-iam.d.ts.map +1 -0
  252. package/lib/constructs/iam/fastly-logs-iam.js +44 -0
  253. package/lib/constructs/iam/fastly-logs-iam.js.map +1 -0
  254. package/lib/constructs/iam/index.d.ts +4 -0
  255. package/lib/constructs/iam/index.d.ts.map +1 -0
  256. package/lib/constructs/iam/index.js +20 -0
  257. package/lib/constructs/iam/index.js.map +1 -0
  258. package/lib/constructs/iam/policies/anghammarad.d.ts +15 -0
  259. package/lib/constructs/iam/policies/anghammarad.d.ts.map +1 -0
  260. package/lib/constructs/iam/policies/anghammarad.js +30 -0
  261. package/lib/constructs/iam/policies/anghammarad.js.map +1 -0
  262. package/lib/constructs/iam/policies/assume-role.d.ts +10 -0
  263. package/lib/constructs/iam/policies/assume-role.d.ts.map +1 -0
  264. package/lib/constructs/iam/policies/assume-role.js +21 -0
  265. package/lib/constructs/iam/policies/assume-role.js.map +1 -0
  266. package/lib/constructs/iam/policies/base-policy.d.ts +20 -0
  267. package/lib/constructs/iam/policies/base-policy.d.ts.map +1 -0
  268. package/lib/constructs/iam/policies/base-policy.js +33 -0
  269. package/lib/constructs/iam/policies/base-policy.js.map +1 -0
  270. package/lib/constructs/iam/policies/cloudwatch.d.ts +14 -0
  271. package/lib/constructs/iam/policies/cloudwatch.d.ts.map +1 -0
  272. package/lib/constructs/iam/policies/cloudwatch.js +28 -0
  273. package/lib/constructs/iam/policies/cloudwatch.js.map +1 -0
  274. package/lib/constructs/iam/policies/describe-ec2.d.ts +8 -0
  275. package/lib/constructs/iam/policies/describe-ec2.d.ts.map +1 -0
  276. package/lib/constructs/iam/policies/describe-ec2.js +33 -0
  277. package/lib/constructs/iam/policies/describe-ec2.js.map +1 -0
  278. package/lib/constructs/iam/policies/dynamodb.d.ts +20 -0
  279. package/lib/constructs/iam/policies/dynamodb.d.ts.map +1 -0
  280. package/lib/constructs/iam/policies/dynamodb.js +32 -0
  281. package/lib/constructs/iam/policies/dynamodb.js.map +1 -0
  282. package/lib/constructs/iam/policies/index.d.ts +13 -0
  283. package/lib/constructs/iam/policies/index.d.ts.map +1 -0
  284. package/lib/constructs/iam/policies/index.js +29 -0
  285. package/lib/constructs/iam/policies/index.js.map +1 -0
  286. package/lib/constructs/iam/policies/kcl.d.ts +17 -0
  287. package/lib/constructs/iam/policies/kcl.d.ts.map +1 -0
  288. package/lib/constructs/iam/policies/kcl.js +60 -0
  289. package/lib/constructs/iam/policies/kcl.js.map +1 -0
  290. package/lib/constructs/iam/policies/log-shipping.d.ts +8 -0
  291. package/lib/constructs/iam/policies/log-shipping.d.ts.map +1 -0
  292. package/lib/constructs/iam/policies/log-shipping.js +24 -0
  293. package/lib/constructs/iam/policies/log-shipping.js.map +1 -0
  294. package/lib/constructs/iam/policies/parameter-store-read.d.ts +39 -0
  295. package/lib/constructs/iam/policies/parameter-store-read.d.ts.map +1 -0
  296. package/lib/constructs/iam/policies/parameter-store-read.js +73 -0
  297. package/lib/constructs/iam/policies/parameter-store-read.js.map +1 -0
  298. package/lib/constructs/iam/policies/s3-get-object.d.ts +57 -0
  299. package/lib/constructs/iam/policies/s3-get-object.d.ts.map +1 -0
  300. package/lib/constructs/iam/policies/s3-get-object.js +73 -0
  301. package/lib/constructs/iam/policies/s3-get-object.js.map +1 -0
  302. package/lib/constructs/iam/policies/s3-put-object.d.ts +11 -0
  303. package/lib/constructs/iam/policies/s3-put-object.d.ts.map +1 -0
  304. package/lib/constructs/iam/policies/s3-put-object.js +13 -0
  305. package/lib/constructs/iam/policies/s3-put-object.js.map +1 -0
  306. package/lib/constructs/iam/policies/ses.d.ts +15 -0
  307. package/lib/constructs/iam/policies/ses.d.ts.map +1 -0
  308. package/lib/constructs/iam/policies/ses.js +14 -0
  309. package/lib/constructs/iam/policies/ses.js.map +1 -0
  310. package/lib/constructs/iam/policies/ssm-ssh.d.ts +19 -0
  311. package/lib/constructs/iam/policies/ssm-ssh.d.ts.map +1 -0
  312. package/lib/constructs/iam/policies/ssm-ssh.js +49 -0
  313. package/lib/constructs/iam/policies/ssm-ssh.js.map +1 -0
  314. package/lib/constructs/iam/roles/github-actions.d.ts +41 -0
  315. package/lib/constructs/iam/roles/github-actions.d.ts.map +1 -0
  316. package/lib/constructs/iam/roles/github-actions.js +77 -0
  317. package/lib/constructs/iam/roles/github-actions.js.map +1 -0
  318. package/lib/constructs/iam/roles/index.d.ts +4 -0
  319. package/lib/constructs/iam/roles/index.d.ts.map +1 -0
  320. package/lib/constructs/iam/roles/index.js +20 -0
  321. package/lib/constructs/iam/roles/index.js.map +1 -0
  322. package/lib/constructs/iam/roles/instance-role.d.ts +38 -0
  323. package/lib/constructs/iam/roles/instance-role.d.ts.map +1 -0
  324. package/lib/constructs/iam/roles/instance-role.js +45 -0
  325. package/lib/constructs/iam/roles/instance-role.js.map +1 -0
  326. package/lib/constructs/iam/roles/roles.d.ts +8 -0
  327. package/lib/constructs/iam/roles/roles.d.ts.map +1 -0
  328. package/lib/constructs/iam/roles/roles.js +11 -0
  329. package/lib/constructs/iam/roles/roles.js.map +1 -0
  330. package/lib/constructs/kinesis/index.d.ts +2 -0
  331. package/lib/constructs/kinesis/index.d.ts.map +1 -0
  332. package/lib/constructs/kinesis/index.js +18 -0
  333. package/lib/constructs/kinesis/index.js.map +1 -0
  334. package/lib/constructs/kinesis/kinesis-stream.d.ts +14 -0
  335. package/lib/constructs/kinesis/kinesis-stream.d.ts.map +1 -0
  336. package/lib/constructs/kinesis/kinesis-stream.js +17 -0
  337. package/lib/constructs/kinesis/kinesis-stream.js.map +1 -0
  338. package/lib/constructs/lambda/index.d.ts +2 -0
  339. package/lib/constructs/lambda/index.d.ts.map +1 -0
  340. package/lib/constructs/lambda/index.js +18 -0
  341. package/lib/constructs/lambda/index.js.map +1 -0
  342. package/lib/constructs/lambda/lambda.d.ts +95 -0
  343. package/lib/constructs/lambda/lambda.d.ts.map +1 -0
  344. package/lib/constructs/lambda/lambda.js +115 -0
  345. package/lib/constructs/lambda/lambda.js.map +1 -0
  346. package/lib/constructs/loadbalancing/alb/application-listener.d.ts +49 -0
  347. package/lib/constructs/loadbalancing/alb/application-listener.d.ts.map +1 -0
  348. package/lib/constructs/loadbalancing/alb/application-listener.js +53 -0
  349. package/lib/constructs/loadbalancing/alb/application-listener.js.map +1 -0
  350. package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts +63 -0
  351. package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts.map +1 -0
  352. package/lib/constructs/loadbalancing/alb/application-load-balancer.js +70 -0
  353. package/lib/constructs/loadbalancing/alb/application-load-balancer.js.map +1 -0
  354. package/lib/constructs/loadbalancing/alb/application-target-group.d.ts +42 -0
  355. package/lib/constructs/loadbalancing/alb/application-target-group.d.ts.map +1 -0
  356. package/lib/constructs/loadbalancing/alb/application-target-group.js +64 -0
  357. package/lib/constructs/loadbalancing/alb/application-target-group.js.map +1 -0
  358. package/lib/constructs/loadbalancing/alb/index.d.ts +4 -0
  359. package/lib/constructs/loadbalancing/alb/index.d.ts.map +1 -0
  360. package/lib/constructs/loadbalancing/alb/index.js +20 -0
  361. package/lib/constructs/loadbalancing/alb/index.js.map +1 -0
  362. package/lib/constructs/loadbalancing/index.d.ts +2 -0
  363. package/lib/constructs/loadbalancing/index.d.ts.map +1 -0
  364. package/lib/constructs/loadbalancing/index.js +18 -0
  365. package/lib/constructs/loadbalancing/index.js.map +1 -0
  366. package/lib/constructs/rds/index.d.ts +2 -0
  367. package/lib/constructs/rds/index.d.ts.map +1 -0
  368. package/lib/constructs/rds/index.js +18 -0
  369. package/lib/constructs/rds/index.js.map +1 -0
  370. package/lib/constructs/rds/instance.d.ts +33 -0
  371. package/lib/constructs/rds/instance.d.ts.map +1 -0
  372. package/lib/constructs/rds/instance.js +27 -0
  373. package/lib/constructs/rds/instance.js.map +1 -0
  374. package/lib/constructs/root.d.ts +32 -0
  375. package/lib/constructs/root.d.ts.map +1 -0
  376. package/lib/constructs/root.js +46 -0
  377. package/lib/constructs/root.js.map +1 -0
  378. package/lib/constructs/s3/index.d.ts +18 -0
  379. package/lib/constructs/s3/index.d.ts.map +1 -0
  380. package/lib/constructs/s3/index.js +21 -0
  381. package/lib/constructs/s3/index.js.map +1 -0
  382. package/lib/constructs/ses/index.d.ts +35 -0
  383. package/lib/constructs/ses/index.d.ts.map +1 -0
  384. package/lib/constructs/ses/index.js +52 -0
  385. package/lib/constructs/ses/index.js.map +1 -0
  386. package/lib/constructs/vpc/index.d.ts +2 -0
  387. package/lib/constructs/vpc/index.d.ts.map +1 -0
  388. package/lib/constructs/vpc/index.js +18 -0
  389. package/lib/constructs/vpc/index.js.map +1 -0
  390. package/lib/constructs/vpc/vpc.d.ts +57 -0
  391. package/lib/constructs/vpc/vpc.d.ts.map +1 -0
  392. package/lib/constructs/vpc/vpc.js +91 -0
  393. package/lib/constructs/vpc/vpc.js.map +1 -0
  394. package/lib/experimental/constructs/iam/index.d.ts +2 -0
  395. package/lib/experimental/constructs/iam/index.d.ts.map +1 -0
  396. package/lib/experimental/constructs/iam/index.js +18 -0
  397. package/lib/experimental/constructs/iam/index.js.map +1 -0
  398. package/lib/experimental/constructs/iam/policies/developer-policy.d.ts +63 -0
  399. package/lib/experimental/constructs/iam/policies/developer-policy.d.ts.map +1 -0
  400. package/lib/experimental/constructs/iam/policies/developer-policy.js +150 -0
  401. package/lib/experimental/constructs/iam/policies/developer-policy.js.map +1 -0
  402. package/lib/experimental/constructs/iam/policies/index.d.ts +2 -0
  403. package/lib/experimental/constructs/iam/policies/index.d.ts.map +1 -0
  404. package/lib/experimental/constructs/iam/policies/index.js +18 -0
  405. package/lib/experimental/constructs/iam/policies/index.js.map +1 -0
  406. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts +30 -0
  407. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts.map +1 -0
  408. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js +34 -0
  409. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js.map +1 -0
  410. package/lib/experimental/constructs/iam/roles/index.d.ts +2 -0
  411. package/lib/experimental/constructs/iam/roles/index.d.ts.map +1 -0
  412. package/lib/experimental/constructs/iam/roles/index.js +18 -0
  413. package/lib/experimental/constructs/iam/roles/index.js.map +1 -0
  414. package/lib/experimental/constructs/policies/index.d.ts +2 -0
  415. package/lib/experimental/constructs/policies/index.d.ts.map +1 -0
  416. package/lib/experimental/constructs/policies/index.js +18 -0
  417. package/lib/experimental/constructs/policies/index.js.map +1 -0
  418. package/lib/experimental/constructs/policies/kinesis-put-records.d.ts +11 -0
  419. package/lib/experimental/constructs/policies/kinesis-put-records.d.ts.map +1 -0
  420. package/lib/experimental/constructs/policies/kinesis-put-records.js +12 -0
  421. package/lib/experimental/constructs/policies/kinesis-put-records.js.map +1 -0
  422. package/lib/experimental/constructs/riff-raff-deployment-id.d.ts +8 -0
  423. package/lib/experimental/constructs/riff-raff-deployment-id.d.ts.map +1 -0
  424. package/lib/experimental/constructs/riff-raff-deployment-id.js +21 -0
  425. package/lib/experimental/constructs/riff-raff-deployment-id.js.map +1 -0
  426. package/lib/experimental/patterns/ec2-app.d.ts +175 -0
  427. package/lib/experimental/patterns/ec2-app.d.ts.map +1 -0
  428. package/lib/experimental/patterns/ec2-app.js +412 -0
  429. package/lib/experimental/patterns/ec2-app.js.map +1 -0
  430. package/lib/experimental/patterns/gu-load-balanced-app.d.ts +360 -0
  431. package/lib/experimental/patterns/gu-load-balanced-app.d.ts.map +1 -0
  432. package/lib/experimental/patterns/gu-load-balanced-app.js +520 -0
  433. package/lib/experimental/patterns/gu-load-balanced-app.js.map +1 -0
  434. package/lib/experimental/patterns/index.d.ts +3 -0
  435. package/lib/experimental/patterns/index.d.ts.map +1 -0
  436. package/lib/experimental/patterns/index.js +19 -0
  437. package/lib/experimental/patterns/index.js.map +1 -0
  438. package/lib/experimental/patterns/kinesis-lambda.d.ts +75 -0
  439. package/lib/experimental/patterns/kinesis-lambda.d.ts.map +1 -0
  440. package/lib/experimental/patterns/kinesis-lambda.js +48 -0
  441. package/lib/experimental/patterns/kinesis-lambda.js.map +1 -0
  442. package/lib/experimental/patterns/sns-lambda.d.ts +62 -0
  443. package/lib/experimental/patterns/sns-lambda.d.ts.map +1 -0
  444. package/lib/experimental/patterns/sns-lambda.js +41 -0
  445. package/lib/experimental/patterns/sns-lambda.js.map +1 -0
  446. package/lib/index.d.ts +2 -0
  447. package/lib/index.d.ts.map +1 -0
  448. package/lib/index.js +18 -0
  449. package/lib/index.js.map +1 -0
  450. package/lib/patterns/api-lambda.d.ts +61 -0
  451. package/lib/patterns/api-lambda.d.ts.map +1 -0
  452. package/lib/patterns/api-lambda.js +62 -0
  453. package/lib/patterns/api-lambda.js.map +1 -0
  454. package/lib/patterns/api-multiple-lambdas.d.ts +122 -0
  455. package/lib/patterns/api-multiple-lambdas.d.ts.map +1 -0
  456. package/lib/patterns/api-multiple-lambdas.js +93 -0
  457. package/lib/patterns/api-multiple-lambdas.js.map +1 -0
  458. package/lib/patterns/ec2-app/base.d.ts +325 -0
  459. package/lib/patterns/ec2-app/base.d.ts.map +1 -0
  460. package/lib/patterns/ec2-app/base.js +273 -0
  461. package/lib/patterns/ec2-app/base.js.map +1 -0
  462. package/lib/patterns/ec2-app/framework.d.ts +32 -0
  463. package/lib/patterns/ec2-app/framework.d.ts.map +1 -0
  464. package/lib/patterns/ec2-app/framework.js +46 -0
  465. package/lib/patterns/ec2-app/framework.js.map +1 -0
  466. package/lib/patterns/ec2-app/index.d.ts +3 -0
  467. package/lib/patterns/ec2-app/index.d.ts.map +1 -0
  468. package/lib/patterns/ec2-app/index.js +19 -0
  469. package/lib/patterns/ec2-app/index.js.map +1 -0
  470. package/lib/patterns/index.d.ts +6 -0
  471. package/lib/patterns/index.d.ts.map +1 -0
  472. package/lib/patterns/index.js +22 -0
  473. package/lib/patterns/index.js.map +1 -0
  474. package/lib/patterns/scheduled-ecs-task.d.ts +36 -0
  475. package/lib/patterns/scheduled-ecs-task.d.ts.map +1 -0
  476. package/lib/patterns/scheduled-ecs-task.js +30 -0
  477. package/lib/patterns/scheduled-ecs-task.js.map +1 -0
  478. package/lib/patterns/scheduled-lambda.d.ts +42 -0
  479. package/lib/patterns/scheduled-lambda.d.ts.map +1 -0
  480. package/lib/patterns/scheduled-lambda.js +33 -0
  481. package/lib/patterns/scheduled-lambda.js.map +1 -0
  482. package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts +5 -0
  483. package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts.map +1 -0
  484. package/lib/riff-raff-yaml-file/deployments/autoscaling.js +44 -0
  485. package/lib/riff-raff-yaml-file/deployments/autoscaling.js.map +1 -0
  486. package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts +7 -0
  487. package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts.map +1 -0
  488. package/lib/riff-raff-yaml-file/deployments/cloudformation.js +64 -0
  489. package/lib/riff-raff-yaml-file/deployments/cloudformation.js.map +1 -0
  490. package/lib/riff-raff-yaml-file/deployments/lambda.d.ts +5 -0
  491. package/lib/riff-raff-yaml-file/deployments/lambda.d.ts.map +1 -0
  492. package/lib/riff-raff-yaml-file/deployments/lambda.js +71 -0
  493. package/lib/riff-raff-yaml-file/deployments/lambda.js.map +1 -0
  494. package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts +3 -0
  495. package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts.map +1 -0
  496. package/lib/riff-raff-yaml-file/deployments/update-parameters.js +17 -0
  497. package/lib/riff-raff-yaml-file/deployments/update-parameters.js.map +1 -0
  498. package/lib/riff-raff-yaml-file/group-by.d.ts +8 -0
  499. package/lib/riff-raff-yaml-file/group-by.d.ts.map +1 -0
  500. package/lib/riff-raff-yaml-file/group-by.js +25 -0
  501. package/lib/riff-raff-yaml-file/group-by.js.map +1 -0
  502. package/lib/riff-raff-yaml-file/index.d.ts +71 -0
  503. package/lib/riff-raff-yaml-file/index.d.ts.map +1 -0
  504. package/lib/riff-raff-yaml-file/index.js +244 -0
  505. package/lib/riff-raff-yaml-file/index.js.map +1 -0
  506. package/lib/riff-raff-yaml-file/types.d.ts +35 -0
  507. package/lib/riff-raff-yaml-file/types.d.ts.map +1 -0
  508. package/lib/riff-raff-yaml-file/types.js +10 -0
  509. package/lib/riff-raff-yaml-file/types.js.map +1 -0
  510. package/lib/types/access.d.ts +66 -0
  511. package/lib/types/access.d.ts.map +1 -0
  512. package/lib/types/access.js +39 -0
  513. package/lib/types/access.js.map +1 -0
  514. package/lib/types/amigo.d.ts +17 -0
  515. package/lib/types/amigo.d.ts.map +1 -0
  516. package/lib/types/amigo.js +3 -0
  517. package/lib/types/amigo.js.map +1 -0
  518. package/lib/types/asg.d.ts +19 -0
  519. package/lib/types/asg.d.ts.map +1 -0
  520. package/lib/types/asg.js +3 -0
  521. package/lib/types/asg.js.map +1 -0
  522. package/lib/types/cli.d.ts +12 -0
  523. package/lib/types/cli.d.ts.map +1 -0
  524. package/lib/types/cli.js +3 -0
  525. package/lib/types/cli.js.map +1 -0
  526. package/lib/types/distributable.d.ts +19 -0
  527. package/lib/types/distributable.d.ts.map +1 -0
  528. package/lib/types/distributable.js +9 -0
  529. package/lib/types/distributable.js.map +1 -0
  530. package/lib/types/domain-names.d.ts +15 -0
  531. package/lib/types/domain-names.d.ts.map +1 -0
  532. package/lib/types/domain-names.js +3 -0
  533. package/lib/types/domain-names.js.map +1 -0
  534. package/lib/types/index.d.ts +5 -0
  535. package/lib/types/index.d.ts.map +1 -0
  536. package/lib/types/index.js +21 -0
  537. package/lib/types/index.js.map +1 -0
  538. package/lib/utils/array.d.ts +7 -0
  539. package/lib/utils/array.d.ts.map +1 -0
  540. package/lib/utils/array.js +19 -0
  541. package/lib/utils/array.js.map +1 -0
  542. package/lib/utils/cli/vpc.d.ts +8 -0
  543. package/lib/utils/cli/vpc.d.ts.map +1 -0
  544. package/lib/utils/cli/vpc.js +74 -0
  545. package/lib/utils/cli/vpc.js.map +1 -0
  546. package/lib/utils/cognito/cognito.d.ts +2 -0
  547. package/lib/utils/cognito/cognito.d.ts.map +1 -0
  548. package/lib/utils/cognito/cognito.js +19 -0
  549. package/lib/utils/cognito/cognito.js.map +1 -0
  550. package/lib/utils/ec2/index.d.ts +2 -0
  551. package/lib/utils/ec2/index.d.ts.map +1 -0
  552. package/lib/utils/ec2/index.js +18 -0
  553. package/lib/utils/ec2/index.js.map +1 -0
  554. package/lib/utils/ec2/private-config.d.ts +11 -0
  555. package/lib/utils/ec2/private-config.d.ts.map +1 -0
  556. package/lib/utils/ec2/private-config.js +3 -0
  557. package/lib/utils/ec2/private-config.js.map +1 -0
  558. package/lib/utils/exec.d.ts +7 -0
  559. package/lib/utils/exec.d.ts.map +1 -0
  560. package/lib/utils/exec.js +46 -0
  561. package/lib/utils/exec.js.map +1 -0
  562. package/lib/utils/git.d.ts +3 -0
  563. package/lib/utils/git.d.ts.map +1 -0
  564. package/lib/utils/git.js +23 -0
  565. package/lib/utils/git.js.map +1 -0
  566. package/lib/utils/lambda/event-source.d.ts +52 -0
  567. package/lib/utils/lambda/event-source.d.ts.map +1 -0
  568. package/lib/utils/lambda/event-source.js +41 -0
  569. package/lib/utils/lambda/event-source.js.map +1 -0
  570. package/lib/utils/lambda/index.d.ts +2 -0
  571. package/lib/utils/lambda/index.d.ts.map +1 -0
  572. package/lib/utils/lambda/index.js +18 -0
  573. package/lib/utils/lambda/index.js.map +1 -0
  574. package/lib/utils/math.d.ts +2 -0
  575. package/lib/utils/math.d.ts.map +1 -0
  576. package/lib/utils/math.js +6 -0
  577. package/lib/utils/math.js.map +1 -0
  578. package/lib/utils/mixin/app-aware-construct.d.ts +11 -0
  579. package/lib/utils/mixin/app-aware-construct.d.ts.map +1 -0
  580. package/lib/utils/mixin/app-aware-construct.js +35 -0
  581. package/lib/utils/mixin/app-aware-construct.js.map +1 -0
  582. package/lib/utils/mixin/types.d.ts +2 -0
  583. package/lib/utils/mixin/types.d.ts.map +1 -0
  584. package/lib/utils/mixin/types.js +3 -0
  585. package/lib/utils/mixin/types.js.map +1 -0
  586. package/lib/utils/security-groups/helpers.d.ts +4 -0
  587. package/lib/utils/security-groups/helpers.d.ts.map +1 -0
  588. package/lib/utils/security-groups/helpers.js +15 -0
  589. package/lib/utils/security-groups/helpers.js.map +1 -0
  590. package/lib/utils/security-groups/index.d.ts +2 -0
  591. package/lib/utils/security-groups/index.d.ts.map +1 -0
  592. package/lib/utils/security-groups/index.js +18 -0
  593. package/lib/utils/security-groups/index.js.map +1 -0
  594. package/lib/utils/singleton.d.ts +40 -0
  595. package/lib/utils/singleton.d.ts.map +1 -0
  596. package/lib/utils/singleton.js +43 -0
  597. package/lib/utils/singleton.js.map +1 -0
  598. package/lib/utils/string.d.ts +3 -0
  599. package/lib/utils/string.d.ts.map +1 -0
  600. package/lib/utils/string.js +19 -0
  601. package/lib/utils/string.js.map +1 -0
  602. package/lib/utils/test/assertions.d.ts +24 -0
  603. package/lib/utils/test/assertions.d.ts.map +1 -0
  604. package/lib/utils/test/assertions.js +88 -0
  605. package/lib/utils/test/assertions.js.map +1 -0
  606. package/lib/utils/test/attach-policy-to-test-role.d.ts +4 -0
  607. package/lib/utils/test/attach-policy-to-test-role.d.ts.map +1 -0
  608. package/lib/utils/test/attach-policy-to-test-role.js +15 -0
  609. package/lib/utils/test/attach-policy-to-test-role.js.map +1 -0
  610. package/lib/utils/test/index.d.ts +5 -0
  611. package/lib/utils/test/index.d.ts.map +1 -0
  612. package/lib/utils/test/index.js +21 -0
  613. package/lib/utils/test/index.js.map +1 -0
  614. package/lib/utils/test/simple-gu-stack.d.ts +4 -0
  615. package/lib/utils/test/simple-gu-stack.d.ts.map +1 -0
  616. package/lib/utils/test/simple-gu-stack.js +13 -0
  617. package/lib/utils/test/simple-gu-stack.js.map +1 -0
  618. package/lib/utils/test/template.d.ts +12 -0
  619. package/lib/utils/test/template.d.ts.map +1 -0
  620. package/lib/utils/test/template.js +28 -0
  621. package/lib/utils/test/template.js.map +1 -0
  622. package/package.json +72 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "@guardian/tsconfig/tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS"
5
+ },
6
+ "include": ["lib/**/*", "bin/**/*"],
7
+ "exclude": [
8
+ "node_modules",
9
+ "cdk.out",
10
+ "lib/**/__snapshots__/**"
11
+ ]
12
+ }
@@ -0,0 +1,23 @@
1
+ import { CodeMaker } from "codemaker";
2
+ import type { Imports } from "./imports";
3
+ import type { Name } from "./utils";
4
+ interface AppBuilderProps {
5
+ imports: Imports;
6
+ appName: Name;
7
+ stack: Name;
8
+ stages: string[];
9
+ regions: string[];
10
+ outputFile: string;
11
+ outputDir: string;
12
+ comment?: string;
13
+ migrated?: boolean;
14
+ }
15
+ export declare class AppBuilder {
16
+ config: AppBuilderProps;
17
+ code: CodeMaker;
18
+ constructor(props: AppBuilderProps);
19
+ constructCdkFile(): Promise<void>;
20
+ }
21
+ export declare const constructApp: (props: AppBuilderProps) => Promise<void>;
22
+ export {};
23
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,UAAU;IACrB,MAAM,EAAE,eAAe,CAAC;IAExB,IAAI,EAAE,SAAS,CAAC;gBAEJ,KAAK,EAAE,eAAe;IAO5B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBxC;AAED,eAAO,MAAM,YAAY,GAAU,OAAO,eAAe,KAAG,OAAO,CAAC,IAAI,CAGvE,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constructApp = exports.AppBuilder = void 0;
4
+ const codemaker_1 = require("codemaker");
5
+ class AppBuilder {
6
+ constructor(props) {
7
+ this.config = props;
8
+ this.code = new codemaker_1.CodeMaker({ indentationLevel: 2 });
9
+ this.code.closeBlockFormatter = (s) => s ?? "}";
10
+ }
11
+ async constructCdkFile() {
12
+ const { comment, outputFile, imports, appName, stack, outputDir, stages, regions } = this.config;
13
+ this.code.openFile(outputFile);
14
+ if (comment) {
15
+ this.code.line(comment);
16
+ this.code.line();
17
+ }
18
+ imports.render(this.code);
19
+ this.code.line("const app = new GuRoot();");
20
+ stages.forEach((stage) => {
21
+ regions.forEach((region) => {
22
+ const regionNoHyphen = region.replace("-", "");
23
+ this.code.line(`new ${appName.pascal}(app, "${appName.pascal}-${regionNoHyphen}-${stage}", { stack: "${stack.kebab}", stage: "${stage}", env: { region: "${region}" } });`);
24
+ });
25
+ });
26
+ this.code.closeFile(outputFile);
27
+ await this.code.save(outputDir);
28
+ }
29
+ }
30
+ exports.AppBuilder = AppBuilder;
31
+ const constructApp = async (props) => {
32
+ const builder = new AppBuilder(props);
33
+ await builder.constructCdkFile();
34
+ };
35
+ exports.constructApp = constructApp;
36
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/app.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAgBtC,MAAa,UAAU;IAKrB,YAAY,KAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,IAAI,GAAG,IAAI,qBAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAEjG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAE5C,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,CACZ,OAAO,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,MAAM,IAAI,cAAc,IAAI,KAAK,gBAAgB,KAAK,CAAC,KAAK,cAAc,KAAK,sBAAsB,MAAM,SAAS,CAC5J,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;CACF;AArCD,gCAqCC;AAEM,MAAM,YAAY,GAAG,KAAK,EAAE,KAAsB,EAAiB,EAAE;IAC1E,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB","sourcesContent":["import { CodeMaker } from \"codemaker\";\nimport type { Imports } from \"./imports\";\nimport type { Name } from \"./utils\";\n\ninterface AppBuilderProps {\n imports: Imports;\n appName: Name;\n stack: Name;\n stages: string[];\n regions: string[];\n outputFile: string;\n outputDir: string;\n comment?: string;\n migrated?: boolean;\n}\n\nexport class AppBuilder {\n config: AppBuilderProps;\n\n code: CodeMaker;\n\n constructor(props: AppBuilderProps) {\n this.config = props;\n\n this.code = new CodeMaker({ indentationLevel: 2 });\n this.code.closeBlockFormatter = (s?: string): string => s ?? \"}\";\n }\n\n async constructCdkFile(): Promise<void> {\n const { comment, outputFile, imports, appName, stack, outputDir, stages, regions } = this.config;\n\n this.code.openFile(outputFile);\n if (comment) {\n this.code.line(comment);\n this.code.line();\n }\n\n imports.render(this.code);\n\n this.code.line(\"const app = new GuRoot();\");\n\n stages.forEach((stage) => {\n regions.forEach((region) => {\n const regionNoHyphen = region.replace(\"-\", \"\");\n this.code.line(\n `new ${appName.pascal}(app, \"${appName.pascal}-${regionNoHyphen}-${stage}\", { stack: \"${stack.kebab}\", stage: \"${stage}\", env: { region: \"${region}\" } });`,\n );\n });\n });\n\n this.code.closeFile(outputFile);\n await this.code.save(outputDir);\n }\n}\n\nexport const constructApp = async (props: AppBuilderProps): Promise<void> => {\n const builder = new AppBuilder(props);\n await builder.constructCdkFile();\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import type { CodeMaker } from "codemaker";
2
+ import type { Name } from "./utils";
3
+ export declare class Imports {
4
+ private readonly imports;
5
+ private constructor();
6
+ static newStackImports(addCfnIncludeImports: boolean): Imports;
7
+ static newAppImports({ kebab, pascal }: Name): Imports;
8
+ static newTestImports({ kebab, pascal }: Name): Imports;
9
+ render(code: CodeMaker): void;
10
+ }
11
+ //# sourceMappingURL=imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/imports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQpC,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IAEjD,OAAO;WAIO,eAAe,CAAC,oBAAoB,EAAE,OAAO,GAAG,OAAO;WAuBvD,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,GAAG,OAAO;WAkB/C,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,GAAG,OAAO;IAiB9D,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;CAqC9B"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Imports = void 0;
4
+ const node_module_1 = require("node:module");
5
+ class Imports {
6
+ constructor(imports) {
7
+ this.imports = imports;
8
+ }
9
+ static newStackImports(addCfnIncludeImports) {
10
+ return new Imports({
11
+ ...(addCfnIncludeImports && {
12
+ path: {
13
+ types: [],
14
+ components: ["join"],
15
+ },
16
+ "aws-cdk-lib/cloudformation-include": {
17
+ types: [],
18
+ components: ["CfnInclude"],
19
+ },
20
+ }),
21
+ "aws-cdk-lib": {
22
+ types: ["App"],
23
+ components: [],
24
+ },
25
+ "@guardian/cdk/lib/constructs/core": {
26
+ types: ["GuStackProps"],
27
+ components: ["GuStack"],
28
+ },
29
+ });
30
+ }
31
+ static newAppImports({ kebab, pascal }) {
32
+ return new Imports({
33
+ "source-map-support/register": {
34
+ basic: true,
35
+ types: [],
36
+ components: [],
37
+ },
38
+ "@guardian/cdk/lib/constructs/root": {
39
+ types: [],
40
+ components: ["GuRoot"],
41
+ },
42
+ [`../lib/${kebab}`]: {
43
+ types: [],
44
+ components: [pascal],
45
+ },
46
+ });
47
+ }
48
+ static newTestImports({ kebab, pascal }) {
49
+ return new Imports({
50
+ "aws-cdk-lib": {
51
+ types: [],
52
+ components: ["App"],
53
+ },
54
+ "aws-cdk-lib/assertions": {
55
+ types: [],
56
+ components: ["Template"],
57
+ },
58
+ [`./${kebab}`]: {
59
+ types: [],
60
+ components: [pascal],
61
+ },
62
+ });
63
+ }
64
+ render(code) {
65
+ Object.entries(this.imports)
66
+ // Render "basic" imports before any others, still in alphabetical order
67
+ // Render Node built-in imports before third-party imports (to satisfy `import/order`)
68
+ // Render relative imports after absolute imports
69
+ .sort(([aKey, aImports], [bKey, bImports]) => {
70
+ if (aImports.basic && !bImports.basic) {
71
+ return -1;
72
+ }
73
+ else if (bImports.basic && !aImports.basic) {
74
+ return 1;
75
+ }
76
+ else if ((0, node_module_1.isBuiltin)(aKey) && !(0, node_module_1.isBuiltin)(bKey)) {
77
+ return -1;
78
+ }
79
+ else if ((0, node_module_1.isBuiltin)(bKey) && !(0, node_module_1.isBuiltin)(aKey)) {
80
+ return 1;
81
+ }
82
+ else if (aKey.startsWith(".") && !bKey.startsWith(".")) {
83
+ return 1;
84
+ }
85
+ else if (bKey.startsWith(".") && !aKey.startsWith(".")) {
86
+ return -1;
87
+ }
88
+ else {
89
+ return aKey.localeCompare(bKey);
90
+ }
91
+ })
92
+ .forEach(([lib, imports]) => {
93
+ if (imports.basic) {
94
+ code.line(`import "${lib}";`);
95
+ }
96
+ if (imports.types.length) {
97
+ code.line(`import type { ${imports.types.sort().join(", ")} } from "${lib}";`);
98
+ }
99
+ if (imports.components.length) {
100
+ code.line(`import { ${imports.components.sort().join(", ")} } from "${lib}";`);
101
+ }
102
+ });
103
+ code.line();
104
+ }
105
+ }
106
+ exports.Imports = Imports;
107
+ //# sourceMappingURL=imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/imports.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAUxC,MAAa,OAAO;IAGlB,YAAoB,OAA+B;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,oBAA6B;QACzD,OAAO,IAAI,OAAO,CAAC;YACjB,GAAG,CAAC,oBAAoB,IAAI;gBAC1B,IAAI,EAAE;oBACJ,KAAK,EAAE,EAAE;oBACT,UAAU,EAAE,CAAC,MAAM,CAAC;iBACrB;gBACD,oCAAoC,EAAE;oBACpC,KAAK,EAAE,EAAE;oBACT,UAAU,EAAE,CAAC,YAAY,CAAC;iBAC3B;aACF,CAAC;YACF,aAAa,EAAE;gBACb,KAAK,EAAE,CAAC,KAAK,CAAC;gBACd,UAAU,EAAE,EA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;YAED,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC9B,IAAI,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;YACjF,CAAC;QACH,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;CACF;AAtGD,0BAsGC","sourcesContent":["import { isBuiltin } from \"node:module\";\nimport type { CodeMaker } from \"codemaker\";\nimport type { Name } from \"./utils\";\n\ninterface Import {\n types: string[];\n components: string[];\n basic?: boolean;\n}\n\nexport class Imports {\n private readonly imports: Record<string, Import>;\n\n private constructor(imports: Record<string, Import>) {\n this.imports = imports;\n }\n\n public static newStackImports(addCfnIncludeImports: boolean): Imports {\n return new Imports({\n ...(addCfnIncludeImports && {\n path: {\n types: [],\n components: [\"join\"],\n },\n \"aws-cdk-lib/cloudformation-include\": {\n types: [],\n components: [\"CfnInclude\"],\n },\n }),\n \"aws-cdk-lib\": {\n types: [\"App\"],\n components: [],\n },\n \"@guardian/cdk/lib/constructs/core\": {\n types: [\"GuStackProps\"],\n components: [\"GuStack\"],\n },\n });\n }\n\n public static newAppImports({ kebab, pascal }: Name): Imports {\n return new Imports({\n \"source-map-support/register\": {\n basic: true,\n types: [],\n components: [],\n },\n \"@guardian/cdk/lib/constructs/root\": {\n types: [],\n components: [\"GuRoot\"],\n },\n [`../lib/${kebab}`]: {\n types: [],\n components: [pascal],\n },\n });\n }\n\n public static newTestImports({ kebab, pascal }: Name): Imports {\n return new Imports({\n \"aws-cdk-lib\": {\n types: [],\n components: [\"App\"],\n },\n \"aws-cdk-lib/assertions\": {\n types: [],\n components: [\"Template\"],\n },\n [`./${kebab}`]: {\n types: [],\n components: [pascal],\n },\n });\n }\n\n render(code: CodeMaker): void {\n Object.entries(this.imports)\n // Render \"basic\" imports before any others, still in alphabetical order\n // Render Node built-in imports before third-party imports (to satisfy `import/order`)\n // Render relative imports after absolute imports\n .sort(([aKey, aImports], [bKey, bImports]) => {\n if (aImports.basic && !bImports.basic) {\n return -1;\n } else if (bImports.basic && !aImports.basic) {\n return 1;\n } else if (isBuiltin(aKey) && !isBuiltin(bKey)) {\n return -1;\n } else if (isBuiltin(bKey) && !isBuiltin(aKey)) {\n return 1;\n } else if (aKey.startsWith(\".\") && !bKey.startsWith(\".\")) {\n return 1;\n } else if (bKey.startsWith(\".\") && !aKey.startsWith(\".\")) {\n return -1;\n } else {\n return aKey.localeCompare(bKey);\n }\n })\n .forEach(([lib, imports]) => {\n if (imports.basic) {\n code.line(`import \"${lib}\";`);\n }\n\n if (imports.types.length) {\n code.line(`import type { ${imports.types.sort().join(\", \")} } from \"${lib}\";`);\n }\n\n if (imports.components.length) {\n code.line(`import { ${imports.components.sort().join(\", \")} } from \"${lib}\";`);\n }\n });\n code.line();\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ export interface InitConfig {
2
+ outputDir: string;
3
+ }
4
+ export declare class ProjectBuilder {
5
+ templateDir: string;
6
+ config: InitConfig;
7
+ static validateConfig: (config: InitConfig) => void;
8
+ constructor(config: InitConfig);
9
+ buildDirectory(): void;
10
+ copyFiles(sourcePath: string, targetPath: string): void;
11
+ }
12
+ export declare const buildDirectory: (config: InitConfig) => void;
13
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/init.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,qBAAa,cAAc;IACzB,WAAW,SAA8B;IACzC,MAAM,EAAE,UAAU,CAAC;IAEnB,MAAM,CAAC,cAAc,GAAI,QAAQ,UAAU,KAAG,IAAI,CAKhD;gBAEU,MAAM,EAAE,UAAU;IAI9B,cAAc,IAAI,IAAI;IAkBtB,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;CAmBxD;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,KAAG,IAGnD,CAAC"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildDirectory = exports.ProjectBuilder = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const constants_1 = require("../../../../constants");
7
+ // TODO: Add project name flag
8
+ class ProjectBuilder {
9
+ constructor(config) {
10
+ this.templateDir = `${__dirname}/../template`;
11
+ this.config = config;
12
+ }
13
+ buildDirectory() {
14
+ ProjectBuilder.validateConfig(this.config);
15
+ if (!(0, fs_1.existsSync)(this.config.outputDir)) {
16
+ console.log(`Creating ${this.config.outputDir}`);
17
+ (0, fs_1.mkdirSync)(this.config.outputDir);
18
+ }
19
+ console.log("Creating package.json");
20
+ createPackageJson(this.config.outputDir);
21
+ console.log("Copying template files");
22
+ // TODO: Replace any params in files with .template extensions
23
+ this.copyFiles(this.templateDir, this.config.outputDir);
24
+ console.log("Success!");
25
+ }
26
+ copyFiles(sourcePath, targetPath) {
27
+ for (const file of (0, fs_1.readdirSync)(sourcePath)) {
28
+ const path = (0, path_1.join)(sourcePath, file);
29
+ if (path.endsWith(".ignore")) {
30
+ continue;
31
+ }
32
+ else if ((0, fs_1.lstatSync)(path).isDirectory()) {
33
+ const nestedTargetPath = (0, path_1.join)(targetPath, file);
34
+ if (!(0, fs_1.existsSync)(nestedTargetPath)) {
35
+ (0, fs_1.mkdirSync)(nestedTargetPath);
36
+ }
37
+ this.copyFiles(path, nestedTargetPath);
38
+ }
39
+ else if (path.endsWith(".template")) {
40
+ (0, fs_1.copyFileSync)(path, (0, path_1.join)(targetPath, file.replace(".template", "")));
41
+ }
42
+ else {
43
+ (0, fs_1.copyFileSync)(path, (0, path_1.join)(targetPath, file));
44
+ }
45
+ }
46
+ }
47
+ }
48
+ exports.ProjectBuilder = ProjectBuilder;
49
+ ProjectBuilder.validateConfig = (config) => {
50
+ const path = config.outputDir;
51
+ if ((0, fs_1.existsSync)(path) && (0, fs_1.readdirSync)(path).length > 0) {
52
+ throw new Error(`Directory ${path} is not empty`);
53
+ }
54
+ };
55
+ const buildDirectory = (config) => {
56
+ const builder = new ProjectBuilder(config);
57
+ builder.buildDirectory();
58
+ };
59
+ exports.buildDirectory = buildDirectory;
60
+ function createPackageJson(outputDirectory) {
61
+ const { NODE_ENV, CI } = process.env;
62
+ const isTest = NODE_ENV?.toUpperCase() === "TEST" || CI?.toUpperCase() === "TRUE";
63
+ const coreDeps = [
64
+ "@guardian/eslint-config",
65
+ "@guardian/tsconfig",
66
+ "@types/jest",
67
+ "@types/node",
68
+ "eslint",
69
+ "jest",
70
+ "prettier",
71
+ "ts-jest",
72
+ "ts-node",
73
+ "typescript",
74
+ ].reduce((acc, depName) => ({ ...acc, [depName]: (0, constants_1.getDevDependency)(depName) }), {});
75
+ const cdkDeps = {
76
+ "@guardian/cdk": isTest ? `file:../guardian-cdk-${constants_1.LibraryInfo.VERSION}.tgz` : constants_1.LibraryInfo.VERSION,
77
+ "aws-cdk": constants_1.LibraryInfo.AWS_CDK_VERSION,
78
+ "aws-cdk-lib": constants_1.LibraryInfo.AWS_CDK_LIB_VERSION,
79
+ constructs: constants_1.LibraryInfo.CONSTRUCTS_VERSION,
80
+ };
81
+ const customDeps = {
82
+ "source-map-support": "^0.5.20",
83
+ "@guardian/prettier": "5.0.0",
84
+ };
85
+ const allDeps = { ...coreDeps, ...cdkDeps, ...customDeps };
86
+ const devDependencies = Object.keys(allDeps)
87
+ .sort()
88
+ .reduce((acc, depName) => ({ ...acc, [depName]: allDeps[depName] }), {});
89
+ const contents = {
90
+ name: "cdk",
91
+ version: "0.0.0",
92
+ private: true,
93
+ scripts: {
94
+ test: "jest",
95
+ "test-update": "jest -u",
96
+ format: 'prettier --write "{lib,bin}/**/*.ts"',
97
+ lint: "eslint lib/** bin/** --no-error-on-unmatched-pattern",
98
+ synth: "cdk synth --path-metadata false --version-reporting false",
99
+ diff: "cdk diff --path-metadata false --version-reporting false",
100
+ },
101
+ devDependencies,
102
+ prettier: "@guardian/prettier",
103
+ jest: {
104
+ testMatch: ["<rootDir>/lib/**/*.test.ts"],
105
+ transform: {
106
+ "^.+\\.tsx?$": "ts-jest",
107
+ },
108
+ setupFilesAfterEnv: ["./jest.setup.js"],
109
+ },
110
+ };
111
+ (0, fs_1.writeFileSync)(`${outputDirectory}/package.json`, JSON.stringify(contents, null, 2));
112
+ }
113
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/init.ts"],"names":[],"mappings":";;;AAAA,2BAAgG;AAChG,+BAA4B;AAC5B,qDAAsE;AAMtE,8BAA8B;AAC9B,MAAa,cAAc;IAWzB,YAAY,MAAkB;QAV9B,gBAAW,GAAG,GAAG,SAAS,cAAc,CAAC;QAWvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,cAAc;QACZ,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE3C,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;YACjD,IAAA,cAAS,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACrC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEzC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,8DAA8D;QAC9D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAA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OAAO;KAC9B,CAAC;IAEF,MAAM,OAAO,GAA2B,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC;IAEnF,MAAM,eAAe,GAA2B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;SACjE,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAE3E,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,SAAS;YACxB,MAAM,EAAE,sCAAsC;YAC9C,IAAI,EAAE,sDAAsD;YAC5D,KAAK,EAAE,2DAA2D;YAClE,IAAI,EAAE,0DAA0D;SACjE;QACD,eAAe;QAEf,QAAQ,EAAE,oBAAoB;QAE9B,IAAI,EAAE;YACJ,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,SAAS,EAAE;gBACT,aAAa,EAAE,SAAS;aACzB;YACD,kBAAkB,EAAE,CAAC,iBAAiB,CAAC;SACxC;KACF,CAAC;IACF,IAAA,kBAAa,EAAC,GAAG,eAAe,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, writeFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getDevDependency, LibraryInfo } from \"../../../../constants\";\n\nexport interface InitConfig {\n outputDir: string;\n}\n\n// TODO: Add project name flag\nexport class ProjectBuilder {\n templateDir = `${__dirname}/../template`;\n config: InitConfig;\n\n static validateConfig = (config: InitConfig): void => {\n const path = config.outputDir;\n if (existsSync(path) && readdirSync(path).length > 0) {\n throw new Error(`Directory ${path} is not empty`);\n }\n };\n\n constructor(config: InitConfig) {\n this.config = config;\n }\n\n buildDirectory(): void {\n ProjectBuilder.validateConfig(this.config);\n\n if (!existsSync(this.config.outputDir)) {\n console.log(`Creating ${this.config.outputDir}`);\n mkdirSync(this.config.outputDir);\n }\n\n console.log(\"Creating package.json\");\n createPackageJson(this.config.outputDir);\n\n console.log(\"Copying template files\");\n // TODO: Replace any params in files with .template extensions\n this.copyFiles(this.templateDir, this.config.outputDir);\n\n console.log(\"Success!\");\n }\n\n copyFiles(sourcePath: string, targetPath: string): void {\n for (const file of readdirSync(sourcePath)) {\n const path = join(sourcePath, file);\n\n if (path.endsWith(\".ignore\")) {\n continue;\n } else if (lstatSync(path).isDirectory()) {\n const nestedTargetPath = join(targetPath, file);\n if (!existsSync(nestedTargetPath)) {\n mkdirSync(nestedTargetPath);\n }\n this.copyFiles(path, nestedTargetPath);\n } else if (path.endsWith(\".template\")) {\n copyFileSync(path, join(targetPath, file.replace(\".template\", \"\")));\n } else {\n copyFileSync(path, join(targetPath, file));\n }\n }\n }\n}\n\nexport const buildDirectory = (config: InitConfig): void => {\n const builder = new ProjectBuilder(config);\n builder.buildDirectory();\n};\n\nfunction createPackageJson(outputDirectory: string): void {\n const { NODE_ENV, CI } = process.env;\n const isTest = NODE_ENV?.toUpperCase() === \"TEST\" || CI?.toUpperCase() === \"TRUE\";\n\n const coreDeps: Record<string, string> = [\n \"@guardian/eslint-config\",\n \"@guardian/tsconfig\",\n \"@types/jest\",\n \"@types/node\",\n \"eslint\",\n \"jest\",\n \"prettier\",\n \"ts-jest\",\n \"ts-node\",\n \"typescript\",\n ].reduce((acc, depName) => ({ ...acc, [depName]: getDevDependency(depName)! }), {});\n\n const cdkDeps: Record<string, string> = {\n \"@guardian/cdk\": isTest ? `file:../guardian-cdk-${LibraryInfo.VERSION}.tgz` : LibraryInfo.VERSION,\n \"aws-cdk\": LibraryInfo.AWS_CDK_VERSION,\n \"aws-cdk-lib\": LibraryInfo.AWS_CDK_LIB_VERSION,\n constructs: LibraryInfo.CONSTRUCTS_VERSION,\n };\n\n const customDeps = {\n \"source-map-support\": \"^0.5.20\",\n \"@guardian/prettier\": \"5.0.0\",\n };\n\n const allDeps: Record<string, string> = { ...coreDeps, ...cdkDeps, ...customDeps };\n\n const devDependencies: Record<string, string> = Object.keys(allDeps)\n .sort()\n .reduce((acc, depName) => ({ ...acc, [depName]: allDeps[depName] }), {});\n\n const contents = {\n name: \"cdk\",\n version: \"0.0.0\",\n private: true,\n scripts: {\n test: \"jest\",\n \"test-update\": \"jest -u\",\n format: 'prettier --write \"{lib,bin}/**/*.ts\"',\n lint: \"eslint lib/** bin/** --no-error-on-unmatched-pattern\",\n synth: \"cdk synth --path-metadata false --version-reporting false\",\n diff: \"cdk diff --path-metadata false --version-reporting false\",\n },\n devDependencies,\n\n prettier: \"@guardian/prettier\",\n\n jest: {\n testMatch: [\"<rootDir>/lib/**/*.test.ts\"],\n transform: {\n \"^.+\\\\.tsx?$\": \"ts-jest\",\n },\n setupFilesAfterEnv: [\"./jest.setup.js\"],\n },\n };\n writeFileSync(`${outputDirectory}/package.json`, JSON.stringify(contents, null, 2));\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { CodeMaker } from "codemaker";
2
+ import type { Imports } from "./imports";
3
+ import type { Name } from "./utils";
4
+ export interface TestBuilderProps {
5
+ imports: Imports;
6
+ appName: Name;
7
+ stackName: Name;
8
+ outputFile: string;
9
+ outputDir: string;
10
+ comment?: string;
11
+ }
12
+ export declare class TestBuilder {
13
+ config: TestBuilderProps;
14
+ imports: Imports;
15
+ code: CodeMaker;
16
+ constructor(props: TestBuilderProps);
17
+ constructCdkFile(): Promise<void>;
18
+ addTest(): void;
19
+ }
20
+ export declare const constructTest: (props: TestBuilderProps) => Promise<void>;
21
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,WAAW;IACtB,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,SAAS,CAAC;gBAEJ,KAAK,EAAE,gBAAgB;IAQ7B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAevC,OAAO,IAAI,IAAI;CAiBhB;AAED,eAAO,MAAM,aAAa,GAAU,OAAO,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAGzE,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constructTest = exports.TestBuilder = void 0;
4
+ const codemaker_1 = require("codemaker");
5
+ class TestBuilder {
6
+ constructor(props) {
7
+ this.config = props;
8
+ this.imports = props.imports;
9
+ this.code = new codemaker_1.CodeMaker({ indentationLevel: 2 });
10
+ this.code.closeBlockFormatter = (s) => s ?? "}";
11
+ }
12
+ async constructCdkFile() {
13
+ this.code.openFile(this.config.outputFile);
14
+ if (this.config.comment) {
15
+ this.code.line(this.config.comment);
16
+ this.code.line();
17
+ }
18
+ this.config.imports.render(this.code);
19
+ this.addTest();
20
+ this.code.closeFile(this.config.outputFile);
21
+ await this.code.save(this.config.outputDir);
22
+ }
23
+ addTest() {
24
+ const { appName, stackName } = this.config;
25
+ this.code.openBlock(`describe("The ${appName.pascal} stack", () =>`);
26
+ this.code.openBlock(`it("matches the snapshot", () =>`);
27
+ this.code.line("const app = new App();");
28
+ this.code.line(`const stack = new ${appName.pascal}(app, "${appName.pascal}", { stack: "${stackName.kebab}", stage: "TEST" });`);
29
+ this.code.line(`const template = Template.fromStack(stack);`);
30
+ this.code.line(`expect(template.toJSON()).toMatchSnapshot();`);
31
+ this.code.closeBlock("});");
32
+ this.code.closeBlock("});");
33
+ }
34
+ }
35
+ exports.TestBuilder = TestBuilder;
36
+ const constructTest = async (props) => {
37
+ const builder = new TestBuilder(props);
38
+ await builder.constructCdkFile();
39
+ };
40
+ exports.constructTest = constructTest;
41
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/snapshot.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAatC,MAAa,WAAW;IAMtB,YAAY,KAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAE7B,IAAI,CAAC,IAAI,GAAG,IAAI,qBAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE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W,QAAA,aAAa,iBAGxB","sourcesContent":["import { CodeMaker } from \"codemaker\";\nimport type { Imports } from \"./imports\";\nimport type { Name } from \"./utils\";\n\nexport interface TestBuilderProps {\n imports: Imports;\n appName: Name;\n stackName: Name;\n outputFile: string;\n outputDir: string;\n comment?: string;\n}\n\nexport class TestBuilder {\n config: TestBuilderProps;\n imports: Imports;\n\n code: CodeMaker;\n\n constructor(props: TestBuilderProps) {\n this.config = props;\n this.imports = props.imports;\n\n this.code = new CodeMaker({ indentationLevel: 2 });\n this.code.closeBlockFormatter = (s?: string): string => s ?? \"}\";\n }\n\n async constructCdkFile(): Promise<void> {\n this.code.openFile(this.config.outputFile);\n if (this.config.comment) {\n this.code.line(this.config.comment);\n this.code.line();\n }\n\n this.config.imports.render(this.code);\n\n this.addTest();\n\n this.code.closeFile(this.config.outputFile);\n await this.code.save(this.config.outputDir);\n }\n\n addTest(): void {\n const { appName, stackName } = this.config;\n\n this.code.openBlock(`describe(\"The ${appName.pascal} stack\", () =>`);\n this.code.openBlock(`it(\"matches the snapshot\", () =>`);\n\n this.code.line(\"const app = new App();\");\n this.code.line(\n `const stack = new ${appName.pascal}(app, \"${appName.pascal}\", { stack: \"${stackName.kebab}\", stage: \"TEST\" });`,\n );\n\n this.code.line(`const template = Template.fromStack(stack);`);\n this.code.line(`expect(template.toJSON()).toMatchSnapshot();`);\n\n this.code.closeBlock(\"});\");\n this.code.closeBlock(\"});\");\n }\n}\n\nexport const constructTest = async (props: TestBuilderProps): Promise<void> => {\n const builder = new TestBuilder(props);\n await builder.constructCdkFile();\n};\n"]}
@@ -0,0 +1,21 @@
1
+ import { CodeMaker } from "codemaker";
2
+ import type { Imports } from "./imports";
3
+ import type { Name } from "./utils";
4
+ interface StackBuilderProps {
5
+ imports: Imports;
6
+ appName: Name;
7
+ outputFile: string;
8
+ outputDir: string;
9
+ comment?: string;
10
+ yamlTemplateLocation?: string;
11
+ }
12
+ export declare class StackBuilder {
13
+ config: StackBuilderProps;
14
+ imports: Imports;
15
+ code: CodeMaker;
16
+ constructor(props: StackBuilderProps);
17
+ constructCdkFile(): Promise<void>;
18
+ }
19
+ export declare const constructStack: (props: StackBuilderProps) => Promise<void>;
20
+ export {};
21
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,qBAAa,YAAY;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,SAAS,CAAC;gBAEJ,KAAK,EAAE,iBAAiB;IAQ9B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA2BxC;AAED,eAAO,MAAM,cAAc,GAAU,OAAO,iBAAiB,KAAG,OAAO,CAAC,IAAI,CAG3E,CAAC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constructStack = exports.StackBuilder = void 0;
4
+ const codemaker_1 = require("codemaker");
5
+ class StackBuilder {
6
+ constructor(props) {
7
+ this.config = props;
8
+ this.imports = props.imports;
9
+ this.code = new codemaker_1.CodeMaker({ indentationLevel: 2 });
10
+ this.code.closeBlockFormatter = (s) => s ?? "}";
11
+ }
12
+ async constructCdkFile() {
13
+ this.code.openFile(this.config.outputFile);
14
+ if (this.config.comment) {
15
+ this.code.line(this.config.comment);
16
+ this.code.line();
17
+ }
18
+ this.config.imports.render(this.code);
19
+ this.code.openBlock(`export class ${this.config.appName.pascal} extends GuStack`);
20
+ this.code.openBlock(`constructor(scope: App, id: string, props: GuStackProps)`);
21
+ this.code.line("super(scope, id, props);");
22
+ if (this.config.yamlTemplateLocation) {
23
+ this.code.line(`const yamlTemplateFilePath = join(__dirname, "../..", "${this.config.yamlTemplateLocation}");`);
24
+ this.code.openBlock(`new CfnInclude(this, "YamlTemplate",`);
25
+ this.code.line(`templateFile: yamlTemplateFilePath,`);
26
+ this.code.closeBlock("});");
27
+ }
28
+ this.code.closeBlock();
29
+ this.code.closeBlock();
30
+ this.code.closeFile(this.config.outputFile);
31
+ await this.code.save(this.config.outputDir);
32
+ }
33
+ }
34
+ exports.StackBuilder = StackBuilder;
35
+ const constructStack = async (props) => {
36
+ const builder = new StackBuilder(props);
37
+ await builder.constructCdkFile();
38
+ };
39
+ exports.constructStack = constructStack;
40
+ //# sourceMappingURL=stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/stack.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAatC,MAAa,YAAY;IAMvB,YAAY,KAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAE7B,IAAI,CAAC,IAAI,GAAG,IAAI,qBAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC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B,EAAE;IAC9E,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB","sourcesContent":["import { CodeMaker } from \"codemaker\";\nimport type { Imports } from \"./imports\";\nimport type { Name } from \"./utils\";\n\ninterface StackBuilderProps {\n imports: Imports;\n appName: Name;\n outputFile: string;\n outputDir: string;\n comment?: string;\n yamlTemplateLocation?: string;\n}\n\nexport class StackBuilder {\n config: StackBuilderProps;\n imports: Imports;\n\n code: CodeMaker;\n\n constructor(props: StackBuilderProps) {\n this.config = props;\n this.imports = props.imports;\n\n this.code = new CodeMaker({ indentationLevel: 2 });\n this.code.closeBlockFormatter = (s?: string): string => s ?? \"}\";\n }\n\n async constructCdkFile(): Promise<void> {\n this.code.openFile(this.config.outputFile);\n if (this.config.comment) {\n this.code.line(this.config.comment);\n this.code.line();\n }\n\n this.config.imports.render(this.code);\n\n this.code.openBlock(`export class ${this.config.appName.pascal} extends GuStack`);\n this.code.openBlock(`constructor(scope: App, id: string, props: GuStackProps)`);\n this.code.line(\"super(scope, id, props);\");\n\n if (this.config.yamlTemplateLocation) {\n this.code.line(`const yamlTemplateFilePath = join(__dirname, \"../..\", \"${this.config.yamlTemplateLocation}\");`);\n\n this.code.openBlock(`new CfnInclude(this, \"YamlTemplate\",`);\n this.code.line(`templateFile: yamlTemplateFilePath,`);\n this.code.closeBlock(\"});\");\n }\n\n this.code.closeBlock();\n this.code.closeBlock();\n\n this.code.closeFile(this.config.outputFile);\n await this.code.save(this.config.outputDir);\n }\n}\n\nexport const constructStack = async (props: StackBuilderProps): Promise<void> => {\n const builder = new StackBuilder(props);\n await builder.constructCdkFile();\n};\n"]}
@@ -0,0 +1,12 @@
1
+ import type { PackageManager } from "../index";
2
+ export interface Name {
3
+ kebab: string;
4
+ pascal: string;
5
+ }
6
+ export declare function getCommands(packageManager: PackageManager, cwd: string): {
7
+ installDependencies: () => Promise<string>;
8
+ lint: () => Promise<string>;
9
+ synth: () => Promise<string>;
10
+ test: () => Promise<string>;
11
+ };
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAgB,WAAW,CACzB,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,MAAM,GACV;IACD,mBAAmB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B,CAOA"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCommands = getCommands;
4
+ const exec_1 = require("../../../../utils/exec");
5
+ async function runTask(packageManager, cwd, args) {
6
+ return await (0, exec_1.execute)(packageManager, args, { cwd });
7
+ }
8
+ function getCommands(packageManager, cwd) {
9
+ return {
10
+ installDependencies: () => runTask(packageManager, cwd, ["install"]),
11
+ lint: () => runTask(packageManager, cwd, ["run", "lint"]),
12
+ test: () => runTask(packageManager, cwd, ["test", "--", "-u"]),
13
+ synth: () => runTask(packageManager, cwd, ["run", "synth"]),
14
+ };
15
+ }
16
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/utils.ts"],"names":[],"mappings":";;AAYA,kCAeC;AA3BD,iDAAiD;AAQjD,KAAK,UAAU,OAAO,CAAC,cAA8B,EAAE,GAAW,EAAE,IAAc;IAChF,OAAO,MAAM,IAAA,cAAO,EAAC,cAAc,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,WAAW,CACzB,cAA8B,EAC9B,GAAW;IAOX,OAAO;QACL,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACpE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9D,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAC5D,CAAC;AACJ,CAAC","sourcesContent":["import { execute } from \"../../../../utils/exec\";\nimport type { PackageManager } from \"../index\";\n\nexport interface Name {\n kebab: string;\n pascal: string;\n}\n\nasync function runTask(packageManager: PackageManager, cwd: string, args: string[]): Promise<string> {\n return await execute(packageManager, args, { cwd });\n}\n\nexport function getCommands(\n packageManager: PackageManager,\n cwd: string,\n): {\n installDependencies: () => Promise<string>;\n lint: () => Promise<string>;\n synth: () => Promise<string>;\n test: () => Promise<string>;\n} {\n return {\n installDependencies: () => runTask(packageManager, cwd, [\"install\"]),\n lint: () => runTask(packageManager, cwd, [\"run\", \"lint\"]),\n test: () => runTask(packageManager, cwd, [\"test\", \"--\", \"-u\"]),\n synth: () => runTask(packageManager, cwd, [\"run\", \"synth\"]),\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}