Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[timelion] Move grammar to package #111881

Merged
merged 5 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -154,6 +154,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