@aws/nx-plugin 0.26.0 → 0.28.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 (68) hide show
  1. package/package.json +1 -1
  2. package/src/api-connection/generator.js +0 -2
  3. package/src/api-connection/generator.js.map +1 -1
  4. package/src/api-connection/schema.d.ts +0 -1
  5. package/src/api-connection/schema.json +0 -7
  6. package/src/cloudscape-website/app/generator.js +1 -0
  7. package/src/cloudscape-website/app/generator.js.map +1 -1
  8. package/src/infra/app/__snapshots__/generator.spec.ts.snap +9 -0
  9. package/src/infra/app/generator.js +1 -0
  10. package/src/infra/app/generator.js.map +1 -1
  11. package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +31 -30
  12. package/src/py/fast-api/generator.js +3 -0
  13. package/src/py/fast-api/generator.js.map +1 -1
  14. package/src/py/fast-api/react/__snapshots__/generator.spec.ts.snap +68 -1
  15. package/src/py/fast-api/react/files/website/components/__apiNameClassName__Provider.tsx.template +27 -1
  16. package/src/py/fast-api/react/generator.js +7 -17
  17. package/src/py/fast-api/react/generator.js.map +1 -1
  18. package/src/py/fast-api/react/schema.d.ts +0 -1
  19. package/src/py/fast-api/react/schema.json +0 -7
  20. package/src/py/fast-api/schema.d.ts +1 -0
  21. package/src/py/fast-api/schema.json +9 -1
  22. package/src/py/project/generator.js +1 -0
  23. package/src/py/project/generator.js.map +1 -1
  24. package/src/py/project/schema.json +7 -2
  25. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +680 -84
  26. package/src/trpc/backend/files/backend/src/client/index.ts.template +22 -2
  27. package/src/trpc/backend/files/backend/src/middleware/index.ts.template +2 -3
  28. package/src/trpc/backend/files/backend/src/router.ts.template +2 -3
  29. package/src/trpc/backend/generator.js +21 -5
  30. package/src/trpc/backend/generator.js.map +1 -1
  31. package/src/trpc/backend/schema.d.ts +2 -1
  32. package/src/trpc/backend/schema.json +10 -2
  33. package/src/trpc/react/__snapshots__/generator.spec.ts.snap +186 -73
  34. package/src/trpc/react/files/src/components/__apiNameClassName__ClientProvider.tsx.template +54 -0
  35. package/src/trpc/react/files/src/hooks/use__apiNameClassName__.tsx.template +2 -2
  36. package/src/trpc/react/generator.js +13 -69
  37. package/src/trpc/react/generator.js.map +1 -1
  38. package/src/trpc/react/schema.d.ts +0 -1
  39. package/src/trpc/react/schema.json +0 -7
  40. package/src/ts/lib/__snapshots__/generator.spec.ts.snap +9 -0
  41. package/src/ts/lib/generator.js +1 -0
  42. package/src/ts/lib/generator.js.map +1 -1
  43. package/src/ts/lib/schema.json +7 -2
  44. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +3 -0
  45. package/src/ts/mcp-server/generator.js +1 -0
  46. package/src/ts/mcp-server/generator.js.map +1 -1
  47. package/src/ts/mcp-server/schema.json +5 -0
  48. package/src/utils/api-constructs/api-constructs.d.ts +1 -0
  49. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  50. package/src/utils/api-constructs/files/app/apis/http/__apiNameKebabCase__.ts.template +53 -2
  51. package/src/utils/api-constructs/files/app/apis/rest/__apiNameKebabCase__.ts.template +57 -2
  52. package/src/utils/api-constructs/files/core/api/http/http-api.ts.template +1 -15
  53. package/src/utils/api-constructs/files/core/api/rest/rest-api.ts.template +0 -14
  54. package/src/utils/nx.d.ts +4 -0
  55. package/src/utils/nx.js +9 -1
  56. package/src/utils/nx.js.map +1 -1
  57. package/src/api-connection/README.md +0 -0
  58. package/src/cloudscape-website/app/README.md +0 -289
  59. package/src/cloudscape-website/cognito-auth/README.md +0 -193
  60. package/src/infra/app/README.md +0 -200
  61. package/src/license/README.md +0 -290
  62. package/src/trpc/backend/README.md +0 -571
  63. package/src/trpc/backend/files/backend/src/client/sigv4.ts.template +0 -9
  64. package/src/trpc/react/README.md +0 -330
  65. package/src/trpc/react/files/src/components/TrpcClients/TrpcApis.tsx.template +0 -1
  66. package/src/trpc/react/files/src/components/TrpcClients/TrpcClientProviders.tsx.template +0 -10
  67. package/src/trpc/react/files/src/components/TrpcClients/TrpcProvider.tsx.template +0 -55
  68. package/src/trpc/react/files/src/components/TrpcClients/index.tsx.template +0 -5
