Skip to content

Commit

Permalink
changed alpha build configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Mar 9, 2020
1 parent 497ac80 commit 182c84a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"scripts": {
"dev": "webpack-dev-server --watch-content-base",
"build": "webpack --mode=production & webpack --mode=production --env.MINIMIZE",
"build-alpha": "webpack --mode=production --env.EDGE & webpack --mode=production --env.MINIMIZE --env.EDGE",
"build-examples": "webpack --config webpack.examples.config.js --mode=production --env.EDGE & webpack --config webpack.examples.config.js --mode=production --env.MINIMIZE --env.EDGE",
"build-alpha": "webpack --mode=production --env.ALPHA & webpack --mode=production --env.MINIMIZE --env.ALPHA",
"build-examples": "webpack --config webpack.examples.config.js --mode=production --env.ALPHA & webpack --config webpack.examples.config.js --mode=production --env.MINIMIZE --env.ALPHA",
"lint": "eslint 'src/**/*.js' 'demo/js/Demo.js' 'demo/js/Compare.js' 'examples/*.js' 'webpack.*.js' 'Gulpfile.js'",
"doc": "gulp doc",
"test": "jest",
Expand Down
14 changes: 8 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ const execSync = require('child_process').execSync;

module.exports = (env = {}) => {
const minimize = env.MINIMIZE || false;
const edge = env.EDGE || false;
const alpha = env.ALPHA || false;
const maxSize = minimize ? 100 * 1024 : 512 * 1024;
const isDevServer = process.env.WEBPACK_DEV_SERVER;

const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
const version = !edge ? pkg.version : `${pkg.version}-alpha-${commitHash}`;
const version = !alpha ? pkg.version : `${pkg.version}-alpha+${commitHash}`;
const date = new Date().toISOString().slice(0, 10);
const name = 'matter';
const banner = `${name} ${version} by @liabru ${date}
${pkg.homepage}
License ${pkg.license}`;
const alphaInfo = 'Experimental pre-release build.\n ';
const banner =
` ${pkg.name} ${version} by @liabru (c) ${date}
${alpha ? alphaInfo : ''}${pkg.homepage}
License ${pkg.license}`;

return {
entry: { [name]: './src/module/main.js' },
Expand All @@ -28,7 +30,7 @@ module.exports = (env = {}) => {
umdNamedDefine: true,
globalObject: 'this',
path: path.resolve(__dirname, './build'),
filename: `[name]${minimize ? '.min' : ''}.js`
filename: `[name]${alpha ? '.alpha' : ''}${minimize ? '.min' : ''}.js`
},
node: false,
optimization: { minimize },
Expand Down

0 comments on commit 182c84a

Please sign in to comment.