summaryrefslogtreecommitdiff
path: root/src/web/docs
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-01-08 01:47:56 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-01-08 01:47:56 +0900
commit6b9f6c6e3b2f82ea2a466614626b7bfaa6ad9286 (patch)
tree2588ef93eb71f2b3ffad410fd871c45ac74912da /src/web/docs
parentMerge branch 'master' of https://github.com/syuilo/misskey (diff)
downloadsharkey-6b9f6c6e3b2f82ea2a466614626b7bfaa6ad9286.tar.gz
sharkey-6b9f6c6e3b2f82ea2a466614626b7bfaa6ad9286.tar.bz2
sharkey-6b9f6c6e3b2f82ea2a466614626b7bfaa6ad9286.zip
Show the licenses in the doc
Diffstat (limited to 'src/web/docs')
-rw-r--r--src/web/docs/api/gulpfile.ts8
-rw-r--r--src/web/docs/gulpfile.ts4
-rw-r--r--src/web/docs/license.en.pug14
-rw-r--r--src/web/docs/license.ja.pug14
-rw-r--r--src/web/docs/style.styl2
-rw-r--r--src/web/docs/vars.ts17
6 files changed, 52 insertions, 7 deletions
diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts
index 4c30871a0f..cd1bf15307 100644
--- a/src/web/docs/api/gulpfile.ts
+++ b/src/web/docs/api/gulpfile.ts
@@ -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);
diff --git a/src/web/docs/gulpfile.ts b/src/web/docs/gulpfile.ts
index 71033e1bc7..d5ddda108d 100644
--- a/src/web/docs/gulpfile.ts
+++ b/src/web/docs/gulpfile.ts
@@ -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);
diff --git a/src/web/docs/license.en.pug b/src/web/docs/license.en.pug
index 240756e7ea..45d8b76473 100644
--- a/src/web/docs/license.en.pug
+++ b/src/web/docs/license.en.pug
@@ -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
diff --git a/src/web/docs/license.ja.pug b/src/web/docs/license.ja.pug
index 1f44f3f5e7..7bd9a62941 100644
--- a/src/web/docs/license.ja.pug
+++ b/src/web/docs/license.ja.pug
@@ -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
diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl
index a726d49b16..bc165f8728 100644
--- a/src/web/docs/style.styl
+++ b/src/web/docs/style.styl
@@ -114,5 +114,7 @@ code
border-radius 4px
pre
+ overflow auto
+
> code
display block
diff --git a/src/web/docs/vars.ts b/src/web/docs/vars.ts
index 95ae9ee629..6f713f21d0 100644
--- a/src/web/docs/vars.ts
+++ b/src/web/docs/vars.ts
@@ -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;
}