Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
6477b8a375 | |||
4b5b2e7ca5 | |||
83a9cabab8 | |||
b046812ff9 |
11509
package-lock.json
generated
11509
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartlegal",
|
||||
"version": "1.0.20",
|
||||
"version": "1.0.22",
|
||||
"private": false,
|
||||
"description": "go legal programmatically",
|
||||
"main": "dist/index.js",
|
||||
@ -26,20 +26,21 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pkunz/legal#README",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartmarkdown": "^2.0.2",
|
||||
"@pushrocks/smartmustache": "^2.0.9",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@tsclass/tsclass": "^2.0.13",
|
||||
"@pushrocks/smartmarkdown": "^2.0.6",
|
||||
"@pushrocks/smartmustache": "^2.0.11",
|
||||
"@pushrocks/smartpromise": "^3.1.5",
|
||||
"@tsclass/tsclass": "^3.0.33",
|
||||
"@types/license-checker": "^25.0.1",
|
||||
"@umbrellazone/legal-docs": "^1.0.12",
|
||||
"license-checker": "^25.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.2.0",
|
||||
"@types/node": "^13.1.7",
|
||||
"tslint": "^5.20.1",
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@gitzone/tstest": "^1.0.54",
|
||||
"@pushrocks/tapbundle": "^3.2.14",
|
||||
"@types/node": "^15.3.0",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"files": [
|
||||
|
@ -24,13 +24,6 @@ smartlegal implements
|
||||
|
||||
* a license checker for checking dependency trees against a set of licenses
|
||||
|
||||
For further information read the linked docs at the top of this README.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[](https://push.rocks)
|
||||
|
||||
## Contribution
|
||||
|
||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||
|
@ -3,7 +3,7 @@ import * as legal from '../ts/index';
|
||||
|
||||
tap.test('should create instance of licenseChecker', async () => {
|
||||
const licenseChecker = await legal.createLicenseChecker();
|
||||
let plainResultArray = await licenseChecker.createPlainResultArray(process.cwd());
|
||||
const plainResultArray = await licenseChecker.createPlainResultArray(process.cwd());
|
||||
expect(plainResultArray).to.be.instanceof(Array);
|
||||
expect(plainResultArray[0]).to.have.property('license');
|
||||
});
|
||||
|
@ -1,6 +1,4 @@
|
||||
import * as plugins from './legal.plugins';
|
||||
import { ICompany } from '@tsclass/tsclass';
|
||||
|
||||
export * from './mod.licensechecker/interfaces';
|
||||
export const createLicenseChecker = async () => {
|
||||
const licenseCheckerMod = await import('./mod.licensechecker/classes.licensechecker');
|
||||
return new licenseCheckerMod.LicenseChecker();
|
||||
|
@ -8,6 +8,4 @@ export { tsclass };
|
||||
|
||||
// @pushrocks
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartmarkdown from '@pushrocks/smartmarkdown';
|
||||
import * as smartmustache from '@pushrocks/smartmustache';
|
||||
export { smartpromise, smartmarkdown, smartmustache };
|
||||
export { smartpromise };
|
||||
|
14
ts/mod.licensechecker/classes.checkresult.ts
Normal file
14
ts/mod.licensechecker/classes.checkresult.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { IModuleLicenseResult } from "./interfaces";
|
||||
|
||||
export class CheckResult {
|
||||
passingModules: IModuleLicenseResult[] = [];
|
||||
failingModules: IModuleLicenseResult[] = [];
|
||||
|
||||
public addPassing(moduleResultArg: IModuleLicenseResult) {
|
||||
this.passingModules.push(moduleResultArg);
|
||||
}
|
||||
|
||||
public addFailing(moduleResultArg: IModuleLicenseResult) {
|
||||
this.failingModules.push(moduleResultArg);
|
||||
}
|
||||
}
|
@ -1,27 +1,7 @@
|
||||
import * as plugins from '../legal.plugins';
|
||||
import * as licenseChecker from 'license-checker';
|
||||
|
||||
export interface IModuleLicenseResult {
|
||||
moduleName: string;
|
||||
license: string;
|
||||
repository: string;
|
||||
publisher: string;
|
||||
email: string;
|
||||
path: string;
|
||||
licenseFile: string;
|
||||
}
|
||||
|
||||
export class CheckResult {
|
||||
passingModules: IModuleLicenseResult[] = [];
|
||||
failingModules: IModuleLicenseResult[] = [];
|
||||
addPassing(moduleResultArg: IModuleLicenseResult) {
|
||||
this.passingModules.push(moduleResultArg);
|
||||
}
|
||||
|
||||
addFailing(moduleResultArg: IModuleLicenseResult) {
|
||||
this.failingModules.push(moduleResultArg);
|
||||
}
|
||||
}
|
||||
import * as interfaces from './interfaces';
|
||||
import { CheckResult } from './classes.checkresult';
|
||||
|
||||
export class LicenseChecker {
|
||||
async excludeLicenseWithinPath(pathArg: string, licenseArrayArg: string[]) {
|
||||
@ -52,8 +32,8 @@ export class LicenseChecker {
|
||||
|
||||
async createPlainResultArray(pathArg: string) {
|
||||
const licenseJson = await this.getJsonForPath(pathArg);
|
||||
const resultArray: IModuleLicenseResult[] = [];
|
||||
for (let moduleKey in licenseJson) {
|
||||
const resultArray: interfaces.IModuleLicenseResult[] = [];
|
||||
for (const moduleKey of Object.keys(licenseJson)) {
|
||||
const refObject = licenseJson[moduleKey];
|
||||
resultArray.push({
|
||||
moduleName: moduleKey,
|
||||
@ -69,12 +49,12 @@ export class LicenseChecker {
|
||||
}
|
||||
|
||||
private async getJsonForPath(checkPathArg) {
|
||||
let done = plugins.smartpromise.defer<any>();
|
||||
const done = plugins.smartpromise.defer<any>();
|
||||
licenseChecker.init(
|
||||
{
|
||||
start: checkPathArg
|
||||
},
|
||||
function(err, licenseJson) {
|
||||
(err, licenseJson) => {
|
||||
if (err) {
|
||||
done.reject(err);
|
||||
} else {
|
||||
@ -82,6 +62,6 @@ export class LicenseChecker {
|
||||
}
|
||||
}
|
||||
);
|
||||
return await done.promise;
|
||||
return done.promise;
|
||||
}
|
||||
}
|
||||
|
9
ts/mod.licensechecker/interfaces.ts
Normal file
9
ts/mod.licensechecker/interfaces.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export interface IModuleLicenseResult {
|
||||
moduleName: string;
|
||||
license: string;
|
||||
repository: string;
|
||||
publisher: string;
|
||||
email: string;
|
||||
path: string;
|
||||
licenseFile: string;
|
||||
}
|
Reference in New Issue
Block a user