0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

update examples build config and scripts

This commit is contained in:
liabru 2020-12-05 23:36:13 +00:00
parent fe80478725
commit 69afb1175d
2 changed files with 12 additions and 7 deletions

View file

@ -35,7 +35,8 @@
"dev": "webpack-dev-server --watch-content-base",
"build": "webpack --mode=production & webpack --mode=production --env.MINIMIZE",
"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",
"build-examples": "webpack --config webpack.examples.config.js --mode=production & webpack --config webpack.examples.config.js --mode=production --env.MINIMIZE",
"build-examples-alpha": "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'",
"doc": "yuidoc --config yuidoc.json --project-version $npm_package_version",
"test": "npm run test-node",

View file

@ -4,20 +4,24 @@
const webpack = require('webpack');
const path = require('path');
const pkg = require('./package.json');
const fs = require('fs');
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 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 license = fs.readFileSync('LICENSE', 'utf8');
const date = new Date().toISOString().slice(0, 10);
const name = 'matter-examples';
const banner = `${name} ${version} by @liabru ${date}
${pkg.homepage}
License ${pkg.license}`;
const name = 'matter-js-examples';
const alphaInfo = 'Experimental pre-release build.\n ';
const banner =
`${name} ${version} by @liabru ${date}
${alpha ? alphaInfo : ''}${pkg.homepage}
License ${pkg.license}${!minimize ? '\n\n' + license : ''}`;
return {
entry: './examples/index.js',