Skip to content

Commit 5708bd7

Browse files
committed
Use configured TypeScript version for packed consumer checks
1 parent 06d774a commit 5708bd7

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

‎scripts/test-packed-types.js‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { promisify } from 'node:util'
66

77
const execFileAsync = promisify(execFile)
88
const projectPath = path.resolve(import.meta.dirname, '..')
9-
const { dependencies } = JSON.parse(await readFile(path.join(projectPath, 'package.json'), 'utf8'))
9+
const { dependencies, devDependencies } = JSON.parse(await readFile(path.join(projectPath, 'package.json'), 'utf8'))
1010
const temporaryPath = await mkdtemp(path.join(tmpdir(), 'domstack-packed-types-'))
1111
const consumerPath = path.join(temporaryPath, 'consumer')
1212

@@ -34,9 +34,7 @@ try {
3434
'@domstack/static': `file:${tarballPath}`,
3535
'@types/node': '^26.0.1',
3636
pino: dependencies.pino,
37-
'typescript-5': 'npm:typescript@~5.9.0',
38-
'typescript-6': 'npm:typescript@~6.0.0',
39-
'typescript-7': 'npm:typescript@~7.0.0',
37+
typescript: devDependencies.typescript,
4038
},
4139
}, null, 2)}\n`),
4240
writeFile(path.join(consumerPath, 'index.ts'), `import { DomStack, PageData } from '@domstack/static'
@@ -113,15 +111,13 @@ void ({} as Results)
113111
consumerPath
114112
)
115113
}
116-
for (const version of ['typescript-5', 'typescript-6', 'typescript-7']) {
117-
for (const config of ['tsconfig.json', 'tsconfig-types.json']) {
118-
console.log(`Checking ${version}, @types/node ${nodeVersion}, ${config}`)
119-
await run(
120-
process.execPath,
121-
[path.join(consumerPath, 'node_modules', version, 'bin', 'tsc'), '--project', config],
122-
consumerPath
123-
)
124-
}
114+
for (const config of ['tsconfig.json', 'tsconfig-types.json']) {
115+
console.log(`Checking TypeScript ${devDependencies.typescript}, @types/node ${nodeVersion}, ${config}`)
116+
await run(
117+
process.execPath,
118+
[path.join(consumerPath, 'node_modules', 'typescript', 'bin', 'tsc'), '--project', config],
119+
consumerPath
120+
)
125121
}
126122
}
127123
} finally {

0 commit comments

Comments
 (0)