Skip to content

Commit

Permalink
[7.x] [timelion] Move grammar to package (#111881) (#112373)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
jbudz and kibanamachine committed Sep 16, 2021
1 parent a9906b8 commit 6260bab
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 1,795 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ snapshots.js
# plugin overrides
/src/core/lib/kbn_internal_native_observable
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
/src/plugins/vis_types/timelion/common/_generated_/**
/x-pack/plugins/canvas/canvas_plugin
/x-pack/plugins/canvas/shareable_runtime/build
/x-pack/plugins/canvas/storybook/build
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"@kbn/server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools",
"@kbn/server-route-repository": "link:bazel-bin/packages/kbn-server-route-repository",
"@kbn/std": "link:bazel-bin/packages/kbn-std",
"@kbn/timelion-grammar": "link:bazel-bin/packages/kbn-timelion-grammar",
"@kbn/tinymath": "link:bazel-bin/packages/kbn-tinymath",
"@kbn/typed-react-router-config": "link:bazel-bin/packages/kbn-typed-react-router-config",
"@kbn/ui-framework": "link:bazel-bin/packages/kbn-ui-framework",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ filegroup(
"//packages/kbn-telemetry-tools:build",
"//packages/kbn-test:build",
"//packages/kbn-test-subj-selector:build",
"//packages/kbn-timelion-grammar:build",
"//packages/kbn-tinymath:build",
"//packages/kbn-typed-react-router-config:build",
"//packages/kbn-ui-framework:build",
Expand Down
46 changes: 46 additions & 0 deletions packages/kbn-timelion-grammar/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("@npm//peggy:index.bzl", "peggy")

PKG_BASE_NAME = "kbn-timelion-grammar"
PKG_REQUIRE_NAME = "@kbn/timelion-grammar"

NPM_MODULE_EXTRA_FILES = [
"package.json",
]

peggy(
name = "grammar",
data = [
":grammar/chain.peggy"
],
output_dir = True,
args = [
"-o",
"$(@D)/chain.js",
"./%s/grammar/chain.peggy" % package_name()
],
)

js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES + [
":grammar"
],
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"],
)
7 changes: 7 additions & 0 deletions packages/kbn-timelion-grammar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@kbn/timelion-grammar",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true,
"main": "grammar/chain.js"
}
8 changes: 1 addition & 7 deletions src/plugins/vis_types/timelion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
Contains the timelion visualization and the timelion backend.

# Generate a parser
If your grammar was changed in `public/chain.peg` you need to re-generate the static parser. You could use a grunt task:

```
grunt peg:timelion_chain
```

The generated parser will be appeared at `public/_generated_` folder, which is included in `.eslintignore`
If your grammar was changed in `packages/@kbn-timelion-grammar` you need to re-generate the static parser. You can do this with `yarn kbn build`.
Loading

0 comments on commit 6260bab

Please sign in to comment.