@pnpm/bins.remover 1000.0.15

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 ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
4
+ Copyright (c) 2016-2026 Zoltan Kochan and other contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @pnpm/remove-bins
2
+
3
+ > Remove bins from ./bin
4
+
5
+ ## Install
6
+
7
+ ```
8
+ pnpm install @pnpm/remove-bins
9
+ ```
10
+
11
+ ## API
12
+
13
+ ### `removeBin(...args)`
14
+
15
+ ### `removeBinsOfDependency(...args)`
16
+
17
+ ## License
18
+
19
+ MIT
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { removeBin, removeBinsOfDependency } from './removeBins.js';
2
+ export { removeBin, removeBinsOfDependency, };
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { removeBin, removeBinsOfDependency } from './removeBins.js';
2
+ export { removeBin, removeBinsOfDependency, };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ import type { DependencyManifest } from '@pnpm/types';
2
+ export declare const removeBin: (cmd: string) => Promise<void>;
3
+ export declare function removeBinsOfDependency(dependencyDir: string, opts: {
4
+ dryRun?: boolean;
5
+ binsDir: string;
6
+ }): Promise<DependencyManifest | undefined>;
@@ -0,0 +1,33 @@
1
+ import path from 'node:path';
2
+ import { getBinsFromPackageManifest } from '@pnpm/bins.resolver';
3
+ import { removalLogger, } from '@pnpm/core-loggers';
4
+ import { safeReadPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
5
+ import { rimraf } from '@zkochan/rimraf';
6
+ import { cmdExtension as CMD_EXTENSION } from 'cmd-extension';
7
+ import isWindows from 'is-windows';
8
+ async function removeOnWin(cmd) {
9
+ removalLogger.debug(cmd);
10
+ await Promise.all([
11
+ rimraf(cmd),
12
+ rimraf(`${cmd}.ps1`),
13
+ rimraf(`${cmd}${CMD_EXTENSION}`),
14
+ ]);
15
+ }
16
+ async function removeOnNonWin(p) {
17
+ removalLogger.debug(p);
18
+ return rimraf(p);
19
+ }
20
+ export const removeBin = isWindows() ? removeOnWin : removeOnNonWin;
21
+ export async function removeBinsOfDependency(dependencyDir, opts) {
22
+ const uninstalledPkgJson = await safeReadPackageJsonFromDir(dependencyDir);
23
+ if (!uninstalledPkgJson)
24
+ return;
25
+ const cmds = await getBinsFromPackageManifest(uninstalledPkgJson, dependencyDir);
26
+ if (!opts.dryRun) {
27
+ await Promise.all(cmds
28
+ .map((cmd) => path.join(opts.binsDir, cmd.name))
29
+ .map(removeBin));
30
+ }
31
+ return uninstalledPkgJson;
32
+ }
33
+ //# sourceMappingURL=removeBins.js.map
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@pnpm/bins.remover",
3
+ "version": "1000.0.15",
4
+ "description": "Remove bins from .bin",
5
+ "keywords": [
6
+ "pnpm",
7
+ "pnpm11"
8
+ ],
9
+ "license": "MIT",
10
+ "funding": "https://opencollective.com/pnpm",
11
+ "repository": "https://github.com/pnpm/pnpm/tree/main/bins/remover",
12
+ "homepage": "https://github.com/pnpm/pnpm/tree/main/bins/remover#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/pnpm/pnpm/issues"
15
+ },
16
+ "type": "module",
17
+ "main": "lib/index.js",
18
+ "types": "lib/index.d.ts",
19
+ "exports": {
20
+ ".": "./lib/index.js"
21
+ },
22
+ "files": [
23
+ "lib",
24
+ "!*.map"
25
+ ],
26
+ "dependencies": {
27
+ "@zkochan/rimraf": "^4.0.0",
28
+ "cmd-extension": "^2.0.0",
29
+ "is-windows": "^1.0.2",
30
+ "@pnpm/bins.resolver": "1000.0.11",
31
+ "@pnpm/pkg-manifest.reader": "1000.1.2",
32
+ "@pnpm/core-loggers": "1001.0.4",
33
+ "@pnpm/types": "1000.9.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@pnpm/logger": ">=1001.0.0 <1002.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/is-windows": "^1.0.2",
40
+ "@types/ramda": "0.29.12",
41
+ "@pnpm/bins.remover": "1000.0.15",
42
+ "@pnpm/logger": "1001.0.1"
43
+ },
44
+ "engines": {
45
+ "node": ">=22.13"
46
+ },
47
+ "jest": {
48
+ "preset": "@pnpm/jest-config"
49
+ },
50
+ "scripts": {
51
+ "start": "tsgo --watch",
52
+ "test": "pnpm run compile",
53
+ "lint": "eslint \"src/**/*.ts\"",
54
+ "compile": "tsgo --build && pnpm run lint --fix"
55
+ }
56
+ }