bpmn-js/Gruntfile.js

127 lines
2.7 KiB
JavaScript
Raw Normal View History

'use strict';
2014-03-11 14:54:36 +00:00
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
2014-03-11 14:54:36 +00:00
/* global process */
// 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({
2014-03-11 14:54:36 +00:00
pkg: grunt.file.readJSON('package.json'),
config: {
sources: 'lib',
tests: 'test',
dist: '../bower-bpmn-js/dist'
2014-03-11 14:54:36 +00:00
},
eslint: {
check: {
src: [
'{lib,test}/**/*.js'
]
},
fix: {
src: [
'{lib,test}/**/*.js'
],
options: {
fix: true
}
2014-03-11 14:54:36 +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,
browsers: TEST_BROWSERS
2014-03-11 14:54:36 +00:00
},
unit: {
browsers: TEST_BROWSERS
},
translations: {
singleRun: true,
autoWatch: false,
reporters: [ 'dots', 'translation-reporter' ],
plugins: [
'karma-*',
require('./test/config/translation-reporter')
],
envPreprocessor: [
'TRANSLATIONS'
],
browsers: TEST_BROWSERS
2014-03-11 14:54:36 +00:00
}
},
bundle: {
viewer: {
name: 'bpmn-viewer',
src: '<%= config.sources %>/Viewer.js',
dest: '<%= config.dist %>'
2014-03-31 13:53:31 +00:00
},
navigated_viewer: {
name: 'bpmn-navigated-viewer',
src: '<%= config.sources %>/NavigatedViewer.js',
dest: '<%= config.dist %>'
},
modeler: {
name: 'bpmn-modeler',
src: '<%= config.sources %>/Modeler.js',
dest: '<%= config.dist %>'
}
},
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-11 14:54:36 +00:00
});
grunt.loadTasks('tasks');
2014-03-25 13:06:52 +00:00
// tasks
grunt.registerTask('extract-translations', [ 'karma:translations' ]);
2014-03-25 13:06:52 +00:00
grunt.registerTask('test', [ 'karma:single' ]);
grunt.registerTask('auto-test', [ 'karma:unit' ]);
2014-03-11 14:54:36 +00:00
grunt.registerTask('build', [ 'bundle', 'copy' ]);
grunt.registerTask('default', [ 'eslint:check', 'test', 'build' ]);
2014-03-11 14:54:36 +00:00
};