Skip to content

Commit 26aafe7

Browse files
committed
Add version info when bundle in production #154
1 parent b3f5da6 commit 26aafe7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ then
1313
npm test 2>/dev/null
1414

1515
# build
16-
npm run build
16+
VERSION=$VERSION npm run build
1717

1818
# commit
1919
git add -A

webpack.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,19 @@ module.exports = {
4646
}
4747
};
4848

49-
if (process.env.NODE_ENV !== 'production') {
49+
if (process.env.NODE_ENV === 'production') {
50+
// production configurations
51+
const pkg = require('./package');
52+
const banner = [
53+
`${pkg.name} v${process.env.VERSION || pkg.version}`,
54+
`(c) 2016-${new Date().getFullYear()} ${pkg.author.name}`,
55+
`${pkg.license} License`
56+
].join('\n');
57+
58+
module.exports.plugins = [
59+
new webpack.BannerPlugin(banner)
60+
];
61+
} else {
5062
// development configurations
5163
module.exports.plugins = [
5264
new HtmlWebpackPlugin({

0 commit comments

Comments
 (0)