From 5b4f44f6930215e35cc5d4a8eb210c91b449d4cc Mon Sep 17 00:00:00 2001 From: Ivan Tanev Date: Sun, 13 Oct 2024 00:41:13 +0300 Subject: [PATCH] Replace fs-extra with node:fs/promises --- .changeset/thick-panthers-smile.md | 5 +++++ package.json | 1 + packages/cli/package.json | 1 - packages/cli/src/utils.ts | 5 +++-- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/thick-panthers-smile.md diff --git a/.changeset/thick-panthers-smile.md b/.changeset/thick-panthers-smile.md new file mode 100644 index 0000000..3674154 --- /dev/null +++ b/.changeset/thick-panthers-smile.md @@ -0,0 +1,5 @@ +--- +"@manypkg/cli": minor +--- + +Replace fs-extra with native node:fs/promises diff --git a/package.json b/package.json index fb50a79..4e9fbd4 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "prettier-plugin-packagejson": "^2.3.0", "typescript": "^5.3.2" }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", "engines": { "node": ">=14.18.0" }, diff --git a/packages/cli/package.json b/packages/cli/package.json index adf5796..762ef9a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -17,7 +17,6 @@ "chalk": "^2.4.2", "detect-indent": "^6.0.0", "find-up": "^4.1.0", - "fs-extra": "^8.1.0", "normalize-path": "^3.0.0", "p-limit": "^2.2.1", "package-json": "^8.1.0", diff --git a/packages/cli/src/utils.ts b/packages/cli/src/utils.ts index 23f26bd..6a52c39 100644 --- a/packages/cli/src/utils.ts +++ b/packages/cli/src/utils.ts @@ -1,4 +1,4 @@ -import * as fs from "fs-extra"; +import fs from "node:fs/promises"; import { Package, Tool } from "@manypkg/get-packages"; import path from "path"; import spawn from "spawndamnit"; @@ -10,7 +10,8 @@ export async function writePackage(pkg: Package) { return fs.writeFile( path.join(pkg.dir, "package.json"), JSON.stringify(pkg.packageJson, null, indent) + - (pkgRaw.endsWith("\n") ? "\n" : "") + (pkgRaw.endsWith("\n") ? "\n" : ""), + "utf-8" ); }