Commit da832368 by Torkel Ödegaard

dev building and optimized builds work

parent abac8bcc
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"grunt-contrib-htmlmin": "~0.1.3", "grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-jshint": "~0.10.0", "grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-less": "~0.7.0", "grunt-contrib-less": "~0.7.0",
"grunt-contrib-requirejs": "~0.4.1", "grunt-contrib-requirejs": "~0.4.4",
"grunt-contrib-uglify": "~0.8.0", "grunt-contrib-uglify": "~0.8.0",
"grunt-contrib-watch": "^0.6.1", "grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^0.2.1", "grunt-filerev": "^0.2.1",
......
...@@ -8,7 +8,6 @@ function (angular) { ...@@ -8,7 +8,6 @@ function (angular) {
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
module.controller('ErrorCtrl', function($scope, contextSrv) { module.controller('ErrorCtrl', function($scope, contextSrv) {
var showSideMenu = contextSrv.sidemenu; var showSideMenu = contextSrv.sidemenu;
......
...@@ -9,10 +9,10 @@ module.exports = function(config) { ...@@ -9,10 +9,10 @@ module.exports = function(config) {
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
'public/test/test-main.js', 'public/test/test-main.js',
{pattern: 'public/.app_gen/**/*.js', included: false}, {pattern: 'public_gen/.app_gen/**/*.js', included: false},
{pattern: 'public/vendor/**/*.js', included: false}, {pattern: 'public_gen/vendor/**/*.js', included: false},
{pattern: 'public/test/**/*.js', included: false}, {pattern: 'public_gen/test/**/*.js', included: false},
{pattern: 'public/**/*.js', included: false} {pattern: 'public_gen/**/*.js', included: false}
], ],
// list of files to exclude // list of files to exclude
......
require.config({ require.config({
baseUrl: 'http://localhost:9876/base/public/app_gen', baseUrl: 'http://localhost:9876/base/public_gen/app',
paths: { paths: {
specs: '../test/specs', specs: '../test/specs',
......
...@@ -6,18 +6,18 @@ module.exports = function(grunt) { ...@@ -6,18 +6,18 @@ module.exports = function(grunt) {
'jshint:source', 'jshint:source',
'jshint:tests', 'jshint:tests',
'jscs', 'jscs',
'clean:on_start', 'clean:release',
'copy:app_gen_build', 'copy:public_to_gen',
'typescript:build', 'typescript:build',
'karma:test', 'karma:test',
'css', 'css',
'copy:everything_but_less_to_temp',
'htmlmin:build', 'htmlmin:build',
'ngtemplates', 'ngtemplates',
'cssmin:build', 'cssmin:build',
'ngAnnotate:build', 'ngAnnotate:build',
'requirejs:build', 'requirejs:build',
'concat:js', 'concat:js',
'clean:temp',
'filerev', 'filerev',
'remapFilerev', 'remapFilerev',
'usemin', 'usemin',
...@@ -26,14 +26,13 @@ module.exports = function(grunt) { ...@@ -26,14 +26,13 @@ module.exports = function(grunt) {
]); ]);
// task to add [[.AppSubUrl]] to reved path // task to add [[.AppSubUrl]] to reved path
grunt.registerTask('remapFilerev', function(){ grunt.registerTask('remapFilerev', function() {
var root = grunt.config().destDir; var root = grunt.config().genDir;
var summary = grunt.filerev.summary; var summary = grunt.filerev.summary;
var fixed = {}; var fixed = {};
for(var key in summary){ for(var key in summary){
if(summary.hasOwnProperty(key)){ if(summary.hasOwnProperty(key)){
var orig = key.replace(root, root+'/[[.AppSubUrl]]'); var orig = key.replace(root, root+'/[[.AppSubUrl]]');
var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]'); var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]');
fixed[orig] = revved; fixed[orig] = revved;
...@@ -44,29 +43,27 @@ module.exports = function(grunt) { ...@@ -44,29 +43,27 @@ module.exports = function(grunt) {
}); });
grunt.registerTask('build-post-process', function() { grunt.registerTask('build-post-process', function() {
grunt.config('copy.dist_to_tmp', { grunt.config('copy.public_gen_to_dest', {
expand: true, expand: true,
cwd: '<%= destDir %>', cwd: '<%= genDir %>',
src: '**/*', src: '**/*',
dest: '<%= tempDir %>/public/', dest: '<%= destDir %>/public/',
}); });
grunt.config('clean.dest_dir', ['<%= destDir %>']);
grunt.config('copy.backend_bin', { grunt.config('copy.backend_bin', {
cwd: 'bin', cwd: 'bin',
expand: true, expand: true,
src: ['*'], src: ['*'],
options: { mode: true}, options: { mode: true},
dest: '<%= tempDir %>/bin/' dest: '<%= destDir %>/bin/'
}); });
grunt.config('copy.backend_files', { grunt.config('copy.backend_files', {
expand: true, expand: true,
src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'], src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'],
options: { mode: true}, options: { mode: true},
dest: '<%= tempDir %>' dest: '<%= destDir %>'
}); });
grunt.task.run('copy:dist_to_tmp'); grunt.task.run('copy:public_gen_to_dest');
grunt.task.run('clean:dest_dir');
grunt.task.run('copy:backend_bin'); grunt.task.run('copy:backend_bin');
grunt.task.run('copy:backend_files'); grunt.task.run('copy:backend_files');
}); });
......
...@@ -7,7 +7,7 @@ module.exports = function(grunt) { ...@@ -7,7 +7,7 @@ module.exports = function(grunt) {
'jscs', 'jscs',
'jshint', 'jshint',
'clean:gen', 'clean:gen',
'copy:everything_but_ts_and_less', 'copy:public_to_gen',
'css', 'css',
'typescript:build' 'typescript:build'
]); ]);
......
...@@ -9,7 +9,7 @@ module.exports = function(config) { ...@@ -9,7 +9,7 @@ module.exports = function(config) {
files : [ files : [
{ {
expand: true, expand: true,
cwd: '<%= tempDir %>', cwd: '<%= destDir %>',
src: ['**/*'], src: ['**/*'],
dest: '<%= pkg.name %>-<%= pkg.version %>/', dest: '<%= pkg.name %>-<%= pkg.version %>/',
}, },
......
...@@ -27,11 +27,11 @@ module.exports = function(config) { ...@@ -27,11 +27,11 @@ module.exports = function(config) {
js: { js: {
src: [ src: [
'<%= destDir %>/vendor/requirejs/require.js', '<%= tempDir %>/vendor/requirejs/require.js',
'<%= destDir %>/app/components/require.config.js', '<%= tempDir %>/app/components/require.config.js',
'<%= destDir %>/app/app.js', '<%= tempDir %>/app/app.js',
], ],
dest: '<%= destDir %>/app/app.js' dest: '<%= genDir %>/app/app.js'
}, },
}; };
}; };
...@@ -8,7 +8,7 @@ module.exports = function(config) { ...@@ -8,7 +8,7 @@ module.exports = function(config) {
dest: '<%= tempDir %>' dest: '<%= tempDir %>'
}, },
everything_but_less: { public_to_gen: {
cwd: '<%= srcDir %>', cwd: '<%= srcDir %>',
expand: true, expand: true,
src: ['**/*', '!**/*.less'], src: ['**/*', '!**/*.less'],
......
...@@ -2,9 +2,9 @@ module.exports = function(config) { ...@@ -2,9 +2,9 @@ module.exports = function(config) {
return { return {
build: { build: {
expand: true, expand: true,
cwd: '<%= tempDir %>', cwd: '<%= genDir %>',
src: '**/*.css', src: '**/*.css',
dest: '<%= tempDir %>' dest: '<%= genDir %>'
} }
}; };
}; };
\ No newline at end of file
...@@ -6,16 +6,16 @@ module.exports = function(config) { ...@@ -6,16 +6,16 @@ module.exports = function(config) {
length: 8, length: 8,
}, },
cssDark: { cssDark: {
src: '<%= destDir %>/css/grafana.dark.min.css', src: '<%= genDir %>/css/grafana.dark.min.css',
dest: '<%= destDir %>/css' dest: '<%= genDir %>/css'
}, },
cssLight: { cssLight: {
src: '<%= destDir %>/css/grafana.light.min.css', src: '<%= genDir %>/css/grafana.light.min.css',
dest: '<%= destDir %>/css' dest: '<%= genDir %>/css'
}, },
js: { js: {
src: '<%= destDir %>/app/app.js', src: '<%= genDir %>/app/app.js',
dest: '<%= destDir %>/app' dest: '<%= genDir %>/app'
} }
}; };
}; };
...@@ -6,13 +6,13 @@ module.exports = function(config) { ...@@ -6,13 +6,13 @@ module.exports = function(config) {
collapseWhitespace: true collapseWhitespace: true
}, },
expand: true, expand: true,
cwd: '<%= tempDir %>', cwd: '<%= genDir %>',
src: [ src: [
//'index.html', //'index.html',
'app/panels/**/*.html', 'app/panels/**/*.html',
'app/partials/**/*.html' 'app/partials/**/*.html'
], ],
dest: '<%= tempDir %>' dest: '<%= genDir %>'
} }
}; };
}; };
\ No newline at end of file
...@@ -2,7 +2,7 @@ module.exports = function(config) { ...@@ -2,7 +2,7 @@ module.exports = function(config) {
return { return {
build: { build: {
expand: true, expand: true,
cwd:'<%= tempDir %>', cwd:'<%= genDir %>',
src: [ src: [
'app/controllers/**/*.js', 'app/controllers/**/*.js',
'app/plugins/**/*.js', 'app/plugins/**/*.js',
...@@ -15,7 +15,7 @@ module.exports = function(config) { ...@@ -15,7 +15,7 @@ module.exports = function(config) {
'app/app.js', 'app/app.js',
'vendor/angular/**/*.js', 'vendor/angular/**/*.js',
], ],
dest: '<%= tempDir %>' dest: '<%= genDir %>'
} }
}; };
}; };
module.exports = function(config) { module.exports = function(config) {
return { return {
grafana: { grafana: {
cwd: '<%= tempDir %>', cwd: '<%= genDir %>',
src: ['app/**/*.html'], src: ['app/**/*.html'],
dest: '<%= tempDir %>/app/components/partials.js', dest: '<%= genDir %>/app/components/partials.js',
options: { options: {
bootstrap: function(module, script) { bootstrap: function(module, script) {
return "define('components/partials', ['angular'], function(angular) { \n" + return "define('components/partials', ['angular'], function(angular) { \n" +
......
...@@ -4,10 +4,10 @@ module.exports = function(config,grunt) { ...@@ -4,10 +4,10 @@ module.exports = function(config,grunt) {
function buildRequireJsOptions() { function buildRequireJsOptions() {
var options = { var options = {
appDir: '<%= tempDir %>', appDir: '<%= genDir %>',
dir: '<%= destDir %>', dir: '<%= tempDir %>',
mainConfigFile: '<%= tempDir %>/app/components/require.config.js', mainConfigFile: '<%= genDir %>/app/components/require.config.js',
baseUrl: 'app_gen', baseUrl: 'app',
waitSeconds: 0, waitSeconds: 0,
modules: [], // populated below, modules: [], // populated below,
...@@ -74,7 +74,7 @@ module.exports = function(config,grunt) { ...@@ -74,7 +74,7 @@ module.exports = function(config,grunt) {
]; ];
var fs = require('fs'); var fs = require('fs');
var panelPath = config.srcDir+'/app/panels'; var panelPath = config.genDir+'/app/panels';
// create a module for each directory in public/app/panels/ // create a module for each directory in public/app/panels/
fs.readdirSync(panelPath).forEach(function (panelName) { fs.readdirSync(panelPath).forEach(function (panelName) {
......
...@@ -2,9 +2,9 @@ module.exports = function(config) { ...@@ -2,9 +2,9 @@ module.exports = function(config) {
return { return {
dest: { dest: {
expand: true, expand: true,
src: ['**/*.js', '!dashboards/*.js', '!vendor/jquery/**/*.js'], src: ['**/*.js', '!dashboards/*.js', '!vendor/**/*.js'],
dest: '<%= destDir %>', dest: '<%= genDir %>',
cwd: '<%= destDir %>', cwd: '<%= genDir %>',
options: { options: {
quite: true, quite: true,
compress: {}, compress: {},
......
...@@ -3,10 +3,11 @@ module.exports = function() { ...@@ -3,10 +3,11 @@ module.exports = function() {
return { return {
html: [ html: [
'<%= destDir %>/views/index.html', '<%= genDir %>/views/index.html',
'<%= genDir %>/views/500.html',
], ],
options: { options: {
assetsDirs: ['<%= destDir %>'], assetsDirs: ['<%= genDir %>'],
patterns: { patterns: {
css: [ css: [
[/(\.css)/, 'Replacing reference to image.png'] [/(\.css)/, 'Replacing reference to image.png']
......
module.exports = function(config) {
return {
html: [
'tmp/index.html',
]
};
};
...@@ -10,7 +10,7 @@ module.exports = function(config) { ...@@ -10,7 +10,7 @@ module.exports = function(config) {
copy_to_gen: { copy_to_gen: {
files: ['<%= srcDir %>/**/*', '!<%= srcDir %>/**/*.less'], files: ['<%= srcDir %>/**/*', '!<%= srcDir %>/**/*.less'],
tasks: ['copy:everything_but_less'], tasks: ['copy:public_to_gen'],
options: { options: {
spawn: false spawn: false
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment