mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* chore(NA): moving @kbn/plugin-generator into bazel * chore(NA): add templates to build file * chore(NA): restore plugins empty file Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
This commit is contained in:
parent
4accfcd9d0
commit
a43ea4b1ff
7 changed files with 111 additions and 40 deletions
|
@ -450,7 +450,7 @@
|
|||
"@kbn/eslint-plugin-eslint": "link:bazel-bin/packages/kbn-eslint-plugin-eslint/npm_module",
|
||||
"@kbn/expect": "link:bazel-bin/packages/kbn-expect/npm_module",
|
||||
"@kbn/optimizer": "link:packages/kbn-optimizer",
|
||||
"@kbn/plugin-generator": "link:packages/kbn-plugin-generator",
|
||||
"@kbn/plugin-generator": "link:bazel-bin/packages/kbn-plugin-generator/npm_module",
|
||||
"@kbn/plugin-helpers": "link:packages/kbn-plugin-helpers",
|
||||
"@kbn/pm": "link:packages/kbn-pm",
|
||||
"@kbn/storybook": "link:packages/kbn-storybook",
|
||||
|
|
|
@ -22,6 +22,7 @@ filegroup(
|
|||
"//packages/kbn-expect:build",
|
||||
"//packages/kbn-legacy-logging:build",
|
||||
"//packages/kbn-logging:build",
|
||||
"//packages/kbn-plugin-generator:build",
|
||||
"//packages/kbn-securitysolution-constants:build",
|
||||
"//packages/kbn-securitysolution-io-ts-utils:build",
|
||||
"//packages/kbn-securitysolution-utils:build",
|
||||
|
|
106
packages/kbn-plugin-generator/BUILD.bazel
Normal file
106
packages/kbn-plugin-generator/BUILD.bazel
Normal file
|
@ -0,0 +1,106 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
||||
|
||||
PKG_BASE_NAME = "kbn-plugin-generator"
|
||||
PKG_REQUIRE_NAME = "@kbn/plugin-generator"
|
||||
|
||||
SOURCE_FILES = glob(
|
||||
[
|
||||
"src/**/*.ts",
|
||||
],
|
||||
exclude = [
|
||||
"**/integration_tests/**/*",
|
||||
],
|
||||
)
|
||||
|
||||
SRCS = SOURCE_FILES
|
||||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = SRCS,
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "template",
|
||||
srcs = glob(
|
||||
[
|
||||
"template/**/*",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
NPM_MODULE_EXTRA_FILES = [
|
||||
"package.json",
|
||||
"README.md",
|
||||
":template",
|
||||
]
|
||||
|
||||
SRC_DEPS = [
|
||||
"//packages/kbn-utils",
|
||||
"//packages/kbn-dev-utils",
|
||||
"@npm//del",
|
||||
"@npm//ejs",
|
||||
"@npm//execa",
|
||||
"@npm//globby",
|
||||
"@npm//inquirer",
|
||||
"@npm//minimatch",
|
||||
"@npm//prettier",
|
||||
"@npm//vinyl-fs",
|
||||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"@npm//@types/ejs",
|
||||
"@npm//@types/inquirer",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/minimatch",
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/prettier",
|
||||
"@npm//@types/vinyl-fs",
|
||||
]
|
||||
|
||||
DEPS = SRC_DEPS + TYPES_DEPS
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig.json",
|
||||
deps = [
|
||||
"//:tsconfig.base.json",
|
||||
],
|
||||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
incremental = True,
|
||||
out_dir = "target",
|
||||
source_map = True,
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = PKG_BASE_NAME,
|
||||
srcs = NPM_MODULE_EXTRA_FILES,
|
||||
deps = [":tsc"] + DEPS,
|
||||
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"],
|
||||
)
|
|
@ -4,9 +4,5 @@
|
|||
"private": true,
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"main": "target/index.js",
|
||||
"types": "target/index.d.ts",
|
||||
"scripts": {
|
||||
"kbn:bootstrap": "node scripts/build",
|
||||
"kbn:watch": "node scripts/build --watch"
|
||||
}
|
||||
"types": "target/index.d.ts"
|
||||
}
|
|
@ -1,32 +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 { run } = require('@kbn/dev-utils');
|
||||
const del = require('del');
|
||||
const execa = require('execa');
|
||||
|
||||
run(
|
||||
async ({ flags }) => {
|
||||
await del(Path.resolve(__dirname, '../target'));
|
||||
|
||||
await execa(require.resolve('typescript/bin/tsc'), flags.watch ? ['--watch'] : [], {
|
||||
cwd: Path.resolve(__dirname, '..'),
|
||||
stdio: 'inherit',
|
||||
});
|
||||
},
|
||||
{
|
||||
flags: {
|
||||
boolean: ['watch'],
|
||||
help: `
|
||||
--watch Watch files and rebuild on changes
|
||||
`,
|
||||
},
|
||||
}
|
||||
);
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"incremental": false,
|
||||
"incremental": true,
|
||||
"outDir": "target",
|
||||
"target": "ES2019",
|
||||
"declaration": true,
|
||||
|
|
|
@ -2686,7 +2686,7 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/plugin-generator@link:packages/kbn-plugin-generator":
|
||||
"@kbn/plugin-generator@link:bazel-bin/packages/kbn-plugin-generator/npm_module":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue