Skip to content

Commit 523e043

Browse files
authored
Merge pull request #2 from renzp94/rspack
chore(utils): 优化fileExists函数
2 parents cce15aa + 82d7131 commit 523e043

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

packages/rzpack-utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rzpack-utils",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "rzpack工具箱",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/rzpack-utils/src/command.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { exec } from 'child_process'
1+
import { exec } from 'node:child_process'
22

33
/**
44
* 执行命令

packages/rzpack-utils/src/file.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import fs from 'fs'
21
import { createHash } from 'node:crypto'
3-
import path from 'path'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
44
import * as esbuild from 'esbuild'
55
import { logError } from './log'
66

@@ -9,7 +9,7 @@ import { logError } from './log'
99
* @param file 文件路径
1010
* @returns Promise<boolean>
1111
*/
12-
export const fileExists = (file: string): boolean => fs.existsSync(file)
12+
export const fileExists = (file?: string): boolean => fs.existsSync(file)
1313
/**
1414
* 加载模块
1515
* @param module 模块

packages/rzpack-utils/src/package.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fs from 'fs'
1+
import fs from 'node:fs'
22
import check from 'check-dependencies'
33
import { fileExists, pathResolve } from './file'
44

0 commit comments

Comments
 (0)