@kingironman2011/license-checker 1.0.1 → 1.0.2
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 +91 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# License Checker
|
|
2
|
+
|
|
3
|
+
Scan a Node.js project’s production and development dependencies, print their license information, and copy discovered license files into an output directory.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 24 or newer
|
|
8
|
+
- A project with dependencies installed
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
Run the CLI directly with pnpm:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm dlx @kingironman2011/license-checker
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or install it in a project:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
pnpm add -D @kingironman2011/license-checker
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then run:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pnpm exec license-checker
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The command scans the current directory by default. Pass a project directory to scan another project:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pnpm exec license-checker ./path/to/project
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## CLI options
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Usage: license-checker [project-directory] [options]
|
|
40
|
+
|
|
41
|
+
Options:
|
|
42
|
+
--check List dependencies with no license metadata or license file
|
|
43
|
+
--silent, -s Do not print the license report
|
|
44
|
+
--extract, --files <dir> Copy license files into <dir>
|
|
45
|
+
--production, --prod Scan production dependencies only
|
|
46
|
+
--development, --dev Scan development dependencies only
|
|
47
|
+
--all Scan both dependency scopes (default)
|
|
48
|
+
--help, -h Show this help
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Examples:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
# Check production dependencies in the current directory
|
|
55
|
+
pnpm exec license-checker --production
|
|
56
|
+
|
|
57
|
+
# Find dependencies without license metadata or a license file (exits nonzero if any are found)
|
|
58
|
+
pnpm exec license-checker --check
|
|
59
|
+
|
|
60
|
+
# Copy discovered license files to ./licenses
|
|
61
|
+
pnpm exec license-checker --extract ./licenses
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
When `--check` finds dependencies whose license is unknown and which have no license files, it lists them and exits with status 1. Otherwise it reports that all dependencies have license metadata or license files. `--silent` suppresses report output; it does not change the exit status.
|
|
65
|
+
|
|
66
|
+
## Library API
|
|
67
|
+
|
|
68
|
+
The package also exports `runLicenseCheck` for use from JavaScript or TypeScript:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { runLicenseCheck } from "@kingironman2011/license-checker";
|
|
72
|
+
|
|
73
|
+
const dependencies = await runLicenseCheck({
|
|
74
|
+
start: process.cwd(),
|
|
75
|
+
production: true,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(dependencies);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Options include `start` (project directory), `production`, `development`, and `files` (directory for extracted license files). With neither scope selected, both production and development dependencies are scanned. Each result includes the package name, version, license, license file paths, and dependency scope.
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
pnpm install
|
|
87
|
+
pnpm build
|
|
88
|
+
pnpm lint
|
|
89
|
+
pnpm format:check
|
|
90
|
+
```
|
|
91
|
+
|