Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@
"@types/supertest": "^2.0.5",
"@types/type-detect": "^4.0.1",
"@types/uuid": "^3.4.4",
"@types/vinyl-fs": "^2.4.11",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "1.13.0",
"@typescript-eslint/parser": "1.13.0",
Expand Down
26 changes: 26 additions & 0 deletions packages/kbn-plugin-helpers/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export function babelRegister(): void;
export function resolveKibanaPath(path: string): string;
export function readFtrConfigFile(path: string): any;
export function run(
task: 'build' | 'start' | 'testAll' | 'testBrowser' | 'testServer' | 'postinstall',
options: any
): Promise<void>;
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"globby": "^8.0.1",
"gulp-babel": "^8.0.0",
"gulp-rename": "1.4.0",
"gulp-zip": "4.2.0",
"gulp-zip": "5.0.1",
"inquirer": "^1.2.2",
"minimatch": "^3.0.4",
"node-sass": "^4.9.4",
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-plugin-helpers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["lib/index.d.ts"]
}
20 changes: 20 additions & 0 deletions packages/kbn-test/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export * from './src/index';
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,26 @@
* under the License.
*/

// @ts-ignore not typed yet
export { runTestsCli, startServersCli } from './functional_tests/cli';

// @ts-ignore not typed yet
export { runTests, startServers } from './functional_tests/tasks';

// @ts-ignore not typed yet
export { OPTIMIZE_BUNDLE_DIR, KIBANA_ROOT } from './functional_tests/lib/paths';

// @ts-ignore not typed yet
export { esTestConfig, createEsTestCluster } from './es';

// @ts-ignore not typed yet
export { kbnTestConfig, kibanaServerTestUser, kibanaTestUser, adminTestUser } from './kbn';

// @ts-ignore not typed yet
export { setupUsers, DEFAULT_SUPERUSER_PASS } from './functional_tests/lib/auth';

// @ts-ignore not typed yet
export { readConfigFile } from './functional_test_runner/lib/config/read_config_file';

// @ts-ignore not typed yet
export { runFtrCli } from './functional_test_runner/cli';
3 changes: 2 additions & 1 deletion packages/kbn-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.json",
"include": [
"types/**/*",
"src/functional_test_runner/**/*"
"src/**/*",
"index.d.ts"
]
}
25 changes: 25 additions & 0 deletions src/dev/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

// @ts-ignore not typed yet
export { createAutoJUnitReporter } from './auto_junit_reporter';
// @ts-ignore not typed yet
export { setupJUnitReportGeneration } from './junit_report_generation';
// @ts-ignore not typed yet
export { runMochaCli } from './run_mocha_cli';
3 changes: 3 additions & 0 deletions src/dev/mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* under the License.
*/

// @ts-ignore not typed yet
export { createAutoJUnitReporter } from './auto_junit_reporter';
// @ts-ignore not typed yet
export { setupJUnitReportGeneration } from './junit_report_generation';
// @ts-ignore not typed yet
export { runMochaCli } from './run_mocha_cli';
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,30 @@
*/

import vfs from 'vinyl-fs';
import { ToolingLog } from '@kbn/dev-utils';

const NOTICE_COMMENT_RE = /\/\*[\s\n\*]*@notice([\w\W]+?)\*\//g;
const NEWLINE_RE = /\r?\n/g;

interface Options {
/**
* Name to print at the top of the notice
*/
productName: string;
/**
* absolute path to the repo to search for @notice comments
*/
directory: string;
log: ToolingLog;
}

/**
* Generates the text for the NOTICE.txt file at the root of the
* repo which details the licenses for code that is copied/vendored
* into the repository.
*
* @param {Object} options
* @property {string} options.productName Name to print at the top of the notice
* @property {ToolingLog} options.log
* @property {string} options.directory absolute path to the repo to search for @notice comments
* @return {string}
*/
export async function generateNoticeFromSource({ productName, directory, log }) {
const globs = [
'**/*.{js,less,css,ts}',
];
export async function generateNoticeFromSource({ productName, directory, log }: Options) {
const globs = ['**/*.{js,less,css,ts}'];

const options = {
cwd: directory,
Expand All @@ -46,18 +51,18 @@ export async function generateNoticeFromSource({ productName, directory, log })
'packages/*/{node_modules,build,target,dist}/**',
'x-pack/{node_modules,build,target,dist,optimize}/**',
'x-pack/packages/*/{node_modules,build,target,dist}/**',
]
],
};

