mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-28 08:26:44 -06:00
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-url": "1.2.28",
|
||||
"@types/js-yaml": "3.10.1",
|
||||
"@types/license-checker": "^15.0.0",
|
||||
"@types/mkdirp": "0.5.2",
|
||||
"@types/mocha": "2.2.45",
|
||||
"@types/mongodb": "2.2.18",
|
||||
|
@ -122,6 +123,7 @@
|
|||
"is-root": "1.0.0",
|
||||
"is-url": "1.2.2",
|
||||
"js-yaml": "3.10.0",
|
||||
"license-checker": "^15.0.0",
|
||||
"mecab-async": "0.1.2",
|
||||
"mkdirp": "0.5.1",
|
||||
"mocha": "4.1.0",
|
||||
|
|
|
@ -17,8 +17,6 @@ import config from './../../../conf';
|
|||
|
||||
import generateVars from '../vars';
|
||||
|
||||
const commonVars = generateVars();
|
||||
|
||||
const langs = Object.keys(locales);
|
||||
|
||||
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'
|
||||
]);
|
||||
|
||||
gulp.task('doc:api:endpoints', () => {
|
||||
gulp.task('doc:api:endpoints', async () => {
|
||||
const commonVars = await generateVars();
|
||||
glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => {
|
||||
if (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) => {
|
||||
if (globErr) {
|
||||
console.error(globErr);
|
||||
|
|
|
@ -23,9 +23,9 @@ gulp.task('doc', [
|
|||
'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) => {
|
||||
if (globErr) {
|
||||
console.error(globErr);
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
h1 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 ライセンス
|
||||
|
||||
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
|
||||
|
||||
pre
|
||||
overflow auto
|
||||
|
||||
> code
|
||||
display block
|
||||
|
|
|
@ -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…
Reference in a new issue