Skip to content

Commit

Permalink
Merge branch 'master' into 2020-05-15-add-console-error
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored May 18, 2020
2 parents f6fda22 + 1c72279 commit b4768c1
Show file tree
Hide file tree
Showing 473 changed files with 6,893 additions and 2,540 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ module.exports = {
'.eslintrc.js',
'**/webpackShims/**/*.js',
'packages/kbn-plugin-generator/**/*.js',
'packages/kbn-plugin-helpers/**/*.js',
'packages/kbn-eslint-import-resolver-kibana/**/*.js',
'packages/kbn-eslint-plugin-eslint/**/*',
'x-pack/gulpfile.js',
Expand Down
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,14 @@
/src/legacy/server/sass/ @elastic/kibana-operations
/src/legacy/server/utils/ @elastic/kibana-operations
/src/legacy/server/warnings/ @elastic/kibana-operations
/.ci/es-snapshots/ @elastic/kibana-operations
/vars/ @elastic/kibana-operations

# Quality Assurance
/src/dev/code_coverage @elastic/kibana-qa
/test/functional/services/common @elastic/kibana-qa
/test/functional/services/lib @elastic/kibana-qa
/test/functional/services/remote @elastic/kibana-qa

# Platform
/src/core/ @elastic/kibana-platform
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
library 'kibana-pipeline-library'
kibanaLibrary.load()

kibanaPipeline(timeoutMinutes: 135, checkPrChanges: true) {
kibanaPipeline(timeoutMinutes: 155, checkPrChanges: true) {
ciStats.trackBuild {
githubPr.withDefaultPrComments {
catchError {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
"@elastic/eslint-plugin-eui": "0.0.2",
"@elastic/github-checks-reporter": "0.0.20b3",
"@elastic/makelogs": "^5.0.1",
"@elastic/static-fs": "1.0.1",
"@elastic/static-fs": "1.0.2",
"@kbn/dev-utils": "1.0.0",
"@kbn/es": "1.0.0",
"@kbn/eslint-import-resolver-kibana": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/bin/plugin-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ if (nodeMajorVersion < 6) {
process.exit(1);
}

require('../cli');
require('../target/cli');
26 changes: 0 additions & 26 deletions packages/kbn-plugin-helpers/lib/index.d.ts

This file was deleted.

32 changes: 0 additions & 32 deletions packages/kbn-plugin-helpers/lib/index.js

This file was deleted.

58 changes: 0 additions & 58 deletions packages/kbn-plugin-helpers/lib/run.test.js

This file was deleted.

27 changes: 20 additions & 7 deletions packages/kbn-plugin-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"name": "@kbn/plugin-helpers",
"private": true,
"version": "9.0.2",
"private": true,
"description": "Just some helpers for kibana plugin devs.",
"main": "lib/index.js",
"license": "Apache-2.0",
"main": "target/lib/index.js",
"scripts": {
"kbn:bootstrap": "tsc"
},
"bin": {
"plugin-helpers": "bin/plugin-helpers.js"
},
"author": "Spencer Alger <[email protected]>",
"license": "Apache-2.0",
"peerDependencies": {
"@kbn/babel-preset": "1.0.0"
},
"dependencies": {
"@babel/core": "^7.9.0",
"argv-split": "^2.0.1",
Expand All @@ -27,6 +26,20 @@
"node-sass": "^4.13.1",
"through2": "^2.0.3",
"through2-map": "^3.0.0",
"vinyl": "^2.2.0",
"vinyl-fs": "^3.0.3"
},
"devDependencies": {
"@types/gulp-rename": "^0.0.33",
"@types/gulp-zip": "^4.0.1",
"@types/inquirer": "^6.5.0",
"@types/node-sass": "^4.11.0",
"@types/through2": "^2.0.35",
"@types/through2-map": "^3.0.0",
"@types/vinyl": "^2.0.4",
"typescript": "3.7.2"
},
"peerDependencies": {
"@kbn/babel-preset": "1.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
* under the License.
*/

const program = require('commander');
import Fs from 'fs';
import Path from 'path';

const pkg = require('./package.json');
const createCommanderAction = require('./lib/commander_action');
const docs = require('./lib/docs');
const enableCollectingUnknownOptions = require('./lib/enable_collecting_unknown_options');
import program from 'commander';

import { createCommanderAction } from './lib/commander_action';
import { docs } from './lib/docs';
import { enableCollectingUnknownOptions } from './lib/enable_collecting_unknown_options';

const pkg = JSON.parse(Fs.readFileSync(Path.resolve(__dirname, '../package.json'), 'utf8'));
program.version(pkg.version);

enableCollectingUnknownOptions(
Expand Down Expand Up @@ -55,7 +58,7 @@ program
buildVersion: command.buildVersion,
kibanaVersion: command.kibanaVersion,
skipArchive: Boolean(command.skipArchive),
files: files,
files,
}))
);

Expand Down Expand Up @@ -84,7 +87,7 @@ program
.on('--help', docs('test/mocha'))
.action(
createCommanderAction('testMocha', (command, files) => ({
files: files,
files,
}))
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
* under the License.
*/

/*eslint-env jest*/
import { createCommanderAction } from './commander_action';
import { run } from './run';

const createCommanderAction = require('./commander_action');
const run = require('./run');

jest.mock('./run', () => jest.fn());
jest.mock('./run');

const STACK_TRACE_RE = /\n(?:\s+at .+(?:\n|$))+/g;
expect.addSnapshotSerializer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
* under the License.
*/

const run = require('./run');
import { run } from './run';
import { Tasks } from './tasks';

module.exports = function createCommanderAction(taskName, getOptions = () => {}) {
return async (...args) => {
type GetOptions = (command: any, ...args: string[]) => any;

export function createCommanderAction(taskName: keyof Tasks, getOptions: GetOptions = () => {}) {
return async (...args: string[]) => {
try {
// command is the last arg passed by commander, but we move it to the front of the list
const command = args.pop();
Expand All @@ -30,4 +33,4 @@ module.exports = function createCommanderAction(taskName, getOptions = () => {})
process.exit(1);
}
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,34 @@
* under the License.
*/

const resolve = require('path').resolve;
const readFileSync = require('fs').readFileSync;
import { resolve } from 'path';
import { readFileSync } from 'fs';

const configFiles = ['.kibana-plugin-helpers.json', '.kibana-plugin-helpers.dev.json'];
const configCache = {};
const configFileNames = ['.kibana-plugin-helpers.json', '.kibana-plugin-helpers.dev.json'];

module.exports = function(root) {
if (!root) root = process.cwd();
interface Config {
[key: string]: unknown;
}

if (configCache[root]) {
return configCache[root];
const configCache = new Map<string, Config>();

export function configFile(root: string = process.cwd()) {
if (configCache.has(root)) {
return configCache.get(root)!;
}

// config files to read from, in the order they are merged together
let config = (configCache[root] = {});

configFiles.forEach(function(configFile) {
let config: Config = {};
for (const name of configFileNames) {
try {
const content = JSON.parse(readFileSync(resolve(root, configFile)));
config = Object.assign(config, content);
config = JSON.parse(readFileSync(resolve(root, name), 'utf8'));
} catch (e) {
// rethrow error unless it's complaining about file not existing
if (e.code !== 'ENOENT') {
throw e;
}
}
});
}

const deprecationMsg =
'has been removed from `@kbn/plugin-helpers`. ' +
Expand All @@ -59,8 +60,10 @@ module.exports = function(root) {
}

// use resolve to ensure correct resolution of paths
const { includePlugins } = config;
if (includePlugins) config.includePlugins = includePlugins.map(path => resolve(root, path));
if (Array.isArray(config.includePlugins)) {
config.includePlugins = config.includePlugins.map((path: string) => resolve(root, path));
}

configCache.set(root, config);
return config;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@
* under the License.
*/

const resolve = require('path').resolve;
const readFileSync = require('fs').readFileSync;
import { resolve } from 'path';
import { readFileSync } from 'fs';

function indent(txt, n) {
function indent(txt: string, n: number) {
const space = new Array(n + 1).join(' ');
return space + txt.split('\n').join('\n' + space);
}

module.exports = function docs(name) {
const md = readFileSync(resolve(__dirname, '../tasks', name, 'README.md'), 'utf8');
export function docs(name: string) {
const md = readFileSync(resolve(__dirname, '../../src/tasks', name, 'README.md'), 'utf8');

return function() {
console.log('\n Docs:');
console.log('');
console.log(indent(md, 4));
console.log('');
/* eslint-disable-next-line no-console */
console.log(`\n Docs:\n\n${indent(md, 4)}\n\n`);
};
};
}
Loading

0 comments on commit b4768c1

Please sign in to comment.