chore(project): remove browserify bundle

Bundling must be done by users of the library in some way anyway.
All those that do not bundle it will use the bower version.

Removing the bundle function to keep the build slim.
This commit is contained in:
Nico Rehwaldt 2014-08-21 15:34:37 +02:00
parent eb77b6c418
commit 88fbe05ae4
2 changed files with 16 additions and 127 deletions

View File

@ -9,30 +9,6 @@ module.exports = function(grunt) {
// any of [ 'PhantomJS', 'Chrome', 'Firefox', 'IE']
var TEST_BROWSERS = ((process.env.TEST_BROWSERS || '').replace(/^\s+|\s+$/, '') || 'PhantomJS').split(/\s*,\s*/g);
function bundleAlias(components) {
var alias = [];
if (components.indexOf('libs-external') >= 0) {
alias.push('node_modules/jquery:jquery');
alias.push('node_modules/lodash:lodash');
}
if (components.indexOf('libs-local') >= 0) {
alias.push('node_modules/bpmn-moddle:bpmn-moddle');
}
if (components.indexOf('viewer') >= 0) {
alias.push('index.js:bpmn-js');
}
if (components.indexOf('modeler') >= 0) {
alias.push('<%= config.sources %>/Modeler.js:bpmn-js/Modeler');
}
return alias;
}
function extractSourceMap(file) {
var content = grunt.file.read(file, { encoding: 'utf-8' });
@ -76,9 +52,6 @@ module.exports = function(grunt) {
src: [
['<%=config.sources %>']
],
gruntfile: [
'Gruntfile.js'
],
options: {
jshintrc: true
}
@ -118,21 +91,6 @@ module.exports = function(grunt) {
debug: true
}
},
watch: {
files: {
'<%= config.dist %>/bpmn.js': [ '<%= config.sources %>/**/*.js' ],
'<%= config.dist %>/bpmn-viewer.js': [ '<%= config.sources %>/Viewer.js' ]
},
options: {
watch: true,
alias: bundleAlias([
'viewer',
'modeler',
'libs-external',
'libs-local'
])
}
},
bowerViewer: {
files: {
'<%= config.bowerDist %>/bpmn-viewer.js': [ '<%= config.sources %>/Viewer.js' ]
@ -160,46 +118,6 @@ module.exports = function(grunt) {
} ]
]
}
},
standaloneViewer: {
files: {
'<%= config.dist %>/bpmn-viewer.js': [ '<%= config.sources %>/Viewer.js' ]
},
options: {
alias: bundleAlias([
'viewer',
'libs-external',
'libs-local'
])
}
},
standaloneModeler: {
files: {
'<%= config.dist %>/bpmn.js': [ '<%= config.sources %>/**/*.js' ],
},
options: {
alias: bundleAlias([
'viewer',
'modeler',
'libs-external',
'libs-local'
])
}
}
},
watch: {
standaloneModeler: {
files: [ '<%= config.dist %>/bpmn.js' ],
tasks: [ 'uglify:standaloneModeler' ]
},
standaloneViewer: {
files: [ '<%= config.dist %>/bpmn-viewer.js' ],
tasks: [ 'uglify:standaloneViewer' ]
},
bowerViewer: {
files: [ '<%= config.bowerDist %>/bpmn-viewer.js' ],
tasks: [ 'uglify:bowerViewer' ]
}
},
@ -229,16 +147,6 @@ module.exports = function(grunt) {
files: {
'<%= config.bowerDist %>/bpmn-viewer.min.js': [ '<%= config.bowerDist %>/bpmn-viewer.js' ]
}
},
standaloneModeler: {
files: {
'<%= config.dist %>/bpmn.min.js': [ '<%= config.dist %>/bpmn.js' ]
}
},
standaloneViewer: {
files: {
'<%= config.dist %>/bpmn-viewer.min.js': [ '<%= config.dist %>/bpmn-viewer.js' ]
}
}
}
});
@ -254,38 +162,20 @@ module.exports = function(grunt) {
// valid executions are
//
// * build -> build:all
// * build:all -> build:lib, build:bower
// * build:lib -> { packages library files as standalone bundle }
// * build:lib -> { packages library files as bower bundle }
// * build:all -> build:bower
// * build:bower
//
grunt.registerTask('build', function(target, mode) {
mode = mode || 'prod';
grunt.registerTask('build', function(target) {
if (target === 'bower') {
return grunt.task.run(['browserify:bowerViewer', 'uglify:bowerViewer']);
}
if (target === 'lib') {
var tasks = [];
if (mode !== 'dev') {
tasks.push('uglify:standaloneModeler', 'uglify:standaloneViewer');
}
return grunt.task.run(['browserify:standaloneViewer', 'browserify:standaloneModeler'].concat(tasks));
return grunt.task.run([ 'browserify:bowerViewer', 'uglify:bowerViewer' ]);
}
if (!target || target === 'all') {
return grunt.task.run(['build:lib:' + mode, 'build:bower' ]);
return grunt.task.run([ 'build:bower' ]);
}
});
grunt.registerTask('auto-build', [
'browserify:watch',
'watch'
]);
grunt.registerTask('auto-test', [ 'karma:unit' ]);
grunt.registerTask('default', [ 'jshint', 'test', 'build', 'jsdoc' ]);

View File

@ -29,13 +29,13 @@
],
"license": "http://bpmn.io/license",
"devDependencies": {
"brfs": "^1.0.2",
"brfs": "^1.2.0",
"diagram-js": "^0.4.0",
"exposify": "https://github.com/Nikku/exposify/archive/v0.2.0-transform-arguments-0.tar.gz",
"grunt": "^0.4.4",
"grunt-browserify": "^2.1.2",
"grunt-contrib-jshint": "^0.7.2",
"grunt-contrib-uglify": "https://github.com/gruntjs/grunt-contrib-uglify/archive/master.tar.gz",
"grunt-contrib-watch": "^0.5.3",
"grunt-jsdoc": "^0.5.1",
"grunt-karma": "^0.8.0",
"grunt-release": "^0.7.0",
@ -49,21 +49,20 @@
"karma-jasmine": "https://github.com/Nikku/karma-jasmine/archive/jasmine-v2.0.0-latest-1.tar.gz",
"karma-phantomjs-launcher": "^0.1.2",
"load-grunt-tasks": "^0.3.0",
"time-grunt": "^0.3.2",
"diagram-js": "~0.4.0"
"time-grunt": "^0.3.2"
},
"dependencies": {
"bpmn-moddle": "~0.3.0",
"diagram-js-direct-editing": "0.3.0",
"didi": "~0.0.4",
"jquery": "~2.1.0",
"jquery-mousewheel": "~3.1.11",
"lodash": "~2.4.0",
"bpmn-moddle": "^0.3.0",
"diagram-js-direct-editing": "^0.3.0",
"didi": "^0.0.4",
"jquery": "^2.1.0",
"jquery-mousewheel": "^3.1.11",
"lodash": "^2.4.0",
"object-refs": "^0.1.0",
"ids": "0.0.3",
"ids": "^0.0.3",
"bpmn-js-cli": "^0.1.1"
},
"peerDependencies": {
"diagram-js": "~0.4.0"
"diagram-js": "^0.4.0"
}
}