Skip to content

Commit 6549a6c

Browse files
authored
Drop support for typedoc 0.20 and 0.21 (#52)
1 parent ec3277c commit 6549a6c

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ jobs:
6060
strategy:
6161
fail-fast: false
6262
matrix:
63-
python-version: ['3.10', '3.11']
64-
typedoc-version: ['0.20', '0.21', '0.22', '0.23', '0.24', '0.25']
63+
python-version: ['3.11']
64+
typedoc-version: ['0.22', '0.23', '0.24', '0.25']
6565
experimental: [false]
6666

6767
name: Python ${{ matrix.python-version}} + typedoc ${{ matrix.typedoc-version }}

noxfile.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@
77
@nox.session(python=["3.10", "3.11"])
88
def tests(session: Session) -> None:
99
session.install("-r", "requirements_dev.txt")
10-
session.run("npm", "i", "--no-save", "[email protected]", "[email protected]", external=True)
10+
venvroot = Path(session.bin).parent
11+
(venvroot / "node_modules").mkdir()
12+
with session.chdir(venvroot):
13+
session.run(
14+
"npm", "i", "--no-save", "[email protected]", "[email protected]", external=True
15+
)
1116
session.run("pytest", "--junitxml=test-results.xml")
1217

1318

14-
@nox.session(python=["3.10", "3.11"])
15-
@nox.parametrize("typedoc", ["0.20", "0.21", "0.22", "0.23", "0.24", "0.25"])
19+
@nox.session(python=["3.11"])
20+
@nox.parametrize("typedoc", ["0.22", "0.23", "0.24", "0.25"])
1621
def test_typedoc(session: Session, typedoc: str) -> None:
1722

1823
session.install("-r", "requirements_dev.txt")

sphinx_js/typedoc.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
__all__ = ["Analyzer"]
2727

28+
MIN_TYPEDOC_VERSION = (0, 22, 0)
29+
2830

2931
@cache
3032
def typedoc_version_info(typedoc: str) -> tuple[tuple[int, ...], tuple[int, ...]]:
@@ -41,21 +43,29 @@ def typedoc_version_info(typedoc: str) -> tuple[tuple[int, ...], tuple[int, ...]
4143
return typedoc_version, typescript_version
4244

4345

46+
def version_to_str(t: Sequence[int]) -> str:
47+
return ".".join(str(x) for x in t)
48+
49+
4450
def typedoc_output(
4551
abs_source_paths: list[str], sphinx_conf_dir: str | pathlib.Path, config_path: str
4652
) -> "Project":
4753
"""Return the loaded JSON output of the TypeDoc command run over the given
4854
paths."""
4955
typedoc = search_node_modules("typedoc", "typedoc/bin/typedoc", sphinx_conf_dir)
5056
typedoc_version, _ = typedoc_version_info(typedoc)
57+
if typedoc_version < MIN_TYPEDOC_VERSION:
58+
raise RuntimeError(
59+
f"Typedoc version {version_to_str(typedoc_version)} is too old, minimum required is {version_to_str(MIN_TYPEDOC_VERSION)}"
60+
)
61+
5162
command = Command("node")
5263
os.environ["TYPEDOC_NODE_MODULES"] = str(Path(typedoc).parents[2])
5364
if typedoc_version >= (0, 24, 0):
5465
command.add(str(Path(__file__).parent / "typedoc_0.24.mjs"))
5566
else:
5667
command.add(typedoc)
57-
if typedoc_version >= (0, 22, 0):
58-
command.add("--entryPointStrategy", "expand")
68+
command.add("--entryPointStrategy", "expand")
5969

6070
if config_path:
6171
tsconfig_path = str((Path(sphinx_conf_dir) / config_path).absolute())
@@ -657,8 +667,7 @@ def to_ir(
657667
class OtherNode(NodeBase):
658668
kindString: Literal[
659669
"Enumeration",
660-
"Enumeration Member", # M changed to uppercase in version 0.22
661-
"Enumeration member",
670+
"Enumeration Member",
662671
"Namespace",
663672
"Type alias",
664673
"Reference",

0 commit comments

Comments
 (0)