Skip to content

Commit 8100920

Browse files
committed
Make plugin peerDependency filtering more strict
Yes, this means that even plugins which use even a *tiny* bit of TypeDoc's API will require a re-release when breaking TypeDoc versions are released in order to continue showing up in the current version. That's completely intended; it should be up to plugin maintainers to verify support, not a new user who tries to use it based on a soft recommendation from TypeDoc's plugin page. Users wanting to try to use a plugin which doesn't claim support can still do so, either with "legacy" peer deps, or by using overrides.
1 parent 9ed2e6f commit 8100920

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

scripts/generate_site_plugins.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ import * as cp from "child_process";
33
import { mkdirSync, promises as fs } from "fs";
44
import semver from "semver";
55

6+
const { version: TYPEDOC_VERSION } = JSON.parse(await fs.readFile("package.json", "utf-8"));
7+
const NEXT_BREAKING_TYPEDOC_VERSION = semver.parse(TYPEDOC_VERSION)?.inc("minor");
8+
if (!NEXT_BREAKING_TYPEDOC_VERSION) {
9+
throw new Error("Failed to determine next TypeDoc version");
10+
}
11+
console.log(NEXT_BREAKING_TYPEDOC_VERSION);
12+
613
const CACHE_ROOT = "tmp/site-cache";
714
mkdirSync(CACHE_ROOT, { recursive: true });
815

@@ -112,10 +119,13 @@ function getSupportingPlugins(typedocVersion, plugins) {
112119
version = version.replace(/>=/g, "^");
113120
}
114121

115-
// Any plugin which claims compatibility with a version far in the future is lying.
116-
// They can't possibly know that it satisfies this, so exclude them because we can't
117-
// reliably figure out what version they do actually support.
118-
if (semver.satisfies("0.99.0", version)) continue;
122+
// Any plugin which claims compatibility with a version which includes breaking changes
123+
// in the future is lying. They can't possibly know that it satisfies this, so exclude
124+
// them because we can't reliably figure out what version they do actually support.
125+
// (we could technically probably look at when they were published and match that up
126+
// to when TypeDoc breaking versions were released, but that's far too much hackery
127+
// to permit plugins which include inaccurate version support anyways.)
128+
if (semver.satisfies(NEXT_BREAKING_TYPEDOC_VERSION || "", version)) continue;
119129

120130
if (semver.satisfies(typedocVersion, version)) {
121131
supported.push(plugin);

0 commit comments

Comments
 (0)