Skip to content

Commit

Permalink
Deps: Remove fs-extra dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Dec 29, 2022
1 parent 1f1db53 commit 92ca253
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 67 deletions.
8 changes: 3 additions & 5 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,8 @@ const {argv} = yargs
// Catalog globals etc
require('./init/index.js');

// Import dependencies required for serialize.
// `fs-extra` must be imported after cataloging globals as `fs-extra` uses `graceful-fs` internally,
// which monkey-patches `fs` module. Need to catalog globals before `graceful-fs`'s patches are applied.
const {writeFile, mkdirs} = require('fs-extra'),
// Import dependencies required for serialize
const {writeFile, mkdir} = require('fs/promises'),
{serializeEntries} = require('./serialize/index.js'),
{DEFAULT_OUTPUT_FILENAME} = require('./shared/constants.js');

Expand Down Expand Up @@ -268,7 +266,7 @@ register({
// Output files
for (const {filename, content} of files) {
const path = pathJoin(outPath, filename);
await mkdirs(dirname(path));
await mkdir(dirname(path), {recursive: true});
await writeFile(path, content);
}
})();
63 changes: 4 additions & 59 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"convert-source-map": "^2.0.0",
"find-cache-dir": "^3.3.2",
"find-up": "^5.0.0",
"fs-extra": "^11.1.0",
"is-it-type": "^5.1.2",
"lodash": "^4.17.21",
"native-type-of": "^1.1.0",
Expand Down
4 changes: 2 additions & 2 deletions test/support/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Modules
const {join: pathJoin, dirname} = require('path'),
{writeFileSync, mkdirsSync, rmSync} = require('fs-extra'),
{writeFileSync, mkdirSync, rmSync} = require('fs'),
{spawn} = require('child_process'),
{isString} = require('is-it-type');

Expand Down Expand Up @@ -48,7 +48,7 @@ function createFixtures(files) {
for (const filename of Object.keys(files)) {
const path = pathJoin(fixturePath, filename);

mkdirsSync(dirname(path));
mkdirSync(dirname(path), {recursive: true});
writeFileSync(path, files[filename]);

paths.push(path);
Expand Down

0 comments on commit 92ca253

Please sign in to comment.