Selaa lähdekoodia

add licenses of third-party libraries to Dependencies.md

Falko Schindler 1 vuosi sitten
vanhempi
säilyke
8f0771745c
2 muutettua tiedostoa jossa 23 lisäystä ja 17 poistoa
  1. 14 14
      DEPENDENCIES.md
  2. 9 3
      npm.py

+ 14 - 14
DEPENDENCIES.md

@@ -1,16 +1,16 @@
 # Included Web Dependencies
 
-- vue: 3.3.4
-- quasar: 2.12.2
-- tailwindcss: 3.3.2
-- socket.io: 4.7.1
-- es-module-shims: 1.7.3
-- aggrid: 30.0.3
-- echarts: 5.4.3
-- highcharts: 11.1.0
-- mermaid: 10.2.4
-- nipplejs: 0.10.1
-- plotly: 2.24.3
-- three: 0.154.0
-- tween: 21.0.0
-- vanilla-jsoneditor: 0.18.0
+- vue: 3.3.4 ([MIT](https://opensource.org/licenses/MIT))
+- quasar: 2.12.7 ([MIT](https://opensource.org/licenses/MIT))
+- tailwindcss: 3.3.3 ([MIT](https://opensource.org/licenses/MIT))
+- socket.io: 4.7.2 ([MIT](https://opensource.org/licenses/MIT))
+- es-module-shims: 1.8.0 ([MIT](https://opensource.org/licenses/MIT))
+- aggrid: 30.2.0 ([MIT](https://opensource.org/licenses/MIT))
+- echarts: 5.4.3 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0))
+- highcharts: 11.1.0 ([https://www.highcharts.com/license](https://www.highcharts.com/license))
+- mermaid: 10.5.0 ([MIT](https://opensource.org/licenses/MIT))
+- nipplejs: 0.10.1 ([MIT](https://opensource.org/licenses/MIT))
+- plotly: 2.26.2 ([MIT](https://opensource.org/licenses/MIT))
+- three: 0.157.0 ([MIT](https://opensource.org/licenses/MIT))
+- tween: 21.0.0 ([MIT](https://opensource.org/licenses/MIT))
+- vanilla-jsoneditor: 0.18.8 ([ISC](https://opensource.org/licenses/ISC))

+ 9 - 3
npm.py

@@ -39,13 +39,18 @@ def download_buffered(url: str) -> Path:
     path.mkdir(exist_ok=True)
     filepath = path / url_to_filename(url)
     if not filepath.exists():
-        response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
+        response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'}, timeout=3)
         filepath.write_bytes(response.content)
     return filepath
 
 
 DEPENDENCIES = (Path(__file__).parent / 'DEPENDENCIES.md').open('w')
 DEPENDENCIES.write('# Included Web Dependencies\n\n')
+KNOWN_LICENSES = {
+    'MIT': 'https://opensource.org/licenses/MIT',
+    'ISC': 'https://opensource.org/licenses/ISC',
+    'Apache-2.0': 'https://opensource.org/licenses/Apache-2.0',
+}
 
 # Create a hidden folder to work in.
 tmp = cleanup(Path('.npm'))
@@ -60,8 +65,9 @@ for key, dependency in dependencies.items():
     npm_data = json.loads(download_buffered(f'https://registry.npmjs.org/{package_name}').read_text())
     npm_version = dependency.get('version', npm_data['dist-tags']['latest'])
     npm_tarball = npm_data['versions'][npm_version]['dist']['tarball']
-    print(f'{key}: {npm_version} - {npm_tarball}')
-    DEPENDENCIES.write(f'- {key}: {npm_version}\n')
+    license_ = npm_data['versions'][npm_version]['license']
+    print(f'{key}: {npm_version} - {npm_tarball} ({license_})')
+    DEPENDENCIES.write(f'- {key}: {npm_version} ([{license_}]({KNOWN_LICENSES.get(license_, license_)}))\n')
 
     # Handle the special case of tailwind. Hopefully remove this soon.
     if 'download' in dependency: