1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-10-31 07:11:47 +09:00
This commit is contained in:
syuilo 2018-01-01 02:08:41 +09:00
parent 727ecf86b9
commit 88e4f1b287
5 changed files with 24 additions and 7 deletions

View 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
};

View File

@ -0,0 +1,3 @@
h1 License
div!= common.license

View File

@ -0,0 +1,3 @@
h1 ライセンス
div!= common.license

View File

@ -4,6 +4,7 @@ import * as yaml from 'js-yaml';
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';
const constants = require('../../const.json'); const constants = require('../../const.json');
export default function(): { [key: string]: any } { export default function(): { [key: string]: any } {
@ -42,5 +43,7 @@ export default function(): { [key: string]: any } {
vars['facss'] = fa.dom.css(); vars['facss'] = fa.dom.css();
vars['license'] = licenseHtml;
return vars; return vars;
} }

View File

@ -2,13 +2,8 @@
* Inject license * Inject license
*/ */
import * as fs from 'fs';
const StringReplacePlugin = require('string-replace-webpack-plugin'); const StringReplacePlugin = require('string-replace-webpack-plugin');
import { licenseHtml } from '../../../src/common/build/license';
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>');
export default () => ({ export default () => ({
enforce: 'pre', enforce: 'pre',
@ -16,7 +11,7 @@ export default () => ({
exclude: /node_modules/, exclude: /node_modules/,
loader: StringReplacePlugin.replace({ loader: StringReplacePlugin.replace({
replacements: [{ replacements: [{
pattern: '%license%', replacement: () => license pattern: '%license%', replacement: () => licenseHtml
}] }]
}) })
}); });