@@ -1,290 +0,0 @@
1
- # License Generator
2
-
3
- ## Overview
4
-
5
- This generator configures `LICENSE` files and source file headers for your project. After you run this generator, a [sync generator](https://nx.dev/concepts/sync-generators) is registered to execute as part of your `lint` targets which will ensure that your source files conform to the desired license content and format, as well as ensuring that your project's LICENSE files are correct, and licensing information is included in relevant project files.
6
-
7
- ## Usage
8
-
9
- You can run the generator in two ways:
10
-
11
- ### 1. Using VSCode IDE
12
-
13
- First, install the NX Console extension for VSCode:
14
-
15
- 1. Open VSCode
16
- 2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
17
- 3. Search for "Nx Console"
18
- 4. Install [Nx Console](https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console)
19
-
20
- Then generate your API:
21
-
22
- 1. Open the NX Console in VSCode
23
- 2. Click on "Generate"
24
- 3. Search for "license"
25
- 4. Fill in the required parameters in the form
26
- 5. Click "Run"
27
-
28
- ### 2. Using CLI
29
-
30
- Generate the API:
31
-
32
- ```bash
33
- nx g @aws/nx-plugin:license --copyrightHolder="My Company, Inc." --license=MIT
34
- ```
35
-
36
- You can also perform a dry-run to see what files would be generated or updated without actually creating them:
37
-
38
- ```bash
39
- nx g @aws/nx-plugin:license --copyrightHolder="My Company, Inc." --license=MIT --dry-run
40
- ```
41
-
42
- Both methods will configure the license sync generator to ensure that your project contains the correct LICENSE files, and source files specify the correct license header.
43
-
44
- ## Input Parameters
45
-
46
- | Parameter | Type | Default | Description |
47
- | --------------- | ------ | ------------------------------------ | -------------------------------------------------------------------------------------- |
48
- | license | string | "Apache-2.0" | The SPDX license identifier for your chosen license. |
49
- | copyrightHolder | string | "Amazon.com, Inc. or its affiliates" | The copyright holder, included in the LICENSE file and source file headers by default. |
50
-
51
- ## Expected Output
52
-
53
- The generator will create or update the following files:
54
-
55
- ```
56
- └── nx.json # The "lint" target is configured to sync LICENSE files and source file headers
57
- └── aws-nx-plugin.config.mts # Configuration for the license sync, such as customising the license header content and format for different languages
58
- ```
59
-
60
- Some default configuration for license header content and format is added to `aws-nx-plugin.config.mts` to write appropriate headers for a handful of file types. You may wish to customise this further; please see the [configuration section](#configuration) below.
61
-
62
- ## License Sync Behaviour
63
-
64
- The license sync generator performs three main tasks:
65
-
66
- ### 1. Synchronise Source File License Headers
67
-
68
- When the sync generator is run, it will ensure that all source code files in your workspace (based on your configuration) contain the appropriate license header. The header is written as the first block comment or consecutive series of line comments in the file (besides the shebang/hashbang if present in a file).
69
-
70
- You can update the configuration at any time to change which files should be included or excluded, as well as the content or format of license headers for different file types. For more details, please see the [configuration section](#configuration) below.
71
-
72
- ### 2. Synchronise LICENSE Files
73
-
74
- When the sync generator is run, it will ensure that the root `LICENSE` file corresponds to your configured license, as well as ensuring that all subprojects in your workspace also contain the correct `LICENSE` file.
75
-
76
- You can exclude projects in the configuration if required. For more details, please see the [configuration section](#configuration) below.
77
-
78
- ### 3. Synchronise licensing information in project files
79
-
80
- When the sync generator is run, it will ensure the `license` fields in `package.json` and `pyproject.toml` files are set to your configured license.
81
-
82
- You can exclude projects in the configuration if required. For more details, please see the [configuration section](#configuration) below.
83
-
84
- ## Configuration
85
-
86
- Configuration is defined in the `aws-nx-plugin.config.mts` file in the root of your workspace.
87
-
88
- ### SPDX and Copyright Holder
89
-
90
- Your chosen license can be updated at any time via the `spdx` configuration property:
91
-
92
- ```typescript
93
- {
94
- license: {
95
- spdx: 'MIT',
96
- }
97
- }
98
- ```
99
-
100
- When the sync generator runs, all `LICENSE` files, `package.json` and `pyproject.toml` files will be updated to reflect the configured license.
101
-
102
- You can additionally configure the copyright holder and copyright year, which are included in some `LICENSE` files:
103
-
104
- ```typescript
105
- {
106
- license: {
107
- spdx: 'MIT',
108
- copyrightHolder: 'Amazon.com, Inc. or its affiliates',
109
- copyrightYear: 2025,
110
- }
111
- }
112
- ```
113
-
114
- ### License Headers
115
-
116
- #### Content
117
-
118
- The license header content can be configured in two ways:
119
-
120
- 1. Using inline content:
121
-
122
- ```typescript
123
- {
124
- license: {
125
- header: {
126
- content: {
127
- lines: ['Copyright My Company, Inc.', 'Licensed under MIT License', 'All rights reserved'];
128
- }
129
- // ... format configuration
130
- }
131
- }
132
- }
133
- ```
134
-
135
- 2. Loading from a file:
136
-
137
- ```typescript
138
- {
139
- license: {
140
- header: {
141
- content: {
142
- filePath: 'license-header.txt'; // relative to workspace root
143
- }
144
- // ... format configuration
145
- }
146
- }
147
- }
148
- ```
149
-
150
- #### Including files and specifying header format
151
-
152
- You can specify how license headers should be formatted for different file types using glob patterns. The format configuration supports line comments, block comments, or a combination of both:
153
-
154
- ```typescript
155
- {
156
- license: {
157
- header: {
158
- content: {
159
- lines: ['Copyright notice here']
160
- },
161
- format: {
162
- // Line comments
163
- '**/*.ts': {
164
- lineStart: '// '
165
- },
166
-
167
- // Block comments
168
- '**/*.css': {
169
- blockStart: '/*',
170
- blockEnd: '*/'
171
- },
172
-
173
- // Block comments with line prefixes
174
- '**/*.java': {
175
- blockStart: '/*',
176
- lineStart: ' * ',
177
- blockEnd: ' */'
178
- },
179
-
180
- // Line comments with header/footer
181
- '**/*.py': {
182
- blockStart: '# ------------',
183
- lineStart: '# ',
184
- blockEnd: '# ------------'
185
- }
186
- }
187
- }
188
- }
189
- }
190
- ```
191
-
192
- The format configuration supports:
193
-
194
- - `blockStart`: Text written before the license content (e.g., to start a block comment)
195
- - `lineStart`: Text prepended to each line of the license content
196
- - `lineEnd`: Text appended to each line of the license content
197
- - `blockEnd`: Text written after the license content (e.g., to end a block comment)
198
-
199
- #### Custom comment syntax
200
-
201
- For file types that aren't natively supported, you can specify custom comment syntax:
202
-
203
- ```typescript
204
- {
205
- license: {
206
- header: {
207
- content: {
208
- lines: ['My license header']
209
- },
210
- format: {
211
- '**/*.xyz': {
212
- lineStart: '## '
213
- }
214
- },
215
- commentSyntax: {
216
- xyz: {
217
- line: '##' // Define line comment syntax
218
- },
219
- abc: {
220
- block: { // Define block comment syntax
221
- start: '<!--',
222
- end: '-->'
223
- }
224
- }
225
- }
226
- }
227
- }
228
- }
229
- ```
230
-
231
- This tells the sync generator how to identify existing license headers in these file types. The `commentSyntax` configuration supports:
232
-
233
- - `line`: Characters that start a line comment
234
- - `block`: Characters that start and end a block comment
235
-
236
- #### Excluding files
237
-
238
- By default, in a git repository, all `.gitignore` files are honored to ensure that only files managed by version control are synchronized. In non-git repositories, all files are considered unless explicitly excluded in configuration.
239
-
240
- You can exclude additional files from license header synchronization using glob patterns:
241
-
242
- ```typescript
243
- {
244
- license: {
245
- header: {
246
- content: {
247
- lines: ['My license header']
248
- },
249
- format: {
250
- '**/*.ts': {
251
- lineStart: '// '
252
- }
253
- },
254
- exclude: [
255
- '**/generated/**',
256
- '**/dist/**',
257
- 'some-specific-file.ts'
258
- ]
259
- }
260
- }
261
- }
262
- ```
263
-
264
- ### Excluding project files from sync
265
-
266
- All `LICENSE` files, `package.json` files and `pyproject.toml` files are synchronised with the configured license by default.
267
-
268
- You can exclude specific projects or files from synchronization using glob patterns:
269
-
270
- ```typescript
271
- {
272
- license: {
273
- files: {
274
- exclude: [
275
- 'packages/excluded-project', // do not sync LICENSE file, package.json or pyproject.toml
276
- 'apps/internal/LICENSE', // do not sync LICENSE file, but sync package.json and/or pyproject.toml
277
- ];
278
- }
279
- }
280
- }
281
- ```
282
-
283
- ## Disabling license sync
284
-
285
- To disable the license sync generator:
286
-
287
- 1. Remove the `license` section from your configuration in `aws-nx-plugin.config.mts` (or remove the `aws-nx-plugin.config.mts` file)
288
- 2. Remove the `@aws/nx-plugin:license#sync` generator from `targetDefaults.lint.syncGenerators`
289
-
290
- To re-enable license sync, simply run the `license` generator again.