Skip to content

Commit 450fa76

Browse files
committed
Removed fs-extra dependency
1 parent e9c36b6 commit 450fa76

File tree

5 files changed

+11
-20
lines changed

5 files changed

+11
-20
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"@changesets/changelog-github": "^0.4.2",
1111
"@changesets/cli": "^2.20.0",
1212
"@changesets/write": "^0.1.6",
13-
"@types/fs-extra": "^8.0.0",
1413
"@types/jest": "^29.5.1",
1514
"@types/node": "^22.15.17",
1615
"@types/semver": "^7.5.0",
@@ -45,7 +44,6 @@
4544
"@octokit/core": "^5.2.1",
4645
"@octokit/plugin-throttling": "^8.0.0",
4746
"@types/mdast": "^3.0.0",
48-
"fs-extra": "^8.1.0",
4947
"mdast-util-to-string": "^1.0.6",
5048
"remark-parse": "^7.0.1",
5149
"remark-stringify": "^7.0.3",

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as core from "@actions/core";
2-
import fs from "fs-extra";
2+
import fs from "node:fs";
33
import { Git } from "./git";
44
import { setupOctokit } from "./octokit";
55
import readChangesetState from "./readChangesetState";
@@ -30,7 +30,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
3030
}
3131
const git = new Git({
3232
octokit: commitMode === "github-api" ? octokit : undefined,
33-
cwd
33+
cwd,
3434
});
3535

3636
let setupGitUser = core.getBooleanInput("setupGitUser");
@@ -41,7 +41,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
4141
}
4242

4343
core.info("setting GitHub credentials");
44-
await fs.writeFile(
44+
fs.writeFileSync(
4545
`${process.env.HOME}/.netrc`,
4646
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
4747
);
@@ -73,7 +73,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
7373
let userNpmrcPath = `${process.env.HOME}/.npmrc`;
7474
if (fs.existsSync(userNpmrcPath)) {
7575
core.info("Found existing user .npmrc file");
76-
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
76+
const userNpmrcContent = fs.readFileSync(userNpmrcPath, "utf8");
7777
const authLine = userNpmrcContent.split("\n").find((line) => {
7878
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
7979
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);

src/run.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Changeset } from "@changesets/types";
22
import writeChangeset from "@changesets/write";
33
import fixturez from "fixturez";
4-
import fs from "fs-extra";
5-
import path from "path";
4+
import fs from "node:fs";
5+
import path from "node:path";
66
import { Git } from "./git";
77
import { setupOctokit } from "./octokit";
88
import { runVersion } from "./run";
@@ -36,7 +36,7 @@ let mockedGithubMethods = {
3636
let f = fixturez(__dirname);
3737

3838
const linkNodeModules = async (cwd: string) => {
39-
await fs.symlink(
39+
fs.symlinkSync(
4040
path.join(__dirname, "..", "node_modules"),
4141
path.join(cwd, "node_modules")
4242
);

src/run.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { exec, getExecOutput } from "@actions/exec";
33
import * as github from "@actions/github";
44
import { PreState } from "@changesets/types";
55
import { Package, getPackages } from "@manypkg/get-packages";
6-
import fs from "fs-extra";
7-
import path from "path";
6+
import fs from "node:fs";
7+
import path from "node:path";
88
import resolveFrom from "resolve-from";
99
import * as semver from "semver";
1010
import { Git } from "./git";
@@ -30,7 +30,7 @@ const createRelease = async (
3030
) => {
3131
let changelog;
3232
try {
33-
changelog = await fs.readFile(path.join(pkg.dir, "CHANGELOG.md"), "utf8");
33+
changelog = fs.readFileSync(path.join(pkg.dir, "CHANGELOG.md"), "utf8");
3434
} catch (err) {
3535
if (isErrorWithCode(err, "ENOENT")) {
3636
// if we can't find a changelog, the user has probably disabled changelogs
@@ -294,7 +294,7 @@ export async function runVersion({
294294
let changedPackages = await getChangedPackages(cwd, versionsByDirectory);
295295
let changedPackagesInfoPromises = Promise.all(
296296
changedPackages.map(async (pkg) => {
297-
let changelogContents = await fs.readFile(
297+
let changelogContents = fs.readFileSync(
298298
path.join(pkg.dir, "CHANGELOG.md"),
299299
"utf8"
300300
);

yarn.lock

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,13 +1685,6 @@
16851685
dependencies:
16861686
"@babel/types" "^7.3.0"
16871687

1688-
"@types/fs-extra@^8.0.0":
1689-
version "8.1.2"
1690-
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.2.tgz#7125cc2e4bdd9bd2fc83005ffdb1d0ba00cca61f"
1691-
integrity sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==
1692-
dependencies:
1693-
"@types/node" "*"
1694-
16951688
"@types/graceful-fs@^4.1.3":
16961689
version "4.1.6"
16971690
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae"

0 commit comments

Comments
 (0)