@pnpm/pkgid-to-filename
Advanced tools
Comparing version 2.0.0 to 3.0.0-0
@@ -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 = path.join(prefix, pkgId.slice(5)); | ||
@@ -10,0 +12,0 @@ return `local/${encodeURIComponent(normalize(absolutePath))}`; |
103
package.json
{ | ||
"name": "@pnpm/pkgid-to-filename", | ||
"version": "2.0.0", | ||
"description": "Converts a package ID to a valid file name", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"files": [ | ||
"lib" | ||
], | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"lint": "tslint -c tslint.json --project .", | ||
"tsc": "rimraf lib && tsc", | ||
"test": "npm run lint && preview && ts-node test && mos t", | ||
"md": "mos", | ||
"prepublishOnly": "npm run tsc" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/pnpm/pkgid-to-filename.git" | ||
}, | ||
"keywords": [ | ||
"pnpm", | ||
"integrity", | ||
"package", | ||
"store" | ||
], | ||
"author": "Zoltan Kochan <z@kochan.io> (https://www.kochan.io/)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/pnpm/pkgid-to-filename/issues" | ||
}, | ||
"homepage": "https://github.com/pnpm/pkgid-to-filename#readme", | ||
"dependencies": { | ||
"normalize-path": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^10.9.4", | ||
"@types/tape": "^4.2.31", | ||
"mos": "^2.0.0-alpha.3", | ||
"mos-plugin-readme": "^1.0.4", | ||
"package-preview": "^1.0.1", | ||
"rimraf": "^2.6.2", | ||
"tape": "^4.8.0", | ||
"ts-node": "^7.0.0", | ||
"tslint": "^5.8.0", | ||
"typescript": "^3.0.0" | ||
}, | ||
"mos": { | ||
"plugins": [ | ||
"readme" | ||
], | ||
"installation": { | ||
"useShortAlias": true | ||
} | ||
} | ||
"name": "@pnpm/pkgid-to-filename", | ||
"version": "3.0.0-0", | ||
"description": "Converts a package ID to a valid file name", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"files": [ | ||
"lib" | ||
], | ||
"engines": { | ||
"node": ">=10.13" | ||
}, | ||
"scripts": { | ||
"lint": "tslint -c tslint.json --project .", | ||
"tsc": "rimraf lib && tsc", | ||
"test": "npm run lint && preview && ts-node test", | ||
"prepublishOnly": "npm run tsc" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/pnpm/pkgid-to-filename.git" | ||
}, | ||
"keywords": [ | ||
"pnpm", | ||
"integrity", | ||
"package", | ||
"store" | ||
], | ||
"author": "Zoltan Kochan <z@kochan.io> (https://www.kochan.io/)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/pnpm/pkgid-to-filename/issues" | ||
}, | ||
"homepage": "https://github.com/pnpm/pkgid-to-filename#readme", | ||
"dependencies": { | ||
"normalize-path": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^13.13.4", | ||
"@types/tape": "^4.2.31", | ||
"package-preview": "^3.0.0", | ||
"rimraf": "^3.0.0", | ||
"tape": "^5.0.0", | ||
"ts-node": "^8.10.1", | ||
"tslint": "^6.1.2", | ||
"typescript": "^3.0.0" | ||
} | ||
} |
@@ -9,8 +9,6 @@ # @pnpm/pkgid-to-filename | ||
Most package IDs are already unique and valid filenames, so only the package IDs of local dependencies are converted. | ||
## Installation | ||
```sh | ||
npm i -S @pnpm/pkgid-to-filename | ||
<pnpm|npm|yarn> add @pnpm/pkgid-to-filename | ||
``` | ||
@@ -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 @@ |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
8
14
4267
1
35