updaded typescript to 7 and fixed few bugs
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
Replaces tsc6 script which is called by next.js to run tsc 7,
|
||||
which is a native executable written in go and works faster.
|
||||
The problem is typescript 7 is supported with nextjs,
|
||||
but is not supported by eslint which we use for static code analysis.
|
||||
This script solves the problem.
|
||||
*/
|
||||
|
||||
import { createRequire } from 'node:module'
|
||||
import { writeFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
const tsc6 = path.join(
|
||||
path.dirname(require.resolve('typescript/package.json')),
|
||||
'bin',
|
||||
'tsc6'
|
||||
)
|
||||
const nativeTsc = path.join(
|
||||
path.dirname(require.resolve('@typescript/native/package.json')),
|
||||
'lib',
|
||||
'tsc.js'
|
||||
)
|
||||
const specifier = path
|
||||
.relative(path.dirname(tsc6), nativeTsc)
|
||||
.split(path.sep)
|
||||
.join('/')
|
||||
|
||||
writeFileSync(tsc6, `#!/usr/bin/env node\nimport('${specifier}')\n`)
|
||||
|
||||
console.log(`patched ${tsc6} -> ${nativeTsc}`)
|
||||
Reference in New Issue
Block a user