tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
prefetch-yarn-deps: Fix parsing of scoped packages
Lorenz Leutgeb
2 years ago
3843224a
da41de71
+23
-3
3 changed files
expand all
collapse all
unified
split
pkgs
build-support
node
fetch-yarn-deps
index.js
tests
default.nix
file.lock
+10
-3
pkgs/build-support/node/fetch-yarn-deps/index.js
···
88
88
}
89
89
90
90
const downloadPkg = (pkg, verbose) => {
91
91
-
const [ name, spec ] = pkg.key.split('@', 2);
92
92
-
if (spec.startsWith('file:')) {
93
93
-
console.info(`ignoring relative file:path dependency "${spec}"`)
91
91
+
const fileMarker = '@file:'
92
92
+
const split = pkg.key.split(fileMarker)
93
93
+
if (split.length == 2) {
94
94
+
console.info(`ignoring lockfile entry "${split[0]}" which points at path "${split[1]}"`)
94
95
return
96
96
+
} else if (split.length > 2) {
97
97
+
throw new Error(`The lockfile entry key "${pkg.key}" contains "${fileMarker}" more than once. Processing is not implemented.`)
98
98
+
}
99
99
+
100
100
+
if (pkg.resolved === undefined) {
101
101
+
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.`)
95
102
}
96
103
97
104
const [ url, hash ] = pkg.resolved.split('#')
+4
pkgs/build-support/node/fetch-yarn-deps/tests/default.nix
···
1
1
{ testers, fetchYarnDeps, ... }:
2
2
3
3
{
4
4
+
file = testers.invalidateFetcherByDrvHash fetchYarnDeps {
5
5
+
yarnLock = ./file.lock;
6
6
+
sha256 = "sha256-BPuyQVCbdpFL/iRhmarwWAmWO2NodlVCOY9JU+4pfa4=";
7
7
+
};
4
8
simple = testers.invalidateFetcherByDrvHash fetchYarnDeps {
5
9
yarnLock = ./simple.lock;
6
10
sha256 = "sha256-FRrt8BixleILmFB2ZV8RgPNLqgS+dlH5nWoPgeaaNQ8=";
+9
pkgs/build-support/node/fetch-yarn-deps/tests/file.lock
···
1
1
+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
2
+
# yarn lockfile v1
3
3
+
4
4
+
5
5
+
"@org/somepack@file:vendor/orgpacks/somepack/assets":
6
6
+
version "1.0.0"
7
7
+
8
8
+
"otherpack@file:vendor/otherpack":
9
9
+
version "1.0.0"