tldraw/scripts/typecheck.ts
Steve Ruiz a3c39cde4b
replace console.log with nicelog (#1496)
This PR replaces our `console.log` with `nicelog` so that I can more
easily grep for errant console.logs.

### Change Type

- [x] `internal` — Any other changes that don't affect the published
package (will not publish a new version)
2023-06-01 18:01:49 +00:00

27 lines
972 B
TypeScript

import { execFileSync } from 'child_process'
import path, { join } from 'path'
import { REPO_ROOT, readJsonIfExists } from './lib/file'
import { nicelog } from './lib/nicelog'
import { getAllWorkspacePackages } from './lib/workspace'
async function main() {
const allWorkspaces = await getAllWorkspacePackages()
const tsconfigFiles = []
for (const workspace of allWorkspaces) {
const tsconfigFile = path.join(workspace.path, 'tsconfig.json')
const tsconfigExists = await readJsonIfExists(tsconfigFile)
if (tsconfigExists) tsconfigFiles.push(tsconfigFile)
}
nicelog('Typechecking files:', tsconfigFiles)
const args = ['--build']
if (process.argv.includes('--force')) args.push('--force')
if (process.argv.includes('--watch')) args.push('--watch')
if (process.argv.includes('--preserveWatchOutput')) args.push('--preserveWatchOutput')
execFileSync(join(REPO_ROOT, 'node_modules/.bin/tsc'), [...args, ...tsconfigFiles], {
stdio: 'inherit',
})
}
main()