@iyowei/sweep-node-modules-cli 0.1.1 → 0.1.2

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 iYoWei
3
+ Copyright (c) 2026 iTonyYo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
- # sweep-node-modules
1
+ # sweep-node-modules-cli
2
2
 
3
3
  [![CI](https://github.com/iyowei/sweep-node-modules/actions/workflows/ci.yml/badge.svg)](https://github.com/iyowei/sweep-node-modules/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@iyowei/sweep-node-modules-cli)](https://www.npmjs.com/package/@iyowei/sweep-node-modules-cli)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@iyowei/sweep-node-modules-cli)](https://www.npmjs.com/package/@iyowei/sweep-node-modules-cli)
6
+ ![node](https://img.shields.io/node/v/@iyowei/sweep-node-modules-cli)
7
+ ![bun](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fiyowei%2Fsweep-node-modules%2Fmain%2Fpackage.json&query=%24.packageManager&label=bun)
4
8
 
5
9
  **English** | [中文](README.zh-CN.md)
6
10
 
@@ -55,10 +59,10 @@ bun install -g @iyowei/sweep-node-modules-cli
55
59
  # clone, then cd into the repo root (adjust the path to your clone location)
56
60
  cd "<your clone>/sweep-node-modules"
57
61
 
58
- chmod +x packages/cli/bin/sweep-nm
62
+ chmod +x packages/sweep-node-modules-cli/bin/sweep-nm
59
63
 
60
64
  # symlink it into ~/.local/bin (usually already on PATH); the launcher picks the runtime
61
- ln -sf "$PWD/packages/cli/bin/sweep-nm" ~/.local/packages/cli/bin/sweep-nm
65
+ ln -sf "$PWD/packages/sweep-node-modules-cli/bin/sweep-nm" ~/.local/bin/sweep-nm
62
66
  ```
63
67
 
64
68
  **Windows** (PowerShell):
@@ -66,7 +70,7 @@ ln -sf "$PWD/packages/cli/bin/sweep-nm" ~/.local/packages/cli/bin/sweep-nm
66
70
  ```powershell
67
71
  # add the repo's bin directory to your user PATH; one-time, effective after reopening the terminal
68
72
  # adjust the path to your actual clone location (the launcher locates src relative to itself, so the script cannot be copied out on its own)
69
- $bin = "$env:USERPROFILE\tools\sweep-node-modules\packages\cli\bin"
73
+ $bin = "$env:USERPROFILE\tools\sweep-node-modules\packages\sweep-node-modules-cli\bin"
70
74
  [Environment]::SetEnvironmentVariable(
71
75
  'Path',
72
76
  [Environment]::GetEnvironmentVariable('Path', 'User') + ";$bin",
@@ -77,9 +81,9 @@ $bin = "$env:USERPROFILE\tools\sweep-node-modules\packages\cli\bin"
77
81
  > Or skip the command line: add the `bin` directory to your user `Path` under System Properties → Environment Variables.
78
82
 
79
83
  - **Requires**: bun or node, either works (the launcher is a shell / cmd script run by the OS; it does not depend on node)
80
- - The most direct entry point; afterwards just run `sweep-nm` (on Windows via `packages\cli\bin\sweep-nm.cmd`)
84
+ - The most direct entry point; afterwards just run `sweep-nm` (on Windows via `packages\sweep-node-modules-cli\bin\sweep-nm.cmd`)
81
85
 
82
- > The tool also ships an API package, `@iyowei/sweep-node-modules`, for use in your own programs or scripts (usage is documented in that package).
86
+ > The tool also ships an API package, [`@iyowei/sweep-node-modules`](https://www.npmjs.com/package/@iyowei/sweep-node-modules), for use in your own programs or scripts (usage is documented in that package).
83
87
 
84
88
  ## Usage
85
89
 
package/README.zh-CN.md CHANGED
@@ -1,6 +1,10 @@
1
- # sweep-node-modules
1
+ # sweep-node-modules-cli
2
2
 
3
3
  [![CI](https://github.com/iyowei/sweep-node-modules/actions/workflows/ci.yml/badge.svg)](https://github.com/iyowei/sweep-node-modules/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@iyowei/sweep-node-modules-cli)](https://www.npmjs.com/package/@iyowei/sweep-node-modules-cli)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@iyowei/sweep-node-modules-cli)](https://www.npmjs.com/package/@iyowei/sweep-node-modules-cli)
6
+ ![node](https://img.shields.io/node/v/@iyowei/sweep-node-modules-cli)
7
+ ![bun](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fiyowei%2Fsweep-node-modules%2Fmain%2Fpackage.json&query=%24.packageManager&label=bun)
4
8
 
5
9
  [English](README.md) | **中文**
6
10
 
@@ -55,10 +59,10 @@ bun install -g @iyowei/sweep-node-modules-cli
55
59
  # 克隆后进入仓库根 (路径按你的实际位置调整)
56
60
  cd "<克隆位置>/sweep-node-modules"
57
61
 
58
- chmod +x packages/cli/bin/sweep-nm
62
+ chmod +x packages/sweep-node-modules-cli/bin/sweep-nm
59
63
 
60
64
  # 软链进 ~/.local/bin (通常已在 PATH 中), 启动器会挑选运行时
61
- ln -sf "$PWD/packages/cli/bin/sweep-nm" ~/.local/packages/cli/bin/sweep-nm
65
+ ln -sf "$PWD/packages/sweep-node-modules-cli/bin/sweep-nm" ~/.local/bin/sweep-nm
62
66
  ```
63
67
 
64
68
  **Windows** (PowerShell):
@@ -66,7 +70,7 @@ ln -sf "$PWD/packages/cli/bin/sweep-nm" ~/.local/packages/cli/bin/sweep-nm
66
70
  ```powershell
67
71
  # 把仓库的 bin 目录加入用户 PATH, 只需一次, 重开终端后生效
68
72
  # 路径按你的实际克隆位置调整 (启动器靠自身位置定位 src, 故不能把脚本单独复制走)
69
- $bin = "$env:USERPROFILE\tools\sweep-node-modules\packages\cli\bin"
73
+ $bin = "$env:USERPROFILE\tools\sweep-node-modules\packages\sweep-node-modules-cli\bin"
70
74
  [Environment]::SetEnvironmentVariable(
71
75
  'Path',
72
76
  [Environment]::GetEnvironmentVariable('Path', 'User') + ";$bin",
@@ -77,9 +81,9 @@ $bin = "$env:USERPROFILE\tools\sweep-node-modules\packages\cli\bin"
77
81
  > 也可以不经命令行: 在「系统属性 → 环境变量」里把该 `bin` 目录加到用户变量 `Path` 中。
78
82
 
79
83
  - **需要**: bun 或 node 任一 (启动器是 shell / cmd 脚本, 由系统执行, 不依赖 node)
80
- - 特点: 入口最直接; 之后直接敲 `sweep-nm` (Windows 经 `packages\cli\bin\sweep-nm.cmd`)
84
+ - 特点: 入口最直接; 之后直接敲 `sweep-nm` (Windows 经 `packages\sweep-node-modules-cli\bin\sweep-nm.cmd`)
81
85
 
82
- > 本工具同时提供可编程 API 包 `@iyowei/sweep-node-modules`, 供在程序或脚本中调用 (用法见该包文档)。
86
+ > 本工具同时提供可编程 API 包 [`@iyowei/sweep-node-modules`](https://www.npmjs.com/package/@iyowei/sweep-node-modules), 供在程序或脚本中调用 (用法见该包文档)。
83
87
 
84
88
  ## 使用
85
89
 
package/dist/cli.js CHANGED
@@ -3,10 +3,10 @@ import { lstat as lstat3, mkdir, realpath as realpath3 } from "node:fs/promises"
3
3
  import { homedir as homedir5 } from "node:os";
4
4
  import { basename, dirname } from "node:path";
5
5
 
6
- // ../api/src/classify.ts
6
+ // ../sweep-node-modules/src/classify.ts
7
7
  import { homedir as homedir3 } from "node:os";
8
8
 
9
- // ../api/src/config.ts
9
+ // ../sweep-node-modules/src/config.ts
10
10
  import { readFile } from "node:fs/promises";
11
11
  import { homedir } from "node:os";
12
12
  import { posix, win32 } from "node:path";
@@ -130,7 +130,7 @@ function mergeNames(configNames, cliNames) {
130
130
  return [...new Set([...configNames, ...cliNames])].filter((name) => name !== "node_modules" && name !== ".git");
131
131
  }
132
132
 
133
- // ../api/src/guard.ts
133
+ // ../sweep-node-modules/src/guard.ts
134
134
  import { lstat, realpath, stat } from "node:fs/promises";
135
135
  import { homedir as homedir2 } from "node:os";
136
136
  import { posix as posix2, win32 as win322 } from "node:path";
@@ -319,7 +319,7 @@ async function findCrossDeviceTargets(targets, options) {
319
319
  return found;
320
320
  }
321
321
 
322
- // ../api/src/classify.ts
322
+ // ../sweep-node-modules/src/classify.ts
323
323
  var fold2 = (text, style) => style.caseInsensitive ? text.toLowerCase() : text;
324
324
  var INSTALL_TREE_SEGMENTS = new Set([...DEFAULT_EXCLUDE, "extensions", "_npx"].map((name) => name.toLowerCase()));
325
325
  function classifyTarget(target, options = {}) {
@@ -351,7 +351,7 @@ function classifyTarget(target, options = {}) {
351
351
  }
352
352
  return { kind: "project" };
353
353
  }
354
- // ../api/src/delete.ts
354
+ // ../sweep-node-modules/src/delete.ts
355
355
  import { lstat as lstat2, rm } from "node:fs/promises";
356
356
  import { isAbsolute, join, relative, sep } from "node:path";
357
357
  var ERROR_HINTS = {
@@ -493,7 +493,7 @@ async function removeTargets(targets, options) {
493
493
  }
494
494
  return result;
495
495
  }
496
- // ../api/src/runtime.ts
496
+ // ../sweep-node-modules/src/runtime.ts
497
497
  import { readFile as readFile2, writeFile } from "node:fs/promises";
498
498
  var isBun = typeof Bun !== "undefined";
499
499
  var versions = process.versions;
@@ -506,7 +506,7 @@ async function writeTextFile(path, text) {
506
506
  }
507
507
  await writeFile(path, text, "utf8");
508
508
  }
509
- // ../api/src/scan-parallel.ts
509
+ // ../sweep-node-modules/src/scan-parallel.ts
510
510
  import { readdir, realpath as realpath2, stat as stat2 } from "node:fs/promises";
511
511
  import { join as join2 } from "node:path";
512
512
  var NODE_MODULES = "node_modules";
@@ -676,7 +676,7 @@ function createParallelScanner() {
676
676
  }
677
677
  };
678
678
  }
679
- // ../api/src/size-du.ts
679
+ // ../sweep-node-modules/src/size-du.ts
680
680
  import { spawn } from "node:child_process";
681
681
  import { accessSync, constants } from "node:fs";
682
682
  var DU_PROBES = ["/usr/bin/du", "/bin/du"];
@@ -870,7 +870,7 @@ function createDuSizer(bin = findDu()) {
870
870
  };
871
871
  }
872
872
 
873
- // ../api/src/size-js.ts
873
+ // ../sweep-node-modules/src/size-js.ts
874
874
  import { readdir as readdir2, stat as stat3 } from "node:fs/promises";
875
875
  import { join as join3 } from "node:path";
876
876
  function describeFailure(code) {
@@ -943,11 +943,11 @@ function createJsSizer() {
943
943
  };
944
944
  }
945
945
 
946
- // ../api/src/size.ts
946
+ // ../sweep-node-modules/src/size.ts
947
947
  function createSizer() {
948
948
  return findDu() !== null ? createDuSizer() : createJsSizer();
949
949
  }
950
- // ../api/src/skip.ts
950
+ // ../sweep-node-modules/src/skip.ts
951
951
  var SUSPECT_HINT = "已跳过 (加 --force 一并清理)";
952
952
  var CROSS_DEVICE_NOTES = {
953
953
  "on-path": "跨设备: 根与目标之间有挂载点",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "commit": "2b0f7012154196efa2e5be20be89cc9484dbc374",
3
+ "commit": "0df47482641c2ac1838b93dd4b3fe0ae3b468176",
4
4
  "dirty": false,
5
- "cliSha256": "29d6844dca8fe28b8105b9704473ac1602ec7d081e8b813cd23db6ec1b80d61a",
6
- "builtAt": "2026-09-29T05:40:51.133Z"
5
+ "cliSha256": "d77fbedaffabda1b10f8a901a4aa43842dc1039fee5b419da5e85a29a5b19416",
6
+ "builtAt": "2026-09-29T09:02:15.995Z"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyowei/sweep-node-modules-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CLI to find and delete node_modules across projects: scan multiple workspace roots (monorepo friendly), bulk-remove them to free up disk space, preview first and delete after confirmation. 工作区级 node_modules 批量清理工具。",
5
5
  "keywords": [
6
6
  "cli",
@@ -31,7 +31,7 @@
31
31
  "bun",
32
32
  "node"
33
33
  ],
34
- "author": "iYoWei",
34
+ "author": "iTonyYo (https://github.com/iTonyYo)",
35
35
  "license": "MIT",
36
36
  "repository": {
37
37
  "type": "git",