mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
parent
f6f1d494c8
commit
d31c67c96b
5 changed files with 50 additions and 2 deletions
|
@ -90,6 +90,7 @@ export function runCli() {
|
||||||
|
|
||||||
await Tasks.initTargets(context);
|
await Tasks.initTargets(context);
|
||||||
await Tasks.optimize(context);
|
await Tasks.optimize(context);
|
||||||
|
await Tasks.writePublicAssets(context);
|
||||||
await Tasks.writeServerFiles(context);
|
await Tasks.writeServerFiles(context);
|
||||||
await Tasks.yarnInstall(context);
|
await Tasks.yarnInstall(context);
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,8 @@ it('builds a generated plugin into a viable archive', async () => {
|
||||||
│ info initialized, 0 bundles cached
|
│ info initialized, 0 bundles cached
|
||||||
│ info starting worker [1 bundle]
|
│ info starting worker [1 bundle]
|
||||||
│ succ 1 bundles compiled successfully after <time>
|
│ succ 1 bundles compiled successfully after <time>
|
||||||
info copying source into the build and converting with babel
|
info copying assets from \`public/assets\` to build
|
||||||
|
info copying server source into the build and converting with babel
|
||||||
info running yarn to install dependencies
|
info running yarn to install dependencies
|
||||||
info compressing plugin into [fooTestPlugin-7.5.0.zip]"
|
info compressing plugin into [fooTestPlugin-7.5.0.zip]"
|
||||||
`);
|
`);
|
||||||
|
|
|
@ -20,5 +20,6 @@
|
||||||
export * from './clean';
|
export * from './clean';
|
||||||
export * from './create_archive';
|
export * from './create_archive';
|
||||||
export * from './optimize';
|
export * from './optimize';
|
||||||
|
export * from './write_public_assets';
|
||||||
export * from './write_server_files';
|
export * from './write_server_files';
|
||||||
export * from './yarn_install';
|
export * from './yarn_install';
|
||||||
|
|
45
packages/kbn-plugin-helpers/src/tasks/write_public_assets.ts
Normal file
45
packages/kbn-plugin-helpers/src/tasks/write_public_assets.ts
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { pipeline } from 'stream';
|
||||||
|
import { promisify } from 'util';
|
||||||
|
|
||||||
|
import vfs from 'vinyl-fs';
|
||||||
|
|
||||||
|
import { BuildContext } from '../build_context';
|
||||||
|
|
||||||
|
const asyncPipeline = promisify(pipeline);
|
||||||
|
|
||||||
|
export async function writePublicAssets({ log, plugin, sourceDir, buildDir }: BuildContext) {
|
||||||
|
if (!plugin.manifest.ui) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info('copying assets from `public/assets` to build');
|
||||||
|
|
||||||
|
await asyncPipeline(
|
||||||
|
vfs.src(['public/assets/**/*'], {
|
||||||
|
cwd: sourceDir,
|
||||||
|
base: sourceDir,
|
||||||
|
buffer: true,
|
||||||
|
allowEmpty: true,
|
||||||
|
}),
|
||||||
|
vfs.dest(buildDir)
|
||||||
|
);
|
||||||
|
}
|
|
@ -35,7 +35,7 @@ export async function writeServerFiles({
|
||||||
buildDir,
|
buildDir,
|
||||||
kibanaVersion,
|
kibanaVersion,
|
||||||
}: BuildContext) {
|
}: BuildContext) {
|
||||||
log.info('copying source into the build and converting with babel');
|
log.info('copying server source into the build and converting with babel');
|
||||||
|
|
||||||
// copy source files and apply some babel transformations in the process
|
// copy source files and apply some babel transformations in the process
|
||||||
await asyncPipeline(
|
await asyncPipeline(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue