@aws/nx-plugin 0.0.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 (142) hide show
  1. package/README.md +63 -0
  2. package/generators.json +52 -0
  3. package/package.json +27 -0
  4. package/src/cloudscape-website/app/README.md +253 -0
  5. package/src/cloudscape-website/app/__snapshots__/generator.spec.ts.snap +539 -0
  6. package/src/cloudscape-website/app/files/app/src/config.ts.template +4 -0
  7. package/src/cloudscape-website/app/files/app/src/layouts/App/index.tsx.template +132 -0
  8. package/src/cloudscape-website/app/files/app/src/layouts/App/navitems.ts.template +8 -0
  9. package/src/cloudscape-website/app/files/app/src/layouts/Routes/index.tsx.template +18 -0
  10. package/src/cloudscape-website/app/files/app/src/main.tsx.template +22 -0
  11. package/src/cloudscape-website/app/files/app/src/pages/Home/index.tsx.template +25 -0
  12. package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/cloudfront-web-acl.ts.template +317 -0
  13. package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/index.ts.template +4 -0
  14. package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/static-website.ts.template +237 -0
  15. package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/webacl_event_handler/index.ts.template +301 -0
  16. package/src/cloudscape-website/app/files/e2e/cypress/src/e2e/app.cy.ts.template +13 -0
  17. package/src/cloudscape-website/app/files/e2e/cypress/src/support/app.po.ts.template +1 -0
  18. package/src/cloudscape-website/app/files/e2e/playwright/src/example.spec.ts.template +6 -0
  19. package/src/cloudscape-website/app/generator.d.ts +4 -0
  20. package/src/cloudscape-website/app/generator.js +177 -0
  21. package/src/cloudscape-website/app/generator.js.map +1 -0
  22. package/src/cloudscape-website/app/schema.d.js +6 -0
  23. package/src/cloudscape-website/app/schema.d.js.map +1 -0
  24. package/src/cloudscape-website/app/schema.d.ts +35 -0
  25. package/src/cloudscape-website/app/schema.json +189 -0
  26. package/src/cloudscape-website/cognito-auth/README.md +172 -0
  27. package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +238 -0
  28. package/src/cloudscape-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +50 -0
  29. package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/index.ts.template +4 -0
  30. package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/user-identity.ts.template +69 -0
  31. package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/userpool-with-mfa.ts.template +70 -0
  32. package/src/cloudscape-website/cognito-auth/generator.d.ts +4 -0
  33. package/src/cloudscape-website/cognito-auth/generator.js +100 -0
  34. package/src/cloudscape-website/cognito-auth/generator.js.map +1 -0
  35. package/src/cloudscape-website/cognito-auth/schema.d.js +6 -0
  36. package/src/cloudscape-website/cognito-auth/schema.d.js.map +1 -0
  37. package/src/cloudscape-website/cognito-auth/schema.d.ts +4 -0
  38. package/src/cloudscape-website/cognito-auth/schema.json +36 -0
  39. package/src/cloudscape-website/runtime-config/__snapshots__/generator.spec.ts.snap +112 -0
  40. package/src/cloudscape-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +46 -0
  41. package/src/cloudscape-website/runtime-config/generator.d.ts +4 -0
  42. package/src/cloudscape-website/runtime-config/generator.js +74 -0
  43. package/src/cloudscape-website/runtime-config/generator.js.map +1 -0
  44. package/src/cloudscape-website/runtime-config/schema.d.js +6 -0
  45. package/src/cloudscape-website/runtime-config/schema.d.js.map +1 -0
  46. package/src/cloudscape-website/runtime-config/schema.d.ts +3 -0
  47. package/src/cloudscape-website/runtime-config/schema.json +19 -0
  48. package/src/gitlab/files/.gitlab-ci.yml.template +26 -0
  49. package/src/gitlab/generator.d.ts +4 -0
  50. package/src/gitlab/generator.js +26 -0
  51. package/src/gitlab/generator.js.map +1 -0
  52. package/src/gitlab/schema.d.js +6 -0
  53. package/src/gitlab/schema.d.js.map +1 -0
  54. package/src/gitlab/schema.d.ts +5 -0
  55. package/src/gitlab/schema.json +52 -0
  56. package/src/index.d.ts +0 -0
  57. package/src/index.js +3 -0
  58. package/src/index.js.map +1 -0
  59. package/src/infra/app/README.md +175 -0
  60. package/src/infra/app/__snapshots__/generator.spec.ts.snap +864 -0
  61. package/src/infra/app/files/cdk.json +67 -0
  62. package/src/infra/app/files/src/main.ts.template +37 -0
  63. package/src/infra/app/files/src/stacks/application-stack.ts.template +10 -0
  64. package/src/infra/app/generator.d.ts +4 -0
  65. package/src/infra/app/generator.js +75 -0
  66. package/src/infra/app/generator.js.map +1 -0
  67. package/src/infra/app/schema.d.js +6 -0
  68. package/src/infra/app/schema.d.js.map +1 -0
  69. package/src/infra/app/schema.d.ts +6 -0
  70. package/src/infra/app/schema.json +35 -0
  71. package/src/trpc/backend/README.md +549 -0
  72. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +110 -0
  73. package/src/trpc/backend/files/backend/src/index.ts.template +1 -0
  74. package/src/trpc/backend/files/backend/src/lambdas/index.ts.template +1 -0
  75. package/src/trpc/backend/files/backend/src/lambdas/middleware.ts.template +146 -0
  76. package/src/trpc/backend/files/backend/src/lambdas/router.ts.template +36 -0
  77. package/src/trpc/backend/files/common/constructs/src/__apiNameKebabCase__/index.ts.template +64 -0
  78. package/src/trpc/backend/files/schema/src/index.ts.template +7 -0
  79. package/src/trpc/backend/generator.d.ts +4 -0
  80. package/src/trpc/backend/generator.js +128 -0
  81. package/src/trpc/backend/generator.js.map +1 -0
  82. package/src/trpc/backend/schema.d.js +6 -0
  83. package/src/trpc/backend/schema.d.js.map +1 -0
  84. package/src/trpc/backend/schema.d.ts +8 -0
  85. package/src/trpc/backend/schema.json +44 -0
  86. package/src/trpc/react/README.md +320 -0
  87. package/src/trpc/react/__snapshots__/generator.spec.ts.snap +98 -0
  88. package/src/trpc/react/files/src/components/TRPCClientProvider/index.tsx.template +34 -0
  89. package/src/trpc/react/files/src/hooks/useTrpc.tsx.template +5 -0
  90. package/src/trpc/react/generator.d.ts +4 -0
  91. package/src/trpc/react/generator.js +81 -0
  92. package/src/trpc/react/generator.js.map +1 -0
  93. package/src/trpc/react/schema.d.js +6 -0
  94. package/src/trpc/react/schema.d.js.map +1 -0
  95. package/src/trpc/react/schema.d.ts +5 -0
  96. package/src/trpc/react/schema.json +32 -0
  97. package/src/ts/cjs-to-esm/generator.d.ts +8 -0
  98. package/src/ts/cjs-to-esm/generator.js +201 -0
  99. package/src/ts/cjs-to-esm/generator.js.map +1 -0
  100. package/src/ts/cjs-to-esm/schema.d.js +6 -0
  101. package/src/ts/cjs-to-esm/schema.d.js.map +1 -0
  102. package/src/ts/cjs-to-esm/schema.d.ts +5 -0
  103. package/src/ts/cjs-to-esm/schema.json +28 -0
  104. package/src/ts/lib/README.md +149 -0
  105. package/src/ts/lib/__snapshots__/generator.spec.ts.snap +260 -0
  106. package/src/ts/lib/eslint.d.ts +3 -0
  107. package/src/ts/lib/eslint.js +41 -0
  108. package/src/ts/lib/eslint.js.map +1 -0
  109. package/src/ts/lib/files/src/index.ts.template +3 -0
  110. package/src/ts/lib/generator.d.ts +21 -0
  111. package/src/ts/lib/generator.js +61 -0
  112. package/src/ts/lib/generator.js.map +1 -0
  113. package/src/ts/lib/schema.d.js +6 -0
  114. package/src/ts/lib/schema.d.js.map +1 -0
  115. package/src/ts/lib/schema.d.ts +13 -0
  116. package/src/ts/lib/schema.json +46 -0
  117. package/src/ts/lib/ts-project-utils.d.ts +6 -0
  118. package/src/ts/lib/ts-project-utils.js +107 -0
  119. package/src/ts/lib/ts-project-utils.js.map +1 -0
  120. package/src/ts/lib/types.d.ts +10 -0
  121. package/src/ts/lib/types.js +6 -0
  122. package/src/ts/lib/types.js.map +1 -0
  123. package/src/ts/lib/vitest.d.ts +3 -0
  124. package/src/ts/lib/vitest.js +67 -0
  125. package/src/ts/lib/vitest.js.map +1 -0
  126. package/src/utils/files/common/constructs/src/index.ts.template +1 -0
  127. package/src/utils/files/common/constructs/src/runtime-config/index.ts.template +1 -0
  128. package/src/utils/files/common/constructs/src/runtime-config/runtime-config.ts.template +33 -0
  129. package/src/utils/files/common/types/src/index.ts.template +1 -0
  130. package/src/utils/files/common/types/src/runtime-config.ts.template +13 -0
  131. package/src/utils/npm-scope.d.ts +7 -0
  132. package/src/utils/npm-scope.js +37 -0
  133. package/src/utils/npm-scope.js.map +1 -0
  134. package/src/utils/paths.d.ts +3 -0
  135. package/src/utils/paths.js +32 -0
  136. package/src/utils/paths.js.map +1 -0
  137. package/src/utils/shared-constructs.d.ts +7 -0
  138. package/src/utils/shared-constructs.js +72 -0
  139. package/src/utils/shared-constructs.js.map +1 -0
  140. package/src/utils/versions.d.ts +31 -0
  141. package/src/utils/versions.js +49 -0
  142. package/src/utils/versions.js.map +1 -0
