Skip to content

Commit 7c8d238

Browse files
committed
[JS] Add initial TS config for migration (DO NOT MERGE)
1 parent d7a011c commit 7c8d238

File tree

9 files changed

+710
-606
lines changed

9 files changed

+710
-606
lines changed

javascript/node/selenium-webdriver/BUILD.bazel

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
22
load("@aspect_rules_js//js:defs.bzl", "js_library")
33
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
4+
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
45
load("@npm//:defs.bzl", "npm_link_all_packages")
56
load("@npm//javascript/node/selenium-webdriver:eslint/package_json.bzl", eslint_bin = "bin")
67
load("@npm//javascript/node/selenium-webdriver:prettier/package_json.bzl", prettier_bin = "bin")
@@ -20,31 +21,86 @@ BROWSER_VERSIONS = [
2021
"v133",
2122
]
2223

24+
copy_to_bin(
25+
name = "tsconfig",
26+
srcs = ["tsconfig.json"],
27+
)
28+
29+
# js source files
30+
filegroup(
31+
name = "js_sources",
32+
srcs = glob(
33+
[
34+
"*.js",
35+
"example/*.js",
36+
"http/*.js",
37+
"io/*.js",
38+
"lib/*.js",
39+
"lib/fedcm/*.js",
40+
"net/*.js",
41+
"remote/*.js",
42+
"testing/*.js",
43+
"devtools/*.js",
44+
"common/*.js",
45+
"bidi/*.js",
46+
],
47+
),
48+
)
49+
50+
# TypeScript source files
51+
filegroup(
52+
name = "ts_sources",
53+
srcs = glob(
54+
[
55+
"*.ts",
56+
"example/*.ts",
57+
"http/*.ts",
58+
"io/*.ts",
59+
"lib/*.ts",
60+
"lib/fedcm/*.ts",
61+
"net/*.ts",
62+
"remote/*.ts",
63+
"testing/*.ts",
64+
"devtools/*.ts",
65+
"common/*.ts",
66+
"bidi/*.ts",
67+
],
68+
allow_empty = True,
69+
),
70+
)
71+
72+
# TypeScript compilation
73+
ts_project(
74+
name = "ts-compile",
75+
srcs = [":ts_sources"],
76+
allow_js = False,
77+
declaration = False,
78+
source_map = True,
79+
tsconfig = ":tsconfig",
80+
deps = [
81+
":node_modules/@bazel/runfiles",
82+
":node_modules/@types/node",
83+
":node_modules/jszip",
84+
":node_modules/tmp",
85+
":node_modules/ws",
86+
],
87+
)
88+
89+
# Include all JS files and TS compilation output
2390
js_library(
2491
name = "prod-src-files",
2592
srcs = [
2693
"CHANGES.md",
2794
"README.md",
2895
"package.json",
29-
] + glob([
30-
"*.js",
31-
"example/*.js",
32-
"http/*.js",
33-
"io/*.js",
34-
"lib/*.js",
35-
"lib/fedcm/*.js",
36-
"net/*.js",
37-
"remote/*.js",
38-
"testing/*.js",
39-
"devtools/*.js",
40-
"common/*.js",
41-
"bidi/*.js",
42-
]),
96+
":js_sources",
97+
],
4398
deps = [
4499
":node_modules/@bazel/runfiles",
45100
":node_modules/jszip",
46101
":node_modules/tmp",
47102
":node_modules/ws",
103+
":ts-compile",
48104
],
49105
)
50106

javascript/node/selenium-webdriver/lib/pinnedScript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const crypto = require('node:crypto')
2020
class PinnedScript {
2121
constructor(script) {
2222
this.scriptSource_ = script
23-
// eslint-disable-next-line
23+
2424
this.scriptHandle_ = crypto.randomUUID().replace(/-/gi, '')
2525
}
2626

javascript/node/selenium-webdriver/lib/proxy.js

Lines changed: 0 additions & 222 deletions
This file was deleted.

0 commit comments

Comments
 (0)