✌️
This commit is contained in:
parent
727ecf86b9
commit
88e4f1b287
5 changed files with 24 additions and 7 deletions
13
src/common/build/license.ts
Normal file
13
src/common/build/license.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import * as fs from 'fs';
|
||||
|
||||
const license = fs.readFileSync(__dirname + '/../../../LICENSE', 'utf-8');
|
||||
|
||||
const licenseHtml = license
|
||||
.replace(/\r\n/g, '\n')
|
||||
.replace(/(.)\n(.)/g, '$1 $2')
|
||||
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
|
||||
|
||||
export {
|
||||
license,
|
||||
licenseHtml
|
||||
};
|
3
src/web/docs/license.en.pug
Normal file
3
src/web/docs/license.en.pug
Normal file
|
@ -0,0 +1,3 @@
|
|||
h1 License
|
||||
|
||||
div!= common.license
|
3
src/web/docs/license.ja.pug
Normal file
3
src/web/docs/license.ja.pug
Normal file
|
@ -0,0 +1,3 @@
|
|||
h1 ライセンス
|
||||
|
||||
div!= common.license
|
|
@ -4,6 +4,7 @@ import * as yaml from 'js-yaml';
|
|||
|
||||
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 } {
|
||||
|
@ -42,5 +43,7 @@ export default function(): { [key: string]: any } {
|
|||
|
||||
vars['facss'] = fa.dom.css();
|
||||
|
||||
vars['license'] = licenseHtml;
|
||||
|
||||
return vars;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,8 @@
|
|||
* Inject license
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||
|
||||
const license = fs.readFileSync(__dirname + '/../../../LICENSE', 'utf-8')
|
||||
.replace(/\r\n/g, '\n')
|
||||
.replace(/(.)\n(.)/g, '$1 $2')
|
||||
.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
|
||||
import { licenseHtml } from '../../../src/common/build/license';
|
||||
|
||||
export default () => ({
|
||||
enforce: 'pre',
|
||||
|
@ -16,7 +11,7 @@ export default () => ({
|
|||
exclude: /node_modules/,
|
||||
loader: StringReplacePlugin.replace({
|
||||
replacements: [{
|
||||
pattern: '%license%', replacement: () => license
|
||||
pattern: '%license%', replacement: () => licenseHtml
|
||||
}]
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue