mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
prefetch-yarn-deps: Fix parsing of scoped packages
This commit is contained in:
parent
da41de71f6
commit
3843224a55
@ -88,10 +88,17 @@ const isGitUrl = pattern => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const downloadPkg = (pkg, verbose) => {
|
const downloadPkg = (pkg, verbose) => {
|
||||||
const [ name, spec ] = pkg.key.split('@', 2);
|
const fileMarker = '@file:'
|
||||||
if (spec.startsWith('file:')) {
|
const split = pkg.key.split(fileMarker)
|
||||||
console.info(`ignoring relative file:path dependency "${spec}"`)
|
if (split.length == 2) {
|
||||||
|
console.info(`ignoring lockfile entry "${split[0]}" which points at path "${split[1]}"`)
|
||||||
return
|
return
|
||||||
|
} else if (split.length > 2) {
|
||||||
|
throw new Error(`The lockfile entry key "${pkg.key}" contains "${fileMarker}" more than once. Processing is not implemented.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg.resolved === undefined) {
|
||||||
|
throw new Error(`The lockfile entry with key "${pkg.key}" cannot be downloaded because it is missing the "resolved" attribute, which should contain the URL to download from. The lockfile might be invalid.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const [ url, hash ] = pkg.resolved.split('#')
|
const [ url, hash ] = pkg.resolved.split('#')
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
{ testers, fetchYarnDeps, ... }:
|
{ testers, fetchYarnDeps, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
file = testers.invalidateFetcherByDrvHash fetchYarnDeps {
|
||||||
|
yarnLock = ./file.lock;
|
||||||
|
sha256 = "sha256-BPuyQVCbdpFL/iRhmarwWAmWO2NodlVCOY9JU+4pfa4=";
|
||||||
|
};
|
||||||
simple = testers.invalidateFetcherByDrvHash fetchYarnDeps {
|
simple = testers.invalidateFetcherByDrvHash fetchYarnDeps {
|
||||||
yarnLock = ./simple.lock;
|
yarnLock = ./simple.lock;
|
||||||
sha256 = "sha256-FRrt8BixleILmFB2ZV8RgPNLqgS+dlH5nWoPgeaaNQ8=";
|
sha256 = "sha256-FRrt8BixleILmFB2ZV8RgPNLqgS+dlH5nWoPgeaaNQ8=";
|
||||||
|
9
pkgs/build-support/node/fetch-yarn-deps/tests/file.lock
Normal file
9
pkgs/build-support/node/fetch-yarn-deps/tests/file.lock
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@org/somepack@file:vendor/orgpacks/somepack/assets":
|
||||||
|
version "1.0.0"
|
||||||
|
|
||||||
|
"otherpack@file:vendor/otherpack":
|
||||||
|
version "1.0.0"
|
Loading…
Reference in New Issue
Block a user