kibana/x-pack/tasks/build.ts
Clint Andrew Hall 27cbdf5f50
[feature][Canvas] Share Workpads in other Websites (#46278)
* [Canvas] Embedding Workpads in other Websites (#42545)

* Testing for Workpad Snapshots

* Rename Snapshots to Shareables; update documentation. (#46513)

* [canvas][shareables] Add Localization + Tweaks (#46632)

* Add localization + tweak naming

* Fix duplicate key

* Update storyshots

* [shareables] Unsupported Renderer Warning (#46862)

* [shareables] Unsupported Renderer Warning

* Update snapshots; add test

* Addressing Feedback

* [canvas][shareables] Simplify and complete testing (#47328)

* Simplify

* Updates

* Finishing up

* A few tweaks

* Fix eslint errors; how would those happen??

* Fix CI build of runtime; assorted visual tweaks

* Update x-pack/legacy/plugins/canvas/shareable_runtime/test/index.ts

Co-Authored-By: Spencer <email@spalger.com>

* Addressing feedback

* Remove null-loader from root package

* re-add null-loader until mitigation is found

* [perf] Fix unsupported renderers performance issue (#47769)

* [perf] Fix perf issue with unsupported renderers

* Fixing snapshots

* Addressing review feedback (#47775)

* Addressing feedback

* Addressing feedback (#47883)

* Branding Changes (#47913)

* Branding Changes

* Update snapshots
2019-10-11 12:15:41 -05:00

85 lines
2.4 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import execa from 'execa';
import { resolve } from 'path';
import { writeFileSync } from 'fs';
import pluginHelpers from '@kbn/plugin-helpers';
import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
import gulp from 'gulp';
import del from 'del';
import fancyLog from 'fancy-log';
import chalk from 'chalk';
import { generateNoticeFromSource } from '../../src/dev/notice';
import { prepareTask } from './prepare';
import { gitInfo } from './helpers/git_info';
import { PKG_NAME } from './helpers/pkg';
import { BUILD_VERSION } from './helpers/build_version';
const XPACK_DIR = resolve(REPO_ROOT, 'x-pack');
const BUILD_DIR = resolve(XPACK_DIR, 'build');
const PLUGIN_BUILD_DIR = resolve(BUILD_DIR, 'plugin');
async function cleanBuildTask() {
fancyLog('Deleting', BUILD_DIR);
await del(BUILD_DIR);
fancyLog('[canvas] Deleting Shareable Runtime');
await del(resolve(XPACK_DIR, 'legacy/plugins/canvas/shareable_runtime/build'));
}
async function reportTask() {
const info = await gitInfo();
fancyLog('Package Name', chalk.yellow(PKG_NAME));
fancyLog('Version', chalk.yellow(BUILD_VERSION));
fancyLog('Build Number', chalk.yellow(`${info.number}`));
fancyLog('Build SHA', chalk.yellow(info.sha));
}
async function pluginHelpersBuild() {
await pluginHelpers.run('build', {
skipArchive: true,
buildDestination: PLUGIN_BUILD_DIR,
});
}
async function buildCanvasShareableRuntime() {
await execa(process.execPath, ['legacy/plugins/canvas/scripts/shareable_runtime'], {
cwd: XPACK_DIR,
stdio: ['ignore', 'inherit', 'inherit'],
// @ts-ignore Incorrect @types - execa supports `buffer`
buffer: false,
});
}
async function generateNoticeText() {
const buildRoot = resolve(PLUGIN_BUILD_DIR, 'kibana/x-pack');
const log = new ToolingLog({
level: 'info',
writeTo: process.stdout,
});
writeFileSync(
resolve(buildRoot, 'NOTICE.txt'),
await generateNoticeFromSource({
productName: 'Kibana X-Pack',
log,
directory: buildRoot,
})
);
}
export const buildTask = gulp.series(
cleanBuildTask,
reportTask,
prepareTask,
buildCanvasShareableRuntime,
pluginHelpersBuild,
generateNoticeText
);