@myooken/license-output 0.1.0 → 0.1.1
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/README.md +28 -23
- package/package.json +3 -3
- package/src/cli.js +2 -2
package/README.md
CHANGED
|
@@ -12,64 +12,66 @@ It generates two files: `THIRD-PARTY-LICENSE.md` (main content) and `THIRD-PARTY
|
|
|
12
12
|
- **Review file** flags missing Source / license / license files
|
|
13
13
|
- `--fail-on-missing` supports CI enforcement
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| Option | Description | Default |
|
|
18
|
-
| ---------------------- | ------------------------------------------------------ | ------------------------------- |
|
|
19
|
-
| `--node-modules <dir>` | Path to `node_modules` | `node_modules` |
|
|
20
|
-
| `--review [file]` | Write review file only; optional filename | `THIRD-PARTY-LICENSE-REVIEW.md` |
|
|
21
|
-
| `--license [file]` | Write main file only; optional filename | `THIRD-PARTY-LICENSE.md` |
|
|
22
|
-
| `--fail-on-missing` | Exit with code 1 if LICENSE/NOTICE/COPYING are missing | `false` |
|
|
23
|
-
| `-h`, `--help` | Show help | - |
|
|
24
|
-
|
|
25
|
-
> If neither `--review` nor `--license` is specified, **both files are generated**.
|
|
15
|
+
CLI command: `third-party-license`
|
|
26
16
|
|
|
27
17
|
### Usage
|
|
28
18
|
|
|
29
19
|
#### Run without installing (recommended)
|
|
30
20
|
|
|
31
21
|
```bash
|
|
32
|
-
npx --package=@myooken/license-output -- third-party-
|
|
22
|
+
npx --package=@myooken/license-output -- third-party-license
|
|
33
23
|
```
|
|
34
24
|
|
|
35
25
|
#### Run via npm exec
|
|
36
26
|
|
|
37
27
|
```bash
|
|
38
|
-
npm exec --package=@myooken/license-output -- third-party-
|
|
28
|
+
npm exec --package=@myooken/license-output -- third-party-license
|
|
39
29
|
```
|
|
40
30
|
|
|
41
31
|
#### Install globally
|
|
42
32
|
|
|
43
33
|
```bash
|
|
44
34
|
npm i -g @myooken/license-output
|
|
45
|
-
third-party-
|
|
35
|
+
third-party-license
|
|
46
36
|
```
|
|
47
37
|
|
|
38
|
+
### Options
|
|
39
|
+
|
|
40
|
+
| Option | Description | Default |
|
|
41
|
+
| ---------------------- | ------------------------------------------------------ | ------------------------------- |
|
|
42
|
+
| `--node-modules <dir>` | Path to `node_modules` | `node_modules` |
|
|
43
|
+
| `--review [file]` | Write review file only; optional filename | `THIRD-PARTY-LICENSE-REVIEW.md` |
|
|
44
|
+
| `--license [file]` | Write main file only; optional filename | `THIRD-PARTY-LICENSE.md` |
|
|
45
|
+
| `--fail-on-missing` | Exit with code 1 if LICENSE/NOTICE/COPYING are missing | `false` |
|
|
46
|
+
| `-h`, `--help` | Show help | - |
|
|
47
|
+
|
|
48
|
+
> If neither `--review` nor `--license` is specified, **both files are generated**.
|
|
49
|
+
|
|
48
50
|
### Examples
|
|
49
51
|
|
|
50
52
|
```bash
|
|
51
53
|
# Default (both files)
|
|
52
|
-
third-party-
|
|
54
|
+
third-party-license
|
|
53
55
|
|
|
54
56
|
# Custom node_modules path
|
|
55
|
-
third-party-
|
|
57
|
+
third-party-license --node-modules ./path/to/node_modules
|
|
56
58
|
|
|
57
59
|
# Review-only output (optional filename)
|
|
58
|
-
third-party-
|
|
59
|
-
third-party-
|
|
60
|
+
third-party-license --review
|
|
61
|
+
third-party-license --review ./out/THIRD-PARTY-LICENSE-REVIEW.md
|
|
60
62
|
|
|
61
63
|
# Main-only output (optional filename)
|
|
62
|
-
third-party-
|
|
63
|
-
third-party-
|
|
64
|
+
third-party-license --license
|
|
65
|
+
third-party-license --license ./out/THIRD-PARTY-LICENSE.md
|
|
64
66
|
|
|
65
|
-
# Exit with code 1 when something is missing
|
|
66
|
-
third-party-
|
|
67
|
+
# Exit with code 1 when something is missing (with --fail-on-missing)
|
|
68
|
+
third-party-license --fail-on-missing
|
|
67
69
|
```
|
|
68
70
|
|
|
69
71
|
### Programmatic API
|
|
70
72
|
|
|
71
73
|
```js
|
|
72
|
-
import { collectThirdPartyLicenses } from "@myooken/license-output";
|
|
74
|
+
import { collectThirdPartyLicenses } from "@myooken/third-party-license-output-nodemodules";
|
|
73
75
|
|
|
74
76
|
const result = await collectThirdPartyLicenses({
|
|
75
77
|
nodeModules: "./node_modules",
|
|
@@ -105,5 +107,8 @@ console.log(result.reviewContent);
|
|
|
105
107
|
|
|
106
108
|
### Notes
|
|
107
109
|
|
|
110
|
+
- Scans all packages under `node_modules` (including nested dependencies); license files are searched only in each package root directory.
|
|
111
|
+
- Exit code 0: success.
|
|
112
|
+
- Exit code 1: missing license files when `--fail-on-missing` is set, or `node_modules` not found.
|
|
108
113
|
- Throws an error if `node_modules` does not exist.
|
|
109
114
|
- Missing `license` or `repository` fields are flagged in the review file.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myooken/license-output",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Generate
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Generate third-party-license markdown by scanning licenses in node_modules.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
".": "./src/core.js"
|
|
26
26
|
},
|
|
27
27
|
"bin": {
|
|
28
|
-
"third-party-
|
|
28
|
+
"third-party-license": "./src/cli.js"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"src",
|
package/src/cli.js
CHANGED
|
@@ -66,7 +66,7 @@ function applyOutputMode(mode, args) {
|
|
|
66
66
|
|
|
67
67
|
function showHelp() {
|
|
68
68
|
console.log(`Usage:
|
|
69
|
-
third-party-
|
|
69
|
+
third-party-license [--node-modules <dir>] [--review [file]] [--license [file]] [--fail-on-missing]
|
|
70
70
|
`);
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -129,7 +129,7 @@ function isCliExecution() {
|
|
|
129
129
|
if (resolvedArg === self) return true;
|
|
130
130
|
|
|
131
131
|
const base = path.basename(resolvedArg).toLowerCase();
|
|
132
|
-
if (base === "third-party-
|
|
132
|
+
if (base === "third-party-license" || base === "third-party-license.cmd") {
|
|
133
133
|
return true;
|
|
134
134
|
}
|
|
135
135
|
if (resolvedArg.includes(`${path.sep}.bin${path.sep}`)) return true;
|