convert sql_format to ts_project; move into separate folder
This commit is contained in:
parent
5eb1208714
commit
3d416b4a68
@ -4,7 +4,7 @@
|
||||
load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test")
|
||||
load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script")
|
||||
load(":rustfmt.bzl", "rustfmt_fix", "rustfmt_test")
|
||||
load("//ts:sql_format.bzl", "sql_format")
|
||||
load("//ts/sql_format:defs.bzl", "sql_format")
|
||||
|
||||
# Build script
|
||||
#######################
|
||||
|
@ -1,13 +1,10 @@
|
||||
load("//ts:prettier.bzl", "prettier", "prettier_test")
|
||||
load("//ts:sql_format.bzl", "sql_format_setup")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
|
||||
|
||||
prettier()
|
||||
|
||||
prettier_test()
|
||||
|
||||
sql_format_setup()
|
||||
|
||||
# Exported files
|
||||
#################
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//ts:prettier.bzl", "prettier_test")
|
||||
load("//ts:eslint.bzl", "eslint_test")
|
||||
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
|
||||
|
@ -1,25 +0,0 @@
|
||||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
|
||||
|
||||
def sql_format_setup():
|
||||
ts_library(
|
||||
name = "sql_format_lib",
|
||||
srcs = ["//ts:sql_format.ts"],
|
||||
deps = [
|
||||
"@npm//@sqltools/formatter",
|
||||
"@npm//@types/node",
|
||||
"@npm//@types/diff",
|
||||
"@npm//diff",
|
||||
],
|
||||
tsconfig = "//ts:tsconfig_bin",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
def sql_format(name = "sql_format", srcs = [], **kwargs):
|
||||
nodejs_test(
|
||||
name = name,
|
||||
entry_point = "//ts:sql_format.ts",
|
||||
args = [native.package_name() + "/" + f for f in srcs],
|
||||
data = ["//ts:sql_format_lib", "@npm//tslib", "@npm//diff"] + srcs,
|
||||
**kwargs
|
||||
)
|
19
ts/sql_format/BUILD.bazel
Normal file
19
ts/sql_format/BUILD.bazel
Normal file
@ -0,0 +1,19 @@
|
||||
load("//ts:typescript.bzl", "typescript")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
|
||||
|
||||
_deps = [
|
||||
"@npm//@sqltools/formatter",
|
||||
"@npm//@types/diff",
|
||||
"@npm//@types/node",
|
||||
"@npm//diff",
|
||||
]
|
||||
|
||||
typescript(
|
||||
name = "sql_format_lib",
|
||||
srcs = ["sql_format.ts"],
|
||||
deps = _deps,
|
||||
)
|
||||
|
||||
# a hack to allow us to define the test in a different file; there
|
||||
# should be a better way
|
||||
exports_files(["sql_format.ts"])
|
10
ts/sql_format/defs.bzl
Normal file
10
ts/sql_format/defs.bzl
Normal file
@ -0,0 +1,10 @@
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
|
||||
|
||||
def sql_format(name = "sql_format", srcs = [], **kwargs):
|
||||
nodejs_test(
|
||||
name = name,
|
||||
entry_point = "//ts/sql_format:sql_format.ts",
|
||||
args = [native.package_name() + "/" + f for f in srcs],
|
||||
data = ["//ts/sql_format:sql_format_lib", "@npm//tslib", "@npm//diff"] + srcs,
|
||||
**kwargs
|
||||
)
|
14
ts/sql_format/tsconfig.json
Normal file
14
ts/sql_format/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["*"],
|
||||
"references": [],
|
||||
"compilerOptions": {
|
||||
"types": ["node"],
|
||||
// ignore missing optional modules like postcss
|
||||
"skipLibCheck": true,
|
||||
// ensure node can run the resulting code
|
||||
"noEmitHelpers": false,
|
||||
"importHelpers": false,
|
||||
"module": "commonjs",
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user