@@ -0,0 +1,301 @@
1
+ /* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
2
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
3
+ /*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved.
4
+ SPDX-License-Identifier: Apache-2.0 */
5
+ import { CreateIPSetCommandOutput, Rule, WAFUnavailableEntityException, WAFV2 } from "@aws-sdk/client-wafv2"; // eslint-disable-line
6
+
7
+ const DELIMITER = ":";
8
+ const SCOPE = "CLOUDFRONT";
9
+ const client = new WAFV2({
10
+ region: "us-east-1",
11
+ customUserAgent: "aws-pdk/static-website/waf",
12
+ });
13
+
14
+ const MAX_CREATE_RETRY = 10;
15
+ const RETRY_INTERVAL = 2000;
16
+
17
+ /**
18
+ * Handler for creating a WAF V2 ACL in US-EAST-1.
19
+ */
20
+ export const onEvent = async (event: any) => {
21
+ const { ID, MANAGED_RULES, CIDR_ALLOW_LIST } = event.ResourceProperties;
22
+ const [WEB_ACL_ID, IP_SET_ID] = event.PhysicalResourceId
23
+ ? event.PhysicalResourceId.split(DELIMITER)
24
+ : [];
25
+ let response = {};
26
+
27
+ switch (event.RequestType) {
28
+ case "Create":
29
+ response = await createWaf(ID, MANAGED_RULES, CIDR_ALLOW_LIST);
30
+ break;
31
+ case "Update":
32
+ response = await updateWaf(
33
+ WEB_ACL_ID,
34
+ IP_SET_ID,
35
+ ID,
36
+ getIpSetName(ID),
37
+ MANAGED_RULES,
38
+ CIDR_ALLOW_LIST
39
+ );
40
+ break;
41
+ case "Delete":
42
+ response = await deleteWaf(WEB_ACL_ID, IP_SET_ID, ID, getIpSetName(ID));
43
+ break;
44
+ default:
45
+ throw new Error(`Invalid RequestType: ${event.RequestType}`);
46
+ }
47
+
48
+ return response;
49
+ };
50
+
51
+ /**
52
+ * Generates the name of the IP Set.
53
+ *
54
+ * @param id param passed in.
55
+ * @returns name of IP Set.
56
+ */
57
+ const getIpSetName = (id: string) => `${id}-IPSet`;
58
+
59
+ /**
60
+ * Returns a set of rules to apply.
61
+ *
62
+ * @param ipSetArn ip set arn
63
+ * @param ipSetName ip set name
64
+ * @param managedRules managed rules
65
+ * @param cidrAllowList cidr allow list
66
+ * @returns set of rules to apply.
67
+ */
68
+ const getWafRules = (
69
+ ipSetArn: string,
70
+ ipSetName: string,
71
+ managedRules?: any,
72
+ cidrAllowList?: any
73
+ ): Array<Rule> => {
74
+ const rules: Array<Rule> = [];
75
+
76
+ if (cidrAllowList) {
77
+ rules.push({
78
+ Name: ipSetName,
79
+ Priority: 1,
80
+ VisibilityConfig: {
81
+ MetricName: ipSetName,
82
+ CloudWatchMetricsEnabled: true,
83
+ SampledRequestsEnabled: true,
84
+ },
85
+ Action: {
86
+ Block: {},
87
+ },
88
+ Statement: {
89
+ NotStatement: {
90
+ Statement: {
91
+ IPSetReferenceStatement: {
92
+ ARN: ipSetArn,
93
+ },
94
+ },
95
+ },
96
+ },
97
+ });
98
+ }
99
+
100
+ if (managedRules) {
101
+ rules.push(
102
+ ...managedRules
103
+ .map((r: any) => ({ VendorName: r.vendor, Name: r.name }))
104
+ .map((rule: any, Priority: any) => ({
105
+ Name: `${rule.VendorName}-${rule.Name}`,
106
+ Priority,
107
+ Statement: { ManagedRuleGroupStatement: rule },
108
+ OverrideAction: { None: {} },
109
+ VisibilityConfig: {
110
+ MetricName: `${rule.VendorName}-${rule.Name}`,
111
+ CloudWatchMetricsEnabled: true,
112
+ SampledRequestsEnabled: true,
113
+ },
114
+ }))
115
+ );
116
+ }
117
+
118
+ return rules;
119
+ };
120
+
121
+ const createWaf = async (
122
+ id: string,
123
+ managedRules?: any,
124
+ cidrAllowList?: any
125
+ ) => {
126
+ const ipSetName = getIpSetName(id);
127
+ const createIpSetResponse = await client.createIPSet({
128
+ Name: ipSetName,
129
+ Scope: SCOPE,
130
+ Addresses: cidrAllowList?.cidrRanges ?? [],
131
+ IPAddressVersion: cidrAllowList?.cidrType ?? "IPV4",
132
+ });
133
+
134
+ const createWebAclResponse = await createWafAcl(
135
+ id,
136
+ ipSetName,
137
+ createIpSetResponse,
138
+ managedRules,
139
+ cidrAllowList
140
+ );
141
+
142
+ return {
143
+ PhysicalResourceId: `${createWebAclResponse.Summary?.Id}${DELIMITER}${createIpSetResponse.Summary?.Id}`,
144
+ Data: {
145
+ WebAclArn: createWebAclResponse.Summary?.ARN,
146
+ WebAclId: createWebAclResponse.Summary?.Id,
147
+ IPSetArn: createIpSetResponse.Summary?.ARN,
148
+ IPSetId: createIpSetResponse.Summary?.Id,
149
+ },
150
+ };
151
+ };
152
+
153
+ const createWafAcl = async (
154
+ id: string,
155
+ ipSetName: string,
156
+ createIpSetResponse: CreateIPSetCommandOutput,
157
+ managedRules?: any,
158
+ cidrAllowList?: any
159
+ ) => {
160
+ let counter = 0;
161
+
162
+ while (true) {
163
+ try {
164
+ const createWebAclResponse = await client.createWebACL({
165
+ Name: id,
166
+ DefaultAction: { Allow: {} },
167
+ Scope: SCOPE,
168
+ VisibilityConfig: {
169
+ CloudWatchMetricsEnabled: true,
170
+ MetricName: id,
171
+ SampledRequestsEnabled: true,
172
+ },
173
+ Rules: getWafRules(
174
+ createIpSetResponse.Summary!.ARN!,
175
+ ipSetName,
176
+ managedRules,
177
+ cidrAllowList
178
+ ),
179
+ });
180
+
181
+ return createWebAclResponse;
182
+ } catch (e) {
183
+ if (
184
+ e instanceof WAFUnavailableEntityException &&
185
+ counter < MAX_CREATE_RETRY
186
+ ) {
187
+ counter++;
188
+ console.log(
189
+ `Received error: ${e.message}; Waiting for retrying ${counter}`
190
+ );
191
+ await sleep(RETRY_INTERVAL);
192
+ continue;
193
+ }
194
+
195
+ throw e;
196
+ }
197
+ }
198
+ };
199
+
200
+ const updateWaf = async (
201
+ webAclId: string,
202
+ ipSetId: string,
203
+ id: string,
204
+ ipSetName: string,
205
+ managedRules?: any,
206
+ cidrAllowList?: any
207
+ ) => {
208
+ const getIpSetResponse = await client.getIPSet({
209
+ Id: ipSetId,
210
+ Name: ipSetName,
211
+ Scope: SCOPE,
212
+ });
213
+
214
+ await client.updateIPSet({
215
+ Id: ipSetId,
216
+ Name: ipSetName,
217
+ Addresses: cidrAllowList?.cidrRanges ?? [],
218
+ Scope: SCOPE,
219
+ LockToken: getIpSetResponse.LockToken!,
220
+ });
221
+
222
+ const getWebAclResponse = await client.getWebACL({
223
+ Id: webAclId,
224
+ Name: id,
225
+ Scope: SCOPE,
226
+ });
227
+
228
+ await client.updateWebACL({
229
+ Name: id,
230
+ DefaultAction: { Allow: {} },
231
+ Scope: SCOPE,
232
+ VisibilityConfig: {
233
+ CloudWatchMetricsEnabled: true,
234
+ MetricName: id,
235
+ SampledRequestsEnabled: true,
236
+ },
237
+ Rules: getWafRules(
238
+ getIpSetResponse.IPSet?.ARN!,
239
+ ipSetName,
240
+ managedRules,
241
+ cidrAllowList
242
+ ),
243
+ Id: getWebAclResponse.WebACL?.Id!,
244
+ LockToken: getWebAclResponse.LockToken!,
245
+ });
246
+
247
+ return {
248
+ Data: {
249
+ WebAclArn: getWebAclResponse.WebACL?.ARN,
250
+ WebAclId: getWebAclResponse.WebACL?.Id,
251
+ IPSetArn: getIpSetResponse.IPSet?.ARN,
252
+ IPSetId: getIpSetResponse.IPSet?.Id,
253
+ },
254
+ };
255
+ };
256
+
257
+ const deleteWaf = async (
258
+ webAclId: string,
259
+ ipSetId: string,
260
+ id: string,
261
+ ipSetName: string
262
+ ) => {
263
+ const getWebAclResponse = await client.getWebACL({
264
+ Id: webAclId,
265
+ Name: id,
266
+ Scope: SCOPE,
267
+ });
268
+
269
+ await client.deleteWebACL({
270
+ Id: webAclId,
271
+ Name: id,
272
+ Scope: SCOPE,
273
+ LockToken: getWebAclResponse.LockToken!,
274
+ });
275
+
276
+ const getIpSetResponse = await client.getIPSet({
277
+ Id: ipSetId,
278
+ Name: ipSetName,
279
+ Scope: SCOPE,
280
+ });
281
+
282
+ await client.deleteIPSet({
283
+ Id: ipSetId,
284
+ Name: ipSetName,
285
+ Scope: SCOPE,
286
+ LockToken: getIpSetResponse.LockToken!,
287
+ });
288
+
289
+ return {
290
+ Data: {
291
+ WebAclArn: getWebAclResponse.WebACL?.ARN,
292
+ WebAclId: getWebAclResponse.WebACL?.Id,
293
+ IPSetArn: getIpSetResponse.IPSet?.ARN,
294
+ IPSetId: getIpSetResponse.IPSet?.Id,
295
+ },
296
+ };
297
+ };
298
+
299
+ const sleep = async (duration: number) => {
300
+ return new Promise((resolve) => setTimeout(resolve, duration));
301
+ };
@@ -0,0 +1,13 @@
1
+ import { getTitle } from '../support/app.po';
2
+
3
+ describe('mywebsite-e2e', () => {
4
+ beforeEach(() => cy.visit('/'));
5
+
6
+ it('should display welcome message', () => {
7
+ // Custom command example, see `../support/commands.ts` file
8
+ cy.login('my-email@something.com', 'myPassword');
9
+
10
+ // Function helper example, see `../support/app.po.ts` file
11
+ getTitle().contains("<%= className %>");
12
+ });
13
+ });
@@ -0,0 +1 @@
1
+ export const getTitle = () => cy.get('title');
@@ -0,0 +1,6 @@
1
+ import { test, expect } from '@playwright/test';
2
+
3
+ test('has title', async ({ page }) => {
4
+ await page.goto('/');
5
+ await expect(page).toHaveTitle("<%= className %>");
6
+ });
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { AppGeneratorSchema } from './schema';
3
+ export declare function appGenerator(tree: Tree, schema: AppGeneratorSchema): Promise<() => void>;
4
+ export default appGenerator;
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ appGenerator: function() {
13
+ return appGenerator;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _extends = require("@swc/helpers/_/_extends");
20
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
+ const _devkit = require("@nx/devkit");
22
+ const _tsquery = require("@phenomnomnominal/tsquery");
23
+ const _typescript = require("typescript");
24
+ const _react = require("@nx/react");
25
+ const _sharedconstructs = require("../../utils/shared-constructs");
26
+ const _npmscope = require("../../utils/npm-scope");
27
+ const _lodashkebabcase = /*#__PURE__*/ _interop_require_default._(require("lodash.kebabcase"));
28
+ const _tsprojectutils = require("../../ts/lib/ts-project-utils");
29
+ const _versions = require("../../utils/versions");
30
+ const _paths = require("../../utils/paths");
31
+ async function appGenerator(tree, schema) {
32
+ var _tree_read;
33
+ const npmScopePrefix = (0, _npmscope.getNpmScopePrefix)(tree);
34
+ const fullyQualifiedName = `${npmScopePrefix}${schema.name}`;
35
+ var _schema_directory;
36
+ const websiteContentPath = (0, _devkit.joinPathFragments)((_schema_directory = schema.directory) != null ? _schema_directory : '.', schema.name);
37
+ // Nx 20 is still working on revamping the generator for the TS preset, but our generator applies
38
+ process.env.NX_IGNORE_UNSUPPORTED_TS_SETUP = 'true';
39
+ // TODO: consider exposing and supporting e2e tests
40
+ const e2eTestRunner = 'none';
41
+ await (0, _react.applicationGenerator)(tree, _extends._({}, schema, {
42
+ name: fullyQualifiedName,
43
+ directory: websiteContentPath,
44
+ routing: false,
45
+ addPlugin: true,
46
+ e2eTestRunner
47
+ }));
48
+ (0, _tsprojectutils.configureTsProject)(tree, {
49
+ dir: websiteContentPath,
50
+ fullyQualifiedName
51
+ });
52
+ await (0, _sharedconstructs.sharedConstructsGenerator)(tree);
53
+ const websiteNameKebabCase = (0, _lodashkebabcase.default)(schema.name);
54
+ const constructsPath = (0, _devkit.joinPathFragments)(_sharedconstructs.PACKAGES_DIR, _sharedconstructs.SHARED_CONSTRUCTS_DIR, 'src', websiteNameKebabCase, 'index.ts');
55
+ if (!tree.exists(constructsPath)) {
56
+ const npmScopePrefix = (0, _npmscope.getNpmScopePrefix)(tree);
57
+ (0, _devkit.generateFiles)(tree, (0, _devkit.joinPathFragments)(__dirname, 'files', _sharedconstructs.SHARED_CONSTRUCTS_DIR), (0, _devkit.joinPathFragments)(_sharedconstructs.PACKAGES_DIR, _sharedconstructs.SHARED_CONSTRUCTS_DIR), _extends._({}, schema, {
58
+ npmScopePrefix,
59
+ scopeAlias: (0, _npmscope.toScopeAlias)(npmScopePrefix),
60
+ websiteContentPath: (0, _devkit.joinPathFragments)('dist', websiteContentPath),
61
+ websiteNameKebabCase
62
+ }));
63
+ (0, _devkit.addDependenciesToPackageJson)(tree, (0, _versions.withVersions)([
64
+ 'constructs',
65
+ '@aws/pdk',
66
+ 'cdk-nag',
67
+ 'aws-cdk-lib'
68
+ ]), (0, _versions.withVersions)([
69
+ '@aws-sdk/client-wafv2'
70
+ ]));
71
+ const sharedConstructsIndexTsPath = (0, _devkit.joinPathFragments)(_sharedconstructs.PACKAGES_DIR, _sharedconstructs.SHARED_CONSTRUCTS_DIR, 'src', 'index.ts');
72
+ const sharedConstructsIndexContents = tree.read(sharedConstructsIndexTsPath).toString();
73
+ const staticWebsiteExportDeclaration = _typescript.factory.createExportDeclaration(undefined, undefined, undefined, _typescript.factory.createStringLiteral(`./${websiteNameKebabCase}/index.js`));
74
+ const updatedIndex = _tsquery.tsquery.map((0, _tsquery.ast)(sharedConstructsIndexContents), 'SourceFile', (node)=>{
75
+ return _extends._({}, node, {
76
+ statements: [
77
+ staticWebsiteExportDeclaration,
78
+ ...node.statements
79
+ ]
80
+ });
81
+ }).getFullText();
82
+ if (sharedConstructsIndexContents !== updatedIndex) {
83
+ tree.write(sharedConstructsIndexTsPath, updatedIndex);
84
+ }
85
+ }
86
+ (0, _devkit.updateJson)(tree, (0, _devkit.joinPathFragments)(_sharedconstructs.PACKAGES_DIR, _sharedconstructs.SHARED_CONSTRUCTS_DIR, 'project.json'), (config)=>{
87
+ if (!config.targets) {
88
+ config.targets = {};
89
+ }
90
+ if (!config.targets.build) {
91
+ config.targets.build = {};
92
+ }
93
+ var _config_targets_build_dependsOn;
94
+ config.targets.build.dependsOn = [
95
+ ...(_config_targets_build_dependsOn = config.targets.build.dependsOn) != null ? _config_targets_build_dependsOn : [],
96
+ `${fullyQualifiedName}:build`
97
+ ];
98
+ return config;
99
+ });
100
+ const projectConfig = (0, _devkit.readProjectConfiguration)(tree, fullyQualifiedName);
101
+ const libraryRoot = projectConfig.root;
102
+ tree.delete((0, _devkit.joinPathFragments)(libraryRoot, 'src/app'));
103
+ (0, _devkit.generateFiles)(tree, (0, _devkit.joinPathFragments)(__dirname, './files/app'), libraryRoot, schema // config object to replace variable in file templates
104
+ );
105
+ if (e2eTestRunner !== 'none') {
106
+ const e2eFullyQualifiedName = `${fullyQualifiedName}-e2e`;
107
+ const e2eRoot = (0, _devkit.readProjectConfiguration)(tree, e2eFullyQualifiedName).root;
108
+ (0, _devkit.generateFiles)(tree, (0, _devkit.joinPathFragments)(__dirname, `./files/e2e/${e2eTestRunner}`), e2eRoot, _extends._({}, schema, (0, _devkit.names)(fullyQualifiedName)));
109
+ (0, _tsprojectutils.configureTsProject)(tree, {
110
+ fullyQualifiedName: e2eFullyQualifiedName,
111
+ dir: e2eRoot
112
+ });
113
+ }
114
+ const viteConfigPath = (0, _devkit.joinPathFragments)(libraryRoot, 'vite.config.ts');
115
+ const viteConfigContents = (_tree_read = tree.read(viteConfigPath)) == null ? void 0 : _tree_read.toString();
116
+ if (viteConfigContents) {
117
+ let viteConfigUpdatedContents = viteConfigContents;
118
+ if (schema.unitTestRunner === 'vitest') {
119
+ viteConfigUpdatedContents = _tsquery.tsquery.map((0, _tsquery.ast)(viteConfigContents), 'ObjectLiteralExpression', (node)=>{
120
+ return _typescript.factory.createObjectLiteralExpression([
121
+ _typescript.factory.createPropertyAssignment('define', _typescript.factory.createObjectLiteralExpression([
122
+ _typescript.factory.createPropertyAssignment('global', _typescript.factory.createObjectLiteralExpression())
123
+ ], true)),
124
+ ...node.properties
125
+ ], true);
126
+ }).getFullText();
127
+ }
128
+ if (schema.bundler === 'vite') {
129
+ viteConfigUpdatedContents = _tsquery.tsquery.map((0, _tsquery.ast)(viteConfigUpdatedContents), 'ObjectLiteralExpression', (node)=>{
130
+ const updatedProperties = node.properties.map((prop)=>{
131
+ if ((0, _typescript.isPropertyAssignment)(prop) && prop.name.getText() === 'build') {
132
+ const buildConfig = prop.initializer;
133
+ return _typescript.factory.createPropertyAssignment('build', _typescript.factory.createObjectLiteralExpression(buildConfig.properties.map((buildProp)=>{
134
+ if ((0, _typescript.isPropertyAssignment)(buildProp) && buildProp.name.getText() === 'outDir') {
135
+ return _typescript.factory.createPropertyAssignment('outDir', _typescript.factory.createStringLiteral((0, _devkit.joinPathFragments)((0, _paths.getRelativePathToRoot)(tree, fullyQualifiedName), 'dist', websiteContentPath)));
136
+ }
137
+ return buildProp;
138
+ }), true));
139
+ }
140
+ return prop;
141
+ });
142
+ return _typescript.factory.createObjectLiteralExpression(updatedProperties, true);
143
+ }).getFullText();
144
+ }
145
+ if (viteConfigContents !== viteConfigUpdatedContents) {
146
+ tree.write(viteConfigPath, viteConfigUpdatedContents);
147
+ }
148
+ }
149
+ (0, _devkit.updateJson)(tree, (0, _devkit.joinPathFragments)(websiteContentPath, 'tsconfig.json'), (tsconfig)=>_extends._({}, tsconfig, {
150
+ compilerOptions: _extends._({}, tsconfig.compilerOptions, {
151
+ moduleResolution: 'Bundler',
152
+ module: 'Preserve'
153
+ })
154
+ }));
155
+ (0, _devkit.updateJson)(tree, (0, _devkit.joinPathFragments)(websiteContentPath, 'tsconfig.app.json'), (tsconfig)=>_extends._({}, tsconfig, {
156
+ compilerOptions: _extends._({}, tsconfig.compilerOptions, {
157
+ lib: [
158
+ "DOM"
159
+ ]
160
+ })
161
+ }));
162
+ (0, _devkit.addDependenciesToPackageJson)(tree, (0, _versions.withVersions)([
163
+ '@aws-northstar/ui',
164
+ '@cloudscape-design/components',
165
+ '@cloudscape-design/board-components',
166
+ 'react-router-dom'
167
+ ]), {});
168
+ await (0, _devkit.formatFiles)(tree);
169
+ return ()=>{
170
+ if (!schema.skipInstall) {
171
+ (0, _devkit.installPackagesTask)(tree);
172
+ }
173
+ };
174
+ }
175
+ const _default = appGenerator;
176
+
177
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/cloudscape-website/app/generator.ts"],"sourcesContent":["import {\n formatFiles,\n addDependenciesToPackageJson,\n Tree,\n readProjectConfiguration,\n joinPathFragments,\n generateFiles,\n names,\n updateJson,\n ProjectConfiguration,\n installPackagesTask,\n} from '@nx/devkit';\nimport { tsquery, ast } from '@phenomnomnominal/tsquery';\nimport {\n factory,\n ObjectLiteralExpression,\n SourceFile,\n isPropertyAssignment,\n} from 'typescript';\nimport { AppGeneratorSchema } from './schema';\nimport { applicationGenerator } from '@nx/react';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs';\nimport { getNpmScopePrefix, toScopeAlias } from '../../utils/npm-scope';\nimport kebabCase from 'lodash.kebabcase';\nimport { configureTsProject } from '../../ts/lib/ts-project-utils';\nimport { withVersions } from '../../utils/versions';\nimport { getRelativePathToRoot } from '../../utils/paths';\n\nexport async function appGenerator(tree: Tree, schema: AppGeneratorSchema) {\n const npmScopePrefix = getNpmScopePrefix(tree);\n const fullyQualifiedName = `${npmScopePrefix}${schema.name}`;\n const websiteContentPath = joinPathFragments(schema.directory ?? '.', schema.name);\n\n // Nx 20 is still working on revamping the generator for the TS preset, but our generator applies\n process.env.NX_IGNORE_UNSUPPORTED_TS_SETUP = 'true';\n\n // TODO: consider exposing and supporting e2e tests\n const e2eTestRunner = 'none';\n\n await applicationGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: websiteContentPath,\n routing: false,\n addPlugin: true,\n e2eTestRunner,\n });\n\n configureTsProject(tree, {\n dir: websiteContentPath,\n fullyQualifiedName,\n });\n\n await sharedConstructsGenerator(tree);\n\n const websiteNameKebabCase = kebabCase(schema.name);\n const constructsPath = joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', websiteNameKebabCase, 'index.ts');\n\n if (!tree.exists(constructsPath)) {\n const npmScopePrefix = getNpmScopePrefix(tree);\n generateFiles(\n tree,\n joinPathFragments(__dirname, 'files', SHARED_CONSTRUCTS_DIR),\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR),\n {\n ...schema,\n npmScopePrefix,\n scopeAlias: toScopeAlias(npmScopePrefix),\n websiteContentPath: joinPathFragments('dist', websiteContentPath),\n websiteNameKebabCase,\n }\n );\n\n addDependenciesToPackageJson(\n tree,\n withVersions(['constructs', '@aws/pdk', 'cdk-nag', 'aws-cdk-lib']),\n withVersions(['@aws-sdk/client-wafv2'])\n );\n\n const sharedConstructsIndexTsPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'index.ts'\n );\n const sharedConstructsIndexContents = tree\n .read(sharedConstructsIndexTsPath)\n .toString();\n\n const staticWebsiteExportDeclaration = factory.createExportDeclaration(\n undefined,\n undefined,\n undefined,\n factory.createStringLiteral(`./${websiteNameKebabCase}/index.js`)\n );\n\n const updatedIndex = tsquery\n .map(\n ast(sharedConstructsIndexContents),\n 'SourceFile',\n (node: SourceFile) => {\n return {\n ...node,\n statements: [staticWebsiteExportDeclaration, ...node.statements],\n };\n }\n )\n .getFullText();\n\n if (sharedConstructsIndexContents !== updatedIndex) {\n tree.write(sharedConstructsIndexTsPath, updatedIndex);\n }\n }\n\n updateJson(\n tree,\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'project.json'),\n (config: ProjectConfiguration) => {\n if (!config.targets) {\n config.targets = {};\n }\n\n if (!config.targets.build) {\n config.targets.build = {};\n }\n\n config.targets.build.dependsOn = [\n ...(config.targets.build.dependsOn ?? []),\n `${fullyQualifiedName}:build`,\n ];\n return config;\n }\n );\n\n const projectConfig = readProjectConfiguration(tree, fullyQualifiedName);\n const libraryRoot = projectConfig.root;\n\n tree.delete(joinPathFragments(libraryRoot, 'src/app'));\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(__dirname, './files/app'), // path to the file templates\n libraryRoot, // destination path of the files\n schema // config object to replace variable in file templates\n );\n\n if (e2eTestRunner !== 'none') {\n const e2eFullyQualifiedName = `${fullyQualifiedName}-e2e`;\n const e2eRoot = readProjectConfiguration(tree, e2eFullyQualifiedName).root;\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(__dirname, `./files/e2e/${e2eTestRunner}`), // path to the file templates\n e2eRoot, // destination path of the files\n { ...schema, ...names(fullyQualifiedName) }\n );\n configureTsProject(tree, {\n fullyQualifiedName: e2eFullyQualifiedName,\n dir: e2eRoot,\n });\n }\n\n const viteConfigPath = joinPathFragments(libraryRoot, 'vite.config.ts');\n const viteConfigContents = tree.read(viteConfigPath)?.toString();\n\n if (viteConfigContents) {\n let viteConfigUpdatedContents = viteConfigContents;\n\n if (schema.unitTestRunner === 'vitest') {\n viteConfigUpdatedContents = tsquery\n .map(\n ast(viteConfigContents),\n 'ObjectLiteralExpression',\n (node: ObjectLiteralExpression) => {\n return factory.createObjectLiteralExpression(\n [\n factory.createPropertyAssignment(\n 'define',\n factory.createObjectLiteralExpression(\n [\n factory.createPropertyAssignment(\n 'global',\n factory.createObjectLiteralExpression()\n ),\n ],\n true\n )\n ),\n ...node.properties,\n ],\n true\n );\n }\n )\n .getFullText();\n }\n\n if (schema.bundler === 'vite') {\n viteConfigUpdatedContents = tsquery\n .map(\n ast(viteConfigUpdatedContents),\n 'ObjectLiteralExpression',\n (node: ObjectLiteralExpression) => {\n const updatedProperties = node.properties.map((prop) => {\n if (\n isPropertyAssignment(prop) &&\n prop.name.getText() === 'build'\n ) {\n const buildConfig = prop.initializer as ObjectLiteralExpression;\n return factory.createPropertyAssignment(\n 'build',\n factory.createObjectLiteralExpression(\n buildConfig.properties.map((buildProp) => {\n if (\n isPropertyAssignment(buildProp) &&\n buildProp.name.getText() === 'outDir'\n ) {\n return factory.createPropertyAssignment(\n 'outDir',\n factory.createStringLiteral(\n joinPathFragments(getRelativePathToRoot(tree, fullyQualifiedName), 'dist', websiteContentPath)\n )\n );\n }\n return buildProp;\n }),\n true\n )\n );\n }\n return prop;\n });\n return factory.createObjectLiteralExpression(\n updatedProperties,\n true\n );\n }\n )\n .getFullText();\n }\n\n if (viteConfigContents !== viteConfigUpdatedContents) {\n tree.write(viteConfigPath, viteConfigUpdatedContents);\n }\n }\n\n updateJson(tree, joinPathFragments(websiteContentPath, 'tsconfig.json'), (tsconfig) => ({\n ...tsconfig,\n compilerOptions: {\n ...tsconfig.compilerOptions,\n moduleResolution: 'Bundler',\n module: 'Preserve',\n },\n }));\n\n updateJson(tree, joinPathFragments(websiteContentPath, 'tsconfig.app.json'), (tsconfig) => ({\n ...tsconfig,\n compilerOptions: {\n ...tsconfig.compilerOptions,\n lib: [\"DOM\"]\n },\n }));\n\n addDependenciesToPackageJson(\n tree,\n withVersions([\n '@aws-northstar/ui',\n '@cloudscape-design/components',\n '@cloudscape-design/board-components',\n 'react-router-dom',\n ]),\n {}\n );\n\n await formatFiles(tree);\n\n return () => {\n if (!schema.skipInstall) {\n installPackagesTask(tree);\n }\n };\n}\n\nexport default appGenerator;\n"],"names":["appGenerator","tree","schema","npmScopePrefix","getNpmScopePrefix","fullyQualifiedName","name","websiteContentPath","joinPathFragments","directory","process","env","NX_IGNORE_UNSUPPORTED_TS_SETUP","e2eTestRunner","applicationGenerator","routing","addPlugin","configureTsProject","dir","sharedConstructsGenerator","websiteNameKebabCase","kebabCase","constructsPath","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","exists","generateFiles","__dirname","scopeAlias","toScopeAlias","addDependenciesToPackageJson","withVersions","sharedConstructsIndexTsPath","sharedConstructsIndexContents","read","toString","staticWebsiteExportDeclaration","factory","createExportDeclaration","undefined","createStringLiteral","updatedIndex","tsquery","map","ast","node","statements","getFullText","write","updateJson","config","targets","build","dependsOn","projectConfig","readProjectConfiguration","libraryRoot","root","delete","e2eFullyQualifiedName","e2eRoot","names","viteConfigPath","viteConfigContents","viteConfigUpdatedContents","unitTestRunner","createObjectLiteralExpression","createPropertyAssignment","properties","bundler","updatedProperties","prop","isPropertyAssignment","getText","buildConfig","initializer","buildProp","getRelativePathToRoot","tsconfig","compilerOptions","moduleResolution","module","lib","formatFiles","skipInstall","installPackagesTask"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAgCsBA,YAAY;eAAZA;;IA8PtB,OAA4B;eAA5B;;;;;wBAnRO;yBACsB;4BAMtB;uBAE8B;kCAK9B;0BACyC;0EAC1B;gCACa;0BACN;uBACS;AAE/B,eAAeA,aAAaC,IAAU,EAAEC,MAA0B;QAsI5CD;IArI3B,MAAME,iBAAiBC,IAAAA,2BAAiB,EAACH;IACzC,MAAMI,qBAAqB,CAAC,EAAEF,eAAe,EAAED,OAAOI,IAAI,CAAC,CAAC;QACfJ;IAA7C,MAAMK,qBAAqBC,IAAAA,yBAAiB,EAACN,CAAAA,oBAAAA,OAAOO,SAAS,YAAhBP,oBAAoB,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B;gCACA,OAAOpC,mBAAO,CAAC8B,wBAAwB,CACrC,UACA9B,mBAAO,CAACG,mBAAmB,CACzBhC,IAAAA,yBAAiB,EAACqE,IAAAA,4BAAqB,EAAC5E,MAAMI,qBAAqB,QAAQE;4BAGjF;4BACA,OAAOqE;wBACT,IACA;oBAGN;oBACA,OAAOL;gBACT;gBACA,OAAOlC,mBAAO,CAAC6B,6BAA6B,CAC1CI,mBACA;YAEJ,GAEDvB,WAAW;QAChB;QAEA,IAAIgB,uBAAuBC,2BAA2B;YACpD/D,KAAK+C,KAAK,CAACc,gBAAgBE;QAC7B;IACF;IAEAf,IAAAA,kBAAU,EAAChD,MAAMO,IAAAA,yBAAiB,EAACD,oBAAoB,kBAAkB,CAACuE,WAAc,eACnFA;YACHC,iBAAiB,eACZD,SAASC,eAAe;gBAC3BC,kBAAkB;gBAClBC,QAAQ;;;IAIZhC,IAAAA,kBAAU,EAAChD,MAAMO,IAAAA,yBAAiB,EAACD,oBAAoB,sBAAsB,CAACuE,WAAc,eACvFA;YACHC,iBAAiB,eACZD,SAASC,eAAe;gBAC3BG,KAAK;oBAAC;iBAAM;;;IAIhBpD,IAAAA,oCAA4B,EAC1B7B,MACA8B,IAAAA,sBAAY,EAAC;QACX;QACA;QACA;QACA;KACD,GACD,CAAC;IAGH,MAAMoD,IAAAA,mBAAW,EAAClF;IAElB,OAAO;QACL,IAAI,CAACC,OAAOkF,WAAW,EAAE;YACvBC,IAAAA,2BAAmB,EAACpF;QACtB;IACF;AACF;MAEA,WAAeD"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+
6
+ //# sourceMappingURL=schema.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/cloudscape-website/app/schema.d.ts"],"names":[],"rangeMappings":"","mappings":""}
@@ -0,0 +1,35 @@
1
+ import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
+ import { SupportedStyles } from '@nx/react';
3
+ import { Linter } from '@nx/eslint';
4
+
5
+ export interface AppGeneratorSchema {
6
+ name: string;
7
+ style: SupportedStyles;
8
+ skipFormat?: boolean;
9
+ directory?: string;
10
+ projectNameAndRootFormat?: ProjectNameAndRootFormat;
11
+ tags?: string;
12
+ unitTestRunner?: 'jest' | 'vitest' | 'none';
13
+ inSourceTests?: boolean;
14
+ // TODO: consider exposing if swc paths issue can be addressed https://github.com/swc-project/swc/discussions/8396
15
+ // or if alternative compiler can be used for e2e tests
16
+ // e2eTestRunner: 'cypress' | 'playwright' | 'none';
17
+ linter: Linter;
18
+ pascalCaseFiles?: boolean;
19
+ classComponent?: boolean;
20
+ routing?: boolean;
21
+ skipNxJson?: boolean;
22
+ js?: boolean;
23
+ globalCss?: boolean;
24
+ strict?: boolean;
25
+ setParserOptionsProject?: boolean;
26
+ compiler?: 'babel' | 'swc';
27
+ remotes?: string[];
28
+ devServerPort?: number;
29
+ skipPackageJson?: boolean;
30
+ rootProject?: boolean;
31
+ bundler?: 'webpack' | 'vite' | 'rspack';
32
+ minimal?: boolean;
33
+ addPlugin?: boolean;
34
+ skipInstall?: boolean;
35
+ }