From d00237b76683b29fad0094da2f3873931b975f9f Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 25 May 2017 13:54:31 +0900 Subject: [PATCH] Add banner into built script files --- webpack/plugins/banner.ts | 6 ++++++ webpack/plugins/index.ts | 5 ++++- webpack/webpack.config.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 webpack/plugins/banner.ts diff --git a/webpack/plugins/banner.ts b/webpack/plugins/banner.ts new file mode 100644 index 000000000..963290594 --- /dev/null +++ b/webpack/plugins/banner.ts @@ -0,0 +1,6 @@ +import * as webpack from 'webpack'; + +export default version => new webpack.BannerPlugin({ + banner: `Misskey v${version} - built at ${new Date()} | (c) syuilo 2014-2017 + hash:[hash], chunkhash:[chunkhash], name:[name], filebase:[filebase], query:[query], file:[file]` +}); diff --git a/webpack/plugins/index.ts b/webpack/plugins/index.ts index cbffbad4e..c35350726 100644 --- a/webpack/plugins/index.ts +++ b/webpack/plugins/index.ts @@ -2,11 +2,12 @@ const StringReplacePlugin = require('string-replace-webpack-plugin'); import constant from './const'; import minify from './minify'; +import banner from './banner'; const env = process.env.NODE_ENV; const isProduction = env === 'production'; -export default () => { +export default version => { const plugins = [ constant(), new StringReplacePlugin() @@ -16,5 +17,7 @@ export default () => { plugins.push(minify()); } + plugins.push(banner(version)); + return plugins; }; diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts index 50733a6cf..0154d3b19 100644 --- a/webpack/webpack.config.ts +++ b/webpack/webpack.config.ts @@ -29,7 +29,7 @@ module.exports = langs.map(([lang, locale]) => { name, entry, module: module_(lang, locale), - plugins: plugins(), + plugins: plugins(version), output }; });