Unverified Commit c11ff2b8 authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

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 #
parent 570266a4
// This script must be run with tsx // This script must be run with tsx
const { NEXT_DIR, exec } = require('./pack-util') import { NEXT_DIR, exec } from './pack-util'
const fs = require('fs') import fs from 'fs'
const path = require('path') import path from 'path'
const TARBALLS = `${NEXT_DIR}/tarballs` const TARBALLS = `${NEXT_DIR}/tarballs`
const PROJECT_DIR = path.resolve(process.argv[2]) const PROJECT_DIR = path.resolve(process.argv[2])
function realPathIfAny(path) { function realPathIfAny(path: fs.PathLike) {
try { try {
return fs.realpathSync(path) return fs.realpathSync(path)
} catch { } catch {
......
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