2015-02-02 13:46:21 +00:00
|
|
|
'use strict';
|
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
require('load-grunt-tasks')(grunt);
|
2014-04-28 13:30:22 +00:00
|
|
|
require('time-grunt')(grunt);
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
/* global process */
|
2014-04-03 09:39:11 +00:00
|
|
|
|
|
|
|
// configures browsers to run test against
|
|
|
|
// any of [ 'PhantomJS', 'Chrome', 'Firefox', 'IE']
|
|
|
|
var TEST_BROWSERS = ((process.env.TEST_BROWSERS || '').replace(/^\s+|\s+$/, '') || 'PhantomJS').split(/\s*,\s*/g);
|
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
// project configuration
|
|
|
|
grunt.initConfig({
|
2015-01-11 22:42:27 +00:00
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
|
|
|
|
config: {
|
|
|
|
sources: 'lib',
|
|
|
|
tests: 'test',
|
2015-01-23 14:47:47 +00:00
|
|
|
dist: '../bower-bpmn-js/dist'
|
2014-03-11 14:54:36 +00:00
|
|
|
},
|
|
|
|
|
2016-06-07 06:46:45 +00:00
|
|
|
eslint: {
|
|
|
|
check: {
|
|
|
|
src: [
|
|
|
|
'{lib,test}/**/*.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
fix: {
|
|
|
|
src: [
|
|
|
|
'{lib,test}/**/*.js'
|
|
|
|
],
|
|
|
|
options: {
|
|
|
|
fix: true
|
|
|
|
}
|
2014-03-11 14:54:36 +00:00
|
|
|
}
|
|
|
|
},
|
2014-05-08 06:52:14 +00:00
|
|
|
|
|
|
|
release: {
|
|
|
|
options: {
|
|
|
|
tagName: 'v<%= version %>',
|
|
|
|
commitMessage: 'chore(project): release v<%= version %>',
|
|
|
|
tagMessage: 'chore(project): tag v<%= version %>'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
karma: {
|
|
|
|
options: {
|
2014-07-30 14:26:08 +00:00
|
|
|
configFile: '<%= config.tests %>/config/karma.unit.js'
|
2014-03-11 14:54:36 +00:00
|
|
|
},
|
|
|
|
single: {
|
|
|
|
singleRun: true,
|
|
|
|
autoWatch: false,
|
|
|
|
|
2014-06-23 12:50:23 +00:00
|
|
|
browsers: TEST_BROWSERS
|
2014-03-11 14:54:36 +00:00
|
|
|
},
|
|
|
|
unit: {
|
2016-05-03 14:23:31 +00:00
|
|
|
browsers: TEST_BROWSERS
|
|
|
|
},
|
|
|
|
translations: {
|
|
|
|
singleRun: true,
|
|
|
|
autoWatch: false,
|
|
|
|
|
|
|
|
reporters: [ 'dots', 'translation-reporter' ],
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
'karma-*',
|
|
|
|
require('./test/config/translation-reporter')
|
|
|
|
],
|
|
|
|
|
|
|
|
envPreprocessor: [
|
|
|
|
'TRANSLATIONS'
|
|
|
|
],
|
|
|
|
|
2014-06-23 12:50:23 +00:00
|
|
|
browsers: TEST_BROWSERS
|
2014-03-11 14:54:36 +00:00
|
|
|
}
|
|
|
|
},
|
2014-06-02 12:24:10 +00:00
|
|
|
|
2015-01-11 22:42:27 +00:00
|
|
|
bundle: {
|
|
|
|
viewer: {
|
|
|
|
name: 'bpmn-viewer',
|
|
|
|
src: '<%= config.sources %>/Viewer.js',
|
2015-01-23 14:47:47 +00:00
|
|
|
dest: '<%= config.dist %>'
|
2014-03-31 13:53:31 +00:00
|
|
|
},
|
2015-01-11 22:42:27 +00:00
|
|
|
navigated_viewer: {
|
|
|
|
name: 'bpmn-navigated-viewer',
|
|
|
|
src: '<%= config.sources %>/NavigatedViewer.js',
|
2015-01-23 14:47:47 +00:00
|
|
|
dest: '<%= config.dist %>'
|
2015-01-11 22:42:27 +00:00
|
|
|
},
|
|
|
|
modeler: {
|
|
|
|
name: 'bpmn-modeler',
|
|
|
|
src: '<%= config.sources %>/Modeler.js',
|
2015-01-23 14:47:47 +00:00
|
|
|
dest: '<%= config.dist %>'
|
2015-01-11 22:42:27 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
copy: {
|
|
|
|
bpmn_js: {
|
|
|
|
files: [
|
|
|
|
{ expand: true, cwd: 'assets', src: [ '**' ], dest: '<%= config.dist %>/assets' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
diagram_js: {
|
|
|
|
files: [
|
|
|
|
{ expand: true, cwd: 'node_modules/diagram-js/assets', src: [ '**' ], dest: '<%= config.dist %>/assets' }
|
|
|
|
]
|
2014-03-31 13:53:31 +00:00
|
|
|
}
|
2014-03-13 10:21:03 +00:00
|
|
|
}
|
2014-03-11 14:54:36 +00:00
|
|
|
});
|
|
|
|
|
2015-01-11 22:42:27 +00:00
|
|
|
grunt.loadTasks('tasks');
|
2014-04-25 11:28:40 +00:00
|
|
|
|
2014-03-25 13:06:52 +00:00
|
|
|
|
2015-01-11 22:42:27 +00:00
|
|
|
// tasks
|
2016-05-03 14:23:31 +00:00
|
|
|
grunt.registerTask('extract-translations', [ 'karma:translations' ]);
|
2014-03-25 13:06:52 +00:00
|
|
|
|
2015-01-11 22:42:27 +00:00
|
|
|
grunt.registerTask('test', [ 'karma:single' ]);
|
2014-03-13 10:21:03 +00:00
|
|
|
|
2014-04-08 11:41:03 +00:00
|
|
|
grunt.registerTask('auto-test', [ 'karma:unit' ]);
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2015-01-11 22:42:27 +00:00
|
|
|
grunt.registerTask('build', [ 'bundle', 'copy' ]);
|
|
|
|
|
2016-06-07 06:46:45 +00:00
|
|
|
grunt.registerTask('default', [ 'eslint:check', 'test', 'build' ]);
|
2014-03-11 14:54:36 +00:00
|
|
|
};
|