@gesslar/licensed 1.0.0 → 1.1.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.
- package/README.md +47 -0
- package/package.json +6 -5
- package/src/cli.js +4 -6
package/README.md
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @gesslar/licensed
|
|
2
|
+
|
|
3
|
+
A simple CLI tool that generates license documentation for Node.js projects. It
|
|
4
|
+
reads your `package.json`, finds your license file, and outputs a formatted
|
|
5
|
+
markdown section listing your project license and all dependency licenses.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @gesslar/licensed
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or as a dev dependency:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save-dev @gesslar/licensed
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Run from your project directory:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx @gesslar/licensed
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The tool outputs markdown to stdout that you can add to your README. The output
|
|
28
|
+
includes:
|
|
29
|
+
|
|
30
|
+
- Your project's license with a link to the license file
|
|
31
|
+
- A table of all dependencies with their licenses and repository links
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
- Node.js v24.13.0 or higher
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
licensed is released into the public domain under the
|
|
40
|
+
[Unlicense](UNLICENSE.txt).
|
|
41
|
+
|
|
42
|
+
This package includes or depends on third-party components under their own
|
|
43
|
+
licenses:
|
|
44
|
+
|
|
45
|
+
| Dependency | License |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| [@gesslar/toolkit](https://github.com/gesslar/toolkit) | Unlicense |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gesslar/licensed",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Simple CLI to produce license copy for README.md",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"major": "npm version major"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@gesslar/toolkit": "^
|
|
31
|
+
"@gesslar/toolkit": "^4.4.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@gesslar/uglier": "^2.
|
|
35
|
-
"eslint": "^10.0.
|
|
34
|
+
"@gesslar/uglier": "^2.2.0",
|
|
35
|
+
"eslint": "^10.0.3"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=v24.13.0"
|
|
@@ -40,5 +40,6 @@
|
|
|
40
40
|
"files": [
|
|
41
41
|
"UNLICENSE.txt",
|
|
42
42
|
"src/**/*.js"
|
|
43
|
-
]
|
|
43
|
+
],
|
|
44
|
+
"bin": "./src/cli.js"
|
|
44
45
|
}
|
package/src/cli.js
CHANGED
|
@@ -15,20 +15,18 @@ import {promisify} from "node:util"
|
|
|
15
15
|
// Detect license file in project root
|
|
16
16
|
const licenseFile = (await cwd.glob("{LICEN[CS]E,UNLICEN[CS]E}{,.txt,.md}"))?.files[0]
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
const name = pkg.name?.replace(/^@[^/]+\//, "") ?? "this project"
|
|
18
|
+
const name = pkg.name ?? "this project"
|
|
20
19
|
const license = pkg.license ?? "Unknown"
|
|
21
20
|
|
|
22
21
|
const publicDomain = ["Unlicense", "0BSD", "CC0-1.0"]
|
|
23
22
|
const phrase = publicDomain.includes(license)
|
|
24
|
-
?
|
|
25
|
-
:
|
|
23
|
+
? `\`${name}\` is released into the public domain under the`
|
|
24
|
+
: `\`${name}\` is released under the`
|
|
26
25
|
|
|
27
26
|
const lines = [
|
|
28
27
|
"## License",
|
|
29
28
|
"",
|
|
30
|
-
phrase
|
|
31
|
-
`[${license}](${licenseFile?.name ?? "LICENSE"}).`,
|
|
29
|
+
`${phrase} [${license}](${licenseFile?.name ?? "LICENSE"}).`,
|
|
32
30
|
]
|
|
33
31
|
|
|
34
32
|
const deps = Object.keys(pkg.dependencies ?? {}).sort()
|