fix(core): update

This commit is contained in:
Philipp Kunz 2021-05-17 15:45:46 +00:00
parent 83a9cabab8
commit 4b5b2e7ca5
8 changed files with 10536 additions and 1059 deletions

11469
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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": [

View File

@ -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');
});

View File

@ -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();

View File

@ -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 };

View 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);
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,9 @@
export interface IModuleLicenseResult {
moduleName: string;
license: string;
repository: string;
publisher: string;
email: string;
path: string;
licenseFile: string;
}