mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
chore(NA): moving @kbn/monaco into bazel (#100709)
* chore(NA): moving @kbn/monaco into bazel * chore(NA): update register globals definitions * chore(NA): remove build script Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
5dde07ff6f
commit
9129887bb7
12 changed files with 128 additions and 72 deletions
|
@ -82,10 +82,12 @@ yarn kbn watch-bazel
|
|||
- @kbn/i18n
|
||||
- @kbn/legacy-logging
|
||||
- @kbn/logging
|
||||
- @kbn/mapbox-gl
|
||||
- @kbn/monaco
|
||||
- @kbn/securitysolution-es-utils
|
||||
- kbn/securitysolution-io-ts-alerting-types
|
||||
- kbn/securitysolution-io-ts-list-types
|
||||
- kbn/securitysolution-io-ts-types
|
||||
- @kbn/securitysolution-io-ts-alerting-types
|
||||
- @kbn/securitysolution-io-ts-list-types
|
||||
- @kbn/securitysolution-io-ts-types
|
||||
- @kbn/securitysolution-io-ts-utils
|
||||
- @kbn/securitysolution-list-api
|
||||
- @kbn/securitysolution-list-constants
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
"@kbn/io-ts-utils": "link:packages/kbn-io-ts-utils",
|
||||
"@kbn/legacy-logging": "link:bazel-bin/packages/kbn-legacy-logging/npm_module",
|
||||
"@kbn/logging": "link:bazel-bin/packages/kbn-logging/npm_module",
|
||||
"@kbn/monaco": "link:packages/kbn-monaco",
|
||||
"@kbn/monaco": "link:bazel-bin/packages/kbn-monaco/npm_module",
|
||||
"@kbn/securitysolution-list-constants": "link:bazel-bin/packages/kbn-securitysolution-list-constants/npm_module",
|
||||
"@kbn/securitysolution-es-utils": "link:bazel-bin/packages/kbn-securitysolution-es-utils/npm_module",
|
||||
"@kbn/securitysolution-io-ts-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-types/npm_module",
|
||||
|
|
|
@ -25,6 +25,7 @@ filegroup(
|
|||
"//packages/kbn-legacy-logging:build",
|
||||
"//packages/kbn-logging:build",
|
||||
"//packages/kbn-mapbox-gl:build",
|
||||
"//packages/kbn-monaco:build",
|
||||
"//packages/kbn-plugin-generator:build",
|
||||
"//packages/kbn-securitysolution-list-constants:build",
|
||||
"//packages/kbn-securitysolution-io-ts-types:build",
|
||||
|
|
|
@ -34,6 +34,7 @@ DEPS = [
|
|||
"@npm//@babel/preset-typescript",
|
||||
"@npm//babel-plugin-add-module-exports",
|
||||
"@npm//babel-plugin-styled-components",
|
||||
"@npm//babel-plugin-transform-react-remove-prop-types",
|
||||
]
|
||||
|
||||
js_library(
|
||||
|
|
108
packages/kbn-monaco/BUILD.bazel
Normal file
108
packages/kbn-monaco/BUILD.bazel
Normal file
|
@ -0,0 +1,108 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
||||
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
|
||||
|
||||
PKG_BASE_NAME = "kbn-monaco"
|
||||
PKG_REQUIRE_NAME = "@kbn/monaco"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*",
|
||||
],
|
||||
exclude = [
|
||||
"**/*.test.*",
|
||||
"**/README.md",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
"README.md"
|
||||
]
|
||||
|
||||
SRC_DEPS = [
|
||||
"//packages/kbn-babel-preset",
|
||||
"//packages/kbn-i18n",
|
||||
"@npm//antlr4ts",
|
||||
"@npm//babel-loader",
|
||||
"@npm//monaco-editor",
|
||||
"@npm//raw-loader",
|
||||
"@npm//regenerator-runtime",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/node",
|
||||
]
|
||||
|
||||
DEPS = SRC_DEPS + TYPES_DEPS
|
||||
|
||||
webpack(
|
||||
name = "target_web",
|
||||
data = DEPS + [
|
||||
":src",
|
||||
":webpack.config.js",
|
||||
],
|
||||
output_dir = True,
|
||||
args = [
|
||||
"--config",
|
||||
"$(location webpack.config.js)",
|
||||
"--output-path",
|
||||
"$(@D)",
|
||||
"--env.prod",
|
||||
"--display=minimal"
|
||||
],
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = DEPS,
|
||||
declaration = True,
|
||||
declaration_dir = "target_types",
|
||||
declaration_map = True,
|
||||
incremental = True,
|
||||
out_dir = "target_node",
|
||||
source_map = True,
|
||||
root_dir = ".",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_BASE_NAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = DEPS + [":target_web", ":tsc"],
|
||||
package_name = PKG_REQUIRE_NAME,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_npm(
|
||||
name = "npm_module",
|
||||
deps = [
|
||||
":%s" % PKG_BASE_NAME,
|
||||
]
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "build",
|
||||
srcs = [
|
||||
":npm_module",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -2,12 +2,10 @@
|
|||
"name": "@kbn/monaco",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"main": "./target/index.js",
|
||||
"types": "./target/index.d.ts",
|
||||
"main": "target_node/src/index.js",
|
||||
"types": "target_types/src/index.d.ts",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"scripts": {
|
||||
"build": "node ./scripts/build.js",
|
||||
"kbn:bootstrap": "yarn build --dev",
|
||||
"build:antlr4ts": "../../node_modules/antlr4ts-cli/antlr4ts ./src/painless/antlr/painless_lexer.g4 ./src/painless/antlr/painless_parser.g4 && node ./scripts/fix_generated_antlr.js"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
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'],
|
||||
},
|
||||
}
|
||||
);
|
|
@ -11,11 +11,11 @@ import { PainlessLang } from './painless';
|
|||
import { EsqlLang } from './esql';
|
||||
import { monaco } from './monaco_imports';
|
||||
// @ts-ignore
|
||||
import xJsonWorkerSrc from '!!raw-loader!../target/public/xjson.editor.worker.js';
|
||||
import xJsonWorkerSrc from '!!raw-loader!../../target_web/xjson.editor.worker.js';
|
||||
// @ts-ignore
|
||||
import defaultWorkerSrc from '!!raw-loader!../target/public/default.editor.worker.js';
|
||||
import defaultWorkerSrc from '!!raw-loader!../../target_web/default.editor.worker.js';
|
||||
// @ts-ignore
|
||||
import painlessWorkerSrc from '!!raw-loader!../target/public/painless.editor.worker.js';
|
||||
import painlessWorkerSrc from '!!raw-loader!../../target_web/painless.editor.worker.js';
|
||||
|
||||
/**
|
||||
* Register languages and lexer rules
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"incremental": false,
|
||||
"outDir": "./target",
|
||||
"incremental": true,
|
||||
"declarationDir": "./target_types",
|
||||
"outDir": "./target_node",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": "../../../../packages/kbn-monaco/src",
|
||||
"types": [
|
||||
|
@ -13,6 +15,6 @@
|
|||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
"src/**/*",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ const createLangWorkerConfig = (lang) => {
|
|||
mode: 'production',
|
||||
entry,
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'target/public'),
|
||||
path: path.resolve(__dirname, 'target_web'),
|
||||
filename: `${lang}.editor.worker.js`,
|
||||
},
|
||||
resolve: {
|
||||
|
|
|
@ -7,8 +7,5 @@
|
|||
"build": "node scripts/build",
|
||||
"kbn:bootstrap": "node scripts/build --dev",
|
||||
"kbn:watch": "node scripts/build --dev --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/monaco": "link:../kbn-monaco"
|
||||
}
|
||||
}
|
|
@ -2682,7 +2682,7 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/monaco@link:packages/kbn-monaco":
|
||||
"@kbn/monaco@link:bazel-bin/packages/kbn-monaco/npm_module":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue