Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnpm/global-bin-dir

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/global-bin-dir - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

8

CHANGELOG.md
# @pnpm/global-bin-dir
## 1.1.0
### Minor Changes
- 915828b46: `globalBinDir()` may accept an array of suitable executable directories.
If one of these directories is in PATH and has bigger priority than the
npm/pnpm/nodejs directories, then that directory will be used.
## 1.0.1

@@ -4,0 +12,0 @@

2

lib/index.d.ts

@@ -1,1 +0,1 @@

export default function (): string;
export default function (knownCandidates?: string[]): string;

@@ -7,3 +7,3 @@ "use strict";

const PATH = require("path-name");
function default_1() {
function default_1(knownCandidates = []) {
var _a, _b;

@@ -14,7 +14,11 @@ if (!process.env[PATH]) {

const dirs = (_b = (_a = process.env[PATH]) === null || _a === void 0 ? void 0 : _a.split(path.delimiter)) !== null && _b !== void 0 ? _b : [];
return pickBestGlobalBinDir(dirs);
const nodeBinDir = path.dirname(process.execPath);
return pickBestGlobalBinDir(dirs, [
...knownCandidates,
nodeBinDir,
]);
}
exports.default = default_1;
function pickBestGlobalBinDir(dirs) {
const nodeBinDir = path.dirname(process.execPath);
const areDirsEqual = (dir1, dir2) => path.relative(dir1, dir2) === '';
function pickBestGlobalBinDir(dirs, knownCandidates) {
const noWriteAccessDirs = [];

@@ -27,3 +31,3 @@ for (const dir of dirs) {

isUnderDir('pnpm', lowCaseDir) ||
path.relative(nodeBinDir, dir) === '') {
knownCandidates.some((candidate) => areDirsEqual(candidate, dir))) {
if (canWriteToDirAndExists(dir))

@@ -30,0 +34,0 @@ return dir;

{
"name": "@pnpm/global-bin-dir",
"version": "1.0.1",
"version": "1.1.0",
"description": "Finds a directory that is in PATH and we have permission to write to i",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc