Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: Correct the LocalSource check for npm provider #378

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion node/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
.venv/
_build/
__pycache__/
node_modules/
./node_modules/
npm-cache-*/
yarn-mirror/
14 changes: 4 additions & 10 deletions node/flatpak_node_generator/providers/npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,14 @@ def _process_packages_v2(
# NOTE We're not interested in symlinks, NPM will create them at install time
# but we still could collect package symlinks anyway just for completeness
continue
if install_path == '':
# The root project is typically listed with a key of ''
continue

name = info.get('name')

source: PackageSource
package_json_path = lockfile.parent / install_path / 'package.json'
if (
'node_modules' not in package_json_path.parents
and package_json_path.exists()
):
source = LocalSource(path=install_path)
if name is None:
with package_json_path.open('rb') as fp:
name = json.load(fp)['name']
elif 'resolved' in info:
if 'resolved' in info:
resolved_url = urllib.parse.urlparse(info['resolved'])
if resolved_url.scheme == 'file':
source = LocalSource(path=resolved_url.path)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

182 changes: 182 additions & 0 deletions node/tests/data/packages/name-as-dep/node_modules/word-wrap/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading