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

11507
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", "homepage": "https://gitlab.com/pkunz/legal#README",
"dependencies": { "dependencies": {
"@pushrocks/smartmarkdown": "^2.0.2", "@pushrocks/smartmarkdown": "^2.0.6",
"@pushrocks/smartmustache": "^2.0.9", "@pushrocks/smartmustache": "^2.0.11",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.1.5",
"@tsclass/tsclass": "^2.0.13", "@tsclass/tsclass": "^3.0.33",
"@types/license-checker": "^25.0.1",
"@umbrellazone/legal-docs": "^1.0.12", "@umbrellazone/legal-docs": "^1.0.12",
"license-checker": "^25.0.1" "license-checker": "^25.0.1"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.17", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.54",
"@pushrocks/tapbundle": "^3.2.0", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^13.1.7", "@types/node": "^15.3.0",
"tslint": "^5.20.1", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"files": [ "files": [

View File

@ -3,7 +3,7 @@ import * as legal from '../ts/index';
tap.test('should create instance of licenseChecker', async () => { tap.test('should create instance of licenseChecker', async () => {
const licenseChecker = await legal.createLicenseChecker(); 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).to.be.instanceof(Array);
expect(plainResultArray[0]).to.have.property('license'); expect(plainResultArray[0]).to.have.property('license');
}); });

View File

@ -1,6 +1,4 @@
import * as plugins from './legal.plugins'; export * from './mod.licensechecker/interfaces';
import { ICompany } from '@tsclass/tsclass';
export const createLicenseChecker = async () => { export const createLicenseChecker = async () => {
const licenseCheckerMod = await import('./mod.licensechecker/classes.licensechecker'); const licenseCheckerMod = await import('./mod.licensechecker/classes.licensechecker');
return new licenseCheckerMod.LicenseChecker(); return new licenseCheckerMod.LicenseChecker();

View File

@ -8,6 +8,4 @@ export { tsclass };
// @pushrocks // @pushrocks
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartmarkdown from '@pushrocks/smartmarkdown'; export { smartpromise };
import * as smartmustache from '@pushrocks/smartmustache';
export { smartpromise, smartmarkdown, smartmustache };

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 plugins from '../legal.plugins';
import * as licenseChecker from 'license-checker'; import * as licenseChecker from 'license-checker';
import * as interfaces from './interfaces';
export interface IModuleLicenseResult { import { CheckResult } from './classes.checkresult';
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);
}
}
export class LicenseChecker { export class LicenseChecker {
async excludeLicenseWithinPath(pathArg: string, licenseArrayArg: string[]) { async excludeLicenseWithinPath(pathArg: string, licenseArrayArg: string[]) {
@ -52,8 +32,8 @@ export class LicenseChecker {
async createPlainResultArray(pathArg: string) { async createPlainResultArray(pathArg: string) {
const licenseJson = await this.getJsonForPath(pathArg); const licenseJson = await this.getJsonForPath(pathArg);
const resultArray: IModuleLicenseResult[] = []; const resultArray: interfaces.IModuleLicenseResult[] = [];
for (let moduleKey in licenseJson) { for (const moduleKey of Object.keys(licenseJson)) {
const refObject = licenseJson[moduleKey]; const refObject = licenseJson[moduleKey];
resultArray.push({ resultArray.push({
moduleName: moduleKey, moduleName: moduleKey,
@ -69,12 +49,12 @@ export class LicenseChecker {
} }
private async getJsonForPath(checkPathArg) { private async getJsonForPath(checkPathArg) {
let done = plugins.smartpromise.defer<any>(); const done = plugins.smartpromise.defer<any>();
licenseChecker.init( licenseChecker.init(
{ {
start: checkPathArg start: checkPathArg
}, },
function(err, licenseJson) { (err, licenseJson) => {
if (err) { if (err) {
done.reject(err); done.reject(err);
} else { } 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;
}