Skip to content

Commit fe72add

Browse files
authored
Fix watchmode for taskr tasks (#80020)
1 parent aefa6f1 commit fe72add

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/next/taskfile.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,11 +2835,21 @@ export async function build(task, opts) {
28352835
}
28362836

28372837
export async function generate_types(task, opts) {
2838-
await execa(
2838+
const watchmode = opts.dev
2839+
const typesPromise = execa(
28392840
'pnpm',
2840-
['run', 'types', ...(opts.dev ? ['--watch', '--preserveWatchOutput'] : [])],
2841+
[
2842+
'run',
2843+
'types',
2844+
...(watchmode ? ['--watch', '--preserveWatchOutput'] : []),
2845+
],
28412846
{ stdio: 'inherit' }
28422847
)
2848+
// In watch-mode the process never completes i.e. the Promise never resolve.
2849+
// But taskr needs to know that it can start watching the files for the task it has to manually restart.
2850+
if (!watchmode) {
2851+
await typesPromise
2852+
}
28432853
}
28442854

28452855
export async function check_error_codes(task, opts) {

0 commit comments

Comments
 (0)