Skip to content

Commit fe413f0

Browse files
authored
chore: remove api.json and use it from driver (#288)
1 parent aa6790e commit fe413f0

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
python -m pip install --upgrade pip
2121
pip install -r local-requirements.txt
2222
pip install -e .
23+
- name: Build package
24+
run: python build_package.py
25+
- name: Install browsers
26+
run: python -m playwright install
2327
- name: Lint
2428
run: pre-commit run --all-files
2529
- name: Test Sync generation script
@@ -58,7 +62,7 @@ jobs:
5862
pip install -e .
5963
- name: Build package
6064
run: python build_package.py
61-
- name: Install
65+
- name: Install browsers
6266
run: python -m playwright install
6367
- name: Test Sync API
6468
if: matrix.os != 'ubuntu-latest'

api.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

build_package.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,3 @@ def driver_version(platform: str) -> str:
9999
zip.write(from_location, to_location)
100100

101101
os.remove(base_wheel_location)
102-
103-
subprocess.check_call("python -m playwright print-api-json > api.json", shell=True)

scripts/documentation_provider.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import json
1616
import re
17+
import subprocess
1718
from sys import stderr
1819
from typing import ( # type: ignore
1920
Any,
@@ -49,8 +50,12 @@ class DocumentationProvider:
4950
def __init__(self) -> None:
5051
self.api: Any = {}
5152
self.printed_entries: List[str] = []
52-
with open("api.json") as json_file:
53-
self.api = json.load(json_file)
53+
process_output = subprocess.run(
54+
["python", "-m", "playwright", "print-api-json"],
55+
check=True,
56+
capture_output=True,
57+
)
58+
self.api = json.loads(process_output.stdout)
5459
self.errors: Set[str] = set()
5560

5661
method_name_rewrites: Dict[str, str] = {

0 commit comments

Comments
 (0)