mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-11 15:37:27 +00:00
[TS] Add single-file ts codegen & bazel rule for typescript (#7161)
The headline here is adding a flatbuffer_ts_library rule for generating typescript code in bazel. This entails some non-trivial other changes, but ideally none are user-visible. In particular: * Added a --ts-flat-file flag that generates a single *_generated.ts file instead of separate files for each typescript type. This makes bazel much happier. * Import the bazel rules_nodejs stuff needed to support building typescript in bazel * Move flatbuffers.ts to index.ts because I wasn't sure how to make bazel comprehend the "main" attribute of the package.json. Happy to take another stab at figuring that out if really needed. * Fix another couple keyword escaping spots in typescript...
This commit is contained in:
14
tests/test_dir/BUILD.bazel
Normal file
14
tests/test_dir/BUILD.bazel
Normal file
@@ -0,0 +1,14 @@
|
||||
load("//:build_defs.bzl", "flatbuffer_ts_library")
|
||||
|
||||
flatbuffer_ts_library(
|
||||
name = "typescript_transitive_ts_fbs",
|
||||
srcs = ["typescript_transitive_include.fbs"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
flatbuffer_ts_library(
|
||||
name = "include_ts_fbs",
|
||||
srcs = ["typescript_include.fbs"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":typescript_transitive_ts_fbs"],
|
||||
)
|
||||
6
tests/test_dir/typescript_include.fbs
Normal file
6
tests/test_dir/typescript_include.fbs
Normal file
@@ -0,0 +1,6 @@
|
||||
include 'typescript_transitive_include.fbs';
|
||||
namespace foobar;
|
||||
|
||||
enum class: int {
|
||||
arguments,
|
||||
}
|
||||
5
tests/test_dir/typescript_transitive_include.fbs
Normal file
5
tests/test_dir/typescript_transitive_include.fbs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace foobar;
|
||||
|
||||
enum Abc: int {
|
||||
a,
|
||||
}
|
||||
Reference in New Issue
Block a user