chore(distro): consolidate into single task

This commit is contained in:
Nico Rehwaldt 2018-01-08 09:19:19 +01:00 committed by Philipp Fromme
parent f7cb94244d
commit d9d0d9dcdb
3 changed files with 31 additions and 17 deletions

View File

@ -7,10 +7,7 @@
"lint": "eslint .", "lint": "eslint .",
"dev": "npm test -- --auto-watch --no-single-run", "dev": "npm test -- --auto-watch --no-single-run",
"test": "karma start test/config/karma.unit.js", "test": "karma start test/config/karma.unit.js",
"clean": "del dist/*", "distro": "node tasks/build-distro.js",
"build-distro": "node tasks/build-distro.js",
"copy-assets": "node tasks/copy-assets.js",
"distro": "run-s clean copy-assets build-distro",
"prepublishOnly": "run-s distro" "prepublishOnly": "run-s distro"
}, },
"repository": { "repository": {
@ -46,6 +43,7 @@
"chai-match": "^1.1.1", "chai-match": "^1.1.1",
"common-shakeify": "^0.4.5", "common-shakeify": "^0.4.5",
"cpx": "^1.5.0", "cpx": "^1.5.0",
"del": "^3.0.0",
"del-cli": "^1.1.0", "del-cli": "^1.1.0",
"eslint": "^4.14.0", "eslint": "^4.14.0",
"eslint-plugin-mocha": "^4.9.0", "eslint-plugin-mocha": "^4.9.0",
@ -61,6 +59,7 @@
"karma-safari-launcher": "^1.0.0", "karma-safari-launcher": "^1.0.0",
"karma-sinon-chai": "^1.3.2", "karma-sinon-chai": "^1.3.2",
"karma-spec-reporter": "0.0.31", "karma-spec-reporter": "0.0.31",
"mkdirp": "^0.5.1",
"mocha": "^4.0.1", "mocha": "^4.0.1",
"mocha-test-container-support": "0.2.0", "mocha-test-container-support": "0.2.0",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",

View File

@ -2,7 +2,34 @@
var bundle = require('./bundle'); var bundle = require('./bundle');
bundle({ var path = require('path');
var mkdirp = require('mkdirp').sync,
cp = require('cpx').copySync,
del = require('del').sync;
var dest = 'dist';
function resolve(module, sub) {
var pkg = require.resolve(module + '/package.json');
return path.dirname(pkg) + sub;
}
console.log('clean ' + dest);
del(dest);
console.log('mkdir -p ' + dest);
mkdirp(dest);
console.log(`copy bpmn-font to ${dest}/bpmn-font`);
cp('assets/bpmn-font/*', dest + '/assets/bpmn-font');
console.log(`copy diagram-js.css to ${dest}`);
cp(resolve('diagram-js', '/assets/**'), dest + '/assets');
bundle(dest, {
'bpmn-viewer': 'lib/Viewer.js', 'bpmn-viewer': 'lib/Viewer.js',
'bpmn-navigated-viewer': 'lib/NavigatedViewer.js', 'bpmn-navigated-viewer': 'lib/NavigatedViewer.js',
'bpmn-modeler': 'lib/Modeler.js' 'bpmn-modeler': 'lib/Modeler.js'

View File

@ -1,12 +0,0 @@
'use strict';
var path = require('path');
var copySync = require('cpx').copySync;
var diagramAssets = path.join(path.dirname(require.resolve('diagram-js')), '/assets') + '/**';
console.log(diagramAssets);
copySync('assets/**', 'dist/');
copySync(diagramAssets, 'dist/');