mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Lockfile lint is now compatible with yarn v3 (#20247)
* Lockfile lint is now compatible with yarn v3 * remove the patch
This commit is contained in:
parent
378bf19c05
commit
05b1b19c6f
@ -1,48 +0,0 @@
|
||||
# Lockfile lint's current version does not work with the updated structure of the yarn v2 lockfile
|
||||
# This patch updates it so that it can parse and read the lockfile entries.
|
||||
diff --git a/src/ParseLockfile.js b/src/ParseLockfile.js
|
||||
index 0f0c951027ec83c61769bb6a48943420dff133b8..bad2d251cf376bf3ef4b444a0d49f03a602d7a6e 100644
|
||||
--- a/src/ParseLockfile.js
|
||||
+++ b/src/ParseLockfile.js
|
||||
@@ -21,13 +21,13 @@ const {
|
||||
* @return boolean
|
||||
*/
|
||||
function checkSampleContent (lockfile) {
|
||||
- const [sampleKey, sampleValue] = Object.entries(lockfile)[0]
|
||||
+ const [sampleKey, sampleValue] = Object.entries(lockfile)[1]
|
||||
return (
|
||||
sampleKey.match(/.*@.*/) &&
|
||||
(sampleValue &&
|
||||
typeof sampleValue === 'object' &&
|
||||
sampleValue.hasOwnProperty('version') &&
|
||||
- sampleValue.hasOwnProperty('resolved'))
|
||||
+ sampleValue.hasOwnProperty('resolution'))
|
||||
)
|
||||
}
|
||||
/**
|
||||
@@ -41,7 +41,24 @@ function yarnParseAndVerify (lockfileBuffer) {
|
||||
if (!hasSensibleContent) {
|
||||
throw Error('Lockfile does not seem to contain a valid dependency list')
|
||||
}
|
||||
- return {type: 'success', object: lockfile}
|
||||
+ const normalized = Object.fromEntries(Object.entries(lockfile).map(([packageName, packageDetails]) => {
|
||||
+ const resolution = packageDetails.resolution;
|
||||
+ if (!resolution) {
|
||||
+ return [packageName, packageDetails];
|
||||
+ }
|
||||
+ const splitByAt = resolution.split('@');
|
||||
+ let resolvedPackageName;
|
||||
+ let host;
|
||||
+ if (splitByAt.length > 2 && resolution[0] === '@') {
|
||||
+ resolvedPackageName = `@${splitByAt[1]}`;
|
||||
+ host = splitByAt[2];
|
||||
+ } else {
|
||||
+ [resolvedPackageName, host] = splitByAt;
|
||||
+ }
|
||||
+
|
||||
+ return [packageName, { ...packageDetails, resolved: host}]
|
||||
+ }))
|
||||
+ return {type: 'success', object: normalized}
|
||||
}
|
||||
class ParseLockfile {
|
||||
/**
|
@ -190,7 +190,6 @@
|
||||
"luxon@^3.0.1": "patch:luxon@npm%3A3.2.1#./.yarn/patches/luxon-npm-3.2.1-56f8d97395.patch",
|
||||
"luxon@^3.2.1": "patch:luxon@npm%3A3.2.1#./.yarn/patches/luxon-npm-3.2.1-56f8d97395.patch",
|
||||
"improved-yarn-audit@^3.0.0": "patch:improved-yarn-audit@npm%3A3.0.0#./.yarn/patches/improved-yarn-audit-npm-3.0.0-3e37ee431a.patch",
|
||||
"lockfile-lint-api@^5.4.6": "patch:lockfile-lint-api@npm%3A5.4.6#./.yarn/patches/lockfile-lint-api-npm-5.4.6-dc86b73900.patch",
|
||||
"symbol-observable": "^2.0.3",
|
||||
"async-done@~1.3.2": "patch:async-done@npm%3A1.3.2#./.yarn/patches/async-done-npm-1.3.2-1f0a4a8997.patch",
|
||||
"async-done@^1.2.0": "patch:async-done@npm%3A1.3.2#./.yarn/patches/async-done-npm-1.3.2-1f0a4a8997.patch",
|
||||
@ -506,7 +505,7 @@
|
||||
"lavamoat": "^7.1.0",
|
||||
"lavamoat-browserify": "^15.7.0",
|
||||
"lavamoat-viz": "^6.0.9",
|
||||
"lockfile-lint": "^4.9.6",
|
||||
"lockfile-lint": "^4.10.6",
|
||||
"loose-envify": "^1.4.0",
|
||||
"madge": "^6.1.0",
|
||||
"mocha": "^9.2.2",
|
||||
|
42
yarn.lock
42
yarn.lock
@ -9098,13 +9098,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@yarnpkg/parsers@npm:^3.0.0-rc.6":
|
||||
version: 3.0.0-rc.26
|
||||
resolution: "@yarnpkg/parsers@npm:3.0.0-rc.26"
|
||||
"@yarnpkg/parsers@npm:^3.0.0-rc.32":
|
||||
version: 3.0.0-rc.48.1
|
||||
resolution: "@yarnpkg/parsers@npm:3.0.0-rc.48.1"
|
||||
dependencies:
|
||||
js-yaml: ^3.10.0
|
||||
tslib: ^2.4.0
|
||||
checksum: a6a30d4a3dca3efb79800e1dd41fad568e309abbf6042cba35808a1d641be9890675f1e38d40fb61cadc31a16c9d0199f5a7626bb8584c37720bd3a7329ca59f
|
||||
checksum: c4328cad81ec91de0840b065dfcfda9afa038dadf7507f27f73415675e257a9ad3b21247a6e28a6e90533c411645320104fd529ef85659173932ae38b26a7b0e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -23285,37 +23285,27 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lockfile-lint-api@npm:5.4.6":
|
||||
version: 5.4.6
|
||||
resolution: "lockfile-lint-api@npm:5.4.6"
|
||||
"lockfile-lint-api@npm:^5.5.5":
|
||||
version: 5.5.5
|
||||
resolution: "lockfile-lint-api@npm:5.5.5"
|
||||
dependencies:
|
||||
"@yarnpkg/parsers": ^3.0.0-rc.6
|
||||
"@yarnpkg/parsers": ^3.0.0-rc.32
|
||||
object-hash: ^3.0.0
|
||||
checksum: ed659ad25712126e7385c60bda6dfca38fb292b61114edd2ec8990224c63879208d8183b17548fd13181d1229727ca85b4fd9d4ae474ad209ebe04beaa699144
|
||||
checksum: 334ffbd29370f106980f17b58f794054f498abef39c2e1cf4a1276c097f78c72f3d087115643c913049b72a84ff7e28a563654271938e09250ae7f6b91a90830
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lockfile-lint-api@patch:lockfile-lint-api@npm%3A5.4.6#./.yarn/patches/lockfile-lint-api-npm-5.4.6-dc86b73900.patch::locator=metamask-crx%40workspace%3A.":
|
||||
version: 5.4.6
|
||||
resolution: "lockfile-lint-api@patch:lockfile-lint-api@npm%3A5.4.6#./.yarn/patches/lockfile-lint-api-npm-5.4.6-dc86b73900.patch::version=5.4.6&hash=9339a7&locator=metamask-crx%40workspace%3A."
|
||||
dependencies:
|
||||
"@yarnpkg/parsers": ^3.0.0-rc.6
|
||||
object-hash: ^3.0.0
|
||||
checksum: d08c6b8fbd19330bfebde24917b3ec544a31be0383cbb35d76453bba4d4248218837b04d74cf5cf943306ed5e8a21aea2e28eb0e574d797e5b07288a1e2a02d2
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lockfile-lint@npm:^4.9.6":
|
||||
version: 4.9.6
|
||||
resolution: "lockfile-lint@npm:4.9.6"
|
||||
"lockfile-lint@npm:^4.10.6":
|
||||
version: 4.10.6
|
||||
resolution: "lockfile-lint@npm:4.10.6"
|
||||
dependencies:
|
||||
cosmiconfig: ^7.0.1
|
||||
debug: ^4.1.1
|
||||
lockfile-lint-api: ^5.4.6
|
||||
lockfile-lint-api: ^5.5.5
|
||||
yargs: ^16.0.0
|
||||
bin:
|
||||
lockfile-lint: ./bin/lockfile-lint.js
|
||||
checksum: f573f3fe111d5499c3a7de8636f330b008123c23ad117102d297c3b5e7085b1524f96be6563e0d151a0e63b1080ac56f45d0c6ffdd7cc02fd3c1e5a496a118cf
|
||||
lockfile-lint: bin/lockfile-lint.js
|
||||
checksum: e031e8578e334ca2e8563bb6fd40dc1708fe77d7a4419de8d6bec6e7e9d26c2c685edec57407568e2b1662d48118003a826c9c4bee9b938836dfc97207d4fe42
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -24472,7 +24462,7 @@ __metadata:
|
||||
lavamoat-browserify: ^15.7.0
|
||||
lavamoat-viz: ^6.0.9
|
||||
localforage: ^1.9.0
|
||||
lockfile-lint: ^4.9.6
|
||||
lockfile-lint: ^4.10.6
|
||||
lodash: ^4.17.21
|
||||
loglevel: ^1.8.1
|
||||
loose-envify: ^1.4.0
|
||||
|
Loading…
Reference in New Issue
Block a user