You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: accepted/0028-npm-license.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,26 @@ Given that this is something that a non-trivial number of users care about _and_
14
14
15
15
## Detailed Explanation
16
16
17
+
### Dependency implementation:
18
+
19
+
- Add a dependency on [licensee](https://www.npmjs.com/package/licensee)
20
+
- Follow the licensee API, with some modifications
21
+
- CLI configuration and commands are aliased to `npm audit license <flags/arguments>` rather than the `licensee` command
22
+
- JSON configuration can either exist in `package.json` under the `audit` property (as an object) in a `licenses` property (as an object), with the same API **or** under the `licenses` (as an object) property in a file named `audit.json`
23
+
- one of the two should take precident over the other if duplication occurs. My preference would be package.json but I can understand why others would disagree and do not hold this opinion strongly.
24
+
25
+
### Additional commands and flags:
26
+
27
+
Since this proposal moves `npm audit` into a wholistic auditing suite rather than just focusing on security, there would need to be additional commands and flags to limit specific features of audit in addition to expanding the scope of the existing flags:
28
+
29
+
-`npm audit security` should be added for consistency. This would replicate the current `npm audit` behavior, auditing dependencies for known security vulnerabilities.
30
+
-`npm audit` would now run both `npm audit security` and `npm audit license`
31
+
-`--no-audit` now blocks `npm audit` which encompasses all audits
32
+
-`--no-audit-security` should block **only security auditing**
33
+
-`--no-audit-license` should block **only license auditing**
34
+
35
+
36
+
<!-- Old "Detailed Explanation" - saved for context while drafting.
17
37
- It should be possible to get a full report of the licenses from all dependencies.
18
38
- This should be runnable from a single command: `npm audit licenses`
19
39
- Offline (default)
@@ -44,6 +64,7 @@ Given that this is something that a non-trivial number of users care about _and_
44
64
- This report should collect all licenses via the `license` properties from `package.json` files in `node_modules`, filtering out any licenses that are in `allow` and `block` in addition to any licenses or modules in `ignore`, and provide the user the option to `allow`, `block`, or `ignore` the license, one by one.
45
65
- Online (`--online`)
46
66
- This report should collect all licenses via the `license` properties from `package.json` files from a resolved dependency tree without needing the modules on disk, filtering out any licenses that are in `allow` and `block` in addition to any licenses or modules in `ignore`, and provide the user the option to `allow`, `block`, or `ignore` the license, one by one.
67
+
-->
47
68
48
69
## Rationale and Alternatives
49
70
@@ -52,7 +73,7 @@ There are a wide array of tools in the ecosystem that have been built to paper o
52
73
Alternatives considered:
53
74
54
75
- Distinct command within the CLI, outside of audit (`npm license` or `npm compliance`).
55
-
- Discarded this as it would potentially create further fragmentation where it's potentially unnecessary.
76
+
- Discarded this as it would potentially create further fragmentation of the npm CLI's user-facing components where it's potentially unnecessary. Further, since this feature only _adds_ to `npm audit`, it should not detract from the experience of those already relying on `npm audit` for security functionality until they opt-in to using licensing functionality.
56
77
- Leave it to the ecosystem.
57
78
- This has been the state of the world for about a decade, and there's still been no excessively positive tooling that's come up and solved all the problems that exist in this space while achieving widespread adoption.
58
79
@@ -74,7 +95,6 @@ Paid tooling:
74
95
Open-source tooling:
75
96
76
97
-https://www.npmjs.com/package/license-checker - relatively widely used and similar-ish to what's proposed. Also a requirable module.
77
-
-https://www.npmjs.com/package/licensee - similar-ish to what's proposed. Potentially already used by npm?
78
98
-https://www.npmjs.com/package/license-report - similar-ish to what's proposed.
79
99
-https://www.npmjs.com/package/nlf - similar-ish to what's proposed. Also a requirable module.
80
100
-https://www.npmjs.com/package/npm-license - similar-ish to what's proposed.
0 commit comments