|
@@ -17,6 +17,7 @@ import shutil
|
|
|
import tarfile
|
|
|
from argparse import ArgumentParser
|
|
|
from pathlib import Path
|
|
|
+from typing import Dict, List
|
|
|
|
|
|
import requests
|
|
|
|
|
@@ -64,7 +65,7 @@ KNOWN_LICENSES = {
|
|
|
# Create a hidden folder to work in.
|
|
|
tmp = cleanup(root_path / '.npm')
|
|
|
|
|
|
-dependencies: dict[str, dict] = json.loads((root_path / 'npm.json').read_text())
|
|
|
+dependencies: Dict[str, dict] = json.loads((root_path / 'npm.json').read_text())
|
|
|
for key, dependency in dependencies.items():
|
|
|
if names is not None and key not in names:
|
|
|
continue
|
|
@@ -100,7 +101,7 @@ for key, dependency in dependencies.items():
|
|
|
tgz_download = download_buffered(npm_tarball)
|
|
|
shutil.copyfile(tgz_download, tgz_file)
|
|
|
with tarfile.open(tgz_file) as archive:
|
|
|
- to_be_extracted: list[tarfile.TarInfo] = []
|
|
|
+ to_be_extracted: List[tarfile.TarInfo] = []
|
|
|
for tarinfo in archive.getmembers():
|
|
|
for keep in dependency['keep']:
|
|
|
if re.match(f'^{keep}$', tarinfo.name):
|