File tree Expand file tree Collapse file tree 3 files changed +18
-19
lines changed
Expand file tree Collapse file tree 3 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -87,19 +87,13 @@ export default async function () {
8787 } ;
8888 } ) ,
8989 // Node commands.
90- ...Object . keys ( packageJSON . bin ) . map ( ( name ) => {
90+ ...Object . entries ( packageJSON . bin ) . map ( ( [ name , file ] ) => {
9191 return {
9292 input : `src/${ name } /index.ts` ,
9393 output : [
9494 {
9595 banner : bannerCommand ,
96- file : `bin/${ name } .cjs` ,
97- format : "cjs" ,
98- sourcemap : true ,
99- } ,
100- {
101- banner : bannerCommand ,
102- file : `bin/${ name } .mjs` ,
96+ file,
10397 format : "esm" ,
10498 sourcemap : true ,
10599 } ,
Original file line number Diff line number Diff line change 1- import { DirResult , dirSync , setGracefulCleanup } from "tmp" ;
2- import { resolve as resolvePath } from "path" ;
3- import { findUp } from "find-up" ;
1+ import { resolve as resolvePath } from "node:path" ;
42import {
5- Stats ,
6- copy ,
73 copyFile ,
84 lstat ,
95 mkdir ,
10- mkdirp ,
116 readFile ,
127 readdir ,
138 writeFile ,
149 unlink ,
15- } from "fs-extra" ;
10+ } from "node:fs/promises" ;
11+ import { Stats } from "node:fs" ;
12+
13+ import { DirResult , dirSync , setGracefulCleanup } from "tmp" ;
14+ import { findUp } from "find-up" ;
15+ import fsExtra from "fs-extra" ;
1616
1717import {
1818 ProjectState ,
@@ -23,6 +23,10 @@ import {
2323 logInfo ,
2424} from "./util" ;
2525
26+ // This is needed because the ESM export fs-extra/esm has no types and the typed
27+ // fs-extra export is CJS.
28+ const { copy, mkdirp } = fsExtra ;
29+
2630// Remove all temporary files on process exit.
2731setGracefulCleanup ( ) ;
2832
@@ -431,7 +435,7 @@ export async function test({
431435 ...( await Promise . all (
432436 ( await readdir ( data . tmpLogsResolve ( ) ) ) . map (
433437 ( filename ) : Promise < string > =>
434- readFile ( data . tmpLogsResolve ( filename ) , "UTF -8" ) ,
438+ readFile ( data . tmpLogsResolve ( filename ) , "utf -8" ) ,
435439 ) ,
436440 ) ) ,
437441 "" ,
Original file line number Diff line number Diff line change 1- import { execSync , spawn } from "child_process" ;
2- import { basename , join } from "path" ;
3- import { createWriteStream , readFile , rename } from "fs-extra" ;
1+ import { execSync , spawn } from "node:child_process" ;
2+ import { basename , join } from "node:path" ;
3+ import { readFile , rename } from "node:fs/promises" ;
4+ import { createWriteStream } from "node:fs" ;
45
56export class ProjectState {
67 /**
You can’t perform that action at this time.
0 commit comments