Show the licenses in the doc
This commit is contained in:
parent
610b6dac8e
commit
6b9f6c6e3b
7 changed files with 54 additions and 7 deletions
|
@ -52,6 +52,7 @@
|
||||||
"@types/is-root": "1.0.0",
|
"@types/is-root": "1.0.0",
|
||||||
"@types/is-url": "1.2.28",
|
"@types/is-url": "1.2.28",
|
||||||
"@types/js-yaml": "3.10.1",
|
"@types/js-yaml": "3.10.1",
|
||||||
|
"@types/license-checker": "^15.0.0",
|
||||||
"@types/mkdirp": "0.5.2",
|
"@types/mkdirp": "0.5.2",
|
||||||
"@types/mocha": "2.2.45",
|
"@types/mocha": "2.2.45",
|
||||||
"@types/mongodb": "2.2.18",
|
"@types/mongodb": "2.2.18",
|
||||||
|
@ -122,6 +123,7 @@
|
||||||
"is-root": "1.0.0",
|
"is-root": "1.0.0",
|
||||||
"is-url": "1.2.2",
|
"is-url": "1.2.2",
|
||||||
"js-yaml": "3.10.0",
|
"js-yaml": "3.10.0",
|
||||||
|
"license-checker": "^15.0.0",
|
||||||
"mecab-async": "0.1.2",
|
"mecab-async": "0.1.2",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"mocha": "4.1.0",
|
"mocha": "4.1.0",
|
||||||
|
|
|
@ -17,8 +17,6 @@ import config from './../../../conf';
|
||||||
|
|
||||||
import generateVars from '../vars';
|
import generateVars from '../vars';
|
||||||
|
|
||||||
const commonVars = generateVars();
|
|
||||||
|
|
||||||
const langs = Object.keys(locales);
|
const langs = Object.keys(locales);
|
||||||
|
|
||||||
const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase();
|
const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase();
|
||||||
|
@ -94,7 +92,8 @@ gulp.task('doc:api', [
|
||||||
'doc:api:entities'
|
'doc:api:entities'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
gulp.task('doc:api:endpoints', () => {
|
gulp.task('doc:api:endpoints', async () => {
|
||||||
|
const commonVars = await generateVars();
|
||||||
glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => {
|
glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => {
|
||||||
if (globErr) {
|
if (globErr) {
|
||||||
console.error(globErr);
|
console.error(globErr);
|
||||||
|
@ -144,7 +143,8 @@ gulp.task('doc:api:endpoints', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('doc:api:entities', () => {
|
gulp.task('doc:api:entities', async () => {
|
||||||
|
const commonVars = await generateVars();
|
||||||
glob('./src/web/docs/api/entities/**/*.yaml', (globErr, files) => {
|
glob('./src/web/docs/api/entities/**/*.yaml', (globErr, files) => {
|
||||||
if (globErr) {
|
if (globErr) {
|
||||||
console.error(globErr);
|
console.error(globErr);
|
||||||
|
|
|
@ -23,9 +23,9 @@ gulp.task('doc', [
|
||||||
'doc:styles'
|
'doc:styles'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const commonVars = generateVars();
|
gulp.task('doc:docs', async () => {
|
||||||
|
const commonVars = await generateVars();
|
||||||
|
|
||||||
gulp.task('doc:docs', () => {
|
|
||||||
glob('./src/web/docs/**/*.*.pug', (globErr, files) => {
|
glob('./src/web/docs/**/*.*.pug', (globErr, files) => {
|
||||||
if (globErr) {
|
if (globErr) {
|
||||||
console.error(globErr);
|
console.error(globErr);
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
h1 License
|
h1 License
|
||||||
|
|
||||||
div!= common.license
|
div!= common.license
|
||||||
|
|
||||||
|
details
|
||||||
|
summary Libraries
|
||||||
|
|
||||||
|
section
|
||||||
|
h2 Libraries
|
||||||
|
|
||||||
|
each dependency, name in common.dependencies
|
||||||
|
details
|
||||||
|
summary= name
|
||||||
|
|
||||||
|
section
|
||||||
|
h3= name
|
||||||
|
pre= dependency.licenseText
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
h1 ライセンス
|
h1 ライセンス
|
||||||
|
|
||||||
div!= common.license
|
div!= common.license
|
||||||
|
|
||||||
|
details
|
||||||
|
summary ライブラリ
|
||||||
|
|
||||||
|
section
|
||||||
|
h2 ライブラリ
|
||||||
|
|
||||||
|
each dependency, name in common.dependencies
|
||||||
|
details
|
||||||
|
summary= name
|
||||||
|
|
||||||
|
section
|
||||||
|
h3= name
|
||||||
|
pre= dependency.licenseText
|
||||||
|
|
|
@ -114,5 +114,7 @@ code
|
||||||
border-radius 4px
|
border-radius 4px
|
||||||
|
|
||||||
pre
|
pre
|
||||||
|
overflow auto
|
||||||
|
|
||||||
> code
|
> code
|
||||||
display block
|
display block
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import * as util from 'util';
|
||||||
import * as glob from 'glob';
|
import * as glob from 'glob';
|
||||||
import * as yaml from 'js-yaml';
|
import * as yaml from 'js-yaml';
|
||||||
|
import * as licenseChecker from 'license-checker';
|
||||||
|
import * as tmp from 'tmp';
|
||||||
|
|
||||||
import { fa } from '../../common/build/fa';
|
import { fa } from '../../common/build/fa';
|
||||||
import config from '../../conf';
|
import config from '../../conf';
|
||||||
import { licenseHtml } from '../../common/build/license';
|
import { licenseHtml } from '../../common/build/license';
|
||||||
const constants = require('../../const.json');
|
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 vars = {} as { [key: string]: any };
|
||||||
|
|
||||||
const endpoints = glob.sync('./src/web/docs/api/endpoints/**/*.yaml');
|
const endpoints = glob.sync('./src/web/docs/api/endpoints/**/*.yaml');
|
||||||
|
@ -45,5 +48,17 @@ export default function(): { [key: string]: any } {
|
||||||
|
|
||||||
vars['license'] = licenseHtml;
|
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;
|
return vars;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue