Skip to content

Commit c11ff2b

Browse files
authored
Scripts: migrate unpack-next to TypeScript (#77538)
## Convert unpack-next.cjs to TypeScript ### What? Converted `scripts/unpack-next.cjs` to TypeScript, renaming it to `scripts/unpack-next.ts` and updating the imports and type definitions. ### Why? This change continues the ongoing TypeScript migration efforts in the codebase, providing better type safety and developer experience. ### How? - Renamed file from `.cjs` to `.ts` - Converted CommonJS `require()` statements to ES module `import` statements - Added type annotation for the `path` parameter in the `realPathIfAny` function Fixes #
1 parent 570266a commit c11ff2b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/unpack-next.cjs scripts/unpack-next.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// This script must be run with tsx
22

3-
const { NEXT_DIR, exec } = require('./pack-util')
4-
const fs = require('fs')
5-
const path = require('path')
3+
import { NEXT_DIR, exec } from './pack-util'
4+
import fs from 'fs'
5+
import path from 'path'
66

77
const TARBALLS = `${NEXT_DIR}/tarballs`
88

99
const PROJECT_DIR = path.resolve(process.argv[2])
1010

11-
function realPathIfAny(path) {
11+
function realPathIfAny(path: fs.PathLike) {
1212
try {
1313
return fs.realpathSync(path)
1414
} catch {

0 commit comments

Comments
 (0)