Merge branch 'master' of github.com:elastic/kibana into implement/uiTestsForPlugins

This commit is contained in:
spalger 2016-02-12 15:16:21 -07:00
commit d664a772c7
5 changed files with 64 additions and 8 deletions

View file

@ -57,7 +57,8 @@
"lint": "grunt eslint:source",
"lintroller": "grunt eslint:fixSource",
"mocha": "mocha",
"mocha:debug": "mocha --debug-brk"
"mocha:debug": "mocha --debug-brk",
"sterilize": "grunt sterilize"
},
"repository": {
"type": "git",

View file

@ -63,7 +63,13 @@ module.exports = class ClusterManager {
bindAll(this, 'onWatcherAdd', 'onWatcherError', 'onWatcherChange');
if (opts.watch) this.setupWatching();
if (opts.watch) {
this.setupWatching([
...settings.plugins.paths,
...settings.plugins.scanDirs
]);
}
else this.startCluster();
}
@ -75,7 +81,7 @@ module.exports = class ClusterManager {
}
}
setupWatching() {
setupWatching(extraPaths) {
const chokidar = require('chokidar');
const utils = require('requirefrom')('src/utils');
const fromRoot = utils('fromRoot');
@ -86,7 +92,7 @@ module.exports = class ClusterManager {
'src/ui',
'src/utils',
'config',
'installedPlugins'
...extraPaths
], {
cwd: fromRoot('.'),
ignored: /[\\\/](\..*|node_modules|bower_components|public|__tests__)[\\\/]/

View file

@ -4,14 +4,14 @@ import DirectoryNameAsMain from 'webpack-directory-name-as-main';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import CommonsChunkPlugin from 'webpack/lib/optimize/CommonsChunkPlugin';
let utils = require('requirefrom')('src/utils');
let fromRoot = utils('fromRoot');
import fromRoot from '../utils/fromRoot';
import babelOptions from './babelOptions';
import { inherits } from 'util';
import { defaults } from 'lodash';
import { defaults, transform } from 'lodash';
import { resolve } from 'path';
import { writeFile } from 'fs';
let babelExclude = [/[\/\\](webpackShims|node_modules|bower_components)[\/\\]/];
import pkg from '../../package.json';
class BaseOptimizer {
constructor(opts) {
@ -133,12 +133,20 @@ class BaseOptimizer {
resolve: {
extensions: ['.js', '.json', '.jsx', '.less', ''],
postfixes: [''],
modulesDirectories: ['webpackShims', 'node_modules'],
modulesDirectories: ['webpackShims', 'node_modules', fromRoot('webpackShims'), fromRoot('node_modules')],
loaderPostfixes: ['-loader', ''],
root: fromRoot('.'),
alias: this.env.aliases,
unsafeCache: this.unsafeCache,
},
resolveLoader: {
alias: transform(pkg.dependencies, function (aliases, version, name) {
if (name.endsWith('-loader')) {
aliases[name.replace(/-loader$/, '')] = require.resolve(name);
}
}, {})
}
};
}

View file

@ -12,3 +12,5 @@ exports.webpack = {
};
exports.node = cloneDeep(exports.webpack);
exports.node.optional = ['asyncToGenerator'];
exports.node.blacklist = ['regenerator'];

39
tasks/sterilize.js Normal file
View file

@ -0,0 +1,39 @@
import { bgRed, white } from 'ansicolors';
import { execSync } from 'child_process';
import { createInterface } from 'readline';
export default function (grunt) {
grunt.registerTask('sterilize', function () {
const cmd = 'git clean -fdx';
const ignores = [
'.aws-config.json',
'config/kibana.dev.yml'
]
.concat(String(grunt.option('ignore') || '').split(','))
.map(f => `-e "${f.split('"').join('\\"')}"`)
.reduce((all, arg) => `${all} ${arg}`, '');
const stdio = 'inherit';
execSync(`${cmd} -n ${ignores}`, { stdio });
const rl = createInterface({
input: process.stdin,
output: process.stdout
});
const danger = bgRed(white('DANGER'));
rl.on('close', this.async());
rl.question(`\n${danger} Do you really want to delete all of the above files?, [N/y] `, function (resp) {
var yes = resp.toLowerCase().trim()[0] === 'y';
rl.close();
if (yes) {
execSync(`${cmd} ${ignores}`, { stdio });
}
});
});
}