-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…06921) * chore(NA): first custom rules for jsts_transpiler * chore(NA): update jsts_transpiler macro * chore(NA): moving @elastic/datemath to babel transpiler * chore(NA): change gitignore rules for bazel Co-authored-by: Tiago Costa <[email protected]>
- Loading branch information
1 parent
cfa379f
commit 69d0a7a
Showing
8 changed files
with
76 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,6 @@ report.asciidoc | |
.yarn-local-mirror | ||
|
||
# Bazel | ||
bazel | ||
bazel-* | ||
/bazel | ||
/bazel-* | ||
.bazelrc.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@kbn/babel-preset/node_preset"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package(default_visibility = ["//visibility:public"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
"""Public API interface for Bazel custom rules. | ||
Please do not import from any other files when looking to use a custom rule | ||
""" | ||
|
||
load("//src/dev/bazel:jsts_transpiler.bzl", _jsts_transpiler = "jsts_transpiler") | ||
|
||
jsts_transpiler = _jsts_transpiler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"Simple wrapper over @babel/cli so we can quickly re-use the same configurations over packages" | ||
|
||
load("@npm//@babel/cli:index.bzl", _babel = "babel") | ||
|
||
def jsts_transpiler(name, srcs, build_pkg_name, root_input_dir = "src", config_file = ".babelrc", additional_args = ["--quiet"], **kwargs): | ||
"""A macro around the autogenerated babel rule. | ||
Args: | ||
name: target name | ||
srcs: list of sources | ||
root_input_dir: defines the root input dir to transpile files from, defaults to "src" | ||
config_file: transpiler config file, it defaults to a package local .babelrc | ||
additional_args: Any additional extra arguments, defaults to --quiet | ||
**kwargs: the rest | ||
""" | ||
args = [ | ||
"./%s/%s" % (build_pkg_name, root_input_dir), | ||
"--config-file", | ||
"./%s/%s" % (build_pkg_name, config_file), | ||
"--out-dir", | ||
"$(@D)", | ||
"--extensions", | ||
".ts,.tsx,.js", | ||
] + additional_args | ||
|
||
data = [config_file] + srcs + [ | ||
"//packages/kbn-babel-preset", | ||
] | ||
|
||
_babel( | ||
name = name, | ||
data = data, | ||
output_dir = True, | ||
args = args, | ||
**kwargs | ||
) |