Commit da832368 by Torkel Ödegaard

dev building and optimized builds work

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