Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Yarn issue #24

Open
4rokis opened this issue Oct 30, 2019 · 4 comments
Open

Yarn issue #24

4rokis opened this issue Oct 30, 2019 · 4 comments

Comments

@4rokis
Copy link
Contributor

4rokis commented Oct 30, 2019

S4n60w3n/phaser/master/9db9511bf106c0e9f7523b1b2d32eaf35ad322d3

Traceback (most recent call last):
  File "/usr/local/bin/license-sh", line 69, in <module>
    dep_tree, license_map = runner.check()
  File "/usr/local/lib/python3.8/site-packages/license_sh/runners/yarn/__init__.py", line 332, in check
    dep_tree = get_dependency_tree(flat_tree, package_json, package_map)
  File "/usr/local/lib/python3.8/site-packages/license_sh/runners/yarn/__init__.py", line 283, in get_dependency_tree
    version=dependency.get("version"),
AttributeError: 'NoneType' object has no attribute 'get'
@4rokis
Copy link
Contributor Author

4rokis commented Oct 30, 2019

https://github.com/S4n60w3n/phaser
@jvorcak If project have both yarn lock and package.json

 if ProjectType.PYTHON_PIPENV in project_types:
        runner = PythonRunner(path, silent)
        dep_tree, license_map = runner.check()

    if ProjectType.NPM in project_types:
        runner = NpmRunner(path, silent)
        dep_tree, license_map = runner.check()

    if ProjectType.MAVEN in project_types:
        runner = MavenRunner(path, silent)
        dep_tree, license_map = runner.check()

    if ProjectType.YARN in project_types:
        runner = YarnRunner(path, silent)
        dep_tree, license_map = runner.check()

The later will override results.

@4rokis
Copy link
Contributor Author

4rokis commented Oct 30, 2019

https://github.com/S4n60w3n/phaser
If yarn.lock file is incompatible with package.json yarn runner fails with

Traceback (most recent call last):
  File "./license-sh", line 69, in <module>
    dep_tree, license_map = runner.check()
  File "/home/theodore/workspace/license.sh/license_sh/runners/yarn/__init__.py", line 333, in check
    dep_tree = get_dependency_tree(flat_tree, package_json, package_map)
  File "/home/theodore/workspace/license.sh/license_sh/runners/yarn/__init__.py", line 283, in get_dependency_tree
    version=dependency.get("version"),
AttributeError: 'NoneType' object has no attribute 'get'

There should be more explanatory error

@4rokis
Copy link
Contributor Author

4rokis commented Oct 30, 2019

https://github.com/S4n60w3n/phaser
Updated package-lock.json

(license.sh) [theodore@milacik license.sh]$ ./license-sh ../phaser/ -t 
├── eventemitter3 - 3.1.0 - MIT
├── exports-loader - 0.7.0 - MIT
│   ├── loader-utils - 1.1.0 - MIT
│   │   ├── big.js - 3.2.0 - MIT
│   │   ├── emojis-list - 2.1.0 - MIT
│   │   └── json5 - 0.5.1 - MIT
│   └── source-map - 0.5.0 - BSD-3-Clause
└── imports-loader - 0.8.0 - MIT
    ├── loader-utils - 1.1.0 - MIT
    │   ├── big.js - 3.2.0 - MIT
    │   ├── emojis-list - 2.1.0 - MIT
    │   └── json5 - 0.5.1 - MIT
    └── source-map - 0.6.1 - BSD-3-Clause

Updated yarn.lock

├── eventemitter3 - None - None
├── exports-loader - None - None
│   ├── loader-utils - 1.2.3 - None
│   │   ├── big.js - 5.2.2 - None
│   │   ├── emojis-list - 2.1.0 - None
│   │   └── json5 - 1.0.1 - None
│   │       └── minimist - 1.2.0 - None
│   └── source-map - 0.5.0 - None
└── imports-loader - None - None
    ├── loader-utils - 1.2.3 - None
    │   ├── big.js - 5.2.2 - None
    │   ├── emojis-list - 2.1.0 - None
    │   └── json5 - 1.0.1 - None
    │       └── minimist - 1.2.0 - None
    └── source-map - 0.6.1 - None

Yarn has minimist - 1.2.0

@4rokis
Copy link
Contributor Author

4rokis commented Nov 1, 2019

https://github.com/S4n60w3n/RandomLibrary

Traceback (most recent call last):
  File "/usr/local/bin/license-sh", line 69, in <module>
    dep_tree, license_map = runner.check()
  File "/usr/local/lib/python3.8/site-packages/license_sh/runners/yarn/__init__.py", line 337, in check
    license_map = fetch_npm_licenses(flat_dependencies)
  File "/usr/local/lib/python3.8/site-packages/license_sh/runners/runners_shared.py", line 11, in fetch_npm_licenses
    urls = [
  File "/usr/local/lib/python3.8/site-packages/license_sh/runners/runners_shared.py", line 13, in <listcomp>
    for dependency, version in all_dependencies
ValueError: too many values to unpack (expected 2)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant