mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-07 17:15:30 +02:00
chore: Started adding typescript to zen, b=(no-bug), c=scripts, workspaces
This commit is contained in:
parent
5dfc6a663f
commit
a7846a64d0
20 changed files with 46424 additions and 14 deletions
41
scripts/update_ts_types.py
Normal file
41
scripts/update_ts_types.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
import os
|
||||
|
||||
FILES = [
|
||||
"index.d.ts",
|
||||
"lib.gecko.darwin.d.ts",
|
||||
"lib.gecko.dom.d.ts",
|
||||
"lib.gecko.glean.d.ts",
|
||||
"lib.gecko.linux.d.ts",
|
||||
"lib.gecko.modules.d.ts",
|
||||
"lib.gecko.nsresult.d.ts",
|
||||
"lib.gecko.services.d.ts",
|
||||
"lib.gecko.tweaks.d.ts",
|
||||
"lib.gecko.win32.d.ts",
|
||||
"lib.gecko.xpcom.d.ts",
|
||||
"lib.gecko.xpidl.d.ts",
|
||||
]
|
||||
|
||||
ENGINE_PATH = os.path.join("engine", "tools", "@types")
|
||||
SRC_PATH = os.path.join("src", "zen", "@types")
|
||||
|
||||
def update_ts_types():
|
||||
os.system("cd engine && ./mach ts build && ./mach ts update")
|
||||
# copy the files from engine/tools/@types to src/@types
|
||||
for file in FILES:
|
||||
src_file = os.path.join(ENGINE_PATH, file)
|
||||
dest_file = os.path.join(SRC_PATH, file)
|
||||
if os.path.exists(src_file):
|
||||
os.system(f"cp {src_file} {dest_file}")
|
||||
else:
|
||||
print(f"File {src_file} does not exist.")
|
||||
|
||||
# add zen.d.ts to the end of index.d.ts
|
||||
with open(os.path.join(SRC_PATH, "index.d.ts"), "a") as f:
|
||||
f.write("\n")
|
||||
f.write('/// <reference types="./zen.d.ts" />\n')
|
||||
f.write('\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
update_ts_types()
|
||||
print("Updated TypeScript types.")
|
Loading…
Add table
Add a link
Reference in a new issue