fix(core): update
This commit is contained in:
parent
2c4db09ac1
commit
c5eb97efff
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
name: Default (not tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm and npmci
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
|
||||||
|
- name: Run npm prepare
|
||||||
|
run: npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
name: Default (tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm publish
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Code quality
|
||||||
|
run: |
|
||||||
|
npmci command npm install -g typescript
|
||||||
|
npmci npm install
|
||||||
|
|
||||||
|
- name: Trigger
|
||||||
|
run: npmci trigger
|
||||||
|
|
||||||
|
- name: Build docs and upload artifacts
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
pnpm install -g @git.zone/tsdoc
|
||||||
|
npmci command tsdoc
|
||||||
|
continue-on-error: true
|
@ -120,7 +120,7 @@ pages:
|
|||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci node install lts
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
- npmci command npm install -g @git.zone/tsdoc
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command tsdoc
|
- npmci command tsdoc
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartlegal",
|
"gitrepo": "smartlegal",
|
||||||
"shortDescription": "go legal programmatically",
|
"description": "go legal programmatically",
|
||||||
"npmPackagename": "@push.rocks/smartlegal",
|
"npmPackagename": "@push.rocks/smartlegal",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
12575
package-lock.json
generated
12575
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
37
package.json
37
package.json
@ -7,11 +7,12 @@
|
|||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+ssh://git@gitlab.com/pkunz/legal.git"
|
"url": "git+ssh://git@gitlab.com/push.rocks/smartlegal.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"legal",
|
"legal",
|
||||||
@ -22,26 +23,23 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pkunz/legal/issues"
|
"url": "https://gitlab.com/push.rocks/smartlegal/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pkunz/legal#README",
|
"homepage": "https://gitlab.com/push.rocks/smartlegal#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartmarkdown": "^2.0.6",
|
"@push.rocks/smartmarkdown": "^3.0.1",
|
||||||
"@pushrocks/smartmustache": "^2.0.11",
|
"@push.rocks/smartmustache": "^3.0.2",
|
||||||
"@pushrocks/smartpromise": "^3.1.5",
|
"@push.rocks/smartpnpm": "^1.0.6",
|
||||||
"@tsclass/tsclass": "^3.0.33",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"@types/license-checker": "^25.0.1",
|
"@push.rocks/smartshell": "^3.0.3",
|
||||||
"@umbrellazone/legal-docs": "^1.0.12",
|
"@tsclass/tsclass": "^4.0.43"
|
||||||
"license-checker": "^25.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@git.zone/tsbuild": "^2.1.25",
|
||||||
"@gitzone/tsrun": "^1.2.12",
|
"@git.zone/tsrun": "^1.2.12",
|
||||||
"@gitzone/tstest": "^1.0.54",
|
"@git.zone/tstest": "^1.0.54",
|
||||||
"@pushrocks/tapbundle": "^3.2.14",
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
"@types/node": "^15.3.0",
|
"@types/node": "^20.8.4"
|
||||||
"tslint": "^6.1.3",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@ -57,5 +55,6 @@
|
|||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
]
|
],
|
||||||
|
"type": "module"
|
||||||
}
|
}
|
5449
pnpm-lock.yaml
generated
5449
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
30
readme.md
30
readme.md
@ -1,27 +1,26 @@
|
|||||||
# @pushrocks/smartlegal
|
# @push.rocks/smartlegal
|
||||||
go legal programmatically
|
go legal programmatically
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlegal)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartlegal)
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartlegal)
|
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartlegal)
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartlegal)
|
* [github.com (source mirror)](https://github.com/push.rocks/smartlegal)
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartlegal/)
|
* [docs (typedoc)](https://push.rocks.gitlab.io/smartlegal/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
|
||||||
Status Category | Status Badge
|
Status Category | Status Badge
|
||||||
-- | --
|
-- | --
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartlegal/badges/master/pipeline.svg)](https://lossless.cloud)
|
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartlegal/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartlegal/badges/master/coverage.svg)](https://lossless.cloud)
|
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartlegal/badges/master/coverage.svg)](https://lossless.cloud)
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartlegal)](https://lossless.cloud)
|
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartlegal)](https://lossless.cloud)
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartlegal)](https://lossless.cloud)
|
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartlegal)](https://lossless.cloud)
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartlegal)](https://lossless.cloud)
|
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartlegal)](https://lossless.cloud)
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartlegal)](https://lossless.cloud)
|
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartlegal)](https://lossless.cloud)
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartlegal)](https://lossless.cloud)
|
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartlegal)](https://lossless.cloud)
|
||||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -37,7 +36,6 @@ We are always happy for code contributions. If you are not the code contributing
|
|||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
## Legal
|
||||||
|
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
|
||||||
|
16
test/test.ts
16
test/test.ts
@ -1,23 +1,17 @@
|
|||||||
import { tap, expect } from '@pushrocks/tapbundle';
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
import * as legal from '../ts/index';
|
import * as legal from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('should create instance of licenseChecker', async () => {
|
|
||||||
const licenseChecker = await legal.createLicenseChecker();
|
|
||||||
const plainResultArray = await licenseChecker.createPlainResultArray(process.cwd());
|
|
||||||
expect(plainResultArray).to.be.instanceof(Array);
|
|
||||||
expect(plainResultArray[0]).to.have.property('license');
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('should exclude certain licenses', async () => {
|
tap.test('should exclude certain licenses', async () => {
|
||||||
const licenseChecker = await legal.createLicenseChecker();
|
const licenseChecker = await legal.createLicenseChecker();
|
||||||
const checkResult = await licenseChecker.excludeLicenseWithinPath(process.cwd(), ['MIT']);
|
const checkResult = await licenseChecker.excludeLicenseWithinPath(process.cwd(), ['MIT']);
|
||||||
expect(checkResult.failingModules.length).to.be.greaterThan(10);
|
expect(checkResult.failingModules.length).toBeGreaterThan(10);
|
||||||
|
console.log(checkResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should include certain licenses', async () => {
|
tap.test('should include certain licenses', async () => {
|
||||||
const licenseChecker = await legal.createLicenseChecker();
|
const licenseChecker = await legal.createLicenseChecker();
|
||||||
const checkResult = await licenseChecker.includeLicencesWithinPath(process.cwd(), ['MIT']);
|
const checkResult = await licenseChecker.includeLicencesWithinPath(process.cwd(), ['MIT']);
|
||||||
expect(checkResult.failingModules.length).to.be.greaterThan(10);
|
expect(checkResult.failingModules.length).toBeGreaterThan(10);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@push.rocks/smartlegal',
|
||||||
|
version: '1.0.25',
|
||||||
|
description: 'go legal programmatically'
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
export * from './mod.licensechecker/interfaces';
|
|
||||||
export const createLicenseChecker = async () => {
|
export const createLicenseChecker = async () => {
|
||||||
const licenseCheckerMod = await import('./mod.licensechecker/classes.licensechecker');
|
const licenseCheckerMod = await import('./mod.licensechecker/classes.licensechecker.js');
|
||||||
return new licenseCheckerMod.LicenseChecker();
|
return new licenseCheckerMod.LicenseChecker();
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
// sub packages
|
|
||||||
import * as legalDocs from '@umbrellazone/legal-docs';
|
|
||||||
export { legalDocs };
|
|
||||||
|
|
||||||
// @tsclass
|
// @tsclass
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
export { tsclass };
|
export { tsclass };
|
||||||
|
|
||||||
// @pushrocks
|
// @pushrocks
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
export { smartpromise };
|
import * as smartshell from '@push.rocks/smartshell';
|
||||||
|
export { smartpromise, smartshell };
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { IModuleLicenseResult } from './interfaces';
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
export class CheckResult {
|
export class CheckResult {
|
||||||
passingModules: IModuleLicenseResult[] = [];
|
passingModules: plugins.smartpnpm.IPnpmLicenseResult[] = [];
|
||||||
failingModules: IModuleLicenseResult[] = [];
|
failingModules: plugins.smartpnpm.IPnpmLicenseResult[] = [];
|
||||||
|
|
||||||
public addPassing(moduleResultArg: IModuleLicenseResult) {
|
public addPassing(moduleResultArg: plugins.smartpnpm.IPnpmLicenseResult) {
|
||||||
this.passingModules.push(moduleResultArg);
|
this.passingModules.push(moduleResultArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addFailing(moduleResultArg: IModuleLicenseResult) {
|
public addFailing(moduleResultArg: plugins.smartpnpm.IPnpmLicenseResult) {
|
||||||
this.failingModules.push(moduleResultArg);
|
this.failingModules.push(moduleResultArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import * as plugins from '../legal.plugins';
|
import * as plugins from './plugins.js';
|
||||||
import * as licenseChecker from 'license-checker';
|
import { CheckResult } from './classes.checkresult.js';
|
||||||
import * as interfaces from './interfaces';
|
|
||||||
import { CheckResult } from './classes.checkresult';
|
|
||||||
|
|
||||||
export class LicenseChecker {
|
export class LicenseChecker {
|
||||||
|
|
||||||
async excludeLicenseWithinPath(pathArg: string, licenseArrayArg: string[]) {
|
async excludeLicenseWithinPath(pathArg: string, licenseArrayArg: string[]) {
|
||||||
const checkResult = new CheckResult();
|
const checkResult = new CheckResult();
|
||||||
const plainResultArray = await this.createPlainResultArray(pathArg);
|
const pnpm = new plugins.smartpnpm.SmartPnpm(pathArg);
|
||||||
|
const plainResultArray = await pnpm.getDependencyLicenseFlatArray();
|
||||||
plainResultArray.forEach((licenseResult) => {
|
plainResultArray.forEach((licenseResult) => {
|
||||||
if (licenseArrayArg.indexOf(licenseResult.license) === -1) {
|
if (licenseArrayArg.indexOf(licenseResult.license) === -1) {
|
||||||
checkResult.addPassing(licenseResult);
|
checkResult.addPassing(licenseResult);
|
||||||
@ -19,7 +19,8 @@ export class LicenseChecker {
|
|||||||
|
|
||||||
async includeLicencesWithinPath(pathArg: string, licenseArrayArg: string[]) {
|
async includeLicencesWithinPath(pathArg: string, licenseArrayArg: string[]) {
|
||||||
const checkResult = new CheckResult();
|
const checkResult = new CheckResult();
|
||||||
const plainResultArray = await this.createPlainResultArray(pathArg);
|
const pnpm = new plugins.smartpnpm.SmartPnpm(pathArg);
|
||||||
|
const plainResultArray = await pnpm.getDependencyLicenseFlatArray();
|
||||||
plainResultArray.forEach((licenseResult) => {
|
plainResultArray.forEach((licenseResult) => {
|
||||||
if (licenseArrayArg.indexOf(licenseResult.license) !== -1) {
|
if (licenseArrayArg.indexOf(licenseResult.license) !== -1) {
|
||||||
checkResult.addPassing(licenseResult);
|
checkResult.addPassing(licenseResult);
|
||||||
@ -29,39 +30,4 @@ export class LicenseChecker {
|
|||||||
});
|
});
|
||||||
return checkResult;
|
return checkResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
async createPlainResultArray(pathArg: string) {
|
|
||||||
const licenseJson = await this.getJsonForPath(pathArg);
|
|
||||||
const resultArray: interfaces.IModuleLicenseResult[] = [];
|
|
||||||
for (const moduleKey of Object.keys(licenseJson)) {
|
|
||||||
const refObject = licenseJson[moduleKey];
|
|
||||||
resultArray.push({
|
|
||||||
moduleName: moduleKey,
|
|
||||||
email: refObject.email,
|
|
||||||
licenseFile: refObject.licenseFile,
|
|
||||||
license: refObject.licenses,
|
|
||||||
path: refObject.path,
|
|
||||||
publisher: refObject.publisher,
|
|
||||||
repository: refObject.repository,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return resultArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async getJsonForPath(checkPathArg) {
|
|
||||||
const done = plugins.smartpromise.defer<any>();
|
|
||||||
licenseChecker.init(
|
|
||||||
{
|
|
||||||
start: checkPathArg,
|
|
||||||
},
|
|
||||||
(err, licenseJson) => {
|
|
||||||
if (err) {
|
|
||||||
done.reject(err);
|
|
||||||
} else {
|
|
||||||
done.resolve(licenseJson);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
export interface IModuleLicenseResult {
|
|
||||||
moduleName: string;
|
|
||||||
license: string;
|
|
||||||
repository: string;
|
|
||||||
publisher: string;
|
|
||||||
email: string;
|
|
||||||
path: string;
|
|
||||||
licenseFile: string;
|
|
||||||
}
|
|
7
ts/mod.licensechecker/plugins.ts
Normal file
7
ts/mod.licensechecker/plugins.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export * from '../legal.plugins.js'
|
||||||
|
|
||||||
|
import * as smartpnpm from '@push.rocks/smartpnpm';
|
||||||
|
|
||||||
|
export {
|
||||||
|
smartpnpm,
|
||||||
|
}
|
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user