Skip to content

Commit 70f5f75

Browse files
committed
Update changelog
Also fix a bug where --watch would sometimes exit unexpectedly
1 parent f1fe72d commit 70f5f75

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ title: Changelog
88

99
- `@includeCode` and `@inline` can now inject parts of files using region
1010
names or line numbers, #2816.
11+
- Improved TypeDoc's `--watch` option to support watching files not caught by
12+
TypeScript's watch mode, #2675.
1113
- The `@inline` tag now works in more places for generic types.
1214

1315
### Bug Fixes
@@ -19,7 +21,9 @@ title: Changelog
1921

2022
### Thanks!
2123

24+
- @pjeby
2225
- @shawninder
26+
- @tats-u
2327

2428
## v0.27.6 (2024-12-26)
2529

bin/typedoc

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ function main() {
88
stdio: "inherit",
99
}).on("exit", (code) => {
1010
// Watch restart required? Fork a new child
11-
if (code === 7) main();
12-
else process.exit(code || 0);
11+
if (code === 7) {
12+
// Set an environment variable to ensure we continue watching
13+
// Otherwise, the watch might stop unexpectedly if the watch
14+
// option was set in a config file originally, and change to false
15+
// later, causing a restart
16+
process.env["TYPEDOC_FORCE_WATCH"] = "1";
17+
main();
18+
} else {
19+
process.exit(code || 0);
20+
}
1321
});
1422
}
1523

site/options/other.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ configuration files, files imported by `@include`/`@includeCode`, and any
1818
files explicitly registered by plugins as needing to be watched, as well
1919
as all your TypeScript source files.
2020

21+
Watch mode is not supported with `entryPointStrategy` set to `packages` or `merge`.
22+
2123
## preserveWatchOutput
2224

2325
```bash

src/lib/cli.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ async function run(app: td.Application) {
7272
return ExitCodes.OptionError;
7373
}
7474

75-
if (app.options.getValue("watch")) {
76-
return (await app.convertAndWatch(async (project) => {
75+
if (app.options.getValue("watch") || process.env["TYPEDOC_FORCE_WATCH"]) {
76+
const continueWatching = await app.convertAndWatch(async (project) => {
7777
app.validate(project);
7878
await app.generateOutputs(project);
79-
}))
80-
? ExitCodes.Watching
81-
: ExitCodes.OptionError;
79+
});
80+
81+
return continueWatching ? ExitCodes.Watching : ExitCodes.OptionError;
8282
}
8383

8484
const project = await app.convert();

0 commit comments

Comments
 (0)