Compare commits
11 Commits
5f2f202f49
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| cf460a8d88 | |||
| 847d842b7e | |||
| 3cafa53318 | |||
| 4b1326e826 | |||
| a074b82c47 | |||
| 48008e5ebe | |||
| fb15002582 | |||
| 0992179dfd | |||
| 2eeacf1219 | |||
| 350497cfdb | |||
| 29d8b9ccb8 |
@@ -6,3 +6,4 @@ node_modules
|
|||||||
.gitignore
|
.gitignore
|
||||||
lib
|
lib
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
changelog.md
|
||||||
18
README.md
18
README.md
@@ -24,12 +24,12 @@ Export all dependencies to markdown: `licenseexporter --md --recursive`
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
Arg | Description | Type | Default
|
Arg | Description | Type | Default
|
||||||
- | - | - | -
|
| - | - | - | -
|
||||||
-j, --json | Exports the license information into ./licenses.json as json. | flag/[boolean] | N/A
|
\-j, --json | Exports the license information into ./licenses.json as json. | flag/[boolean] | N/A
|
||||||
-p, --pretty | Prettify the json output.|flag/[boolean] | N/A
|
\-p, --pretty | Prettify the json output.|flag/[boolean] | N/A
|
||||||
-m, --markdown | Exports the license information into ./licenses.md as markdown. | flag/[boolean] | N/A
|
\-m, --markdown | Exports the license information into ./licenses.md as markdown. | flag/[boolean] | N/A
|
||||||
-r, --recursive | Include all of the dependencies' subdependencies. | flag/[boolean] | N/A
|
\-r, --recursive | Include all of the dependencies' subdependencies. | flag/[boolean] | N/A
|
||||||
-o, --output | Output folder for the exports. | [string] | Current folder
|
\-o, --output | Output folder for the exports. | [string] | Current folder
|
||||||
-i, --input | Path to the input folder containing your package.json and node_modules | [string] | Current folder
|
\-i, --input | Path to the input folder containing your package.json and node_modules | [string] | Current folder
|
||||||
-h, --help | Show help | flag/[boolean] | N/A
|
\-h, --help | Show help | flag/[boolean] | N/A
|
||||||
-v, --version | Show version number | flag/[boolean] | N/A
|
\-v, --version | Show version number | flag/[boolean] | N/A
|
||||||
@@ -69,13 +69,42 @@ function getDependencyLicenseInfo(all_dependencies, recursive) {
|
|||||||
licensetext = fs.readFileSync(`${args.input}/node_modules/${p[0]}/LICENSE.txt`, { encoding: 'utf-8' });
|
licensetext = fs.readFileSync(`${args.input}/node_modules/${p[0]}/LICENSE.txt`, { encoding: 'utf-8' });
|
||||||
}
|
}
|
||||||
const info = {
|
const info = {
|
||||||
author: packageinfo.author,
|
author: "?",
|
||||||
repo: packageinfo.repository || packageinfo.repository.url,
|
repo: packageinfo.repository || packageinfo.repository?.url,
|
||||||
description: packageinfo.description,
|
description: packageinfo.description || "",
|
||||||
name: packageinfo.name,
|
name: packageinfo.name,
|
||||||
license: packageinfo.license,
|
license: packageinfo.license,
|
||||||
|
version: packageinfo.version,
|
||||||
licensetext
|
licensetext
|
||||||
};
|
};
|
||||||
|
if (info.repo) {
|
||||||
|
if (typeof info.repo === "object") {
|
||||||
|
info.repo.url = info.repo.url.replace(/git\:\/\/github.com\//gi, "https://github.com");
|
||||||
|
info.repo.url = info.repo.url.replace(/git\+https:\/\/github.com\//gi, "https://github.com/");
|
||||||
|
}
|
||||||
|
if (typeof info.repo === "string") {
|
||||||
|
info.repo = {
|
||||||
|
url: info.repo
|
||||||
|
};
|
||||||
|
}
|
||||||
|
info.repo.url = info.repo.url.replace(/github:/gi, "https://github.com/");
|
||||||
|
if (info.repo.url.includes("github.com")) {
|
||||||
|
info.repo.url = info.repo.url.replace(/\.git/gi, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (packageinfo.author) {
|
||||||
|
if (typeof packageinfo.author === "string") info.author = packageinfo.author;
|
||||||
|
if (packageinfo.author.name) {
|
||||||
|
info.author = packageinfo.author.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (packageinfo.homepage && packageinfo.repository) {
|
||||||
|
if (typeof packageinfo.repository === "string") {
|
||||||
|
if (packageinfo.homepage.toLowerCase().includes(packageinfo.repository.toLowerCase())) {
|
||||||
|
info.repo = packageinfo.homepage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
all.push(info);
|
all.push(info);
|
||||||
if (recursive == true) {
|
if (recursive == true) {
|
||||||
all.push(...getDependencyLicenseInfo(packageinfo.dependencies, true));
|
all.push(...getDependencyLicenseInfo(packageinfo.dependencies, true));
|
||||||
@@ -98,7 +127,7 @@ if (args.markdown) {
|
|||||||
all.forEach((p) => {
|
all.forEach((p) => {
|
||||||
fs.appendFileSync(
|
fs.appendFileSync(
|
||||||
(args.output+'/licenses.md'),
|
(args.output+'/licenses.md'),
|
||||||
`# ${p.name}\n**Author**: ${p.author}\n**Repo**: ${p.repo}\n**License**: ${p.license}\n**Description**: ${p.description}\n## License Text\n${p.licensetext} \n\n`
|
`# ${p.name}\n**Author**: ${p.author}\n**Repo**: ${p.repo?.url || p.repo}\n**License**: ${p.license}\n**Description**: ${p.description}\n## License Text\n${p.licensetext} \n\n`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
14
changelog.md
Normal file
14
changelog.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
## Changes from 0.0.10 to 0.0.11
|
||||||
|
I noticed some packages not exporting properly/ in a standardized way
|
||||||
|
|
||||||
|
npm package|0.0.10|0.0.11|what
|
||||||
|
--- | --- | --- | ---
|
||||||
|
|core-js|❌|✅|repo contains `.git`
|
||||||
|
|quasar|❌|✅|repo contains `.git` + `git+https://`
|
||||||
|
|vue-property-decorator|❌|✅|repo contains `.git` + `git+https://`
|
||||||
|
|vue-geolocation-api|❌|✅|repo contains `github:` + description=`undefined`
|
||||||
|
|@types/node|❌|✅|author=`undefined`
|
||||||
|
|@typescript-eslint/eslint-plugin|❌|✅|author=`undefined`
|
||||||
|
|@typescript-eslint/parser|❌|✅|author=`undefined`
|
||||||
|
|eslint-config-standard|❌|✅|repo contains `.git` + `git://github.com`
|
||||||
|
|workbox-webpack-plugin|❌|✅|repo without url
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# yargs
|
# yargs
|
||||||
**Author**: undefined
|
**Author**: ?
|
||||||
**Repo**: [object Object]
|
**Repo**: https://github.com/yargs/yargs
|
||||||
**License**: MIT
|
**License**: MIT
|
||||||
**Description**: yargs the modern, pirate-themed, successor to optimist.
|
**Description**: yargs the modern, pirate-themed, successor to optimist.
|
||||||
## License Text
|
## License Text
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/license-exporter",
|
"name": "@odit/license-exporter",
|
||||||
"version": "0.0.8",
|
"version": "0.0.11",
|
||||||
"description": "A simple license crawler for crediting open source work",
|
"description": "A simple license crawler for crediting open source work",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"license",
|
"license",
|
||||||
@@ -11,7 +11,11 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.odit.services/odit/license-exporter"
|
"url": "https://git.odit.services/odit/license-exporter"
|
||||||
},
|
},
|
||||||
"author": "ODIT.Services",
|
"author": {
|
||||||
|
"name": "ODIT.Services",
|
||||||
|
"email": "info@odit.services",
|
||||||
|
"url": "https://odit.services"
|
||||||
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|||||||
Reference in New Issue
Block a user