clear_node_modules 1.2.9 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +13 -3
  2. package/package.json +1 -1
  3. package/src/lib.js +3 -3
package/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # clear_node_modules (English)
1
+ <details open>
2
+ <summary><strong>English</strong></summary>
3
+ <br>
4
+
5
+ # clear_node_modules
2
6
 
3
7
  A command-line tool to delete all `node_modules` directories within a specified path.
4
8
 
@@ -49,9 +53,13 @@ cnm <path> [limit]
49
53
 
50
54
  MIT
51
55
 
52
- ---
56
+ </details>
57
+
58
+ <details>
59
+ <summary><strong>中文 (Chinese)</strong></summary>
60
+ <br>
53
61
 
54
- # clear_node_modules (中文)
62
+ # clear_node_modules
55
63
 
56
64
  一个用于清理指定路径下所有 `node_modules` 目录的命令行工具。
57
65
 
@@ -101,3 +109,5 @@ cnm <path> [limit]
101
109
  ## 许可证
102
110
 
103
111
  MIT
112
+
113
+ </details>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear_node_modules",
3
- "version": "1.2.9",
3
+ "version": "1.3.0",
4
4
  "description": "help you remove all large file of node_modules in dist dir!",
5
5
  "main": "index.js",
6
6
  "directories": {
package/src/lib.js CHANGED
@@ -53,12 +53,12 @@ function wrap(LIMIT_SIZE, NODE_MODULES) {
53
53
  const entries = fs.readdirSync(currentPath);
54
54
  if (entries.length === 0) return;
55
55
 
56
- const dirSize = getDirSize(currentPath);
57
- if (dirSize / 1024 < LIMIT_SIZE) return;
58
-
59
56
  for (const entry of entries) {
60
57
  const subPath = path.join(currentPath, entry);
61
58
  if (entry === NODE_MODULES && fs.statSync(subPath).isDirectory()) {
59
+ const dirSize = getDirSize(subPath);
60
+ if (dirSize / 1024 / 1024 < LIMIT_SIZE) continue;
61
+
62
62
  const spinner = ora(
63
63
  `(${++doneCount}/${totalCount}) Removing ${subPath}`
64
64
  ).start();