kibana/packages/kbn-monaco/scripts/build.js
Jean-Louis Leysens 1346b154ad
[ES UI Shared] Monaco XJSON (#67485)
* First iteration of xjson in monaco

* Throwaway implementation in painless lab - THIS MUST BE REVERTED

* WiP on build process for new kbn-lang package

* new @kbn/langs package and update ui-shared-deps

* Update jest config for new work files

* Update painless lab -- REVERT THIS COMMIT

* Create shared useXJson mode hook

* Final update to using the new shared useXJsonMode hook -- REVERT

* Created @kbn/monaco and share through shared deps

* always access monaco through `@kbn/monaco`

* use path.resolve to create path

* add basic readme

* remove console.log call

* remove typescript support from ui-shared-deps webpack config

* use `@kbn/babel-preset`

* include the monaco styles in the kbn-ui-shared-deps

* sort package.json

* build worker at bootstrap rather than commiting to repo

* only build worker, don't pre-bundle monaco

* fix type check errors

* remove section from readme about committed dist

* keep editor.worker.js postfix

* forgot to save update to import

* license package as apache-2.0

* Added regenerator runtime for worker bundle

* revert changes to painless lab

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-04 13:43:21 +02:00

64 lines
1.8 KiB
JavaScript

/*
* 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.
*/
const path = require('path');
const del = require('del');
const supportsColor = require('supports-color');
const { run } = require('@kbn/dev-utils');
const TARGET_BUILD_DIR = path.resolve(__dirname, '../target');
const ROOT_DIR = path.resolve(__dirname, '../');
const WEBPACK_CONFIG_PATH = path.resolve(ROOT_DIR, 'webpack.config.js');
run(
async ({ procRunner, log, flags }) => {
log.info('Deleting old output');
await del(TARGET_BUILD_DIR);
const cwd = ROOT_DIR;
const env = { ...process.env };
if (supportsColor.stdout) {
env.FORCE_COLOR = 'true';
}
await procRunner.run('worker', {
cmd: 'webpack',
args: ['--config', WEBPACK_CONFIG_PATH, flags.dev ? '--env.dev' : '--env.prod'],
wait: true,
env,
cwd,
});
await procRunner.run('tsc ', {
cmd: 'tsc',
args: [],
wait: true,
env,
cwd,
});
log.success('Complete');
},
{
flags: {
boolean: ['dev'],
},
}
);