Show the licenses in the doc
This commit is contained in:
parent
610b6dac8e
commit
6b9f6c6e3b
7 changed files with 54 additions and 7 deletions
|
|
@ -1,13 +1,16 @@
|
|||
import * as fs from 'fs';
|
||||
import * as util from 'util';
|
||||
import * as glob from 'glob';
|
||||
import * as yaml from 'js-yaml';
|
||||
import * as licenseChecker from 'license-checker';
|
||||
import * as tmp from 'tmp';
|
||||
|
||||
import { fa } from '../../common/build/fa';
|
||||
import config from '../../conf';
|
||||
import { licenseHtml } from '../../common/build/license';
|
||||
const constants = require('../../const.json');
|
||||
|
||||
export default function(): { [key: string]: any } {
|
||||
export default async function(): Promise<{ [key: string]: any }> {
|
||||
const vars = {} as { [key: string]: any };
|
||||
|
||||
const endpoints = glob.sync('./src/web/docs/api/endpoints/**/*.yaml');
|
||||
|
|
@ -45,5 +48,17 @@ export default function(): { [key: string]: any } {
|
|||
|
||||
vars['license'] = licenseHtml;
|
||||
|
||||
const tmpObj = tmp.fileSync();
|
||||
fs.writeFileSync(tmpObj.name, JSON.stringify({
|
||||
licenseText: ''
|
||||
}), 'utf-8');
|
||||
const dependencies = await util.promisify(licenseChecker.init).bind(licenseChecker)({
|
||||
start: __dirname + '/../../../',
|
||||
customPath: tmpObj.name
|
||||
});
|
||||
tmpObj.removeCallback();
|
||||
|
||||
vars['dependencies'] = dependencies;
|
||||
|
||||
return vars;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue