Skip to content

Commit 0f4f572

Browse files
Janpotclaude
andcommitted
Remove fs-extra dependency from bundle-size-checker
Replace fs-extra with native Node.js fs/promises module to eliminate external dependency. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 8f83787 commit 0f4f572

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/bundle-size-checker/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"execa": "^7.2.0",
3636
"fast-glob": "^3.3.2",
3737
"file-loader": "^6.2.0",
38-
"fs-extra": "^11.2.0",
3938
"micromatch": "^4.0.8",
4039
"piscina": "^4.2.1",
4140
"rollup-plugin-visualizer": "^6.0.1",
@@ -47,7 +46,6 @@
4746
},
4847
"devDependencies": {
4948
"@types/env-ci": "^3.1.4",
50-
"@types/fs-extra": "^11.0.4",
5149
"@types/micromatch": "^4.0.9",
5250
"@types/webpack": "^5.28.5",
5351
"@types/webpack-bundle-analyzer": "^4.7.0",

packages/bundle-size-checker/src/cli.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import path from 'path';
44
import os from 'os';
5-
import fse from 'fs-extra';
5+
import fs from 'fs/promises';
66
import yargs from 'yargs';
77
import Piscina from 'piscina';
88
import micromatch from 'micromatch';
@@ -31,7 +31,8 @@ async function getWebpackSizes(args, config) {
3131
});
3232
// Clean and recreate the build directory
3333
const buildDir = path.join(rootDir, 'build');
34-
await fse.emptyDir(buildDir);
34+
await fs.rm(buildDir, { recursive: true, force: true });
35+
await fs.mkdir(buildDir, { recursive: true });
3536

3637
if (
3738
!config ||
@@ -89,8 +90,8 @@ async function run(argv) {
8990
const bundleSizes = Object.fromEntries(webpackSizes.sort((a, b) => a[0].localeCompare(b[0])));
9091

9192
// Ensure output directory exists
92-
await fse.mkdirp(path.dirname(snapshotDestPath));
93-
await fse.writeJSON(snapshotDestPath, bundleSizes, { spaces: 2 });
93+
await fs.mkdir(path.dirname(snapshotDestPath), { recursive: true });
94+
await fs.writeFile(snapshotDestPath, JSON.stringify(bundleSizes, null, 2));
9495

9596
// eslint-disable-next-line no-console
9697
console.log(`Bundle size snapshot written to ${snapshotDestPath}`);

0 commit comments

Comments
 (0)