提交 ebfc9a64 编写于 作者: fxy060608's avatar fxy060608

chore: Drop support for Node.js < 14.18.0 (#3876)

上级 f8d5f256
......@@ -8,6 +8,9 @@
"dist",
"lib"
],
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
......
import { resolve } from 'path'
import { emptyDirSync, lstatSync, readdirSync, unlinkSync } from 'fs-extra'
import { rmdirSync } from 'fs'
import fs from 'fs'
import path from 'path'
export function emptyDir(dir: string, skip: string[] = []) {
for (const file of readdirSync(dir)) {
for (const file of fs.readdirSync(dir)) {
if (skip.includes(file)) {
continue
}
const abs = resolve(dir, file)
// baseline is Node 12 so can't use rmSync :(
if (lstatSync(abs).isDirectory()) {
emptyDirSync(abs)
rmdirSync(abs)
} else {
unlinkSync(abs)
}
// node >= 14.14.0
fs.rmSync(path.resolve(dir, file), { recursive: true, force: true })
}
}
......@@ -12,6 +12,9 @@
"dist",
"lib"
],
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册