@pnpm/pkgid-to-filename
Advanced tools
Comparing version 3.0.0-1 to 3.0.0-2
export default function pkgIdToFilename(pkgId: string, prefix: string): string; |
@@ -6,4 +6,6 @@ "use strict"; | ||
function pkgIdToFilename(pkgId, prefix) { | ||
if (pkgId.indexOf('file:') !== 0) | ||
return pkgId; | ||
if (pkgId.indexOf('file:') !== 0) { | ||
const index = pkgId.lastIndexOf('/'); | ||
return `${pkgId.substr(0, index)}@${pkgId.substr(index + 1)}`; | ||
} | ||
const absolutePath = normalize(path.join(prefix, pkgId.slice(5))); | ||
@@ -10,0 +12,0 @@ const lastSlash = absolutePath.lastIndexOf('/'); |
{ | ||
"name": "@pnpm/pkgid-to-filename", | ||
"version": "3.0.0-1", | ||
"version": "3.0.0-2", | ||
"description": "Converts a package ID to a valid file name", | ||
@@ -8,3 +8,4 @@ "main": "lib/index.js", | ||
"files": [ | ||
"lib" | ||
"lib", | ||
"!*.map" | ||
], | ||
@@ -11,0 +12,0 @@ "engines": { |
@@ -9,4 +9,2 @@ # @pnpm/pkgid-to-filename | ||
Most package IDs are already unique and valid filenames, so only the package IDs of local dependencies are converted. | ||
## Installation | ||
@@ -32,3 +30,3 @@ | ||
pkgIdToFilename('registry.npmjs.org/foo/1.0.0') | ||
//> registry.npmjs.org/foo/1.0.0 | ||
//> registry.npmjs.org/foo@1.0.0 | ||
``` | ||
@@ -35,0 +33,0 @@ |
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
15
3840
5
35