Skip to content

Commit

Permalink
refactor: replace shelljs usage with fs methods
Browse files Browse the repository at this point in the history
replace `shelljs` methods with native `fs` methods and removed dependency `shelljs`.
  • Loading branch information
Phillip9587 committed Apr 11, 2024
1 parent 6345642 commit 923f2e2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 67 deletions.
9 changes: 4 additions & 5 deletions lib/compiler/assets-manager.ts
@@ -1,8 +1,7 @@
import * as chokidar from 'chokidar';
import { statSync } from 'fs';
import { copyFileSync, mkdirSync, rmSync, statSync } from 'fs';
import { sync } from 'glob';
import { dirname, join, sep } from 'path';
import * as shell from 'shelljs';
import {
ActionOnFile,
Asset,
Expand Down Expand Up @@ -137,11 +136,11 @@ export class AssetsManager {

// Copy to output dir if file is changed or added
if (action === 'change') {
shell.mkdir('-p', dirname(dest));
shell.cp(path, dest);
mkdirSync(dirname(dest), { recursive: true });
copyFileSync(path, dest);
} else if (action === 'unlink') {
// Remove from output dir if file is deleted
shell.rm(dest);
rmSync(dest, { force: true });
}
}
}
90 changes: 30 additions & 60 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -52,7 +52,6 @@
"node-emoji": "1.11.0",
"ora": "5.4.1",
"rimraf": "4.4.1",
"shelljs": "0.8.5",
"source-map-support": "0.5.21",
"tree-kill": "1.2.2",
"tsconfig-paths": "4.2.0",
Expand All @@ -70,7 +69,6 @@
"@types/jest": "29.5.12",
"@types/node": "20.12.7",
"@types/node-emoji": "1.8.2",
"@types/shelljs": "0.8.15",
"@types/webpack-node-externals": "3.0.4",
"@typescript-eslint/eslint-plugin": "7.6.0",
"@typescript-eslint/parser": "7.6.0",
Expand Down

0 comments on commit 923f2e2

Please sign in to comment.