* 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:
Torkel Ödegaard
2017-10-01 20:02:25 +02:00
committed by GitHub
parent f6cc741a6d
commit 0c86241c5b
139 changed files with 6186 additions and 15146 deletions
+13
View File
@@ -0,0 +1,13 @@
module.exports = function(grunt) {
"use strict";
// Concat and Minify the src directory into dist
grunt.registerTask('build', [
'clean:release',
'clean:build',
'phantomjs',
'webpack:prod',
]);
};
+34
View File
@@ -0,0 +1,34 @@
// Lint and build CSS
module.exports = function(grunt) {
'use strict';
grunt.registerTask('default', [
'clean:build',
'phantomjs',
'webpack:dev',
]);
grunt.registerTask('test', [
'clean:build',
'jscs',
'jshint',
'sasslint',
'exec:tslint',
'karma:test',
'no-only-tests'
]);
grunt.registerTask('no-only-tests', function() {
var files = grunt.file.expand('public/**/*_specs\.ts', 'public/**/*_specs\.js');
files.forEach(function(spec) {
var rows = grunt.file.read(spec).split('\n');
rows.forEach(function(row) {
if (row.indexOf('.only(') > 0) {
grunt.log.errorlns(row);
grunt.fail.warn('found only statement in test: ' + spec)
}
});
});
});
};
+11
View File
@@ -0,0 +1,11 @@
module.exports = function(config) {
'use strict';
return {
release: ['<%= destDir %>', '<%= tempDir %>', '<%= genDir %>'],
build: ['<%= srcDir %>/build'],
temp: ['<%= tempDir %>'],
packaging: [
],
};
};
+30
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View File
@@ -0,0 +1,11 @@
module.exports = function(config, grunt) {
'use strict'
// dummy to avoid template compile error
return {
source: {
files: {
src: ""
}
}
};
};
+13
View 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
};
};
+41
View File
@@ -0,0 +1,41 @@
var path = require('path');
module.exports = function(grunt) {
"use strict";
// build, then zip and upload to s3
grunt.registerTask('release', [
'build',
'build-post-process',
'compress:release'
]);
grunt.registerTask('build-post-process', function() {
grunt.config('copy.public_to_temp', {
expand: true,
cwd: '<%= srcDir %>',
src: '**/*',
dest: '<%= tempDir %>/public/',
});
grunt.config('copy.backend_bin', {
cwd: 'bin',
expand: true,
src: ['*'],
options: { mode: true},
dest: '<%= tempDir %>/bin/'
});
grunt.config('copy.backend_files', {
expand: true,
src: ['conf/*', 'vendor/phantomjs/*', 'scripts/*'],
options: { mode: true},
dest: '<%= tempDir %>'
});
grunt.task.run('copy:public_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'));
});
};
+47
View File
@@ -0,0 +1,47 @@
module.exports = function(grunt) {
"use strict";
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
function extractColour(line) {
var regex = /\s*:\s*(#[a-fA-F0-9]{3,6})\s*(!default|!default;)?/;
var matches = line.match(regex);
return matches ? matches[1] : matches;
}
function extractVariable(line) {
var matches = line.match(/(\$[0-9a-zA-Z_-]+)\s*(!default|!default;)?/)
return matches ? matches[1] : matches
}
function readVars(file, obj) {
var content = grunt.file.read(file);
var lines = content.split('\n');
lines.forEach(function(line) {
var variable = extractVariable(line);
if (variable) {
var color = extractColour(line, variable);
if (color) {
obj[variable] = color;
}
}
});
}
grunt.registerTask('styleguide', function() {
var data = {
dark: {}, light: {}
};
readVars('public/sass/_variables.dark.scss', data.dark);
readVars('public/sass/_variables.light.scss', data.light);
var styleGuideJson = grunt.config().srcDir + '/build/styleguide.json';
grunt.file.write(styleGuideJson, JSON.stringify(data, null, 4));
});
};