packaging: reducing package size be only including public vendor stuff we need

This commit is contained in:
Torkel Ödegaard
2017-09-14 17:33:58 +02:00
parent a5c08a72fb
commit 210df23430
273 changed files with 67 additions and 165903 deletions

View File

@@ -69,6 +69,7 @@ module.exports = function(grunt) {
grunt.task.run('copy:public_gen_to_temp');
grunt.task.run('copy:backend_bin');
grunt.task.run('copy:backend_files');
grunt.task.run('clean:packaging');
grunt.file.write(path.join(grunt.config('tempDir'), 'VERSION'), grunt.config('pkg.version'));
});

View File

@@ -5,6 +5,12 @@ module.exports = function(config) {
release: ['<%= destDir %>', '<%= tempDir %>', '<%= genDir %>'],
gen: ['<%= genDir %>'],
temp: ['<%= tempDir %>'],
css: ['<%= genDir %>/css']
css: ['<%= genDir %>/css'],
packaging: [
'<%= tempDir %>/public/vendor/npm/rxjs',
'<%= tempDir %>/public/vendor/npm/teather',
'<%= tempDir %>/public/vendor/npm/teather-drop',
'<%= tempDir %>/public/**/*.map',
],
};
};

View File

@@ -19,7 +19,10 @@ module.exports = function(config) {
cwd: './node_modules',
expand: true,
src: [
'ace-builds/src-noconflict/**/*',
'jquery/dist/jquery.js',
'lodash/lodash.js',
'ace-builds/src-noconflict/ace.js',
'ace-builds/src-noconflict/ext-language_tools.js',
'eventemitter3/*.js',
'systemjs/dist/*.js',
'es6-promise/**/*',

View File

@@ -2,6 +2,7 @@ module.exports = function(grunt) {
"use strict";
grunt.registerTask('systemjs:build', function() {
var path = require('path');
var Builder = require('systemjs-builder');
var done = this.async();
@@ -23,8 +24,15 @@ module.exports = function(grunt) {
builder
.bundle(expression, 'public_gen/app/app_bundle.js')
.then(function() {
console.log('Build complete');
.then(function(res) {
console.log('Build complete', res.modules);
for (var i = 0; i < res.modules.length; i++) {
var modulePath = path.join('public_gen', res.modules[i]);
console.log(modulePath);
grunt.file.delete(modulePath);
}
done();
grunt.task.run('concat:bundle_and_boot');
})