@aws/nx-plugin-mcp 1.0.0-rc.4 → 1.0.0-rc.5
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.
package/docs/guides/license.mdx
CHANGED
|
@@ -6,10 +6,12 @@ generator: license
|
|
|
6
6
|
import { FileTree } from '@astrojs/starlight/components';
|
|
7
7
|
import RunGenerator from '@components/run-generator.astro';
|
|
8
8
|
import GeneratorParameters from '@components/generator-parameters.astro';
|
|
9
|
+
import Drawer from '@components/drawer.astro';
|
|
10
|
+
import LicenseAllowlist from '@components/license-allowlist.astro';
|
|
11
|
+
import NxCommands from '@components/nx-commands.astro';
|
|
12
|
+
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
This generator registers a [sync generator](https://nx.dev/concepts/sync-generators) 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 (`package.json`, `pyproject.toml`).
|
|
14
|
+
Manage licensing across your workspace: synchronise `LICENSE` files and source code headers for your own code (`license.source`), and check that every dependency conforms to a license allowlist (`license.dependencies`).
|
|
13
15
|
|
|
14
16
|
## Usage
|
|
15
17
|
|
|
@@ -26,15 +28,17 @@ This generator registers a [sync generator](https://nx.dev/concepts/sync-generat
|
|
|
26
28
|
The generator will create or update the following files:
|
|
27
29
|
|
|
28
30
|
<FileTree>
|
|
29
|
-
- nx.json The lint target is configured to run the license sync generator
|
|
30
|
-
- aws-nx-plugin.config.mts Configuration for
|
|
31
|
+
- nx.json The lint target is configured to run the license sync generator and depends on the license-check target
|
|
32
|
+
- aws-nx-plugin.config.mts Configuration for license source sync (`license.source`) and dependency checking (`license.dependencies`)
|
|
31
33
|
</FileTree>
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
## License Headers & Files
|
|
36
|
+
|
|
37
|
+
The generator registers a [sync generator](https://nx.dev/concepts/sync-generators) to execute as part of your `lint` targets which ensures that your source files contain the correct license headers, your projects contain `LICENSE` files, and licensing metadata is set in `package.json` and `pyproject.toml`.
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
### Workflow
|
|
36
40
|
|
|
37
|
-
Whenever you build your projects (and a `lint` target runs), the license sync generator will make sure that the licensing in your project matches your configuration
|
|
41
|
+
Whenever you build your projects (and a `lint` target runs), the license sync generator will make sure that the licensing in your project matches your configuration. If it detects that anything is out of sync, you will receive a message such as:
|
|
38
42
|
|
|
39
43
|
```bash
|
|
40
44
|
NX The workspace is out of sync
|
|
@@ -67,40 +71,36 @@ Select `Yes` to sync the changes.
|
|
|
67
71
|
Make sure you check the changes the license sync generator makes in to version control to ensure that any continuous integration build tasks don't fail due to licenses being out of sync.
|
|
68
72
|
:::
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
### Sync Behaviour
|
|
71
75
|
|
|
72
76
|
The license sync generator performs three main tasks:
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
#### 1. Synchronise Source File License Headers
|
|
75
79
|
|
|
76
80
|
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).
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### 2. Synchronise LICENSE Files
|
|
82
|
+
#### 2. Synchronise LICENSE Files
|
|
81
83
|
|
|
82
84
|
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.
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### 3. Synchronise licensing information in project files
|
|
86
|
+
#### 3. Synchronise licensing information in project files
|
|
87
87
|
|
|
88
88
|
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.
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
## Configuration
|
|
90
|
+
### Header & File Configuration
|
|
93
91
|
|
|
94
92
|
Configuration is defined in the `aws-nx-plugin.config.mts` file in the root of your workspace.
|
|
95
93
|
|
|
96
|
-
|
|
94
|
+
#### SPDX and Copyright Holder
|
|
97
95
|
|
|
98
96
|
Your chosen license can be updated at any time via the `spdx` configuration property:
|
|
99
97
|
|
|
100
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
98
|
+
```typescript title="aws-nx-plugin.config.mts" {4}
|
|
101
99
|
export default {
|
|
102
100
|
license: {
|
|
103
|
-
|
|
101
|
+
source: {
|
|
102
|
+
spdx: 'MIT',
|
|
103
|
+
},
|
|
104
104
|
},
|
|
105
105
|
} satisfies AwsNxPluginConfig;
|
|
106
106
|
```
|
|
@@ -109,36 +109,38 @@ When the sync generator runs, all `LICENSE` files, `package.json` and `pyproject
|
|
|
109
109
|
|
|
110
110
|
You can additionally configure the copyright holder and copyright year, which are included in some `LICENSE` files:
|
|
111
111
|
|
|
112
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
112
|
+
```typescript title="aws-nx-plugin.config.mts" {5,6}
|
|
113
113
|
export default {
|
|
114
114
|
license: {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
source: {
|
|
116
|
+
spdx: 'MIT',
|
|
117
|
+
copyrightHolder: 'Amazon.com, Inc. or its affiliates',
|
|
118
|
+
copyrightYear: 2025,
|
|
119
|
+
},
|
|
118
120
|
},
|
|
119
121
|
} satisfies AwsNxPluginConfig;
|
|
120
122
|
```
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
#### Content
|
|
124
|
+
#### License Header Content
|
|
125
125
|
|
|
126
126
|
The license header content can be configured in two ways:
|
|
127
127
|
|
|
128
128
|
1. Using inline content:
|
|
129
129
|
|
|
130
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
130
|
+
```typescript title="aws-nx-plugin.config.mts" {6-10}
|
|
131
131
|
export default {
|
|
132
132
|
license: {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
source: {
|
|
134
|
+
header: {
|
|
135
|
+
content: {
|
|
136
|
+
lines: [
|
|
137
|
+
'Copyright: My Company, Incorporated.',
|
|
138
|
+
'Licensed under the MIT License',
|
|
139
|
+
'All rights reserved',
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
// ... format configuration
|
|
140
143
|
}
|
|
141
|
-
// ... format configuration
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
} satisfies AwsNxPluginConfig;
|
|
@@ -146,51 +148,55 @@ export default {
|
|
|
146
148
|
|
|
147
149
|
2. Loading from a file:
|
|
148
150
|
|
|
149
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
151
|
+
```typescript title="aws-nx-plugin.config.mts" {6}
|
|
150
152
|
export default {
|
|
151
153
|
license: {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
source: {
|
|
155
|
+
header: {
|
|
156
|
+
content: {
|
|
157
|
+
filePath: 'license-header.txt'; // relative to workspace root
|
|
158
|
+
}
|
|
159
|
+
// ... format configuration
|
|
155
160
|
}
|
|
156
|
-
// ... format configuration
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
} satisfies AwsNxPluginConfig;
|
|
160
164
|
```
|
|
161
165
|
|
|
162
|
-
#### Format
|
|
166
|
+
#### Header Format
|
|
163
167
|
|
|
164
168
|
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:
|
|
165
169
|
|
|
166
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
170
|
+
```typescript title="aws-nx-plugin.config.mts" {8-30}
|
|
167
171
|
export default {
|
|
168
172
|
license: {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
format: {
|
|
174
|
-
// Line comments
|
|
175
|
-
'**/*.ts': {
|
|
176
|
-
lineStart: '// ',
|
|
177
|
-
},
|
|
178
|
-
// Block comments
|
|
179
|
-
'**/*.css': {
|
|
180
|
-
blockStart: '/*',
|
|
181
|
-
blockEnd: '*/',
|
|
173
|
+
source: {
|
|
174
|
+
header: {
|
|
175
|
+
content: {
|
|
176
|
+
lines: ['Copyright notice here'],
|
|
182
177
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
178
|
+
format: {
|
|
179
|
+
// Line comments
|
|
180
|
+
'**/*.ts': {
|
|
181
|
+
lineStart: '// ',
|
|
182
|
+
},
|
|
183
|
+
// Block comments
|
|
184
|
+
'**/*.css': {
|
|
185
|
+
blockStart: '/*',
|
|
186
|
+
blockEnd: '*/',
|
|
187
|
+
},
|
|
188
|
+
// Block comments with line prefixes
|
|
189
|
+
'**/*.java': {
|
|
190
|
+
blockStart: '/*',
|
|
191
|
+
lineStart: ' * ',
|
|
192
|
+
blockEnd: ' */',
|
|
193
|
+
},
|
|
194
|
+
// Line comments with header/footer
|
|
195
|
+
'**/*.py': {
|
|
196
|
+
blockStart: '# ------------',
|
|
197
|
+
lineStart: '# ',
|
|
198
|
+
blockEnd: '# ------------',
|
|
199
|
+
},
|
|
194
200
|
},
|
|
195
201
|
},
|
|
196
202
|
},
|
|
@@ -209,27 +215,29 @@ The format configuration supports:
|
|
|
209
215
|
|
|
210
216
|
For file types that aren't natively supported, you can specify custom comment syntax to tell the sync generator how to identify existing license headers in these file types.
|
|
211
217
|
|
|
212
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
218
|
+
```typescript title="aws-nx-plugin.config.mts" {13-23}
|
|
213
219
|
export default {
|
|
214
220
|
license: {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
format: {
|
|
220
|
-
'**/*.xyz': {
|
|
221
|
-
lineStart: '## ',
|
|
221
|
+
source: {
|
|
222
|
+
header: {
|
|
223
|
+
content: {
|
|
224
|
+
lines: ['My license header'],
|
|
222
225
|
},
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
format: {
|
|
227
|
+
'**/*.xyz': {
|
|
228
|
+
lineStart: '## ',
|
|
229
|
+
},
|
|
227
230
|
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Define
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
commentSyntax: {
|
|
232
|
+
xyz: {
|
|
233
|
+
line: '##', // Define line comment syntax
|
|
234
|
+
},
|
|
235
|
+
abc: {
|
|
236
|
+
block: {
|
|
237
|
+
// Define block comment syntax
|
|
238
|
+
start: '<!--',
|
|
239
|
+
end: '-->',
|
|
240
|
+
},
|
|
233
241
|
},
|
|
234
242
|
},
|
|
235
243
|
},
|
|
@@ -238,56 +246,203 @@ export default {
|
|
|
238
246
|
} satisfies AwsNxPluginConfig;
|
|
239
247
|
```
|
|
240
248
|
|
|
241
|
-
#### Excluding
|
|
249
|
+
#### Excluding Files from Header Sync
|
|
242
250
|
|
|
243
251
|
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.
|
|
244
252
|
|
|
245
253
|
You can exclude additional files from license header synchronization using glob patterns:
|
|
246
254
|
|
|
247
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
255
|
+
```typescript title="aws-nx-plugin.config.mts" {13}
|
|
248
256
|
export default {
|
|
249
257
|
license: {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
258
|
+
source: {
|
|
259
|
+
header: {
|
|
260
|
+
content: {
|
|
261
|
+
lines: ['My license header'],
|
|
262
|
+
},
|
|
263
|
+
format: {
|
|
264
|
+
'**/*.ts': {
|
|
265
|
+
lineStart: '// ',
|
|
266
|
+
},
|
|
257
267
|
},
|
|
268
|
+
exclude: ['**/generated/**', '**/dist/**', 'some-specific-file.ts'],
|
|
258
269
|
},
|
|
259
|
-
exclude: ['**/generated/**', '**/dist/**', 'some-specific-file.ts'],
|
|
260
270
|
},
|
|
261
271
|
},
|
|
262
272
|
} satisfies AwsNxPluginConfig;
|
|
263
273
|
```
|
|
264
274
|
|
|
265
|
-
|
|
275
|
+
#### Excluding Projects from File Sync
|
|
266
276
|
|
|
267
277
|
All `LICENSE` files, `package.json` files and `pyproject.toml` files are synchronised with the configured license by default.
|
|
268
278
|
|
|
269
279
|
You can exclude specific projects or files from synchronization using glob patterns:
|
|
270
280
|
|
|
271
|
-
```typescript title="aws-nx-plugin.config.mts" {
|
|
281
|
+
```typescript title="aws-nx-plugin.config.mts" {4-11}
|
|
272
282
|
export default {
|
|
273
283
|
license: {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
284
|
+
source: {
|
|
285
|
+
files: {
|
|
286
|
+
exclude: [
|
|
287
|
+
// do not sync LICENSE file, package.json or pyproject.toml
|
|
288
|
+
'packages/excluded-project',
|
|
289
|
+
// do not sync LICENSE file, but sync package.json and/or pyproject.toml
|
|
290
|
+
'apps/internal/LICENSE',
|
|
291
|
+
];
|
|
292
|
+
}
|
|
281
293
|
}
|
|
282
294
|
}
|
|
283
295
|
} satisfies AwsNxPluginConfig;
|
|
284
296
|
```
|
|
285
297
|
|
|
286
|
-
|
|
298
|
+
### Disabling License Sync
|
|
287
299
|
|
|
288
|
-
|
|
300
|
+
License source sync is enabled by the presence of the `license.source` key in your configuration. To disable it:
|
|
289
301
|
|
|
290
|
-
1. Remove the `license` section from your configuration in `aws-nx-plugin.config.mts` (
|
|
291
|
-
2.
|
|
302
|
+
1. Remove the `license.source` section from your configuration in `aws-nx-plugin.config.mts` (you can keep `license.dependencies` if you still want dependency license checking)
|
|
303
|
+
2. If you also want to fully remove the sync generator, remove the `@aws/nx-plugin:license#sync` generator from `targetDefaults.lint.syncGenerators`
|
|
292
304
|
|
|
293
305
|
To re-enable license sync, simply run the `license` generator again.
|
|
306
|
+
|
|
307
|
+
## Dependency License Checks
|
|
308
|
+
|
|
309
|
+
The `license` generator also configures a `license-check` target that fails when one of your project's dependencies (or any transitive dependency) declares a license that is not in your allowlist.
|
|
310
|
+
|
|
311
|
+
### How it runs
|
|
312
|
+
|
|
313
|
+
The generator writes a `license-check` target to your root `project.json`:
|
|
314
|
+
|
|
315
|
+
```json title="project.json"
|
|
316
|
+
{
|
|
317
|
+
"targets": {
|
|
318
|
+
"license-check": {
|
|
319
|
+
"executor": "@aws/nx-plugin:license-check",
|
|
320
|
+
"cache": true,
|
|
321
|
+
"inputs": [
|
|
322
|
+
"{workspaceRoot}/pnpm-lock.yaml",
|
|
323
|
+
"{workspaceRoot}/aws-nx-plugin.config.mts"
|
|
324
|
+
],
|
|
325
|
+
"options": {}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
The `inputs` are computed for your workspace: only lockfiles that are actually present are included, along with `aws-nx-plugin.config.mts`, plus a `{workspaceRoot}/**/uv.lock` glob when Python dependency checking is enabled (i.e. a Python collector is configured).
|
|
332
|
+
|
|
333
|
+
You can run the check directly:
|
|
334
|
+
|
|
335
|
+
<NxCommands commands={['license-check']} />
|
|
336
|
+
|
|
337
|
+
Results are cached against your lockfiles and `aws-nx-plugin.config.mts` — re-runs are instant when nothing has changed.
|
|
338
|
+
|
|
339
|
+
Collectors determine what gets scanned. The `npmCollector` uses [license-checker-rseidelsohn](https://github.com/nicedoc/license-checker-rseidelsohn), and the `pythonCollector` uses [pip-licenses](https://github.com/raimon49/pip-licenses). If no installed dependencies are found, the check passes with nothing to inspect.
|
|
340
|
+
|
|
341
|
+
### Running as part of lint/build
|
|
342
|
+
|
|
343
|
+
The dependency license check runs automatically whenever you `lint` or `build` any project in your workspace. The `license` generator wires each project's `lint` target to depend on the root `license-check` target, and the project generators (`ts#*` and `py#*`) do the same when they run — so the check is wired up regardless of the order generators are run in.
|
|
344
|
+
|
|
345
|
+
This means you don't need to run the check explicitly, though you can still do so with the `license-check` target:
|
|
346
|
+
|
|
347
|
+
<NxCommands commands={['license-check']} />
|
|
348
|
+
|
|
349
|
+
The wiring is a cross-project `dependsOn` on each project's `lint` target that points at the root `license-check` target. To skip the check during a lint or build, set the `LICENSE_DEPENDENCY_CHECK=skip` environment variable:
|
|
350
|
+
|
|
351
|
+
<PackageManagerShortCommand commands={["LICENSE_DEPENDENCY_CHECK=skip lint"]} />
|
|
352
|
+
|
|
353
|
+
### Configuration
|
|
354
|
+
|
|
355
|
+
By default the check uses a built-in set of common permissive licenses (MIT, Apache-2.0, BSD, ISC, etc.) exported as `DEFAULT_LICENSE_ALLOWLIST`. You can extend or override this in your config:
|
|
356
|
+
|
|
357
|
+
```typescript title="aws-nx-plugin.config.mts"
|
|
358
|
+
import { AwsNxPluginConfig } from '@aws/nx-plugin';
|
|
359
|
+
import { DEFAULT_LICENSE_ALLOWLIST } from '@aws/nx-plugin/sdk/license';
|
|
360
|
+
|
|
361
|
+
export default {
|
|
362
|
+
license: {
|
|
363
|
+
// ...
|
|
364
|
+
dependencies: {
|
|
365
|
+
allow: [...DEFAULT_LICENSE_ALLOWLIST, { spdxId: 'LGPL-2.1-or-later', fullName: 'GNU Lesser General Public License v2.1 or later', aliases: [] }],
|
|
366
|
+
exceptions: [
|
|
367
|
+
{ package: 'some-package', reason: 'Audited manually — ships MIT text without SPDX field' },
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
} satisfies AwsNxPluginConfig;
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
<Drawer title="Default License Allowlist" trigger="View the full list of licenses in DEFAULT_LICENSE_ALLOWLIST">
|
|
375
|
+
<LicenseAllowlist />
|
|
376
|
+
</Drawer>
|
|
377
|
+
|
|
378
|
+
#### Customizing the allowlist
|
|
379
|
+
|
|
380
|
+
To restrict the allowlist, replace `DEFAULT_LICENSE_ALLOWLIST` with your own array. To extend it, spread the default and add entries. Entries are matched by SPDX id, full license name, or any of the listed aliases (case-insensitive).
|
|
381
|
+
|
|
382
|
+
#### Per-package exceptions
|
|
383
|
+
|
|
384
|
+
Use `exceptions` for packages that fail the check — either because their license is not in the allowlist, or because they ship without detectable license metadata. The `reason` field is required so reviewers can see why the exception was granted.
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
exceptions: [
|
|
388
|
+
{
|
|
389
|
+
package: 'union',
|
|
390
|
+
version: '0.5.0',
|
|
391
|
+
reason: 'Package ships verbatim MIT text without declaring license',
|
|
392
|
+
},
|
|
393
|
+
];
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Generators that introduce dependencies with problematic metadata (e.g. the MCP server generator) automatically add the required exceptions to your config when they run.
|
|
397
|
+
|
|
398
|
+
#### Collectors
|
|
399
|
+
|
|
400
|
+
Collectors discover dependencies and extract license metadata. The built-in collectors are `npmCollector()` (scans `node_modules`) and `pythonCollector()` (scans Python virtual environments). The license generator configures `npmCollector()` by default and adds `pythonCollector()` when Python projects are present.
|
|
401
|
+
|
|
402
|
+
To implement a custom collector, conform to the `LicenseCollector` interface:
|
|
403
|
+
|
|
404
|
+
```typescript
|
|
405
|
+
import type { LicenseCollector } from '@aws/nx-plugin/sdk/license';
|
|
406
|
+
|
|
407
|
+
const myCollector = (): LicenseCollector => ({
|
|
408
|
+
name: 'my-ecosystem',
|
|
409
|
+
traceCommand: 'my-tool why <package>',
|
|
410
|
+
async collect({ workspaceRoot }) {
|
|
411
|
+
return [
|
|
412
|
+
{ name: 'some-dep', version: '1.0.0', rawLicense: 'MIT', ecosystem: 'my-ecosystem' },
|
|
413
|
+
];
|
|
414
|
+
},
|
|
415
|
+
});
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
#### The onDependency hook
|
|
419
|
+
|
|
420
|
+
`license.dependencies` accepts an optional `onDependency` callback that is invoked once for every discovered dependency, regardless of whether it passes or fails the check. It receives `{ package, spdx }`, where `package` is the package name and `spdx` is the resolved SPDX license expression. An exception's `spdx` takes precedence over the raw declared license, and `spdx` may be an empty string if no license was declared.
|
|
421
|
+
|
|
422
|
+
This is a handy way to print out all of the licenses across your project. Run the `license-check` target to see the output:
|
|
423
|
+
|
|
424
|
+
```typescript title="aws-nx-plugin.config.mts"
|
|
425
|
+
import { AwsNxPluginConfig } from '@aws/nx-plugin';
|
|
426
|
+
import { DEFAULT_LICENSE_ALLOWLIST } from '@aws/nx-plugin/sdk/license';
|
|
427
|
+
|
|
428
|
+
export default {
|
|
429
|
+
license: {
|
|
430
|
+
dependencies: {
|
|
431
|
+
allow: DEFAULT_LICENSE_ALLOWLIST,
|
|
432
|
+
onDependency: ({ package: pkg, spdx }) => {
|
|
433
|
+
console.log(`${pkg} - ${spdx}`);
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
} satisfies AwsNxPluginConfig;
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Disabling Dependency Checks
|
|
441
|
+
|
|
442
|
+
Dependency license checking is enabled by the presence of the `license.dependencies` key in your configuration.
|
|
443
|
+
|
|
444
|
+
To disable the checks for a single run, set the `LICENSE_DEPENDENCY_CHECK=skip` environment variable:
|
|
445
|
+
|
|
446
|
+
<PackageManagerShortCommand commands={["LICENSE_DEPENDENCY_CHECK=skip lint"]} />
|
|
447
|
+
|
|
448
|
+
To disable permanently, remove the `license.dependencies` key from your configuration in `aws-nx-plugin.config.mts`. You can also re-run the `license` generator with `--dependencyCheck=false` to scaffold without it.
|
package/docs/guides/ts-rdb.mdx
CHANGED
|
@@ -38,8 +38,8 @@ The generator will create the following project structure in the `<directory>/<n
|
|
|
38
38
|
- example.prisma Example model definition
|
|
39
39
|
- schema.prisma Main Prisma schema (references models)
|
|
40
40
|
- scripts
|
|
41
|
-
-
|
|
42
|
-
-
|
|
41
|
+
- pull-image.ts Pulls the database container image for local development
|
|
42
|
+
- start-container.ts Starts a local database container
|
|
43
43
|
- wait-for-db.ts Waits for the local database to be ready
|
|
44
44
|
- src
|
|
45
45
|
- index.ts Project entry point
|
|
@@ -169,7 +169,7 @@ The client automatically:
|
|
|
169
169
|
|
|
170
170
|
After adding or updating models under `prisma/models/`, use `migrate dev` to generate migration files and apply them to your local database at the same time.
|
|
171
171
|
|
|
172
|
-
The generated `prisma` target automatically starts a local database
|
|
172
|
+
The generated `prisma` target automatically starts a local database container before running:
|
|
173
173
|
|
|
174
174
|
<NxCommands commands={['run <project>:prisma migrate dev']} />
|
|
175
175
|
|
|
@@ -204,12 +204,26 @@ The generated `prisma` target exposes the Prisma CLI, so you can use it to run a
|
|
|
204
204
|
|
|
205
205
|
<NxCommands commands={['run <project>:prisma <prisma-command>']} />
|
|
206
206
|
|
|
207
|
-
### Prisma Studio
|
|
207
|
+
### Using Prisma Studio
|
|
208
208
|
|
|
209
209
|
[Prisma Studio](https://www.prisma.io/studio) is a visual editor for your local database. Use it to browse tables, inspect and edit records, filter data, follow relations, and run raw SQL via the built-in SQL console. It is useful for verifying migrations and seeding test data during development. Launch it with:
|
|
210
210
|
|
|
211
211
|
<NxCommands commands={['run <project>:prisma studio']} />
|
|
212
212
|
|
|
213
|
+
### Stopping the Local Database
|
|
214
|
+
|
|
215
|
+
Stopping `serve-local` (e.g. with `Ctrl+C`) automatically removes the local database container, but preserves the named volume so your data persists across restarts.
|
|
216
|
+
|
|
217
|
+
:::caution[Windows]
|
|
218
|
+
Due to limitations with signal handling on Windows, the container is not automatically removed when `serve-local` is stopped. You will need to remove it manually:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
<engine> rm -f <scope>-<db-name>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Replace `<engine>` with your container engine (`docker` or `finch`), `<scope>` with your Nx workspace scope (e.g. `proj`), and `<db-name>` with your database project name (e.g. `my-db`).
|
|
225
|
+
:::
|
|
226
|
+
|
|
213
227
|
## Connecting to the Database
|
|
214
228
|
|
|
215
229
|
In any TypeScript project, import `getPrisma` from your database package and call it to get a type-safe Prisma client:
|
|
@@ -524,9 +538,9 @@ module "my_database" {
|
|
|
524
538
|
|
|
525
539
|
Pin a specific Aurora engine version.
|
|
526
540
|
|
|
527
|
-
By default, the generated local
|
|
541
|
+
By default, the generated local database container image matches the default Aurora engine version. If you change the Aurora engine version, it's recommended to also use a matching local container image version for maximum compatibility. See the AWS release notes for [Aurora PostgreSQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraPostgreSQLReleaseNotes/aurorapostgresql-release-calendar.html) and [Aurora MySQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraMySQLReleaseNotes/AuroraMySQL.Updates.30Updates.html) to identify the corresponding community database version.
|
|
528
542
|
|
|
529
|
-
The local database image is configured in the generated database project's `serve-local` target in `project.json`. Update the image argument passed to `scripts/
|
|
543
|
+
The local database image is configured in the generated database project's `serve-local` target in `project.json`. Update the image argument passed to `scripts/start-container.ts` when you change engine versions.
|
|
530
544
|
|
|
531
545
|
<OptionFilter when={{ engine: 'postgres' }}>
|
|
532
546
|
<Infrastructure>
|
|
@@ -4,7 +4,7 @@ title: Required Prerequisites
|
|
|
4
4
|
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
|
5
5
|
- [Node >= 22](https://nodejs.org/en/download) (We recommend using something like [NVM](https://github.com/nvm-sh/nvm) to manage your node versions)
|
|
6
6
|
- verify by running `node --version`
|
|
7
|
-
- [PNPM >=
|
|
7
|
+
- [PNPM >= 11](https://pnpm.io/installation#using-npm) (you can also use [Yarn >= 4](https://yarnpkg.com/getting-started/install), [Bun >= 1](https://bun.sh/docs/installation), or [NPM >= 10](https://nodejs.org/en/learn/getting-started/an-introduction-to-the-npm-package-manager) if you prefer)
|
|
8
8
|
- verify by running `pnpm --version`, `yarn --version`, `bun --version` or `npm --version`
|
|
9
9
|
- [UV >= 0.5.29](https://docs.astral.sh/uv/getting-started/installation/)
|
|
10
10
|
1. install Python 3.14 by running: `uv python install 3.14.0`
|
package/package.json
CHANGED
package/src/license/schema.json
CHANGED
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"description": "The copyright holder, included in the LICENSE file and source file headers by default.",
|
|
18
18
|
"default": "Amazon.com, Inc. or its affiliates",
|
|
19
19
|
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"dependencyCheck": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Configure a license-check target that fails when dependencies declare licenses outside the configured allowlist.",
|
|
24
|
+
"default": true,
|
|
25
|
+
"x-priority": "important"
|
|
20
26
|
}
|
|
21
27
|
},
|
|
22
28
|
"required": []
|