2018-01-05 15:09:39 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-01-08 08:19:19 +00:00
|
|
|
var path = require('path');
|
|
|
|
|
2018-04-02 21:15:15 +00:00
|
|
|
var exec = require('execa').sync,
|
|
|
|
mkdirp = require('mkdirp').sync,
|
2018-01-08 08:19:19 +00:00
|
|
|
cp = require('cpx').copySync,
|
|
|
|
del = require('del').sync;
|
|
|
|
|
2018-01-08 08:30:02 +00:00
|
|
|
var dest = process.env.DISTRO_DIST || 'dist';
|
2018-01-08 08:19:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2018-01-28 19:55:52 +00:00
|
|
|
console.log('copy bpmn-font to ' + dest + '/bpmn-font');
|
2018-01-08 08:24:49 +00:00
|
|
|
cp(resolve('bpmn-font', '/dist/{font,css}/**'), dest + '/assets/bpmn-font');
|
2018-01-08 08:19:19 +00:00
|
|
|
|
2018-01-28 19:55:52 +00:00
|
|
|
console.log('copy diagram-js.css to ' + dest);
|
2018-01-08 08:19:19 +00:00
|
|
|
cp(resolve('diagram-js', '/assets/**'), dest + '/assets');
|
|
|
|
|
2021-10-18 08:28:36 +00:00
|
|
|
console.log('copy bpmn-js.css to ' + dest);
|
|
|
|
cp('./assets/bpmn-js.css', dest + '/assets');
|
|
|
|
|
2018-04-02 21:15:15 +00:00
|
|
|
console.log('building pre-packaged distributions');
|
|
|
|
|
|
|
|
var NODE_ENV = process.env.NODE_ENV;
|
|
|
|
|
|
|
|
[ 'production', 'development' ].forEach(function(env) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
process.env.NODE_ENV = env;
|
2018-01-05 15:09:39 +00:00
|
|
|
|
2021-10-14 21:11:21 +00:00
|
|
|
exec('rollup', [ '-c' ], {
|
|
|
|
stdio: 'inherit'
|
|
|
|
});
|
2018-04-02 21:15:15 +00:00
|
|
|
} catch (e) {
|
|
|
|
console.error('failed to build pre-package distributions', e);
|
|
|
|
|
|
|
|
process.exit(1);
|
2018-01-05 15:09:39 +00:00
|
|
|
}
|
2018-04-02 21:15:15 +00:00
|
|
|
|
|
|
|
process.env.NODE_ENV = NODE_ENV;
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log('done.');
|