bpmn-js/Gruntfile.js

118 lines
2.4 KiB
JavaScript

'use strict';
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
// project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
config: {
sources: 'lib',
tests: 'test',
dist: process.env.BOWER_DIST || '../bower-bpmn-js/dist'
},
eslint: {
check: {
src: [
'{lib,test}/**/*.js'
]
},
fix: {
src: [
'{lib,test}/**/*.js'
],
options: {
fix: true
}
}
},
release: {
options: {
tagName: 'v<%= version %>',
commitMessage: 'chore(project): release v<%= version %>',
tagMessage: 'chore(project): tag v<%= version %>'
}
},
karma: {
options: {
configFile: '<%= config.tests %>/config/karma.unit.js'
},
single: {
singleRun: true,
autoWatch: false
},
unit: { },
translations: {
singleRun: true,
autoWatch: false,
reporters: [ 'dots', 'translation-reporter' ],
plugins: [
'karma-*',
require('./test/config/translation-reporter')
],
envPreprocessor: [
'TRANSLATIONS'
]
}
},
bundle: {
viewer: {
name: 'bpmn-viewer',
src: '<%= config.sources %>/Viewer.js',
dest: '<%= config.dist %>'
},
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' }
]
}
}
});
grunt.loadTasks('tasks');
// tasks
grunt.registerTask('extract-translations', [ 'karma:translations' ]);
grunt.registerTask('test', [ 'karma:single' ]);
grunt.registerTask('lint', [ 'eslint:check' ]);
grunt.registerTask('auto-test', [ 'karma:unit' ]);
grunt.registerTask('build', [ 'bundle', 'copy' ]);
grunt.registerTask('default', [ 'lint', 'test', 'build' ]);
};