@pnpm/link-bins
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -5,2 +5,3 @@ "use strict"; | ||
const read_importer_manifest_1 = require("@pnpm/read-importer-manifest"); | ||
const read_modules_dir_1 = require("@pnpm/read-modules-dir"); | ||
const read_package_json_1 = require("@pnpm/read-package-json"); | ||
@@ -14,5 +15,5 @@ const cmdShim = require("@zkochan/cmd-shim"); | ||
const normalizePath = require("normalize-path"); | ||
const pSettle = require("p-settle"); | ||
const path = require("path"); | ||
const R = require("ramda"); | ||
const getPkgDirs_1 = require("./getPkgDirs"); | ||
const IS_WINDOWS = isWindows(); | ||
@@ -22,5 +23,9 @@ const EXECUTABLE_SHEBANG_SUPPORTED = !IS_WINDOWS; | ||
exports.default = async (modules, binPath, opts) => { | ||
const pkgDirs = await getPkgDirs_1.default(modules); | ||
const pkgDirs = await read_modules_dir_1.default(modules); | ||
// If the modules dir does not exist, do nothing | ||
if (pkgDirs === null) | ||
return; | ||
const pkgBinOpts = Object.assign({ allowExoticManifests: false }, opts); | ||
const allCmds = R.unnest((await Promise.all(pkgDirs | ||
.map((dir) => path.resolve(modules, dir)) | ||
.filter((dir) => !isSubdir(dir, binPath)) // Don't link own bins | ||
@@ -46,5 +51,5 @@ .map(normalizePath) | ||
const [cmdsWithOwnName, cmdsWithOtherNames] = R.partition((cmd) => cmd.ownName, allCmds); | ||
await Promise.all(cmdsWithOwnName.map((cmd) => linkBin(cmd, binPath))); | ||
const results1 = await pSettle(cmdsWithOwnName.map((cmd) => linkBin(cmd, binPath))); | ||
const usedNames = R.fromPairs(cmdsWithOwnName.map((cmd) => [cmd.name, cmd.name])); | ||
await Promise.all(cmdsWithOtherNames.map((cmd) => { | ||
const results2 = await pSettle(cmdsWithOtherNames.map((cmd) => { | ||
if (usedNames[cmd.name]) { | ||
@@ -57,2 +62,8 @@ opts.warn(`Cannot link bin "${cmd.name}" of "${cmd.pkgName}" to "${binPath}". A package called "${usedNames[cmd.name]}" already has its bin linked.`); | ||
})); | ||
// We want to create all commands that we can create before throwing an exception | ||
for (const result of [...results1, ...results2]) { | ||
if (result.isRejected) { | ||
throw result.reason; | ||
} | ||
} | ||
} | ||
@@ -59,0 +70,0 @@ async function getPackageBins(target, opts) { |
{ | ||
"name": "@pnpm/link-bins", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Link bins to node_modules/.bin", | ||
@@ -38,6 +38,6 @@ "main": "lib/index.js", | ||
"@pnpm/read-importer-manifest": "^2.0.0", | ||
"@pnpm/read-modules-dir": "^2.0.1", | ||
"@pnpm/read-package-json": "^3.0.0", | ||
"@pnpm/types": "^4.0.0", | ||
"@zkochan/cmd-shim": "^4.1.0", | ||
"arr-flatten": "^1.1.0", | ||
"is-subdir": "^1.0.3", | ||
@@ -48,3 +48,3 @@ "is-windows": "^1.0.2", | ||
"normalize-path": "^3.0.0", | ||
"p-filter": "^2.1.0", | ||
"p-settle": "^3.1.0", | ||
"ramda": "^0.26.1" | ||
@@ -51,0 +51,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13076
6
126
+ Addedp-settle@^3.1.0
+ Added@pnpm/read-modules-dir@2.0.3(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-reflect@2.1.0(transitive)
+ Addedp-settle@3.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
- Removedarr-flatten@^1.1.0
- Removedp-filter@^2.1.0
- Removedarr-flatten@1.1.0(transitive)
- Removedp-filter@2.1.0(transitive)
- Removedp-map@2.1.0(transitive)