mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Webpack (#9391)
* webpack poc, this is not going to work for plugins, dam * tech: webpack and systemjs for plugins starting to work * tech: webpack and systemjs combo starting to work * tech: webpack + karma tests progress * tech: webpack + karma progress * tech: working on tests * tech: webpack * tech: webpack + karma, all tests pass * tech: webpack + karma, all tests pass * tech: webpack all tests pass * webpack: getting closer * tech: webpack progress * webpack: further build refinements * webpack: ng annotate fixes * webpack: optimized build fix * tech: minor fix for elasticsearch * tech: webpack + ace editor * tech: restored lodash move mixin compatability * tech: added enzyme react test and upgraded to react v16 * tech: package version fix * tech: added testdata to built in bundle * webpack: sass progress * tech: prod & dev build is working for the sass * tech: clean up unused grunt stuff and moved to scripts folder * tech: added vendor and manifest chunks, updated readme and docs * tech: webpack finishing touches
This commit is contained in:
11
scripts/grunt/options/clean.js
Normal file
11
scripts/grunt/options/clean.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = function(config) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
release: ['<%= destDir %>', '<%= tempDir %>', '<%= genDir %>'],
|
||||
build: ['<%= srcDir %>/build'],
|
||||
temp: ['<%= tempDir %>'],
|
||||
packaging: [
|
||||
],
|
||||
};
|
||||
};
|
||||
30
scripts/grunt/options/compress.js
Normal file
30
scripts/grunt/options/compress.js
Normal file
@@ -0,0 +1,30 @@
|
||||
module.exports = function(config) {
|
||||
'use strict';
|
||||
|
||||
var task = {
|
||||
release: {
|
||||
options: {
|
||||
archive: '<%= destDir %>/<%= pkg.name %>-<%= pkg.version %>.<%= platform %>-<%= arch %>.tar.gz'
|
||||
},
|
||||
files : [
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= tempDir %>',
|
||||
src: ['**/*'],
|
||||
dest: '<%= pkg.name %>-<%= pkg.version %>/',
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
src: ['LICENSE.md', 'README.md', 'NOTICE.md'],
|
||||
dest: '<%= pkg.name %>-<%= pkg.version %>/',
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
if (config.platform === 'windows') {
|
||||
task.release.options.archive = '<%= destDir %>/<%= pkg.name %>-<%= pkg.version %>.<%= platform %>-<%= arch %>.zip';
|
||||
}
|
||||
|
||||
return task;
|
||||
};
|
||||
6
scripts/grunt/options/exec.js
Normal file
6
scripts/grunt/options/exec.js
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = function(config, grunt) {
|
||||
'use strict'
|
||||
return {
|
||||
tslint : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json --type-check",
|
||||
};
|
||||
};
|
||||
22
scripts/grunt/options/jscs.js
Normal file
22
scripts/grunt/options/jscs.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
src: [
|
||||
'Gruntfile.js',
|
||||
'<%= srcDir %>/app/**/*.js',
|
||||
'<%= srcDir %>/plugin/**/*.js',
|
||||
'!<%= srcDir %>/app/dashboards/*'
|
||||
],
|
||||
options: {
|
||||
config: ".jscs.json",
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
|
||||
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
"requireRightStickedOperators": ["!"],
|
||||
"requireLeftStickedOperators": [","],
|
||||
*/
|
||||
20
scripts/grunt/options/jshint.js
Normal file
20
scripts/grunt/options/jshint.js
Normal file
@@ -0,0 +1,20 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
source: {
|
||||
files: {
|
||||
src: ['Gruntfile.js', '<%= srcDir %>/app/**/*.js'],
|
||||
}
|
||||
},
|
||||
options: {
|
||||
jshintrc: true,
|
||||
reporter: require('jshint-stylish'),
|
||||
ignores: [
|
||||
'node_modules/*',
|
||||
'dist/*',
|
||||
'sample/*',
|
||||
'<%= srcDir %>/vendor/*',
|
||||
'<%= srcDir %>/app/dashboards/*'
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
||||
20
scripts/grunt/options/karma.js
Normal file
20
scripts/grunt/options/karma.js
Normal file
@@ -0,0 +1,20 @@
|
||||
module.exports = function(config) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
dev: {
|
||||
configFile: 'karma.conf.js',
|
||||
singleRun: false,
|
||||
},
|
||||
|
||||
debug: {
|
||||
configFile: 'karma.conf.js',
|
||||
singleRun: false,
|
||||
browsers: ['Chrome']
|
||||
},
|
||||
|
||||
test: {
|
||||
configFile: 'karma.conf.js',
|
||||
}
|
||||
};
|
||||
};
|
||||
37
scripts/grunt/options/phantomjs.js
Normal file
37
scripts/grunt/options/phantomjs.js
Normal file
@@ -0,0 +1,37 @@
|
||||
module.exports = function(config,grunt) {
|
||||
'use strict';
|
||||
|
||||
grunt.registerTask('phantomjs', 'Copy phantomjs binary to vendor/', function() {
|
||||
|
||||
var dest = './vendor/phantomjs/phantomjs';
|
||||
var confDir = './node_modules/phantomjs-prebuilt/lib/';
|
||||
|
||||
if (process.platform === "win32") {
|
||||
dest += ".exe";
|
||||
}
|
||||
|
||||
src = config.phjs
|
||||
|
||||
if (!src){
|
||||
var m=grunt.file.read(confDir+"location.js")
|
||||
var src=/= \"([^\"]*)\"/.exec(m)[1];
|
||||
|
||||
if (!grunt.file.isPathAbsolute(src)) {
|
||||
src = confDir+src;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
grunt.config('copy.phantom_bin', {
|
||||
src: src,
|
||||
dest: dest,
|
||||
options: { mode: true},
|
||||
});
|
||||
grunt.task.run('copy:phantom_bin');
|
||||
} catch (err) {
|
||||
grunt.verbose.writeln(err);
|
||||
grunt.fail.warn('No working Phantomjs binary available')
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
12
scripts/grunt/options/sasslint.js
Normal file
12
scripts/grunt/options/sasslint.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = function(config) {
|
||||
'use strict';
|
||||
return {
|
||||
options: {
|
||||
configFile: 'public/sass/.sass-lint.yml',
|
||||
},
|
||||
target: [
|
||||
'public/sass/*.scss',
|
||||
'public/sass/components/*.scss',
|
||||
]
|
||||
};
|
||||
};
|
||||
11
scripts/grunt/options/tslint.js
Normal file
11
scripts/grunt/options/tslint.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = function(config, grunt) {
|
||||
'use strict'
|
||||
// dummy to avoid template compile error
|
||||
return {
|
||||
source: {
|
||||
files: {
|
||||
src: ""
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
13
scripts/grunt/options/webpack.js
Normal file
13
scripts/grunt/options/webpack.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const dev = require('../../webpack/webpack.dev.js');
|
||||
const prod = require('../../webpack/webpack.prod.js');
|
||||
|
||||
module.exports = function() {
|
||||
'use strict';
|
||||
return {
|
||||
options: {
|
||||
stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
|
||||
},
|
||||
dev: dev,
|
||||
prod: prod
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user