log.debug('vfs.src globs', globs);
log.debug('vfs.src options', options);
log.info(`Searching ${directory} for multi-line comments starting with @notice`);

const files = vfs.src(globs, options);
const noticeComments = [];
const noticeComments: string[] = [];
await new Promise((resolve, reject) => {
files
.on('data', (file) => {
.on('data', file => {
log.verbose(`Checking for @notice comments in ${file.relative}`);

const source = file.contents.toString('utf8');
Expand All @@ -75,19 +80,19 @@ export async function generateNoticeFromSource({ productName, directory, log })

let noticeText = '';
noticeText += `${productName}\n`;
noticeText += `Copyright 2012-${(new Date()).getUTCFullYear()} Elasticsearch B.V.\n`;
noticeText += `Copyright 2012-${new Date().getUTCFullYear()} Elasticsearch B.V.\n`;

for (const comment of noticeComments.sort()) {
noticeText += '\n---\n';
noticeText += comment
.split(NEWLINE_RE)
.map(line => (
.map(line =>
line
// trim whitespace
.trim()
// trim leading * and a single space
.replace(/(^\* ?)/, '')
))
)
.join('\n')
.trim();
noticeText += '\n';
Expand Down
1 change: 1 addition & 0 deletions src/dev/notice/index.js → src/dev/notice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
*/

export { generateNoticeFromSource } from './generate_notice_from_source';
// @ts-ignore not typed yet
export { generateBuildNoticeText } from './generate_build_notice_text';
44 changes: 14 additions & 30 deletions x-pack/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,20 @@
* you may not use this file except in compliance with the Elastic License.
*/

require('@kbn/plugin-helpers').babelRegister();
require('dotenv').config({ silent: true });
require('../src/setup_node_env');

const path = require('path');
const gulp = require('gulp');
const mocha = require('gulp-mocha');
const multiProcess = require('gulp-multi-process');
const fancyLog = require('fancy-log');
const pkg = require('./package.json');
const { buildTask } = require('./tasks/build');
const { devTask } = require('./tasks/dev');
const { testTask, testBrowserTask, testBrowserDevTask, testServerTask } = require('./tasks/test');
const { prepareTask } = require('./tasks/prepare');

const buildDir = path.resolve(__dirname, 'build');
const buildTarget = path.resolve(buildDir, 'plugin');
const packageDir = path.resolve(buildDir, 'distributions');
const coverageDir = path.resolve(__dirname, 'coverage');

const gulpHelpers = {
buildDir,
buildTarget,
coverageDir,
log: fancyLog,
mocha,
multiProcess,
packageDir,
pkg,
// export the tasks that are runnable from the CLI
module.exports = {
build: buildTask,
dev: devTask,
prepare: prepareTask,
test: testTask,
testserver: testServerTask,
testbrowser: testBrowserTask,
'testbrowser-dev': testBrowserDevTask,
};

require('./tasks/build')(gulp, gulpHelpers);
require('./tasks/clean')(gulp, gulpHelpers);
require('./tasks/dev')(gulp, gulpHelpers);
require('./tasks/prepare')(gulp, gulpHelpers);
require('./tasks/report')(gulp, gulpHelpers);
require('./tasks/test')(gulp, gulpHelpers);
require('./legacy/plugins/canvas/tasks')(gulp, gulpHelpers);
51 changes: 0 additions & 51 deletions x-pack/legacy/plugins/canvas/tasks/helpers/babelhook.js

This file was deleted.

23 changes: 0 additions & 23 deletions x-pack/legacy/plugins/canvas/tasks/helpers/dom_setup.js

This file was deleted.

10 changes: 0 additions & 10 deletions x-pack/legacy/plugins/canvas/tasks/helpers/enzyme_setup.js

This file was deleted.

11 changes: 0 additions & 11 deletions x-pack/legacy/plugins/canvas/tasks/index.js

This file was deleted.

10 changes: 0 additions & 10 deletions x-pack/legacy/plugins/canvas/tasks/mocks/absoluteToParsedUrl.js

This file was deleted.

Loading