diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-12-11 03:38:31 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-12-11 03:38:31 +0900 |
| commit | 845dc261846661359d38fccea0f84b99ed6968e5 (patch) | |
| tree | 623341e642991b495129f90b81e80ce126d13d0a /webpack/module/rules/license.ts | |
| parent | #983 (diff) | |
| download | misskey-845dc261846661359d38fccea0f84b99ed6968e5.tar.gz misskey-845dc261846661359d38fccea0f84b99ed6968e5.tar.bz2 misskey-845dc261846661359d38fccea0f84b99ed6968e5.zip | |
:v:
Diffstat (limited to 'webpack/module/rules/license.ts')
| -rw-r--r-- | webpack/module/rules/license.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/webpack/module/rules/license.ts b/webpack/module/rules/license.ts new file mode 100644 index 0000000000..1795af960d --- /dev/null +++ b/webpack/module/rules/license.ts @@ -0,0 +1,22 @@ +/** + * 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>'); + +export default () => ({ + enforce: 'pre', + test: /\.(tag|js)$/, + exclude: /node_modules/, + loader: StringReplacePlugin.replace({ + replacements: [{ + pattern: '%license%', replacement: () => license + }] + }) +}); |