Skip to content

Commit ce859e3

Browse files
authored
refactor: replace fs-extra with Node.js built-in fs methods (#120)
1 parent 2ab6dce commit ce859e3

File tree

4 files changed

+9
-54
lines changed

4 files changed

+9
-54
lines changed

dist/index.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
"dependencies": {
1010
"@actions/core": "^1.10.1",
1111
"@types/expand-tilde": "^2.0.2",
12-
"@types/fs-extra": "^11.0.4",
1312
"@types/node": "^20.11.5",
1413
"@types/node-fetch": "^2.6.11",
1514
"expand-tilde": "^2.0.2",
16-
"fs-extra": "^11.2.0",
1715
"yaml": "^2.3.4",
1816
"zod": "^3.22.4"
1917
},

pnpm-lock.yaml

-45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/install-pnpm/run.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { addPath, exportVariable } from '@actions/core'
22
import { spawn } from 'child_process'
3-
import { remove, ensureFile, writeFile, readFile } from 'fs-extra'
3+
import { rm, writeFile, readFile, mkdir } from 'fs/promises'
44
import path from 'path'
55
import { execPath } from 'process'
66
import { Inputs } from '../inputs'
@@ -9,9 +9,11 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
99
const { version, dest, packageJsonFile, standalone } = inputs
1010

1111
// prepare self install
12-
await remove(dest)
12+
await rm(dest, { recursive: true, force: true })
13+
// create dest directory after removal
14+
await mkdir(dest, { recursive: true })
1315
const pkgJson = path.join(dest, 'package.json')
14-
await ensureFile(pkgJson)
16+
// we have ensured the dest directory exists, we can write the file directly
1517
await writeFile(pkgJson, JSON.stringify({ private: true }))
1618

1719
// prepare target pnpm

0 commit comments

Comments
 (0)