We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2cc8dd0 commit 6f390d7Copy full SHA for 6f390d7
1 file changed
node/flatpak_node_generator/providers/yarn.py
@@ -44,7 +44,23 @@ def is_git_version(version: str) -> bool:
44
return len([p for p in url.path.split('/') if p]) == 2
45
return False
46
47
+ @staticmethod
48
+ def is_yarn_v1_lockfile(path: Path) -> bool:
49
+ if path.exists():
50
+ with open(path, encoding='utf-8') as f:
51
+ for i, line in enumerate(f):
52
+ if i > 10:
53
+ break
54
+ if '# yarn lockfile v1' in line.strip():
55
+ return True
56
+ return False
57
+
58
def parse_lockfile(self, lockfile: Path) -> Dict[str, Any]:
59
+ if not self.is_yarn_v1_lockfile(lockfile):
60
+ raise NotImplementedError(
61
+ 'Only yarn v1 lockfiles are supported. See https://classic.yarnpkg.com/'
62
+ )
63
64
def _iter_lines() -> Iterator[Tuple[int, str]]:
65
indent = ' '
66
for line in lockfile.open():
0 commit comments