Skip to content

Commit

Permalink
refactor: replace fs-extra with Node.js built-in fs methods (pnpm#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored and github-actions[bot] committed Sep 12, 2024
1 parent d38d20e commit 37ec0cd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 54 deletions.
8 changes: 4 additions & 4 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@types/expand-tilde": "^2.0.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.5",
"@types/node-fetch": "^2.6.11",
"expand-tilde": "^2.0.2",
"fs-extra": "^11.2.0",
"yaml": "^2.3.4",
"zod": "^3.22.4"
},
Expand Down
45 changes: 0 additions & 45 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions src/install-pnpm/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { addPath, exportVariable } from '@actions/core'
import { spawn } from 'child_process'
import { remove, ensureFile, writeFile, readFile } from 'fs-extra'
import { rm, writeFile, readFile, mkdir } from 'fs/promises'
import path from 'path'
import { execPath } from 'process'
import { Inputs } from '../inputs'
Expand All @@ -9,9 +9,11 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest, packageJsonFile, standalone } = inputs

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

// prepare target pnpm
Expand Down

0 comments on commit 37ec0cd

Please sign in to comment.