Unverified Commit 21f4c9f4 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Development: Move all TypeScript related work in watcher together (#83912)

## What?

Work in progress. Checking if tests fail.

Moving these `.d.ts` file writes and TS checks together so that they can
be moved to not block in a follow-up PR.
parent 4d047b28
......@@ -406,7 +406,7 @@ export default abstract class Server<
protected abstract loadEnvConfig(params: {
dev: boolean
forceReload?: boolean
forceReload: boolean
}): void
// TODO-APP: (wyattjoh): Make protected again. Used for turbopack in route-resolver.ts right now.
......@@ -448,7 +448,7 @@ export default abstract class Server<
this.dir = path.resolve(/* turbopackIgnore: true */ dir)
this.quiet = quiet
this.loadEnvConfig({ dev })
this.loadEnvConfig({ dev, forceReload: false })
// TODO: should conf be normalized to prevent missing
// values from causing issues as this can be user provided
......
......@@ -40,8 +40,7 @@ export {}`
try {
// we expect the types directory to already exist
const envDtsPath = join(distDir, 'types', 'env.d.ts')
// do not await, this is not essential for further process
writeFile(envDtsPath, definitionStr, 'utf-8')
await writeFile(envDtsPath, definitionStr, 'utf-8')
} catch (e) {
console.error('Failed to write env.d.ts:', e)
}
......
......@@ -434,17 +434,20 @@ export default class NextNodeServer extends BaseServer<
protected loadEnvConfig({
dev,
forceReload,
silent,
}: {
dev: boolean
forceReload?: boolean
silent?: boolean
forceReload: boolean
}) {
loadEnvConfig(
this.dir,
dev,
silent ? { info: () => {}, error: () => {} } : Log,
Log,
forceReload,
forceReload
? (envFilePath) => {
Log.info(`Reload env: ${envFilePath}`)
}
: undefined
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment