Skip to content

Commit

Permalink
tidy up the root dir a bit by moving jest out to its own folder (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zemnmez authored May 5, 2022
1 parent 560fbf2 commit cec523f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
24 changes: 6 additions & 18 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("//:rules.bzl", "ts_project")
load("@npm//@bazel/esbuild:esbuild_config.bzl", "esbuild_config")
load("//:rules.bzl", "ts_config")

package(default_visibility = [":__subpackages__"])

Expand All @@ -22,7 +22,11 @@ alias(
actual = "//tools/bazel:fix",
)

load("//:rules.bzl", "ts_config")
ts_config(
name = "tsconfig_jsx",
src = "jsx.tsconfig.json",
deps = ["//ts/config:jsx"],
)

ts_config(
name = "tsconfig",
Expand All @@ -35,27 +39,11 @@ ts_config(
deps = ["//ts/config:node"],
)

ts_config(
name = "tsconfig_jsx",
src = "jsx.tsconfig.json",
deps = ["//ts/config:jsx"],
)

js_library(
name = "base_defs",
srcs = ["Global.d.ts"],
)

ts_project(
name = "jest_config_node",
srcs = ["jest.node.config.ts"],
)

ts_project(
name = "jest_config_browser",
srcs = ["jest.browser.config.ts"],
)

exports_files(
[
".prettierrc.json",
Expand Down
2 changes: 1 addition & 1 deletion rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def jest_test(project_deps = [], jsdom = None, deps = [], **kwargs):
extra_deps = ["@npm//jsdom"] if jsdom else []
_jest_test(
deps = deps + [x + "_js" for x in project_deps] + extra_deps,
jest_config = "//:jest_config_browser_js" if jsdom else "//:jest_config_node_js",
jest_config = "//ts/jest:config_browser_js" if jsdom else "//ts/jest:config_node_js",
**kwargs
)

Expand Down
13 changes: 13 additions & 0 deletions ts/jest/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("//:rules.bzl", "ts_project")

package(default_visibility = ["//:__subpackages__"])

ts_project(
name = "config_node",
srcs = ["jest.node.config.ts"],
)

ts_project(
name = "config_browser",
srcs = ["jest.browser.config.ts"],
)
1 change: 1 addition & 0 deletions jest.browser.config.ts → ts/jest/jest.browser.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export default {
'examples_jest/(.*)': '<rootDir>/$1',
},
moduleDirectories: ['node_modules', '.'],
rootDir: '../..',
};
1 change: 1 addition & 0 deletions jest.node.config.ts → ts/jest/jest.node.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export default {
'examples_jest/(.*)': '<rootDir>/$1',
},
moduleDirectories: ['node_modules', '.'],
rootDir: '../..',
};
File renamed without changes.

0 comments on commit cec523f

Please sign in to comment.