Skip to content

Commit da83236

Browse files
committed
dev building and optimized builds work
1 parent abac8bc commit da83236

19 files changed

+52
-62
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"grunt-contrib-htmlmin": "~0.1.3",
2525
"grunt-contrib-jshint": "~0.10.0",
2626
"grunt-contrib-less": "~0.7.0",
27-
"grunt-contrib-requirejs": "~0.4.1",
27+
"grunt-contrib-requirejs": "~0.4.4",
2828
"grunt-contrib-uglify": "~0.8.0",
2929
"grunt-contrib-watch": "^0.6.1",
3030
"grunt-filerev": "^0.2.1",

public/app/controllers/errorCtrl.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ function (angular) {
88

99
var module = angular.module('grafana.controllers');
1010

11-
1211
module.controller('ErrorCtrl', function($scope, contextSrv) {
1312

1413
var showSideMenu = contextSrv.sidemenu;

public/test/karma.conf.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ module.exports = function(config) {
99
// list of files / patterns to load in the browser
1010
files: [
1111
'public/test/test-main.js',
12-
{pattern: 'public/.app_gen/**/*.js', included: false},
13-
{pattern: 'public/vendor/**/*.js', included: false},
14-
{pattern: 'public/test/**/*.js', included: false},
15-
{pattern: 'public/**/*.js', included: false}
12+
{pattern: 'public_gen/.app_gen/**/*.js', included: false},
13+
{pattern: 'public_gen/vendor/**/*.js', included: false},
14+
{pattern: 'public_gen/test/**/*.js', included: false},
15+
{pattern: 'public_gen/**/*.js', included: false}
1616
],
1717

1818
// list of files to exclude

public/test/test-main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require.config({
2-
baseUrl: 'http://localhost:9876/base/public/app_gen',
2+
baseUrl: 'http://localhost:9876/base/public_gen/app',
33

44
paths: {
55
specs: '../test/specs',

tasks/build_task.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ module.exports = function(grunt) {
66
'jshint:source',
77
'jshint:tests',
88
'jscs',
9-
'clean:on_start',
10-
'copy:app_gen_build',
9+
'clean:release',
10+
'copy:public_to_gen',
1111
'typescript:build',
1212
'karma:test',
1313
'css',
14-
'copy:everything_but_less_to_temp',
1514
'htmlmin:build',
1615
'ngtemplates',
1716
'cssmin:build',
1817
'ngAnnotate:build',
1918
'requirejs:build',
2019
'concat:js',
20+
'clean:temp',
2121
'filerev',
2222
'remapFilerev',
2323
'usemin',
@@ -26,14 +26,13 @@ module.exports = function(grunt) {
2626
]);
2727

2828
// task to add [[.AppSubUrl]] to reved path
29-
grunt.registerTask('remapFilerev', function(){
30-
var root = grunt.config().destDir;
29+
grunt.registerTask('remapFilerev', function() {
30+
var root = grunt.config().genDir;
3131
var summary = grunt.filerev.summary;
3232
var fixed = {};
3333

3434
for(var key in summary){
3535
if(summary.hasOwnProperty(key)){
36-
3736
var orig = key.replace(root, root+'/[[.AppSubUrl]]');
3837
var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]');
3938
fixed[orig] = revved;
@@ -44,29 +43,27 @@ module.exports = function(grunt) {
4443
});
4544

4645
grunt.registerTask('build-post-process', function() {
47-
grunt.config('copy.dist_to_tmp', {
46+
grunt.config('copy.public_gen_to_dest', {
4847
expand: true,
49-
cwd: '<%= destDir %>',
48+
cwd: '<%= genDir %>',
5049
src: '**/*',
51-
dest: '<%= tempDir %>/public/',
50+
dest: '<%= destDir %>/public/',
5251
});
53-
grunt.config('clean.dest_dir', ['<%= destDir %>']);
5452
grunt.config('copy.backend_bin', {
5553
cwd: 'bin',
5654
expand: true,
5755
src: ['*'],
5856
options: { mode: true},
59-
dest: '<%= tempDir %>/bin/'
57+
dest: '<%= destDir %>/bin/'
6058
});
6159
grunt.config('copy.backend_files', {
6260
expand: true,
6361
src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'],
6462
options: { mode: true},
65-
dest: '<%= tempDir %>'
63+
dest: '<%= destDir %>'
6664
});
6765

68-
grunt.task.run('copy:dist_to_tmp');
69-
grunt.task.run('clean:dest_dir');
66+
grunt.task.run('copy:public_gen_to_dest');
7067
grunt.task.run('copy:backend_bin');
7168
grunt.task.run('copy:backend_files');
7269
});

tasks/default_task.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = function(grunt) {
77
'jscs',
88
'jshint',
99
'clean:gen',
10-
'copy:everything_but_ts_and_less',
10+
'copy:public_to_gen',
1111
'css',
1212
'typescript:build'
1313
]);

tasks/options/compress.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = function(config) {
99
files : [
1010
{
1111
expand: true,
12-
cwd: '<%= tempDir %>',
12+
cwd: '<%= destDir %>',
1313
src: ['**/*'],
1414
dest: '<%= pkg.name %>-<%= pkg.version %>/',
1515
},

tasks/options/concat.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ module.exports = function(config) {
2727

2828
js: {
2929
src: [
30-
'<%= destDir %>/vendor/requirejs/require.js',
31-
'<%= destDir %>/app/components/require.config.js',
32-
'<%= destDir %>/app/app.js',
30+
'<%= tempDir %>/vendor/requirejs/require.js',
31+
'<%= tempDir %>/app/components/require.config.js',
32+
'<%= tempDir %>/app/app.js',
3333
],
34-
dest: '<%= destDir %>/app/app.js'
34+
dest: '<%= genDir %>/app/app.js'
3535
},
3636
};
3737
};

tasks/options/copy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = function(config) {
88
dest: '<%= tempDir %>'
99
},
1010

11-
everything_but_less: {
11+
public_to_gen: {
1212
cwd: '<%= srcDir %>',
1313
expand: true,
1414
src: ['**/*', '!**/*.less'],

tasks/options/cssmin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module.exports = function(config) {
22
return {
33
build: {
44
expand: true,
5-
cwd: '<%= tempDir %>',
5+
cwd: '<%= genDir %>',
66
src: '**/*.css',
7-
dest: '<%= tempDir %>'
7+
dest: '<%= genDir %>'
88
}
99
};
10-
};
10+
};

tasks/options/filerev.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ module.exports = function(config) {
66
length: 8,
77
},
88
cssDark: {
9-
src: '<%= destDir %>/css/grafana.dark.min.css',
10-
dest: '<%= destDir %>/css'
9+
src: '<%= genDir %>/css/grafana.dark.min.css',
10+
dest: '<%= genDir %>/css'
1111
},
1212
cssLight: {
13-
src: '<%= destDir %>/css/grafana.light.min.css',
14-
dest: '<%= destDir %>/css'
13+
src: '<%= genDir %>/css/grafana.light.min.css',
14+
dest: '<%= genDir %>/css'
1515
},
1616
js: {
17-
src: '<%= destDir %>/app/app.js',
18-
dest: '<%= destDir %>/app'
17+
src: '<%= genDir %>/app/app.js',
18+
dest: '<%= genDir %>/app'
1919
}
2020
};
2121
};

tasks/options/htmlmin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ module.exports = function(config) {
66
collapseWhitespace: true
77
},
88
expand: true,
9-
cwd: '<%= tempDir %>',
9+
cwd: '<%= genDir %>',
1010
src: [
1111
//'index.html',
1212
'app/panels/**/*.html',
1313
'app/partials/**/*.html'
1414
],
15-
dest: '<%= tempDir %>'
15+
dest: '<%= genDir %>'
1616
}
1717
};
18-
};
18+
};

tasks/options/ngAnnotate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = function(config) {
22
return {
33
build: {
44
expand: true,
5-
cwd:'<%= tempDir %>',
5+
cwd:'<%= genDir %>',
66
src: [
77
'app/controllers/**/*.js',
88
'app/plugins/**/*.js',
@@ -15,7 +15,7 @@ module.exports = function(config) {
1515
'app/app.js',
1616
'vendor/angular/**/*.js',
1717
],
18-
dest: '<%= tempDir %>'
18+
dest: '<%= genDir %>'
1919
}
2020
};
2121
};

tasks/options/ngtemplates.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module.exports = function(config) {
22
return {
33
grafana: {
4-
cwd: '<%= tempDir %>',
4+
cwd: '<%= genDir %>',
55
src: ['app/**/*.html'],
6-
dest: '<%= tempDir %>/app/components/partials.js',
6+
dest: '<%= genDir %>/app/components/partials.js',
77
options: {
88
bootstrap: function(module, script) {
99
return "define('components/partials', ['angular'], function(angular) { \n" +

tasks/options/requirejs.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ module.exports = function(config,grunt) {
44
function buildRequireJsOptions() {
55

66
var options = {
7-
appDir: '<%= tempDir %>',
8-
dir: '<%= destDir %>',
9-
mainConfigFile: '<%= tempDir %>/app/components/require.config.js',
10-
baseUrl: 'app_gen',
7+
appDir: '<%= genDir %>',
8+
dir: '<%= tempDir %>',
9+
mainConfigFile: '<%= genDir %>/app/components/require.config.js',
10+
baseUrl: 'app',
1111
waitSeconds: 0,
1212

1313
modules: [], // populated below,
@@ -74,7 +74,7 @@ module.exports = function(config,grunt) {
7474
];
7575

7676
var fs = require('fs');
77-
var panelPath = config.srcDir+'/app/panels';
77+
var panelPath = config.genDir+'/app/panels';
7878

7979
// create a module for each directory in public/app/panels/
8080
fs.readdirSync(panelPath).forEach(function (panelName) {

tasks/options/uglify.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module.exports = function(config) {
22
return {
33
dest: {
44
expand: true,
5-
src: ['**/*.js', '!dashboards/*.js', '!vendor/jquery/**/*.js'],
6-
dest: '<%= destDir %>',
7-
cwd: '<%= destDir %>',
5+
src: ['**/*.js', '!dashboards/*.js', '!vendor/**/*.js'],
6+
dest: '<%= genDir %>',
7+
cwd: '<%= genDir %>',
88
options: {
99
quite: true,
1010
compress: {},

tasks/options/usemin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ module.exports = function() {
33

44
return {
55
html: [
6-
'<%= destDir %>/views/index.html',
6+
'<%= genDir %>/views/index.html',
7+
'<%= genDir %>/views/500.html',
78
],
89
options: {
9-
assetsDirs: ['<%= destDir %>'],
10+
assetsDirs: ['<%= genDir %>'],
1011
patterns: {
1112
css: [
1213
[/(\.css)/, 'Replacing reference to image.png']

tasks/options/useminPrepare.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

tasks/options/watch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = function(config) {
1010

1111
copy_to_gen: {
1212
files: ['<%= srcDir %>/**/*', '!<%= srcDir %>/**/*.less'],
13-
tasks: ['copy:everything_but_less'],
13+
tasks: ['copy:public_to_gen'],
1414
options: {
1515
spawn: false
1616
}

0 commit comments

Comments
 (0)