Revert "Migrate from rules_nodejs to rules_js/rules_ts (#7923)" (#7927)

This reverts commit 4172c3f0bd.
This commit is contained in:
Derek Bailey
2023-04-28 12:58:49 -07:00
committed by GitHub
parent 4172c3f0bd
commit e7dc252b0e
35 changed files with 1214 additions and 1697 deletions

View File

@@ -1,23 +1,5 @@
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
filegroup(
name = "distribution",
srcs = [
"BUILD.bazel",
"compile_flat_file.sh",
] + glob([
"*.ts",
]),
visibility = ["//visibility:public"],
)
# Add an index to emulate the top-level package.json's "main" entry.
genrule(
name = "generate_index.ts",
outs = ["index.ts"],
cmd = """echo "export * from './flatbuffers.js'" > $(OUTS)""",
)
load("@npm//@bazel/typescript:index.bzl", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
ts_project(
name = "flatbuffers_ts",
@@ -29,7 +11,6 @@ ts_project(
"flatbuffers.ts",
"types.ts",
"utils.ts",
":index.ts",
],
declaration = True,
tsconfig = {
@@ -47,19 +28,14 @@ ts_project(
},
},
visibility = ["//visibility:public"],
deps = [
# Because the main repository instantiates the @npm repository, we need
# to depend on the main repository's node import.
"@//:node_modules/@types/node",
],
deps = ["@npm//@types/node"],
)
npm_package(
js_library(
name = "flatbuffers",
srcs = [":flatbuffers_ts"],
include_external_repositories = ["*"],
package = "flatbuffers",
package_name = "flatbuffers",
visibility = ["//visibility:public"],
deps = [":flatbuffers_ts"],
)
sh_binary(
@@ -68,6 +44,7 @@ sh_binary(
data = [
"@com_github_google_flatbuffers//:flatc",
"@nodejs_linux_amd64//:node_bin",
"@npm//esbuild/bin:esbuild",
],
# We just depend directly on the linux amd64 nodejs binary, so only support
# running this script on amd64 for now.