diff --git a/.gitignore b/.gitignore index b5b01b1..98d9f7f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ docs matter-doc-theme build/matter-dev.js build/matter-dev.min.js +build/matter.dev.js +build/matter.dev.min.js demo/js/lib/matter-dev.js demo/js/Examples.min.js examples/build diff --git a/package.json b/package.json index 0a5c29a..eadf1d5 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "serve": "webpack-dev-server --no-cache --mode development --config webpack.demo.config.js", "watch": "nodemon --watch webpack.demo.config.js --exec \"npm run serve\"", "build": "webpack --mode=production --no-hot --no-watch & webpack --mode=production --no-hot --no-watch --env.MINIMIZE", - "build-alpha": "webpack --mode=production --env.ALPHA & webpack --mode=production --env.MINIMIZE --env.ALPHA", + "build-alpha": "webpack --mode=production --no-hot --no-watch --env.KIND=alpha & webpack --mode=production --no-hot --no-watch --env.MINIMIZE --env.KIND=alpha", + "build-dev": "webpack --mode=production --no-hot --no-watch --env.KIND=dev & webpack --mode=production --no-hot --no-watch --env.MINIMIZE --env.KIND=dev", "build-demo": "rm -rf ./demo/js && webpack --no-hot --no-watch --config webpack.demo.config.js --mode=production && webpack --no-hot --no-watch --config webpack.demo.config.js --mode=production --env.MINIMIZE", "lint": "eslint 'src/**/*.js' 'demo/src/**/*.js' 'examples/*.js' 'webpack.*.js'", "doc": "yuidoc --config yuidoc.json --project-version $npm_package_version", @@ -53,7 +54,7 @@ "test-all": "jest --no-cache", "test-save": "SAVE=true npm run test-node", "test-watch": "npm run test-node -- --watch", - "test-node": "node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Examples.spec.js", + "test-node": "npm run build-dev && node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Examples.spec.js", "test-browser": "node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Browser.spec.js", "changelog": "conventional-changelog -i CHANGELOG.md -s -r", "release": "npm version --no-git-tag-version", diff --git a/test/ExampleWorker.js b/test/ExampleWorker.js index 9017132..8a9b074 100644 --- a/test/ExampleWorker.js +++ b/test/ExampleWorker.js @@ -21,7 +21,7 @@ const reset = M => { const mock = require('mock-require'); const { engineCapture } = require('./TestTools'); -const MatterDev = stubBrowserFeatures(require('../src/module/main')); +const MatterDev = stubBrowserFeatures(require('../build/matter.dev')); const MatterBuild = stubBrowserFeatures(require('../build/matter')); const Example = require('../examples/index'); diff --git a/test/TestTools.js b/test/TestTools.js index 4f13f41..67ce103 100644 --- a/test/TestTools.js +++ b/test/TestTools.js @@ -224,7 +224,7 @@ const logReport = (captures, version) => { } } - return `Output logs from ${color(version, colors.Yellow)} version on last run\n\n` + return `Output logs from ${color(version, colors.Yellow)} build on last run\n\n` + (report ? report : ' None\n'); }; diff --git a/webpack.config.js b/webpack.config.js index 3f8764c..885c8f1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,18 +9,17 @@ const execSync = require('child_process').execSync; module.exports = (env = {}) => { const minimize = env.MINIMIZE || false; - const alpha = env.ALPHA || false; + const kind = env.KIND || null; const sizeThreshold = minimize ? 100 * 1024 : 512 * 1024; const commitHash = execSync('git rev-parse --short HEAD').toString().trim(); - const version = !alpha ? pkg.version : `${pkg.version}-alpha+${commitHash}`; + const version = !kind ? pkg.version : `${pkg.version}-${kind}+${commitHash}`; const license = fs.readFileSync('LICENSE', 'utf8'); const resolve = relativePath => path.resolve(__dirname, relativePath); - const alphaInfo = 'Experimental pre-release build.\n '; const banner = `${pkg.name} ${version} by @liabru -${alpha ? alphaInfo : ''}${pkg.homepage} +${kind ? 'Experimental pre-release build.\n ' : ''}${pkg.homepage} License ${pkg.license}${!minimize ? '\n\n' + license : ''}`; return { @@ -32,7 +31,7 @@ License ${pkg.license}${!minimize ? '\n\n' + license : ''}`; umdNamedDefine: true, globalObject: 'this', path: resolve('./build'), - filename: `[name]${alpha ? '.alpha' : ''}${minimize ? '.min' : ''}.js` + filename: `[name]${kind ? '.' + kind : ''}${minimize ? '.min' : ''}.js` }, optimization: { minimize }, performance: {