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

fix: bootstrap fails when version is not specified #777

Closed
1 task done
MohiuddinM opened this issue Oct 16, 2024 · 7 comments
Closed
1 task done

fix: bootstrap fails when version is not specified #777

MohiuddinM opened this issue Oct 16, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@MohiuddinM
Copy link
Contributor

MohiuddinM commented Oct 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Version

6.2.0

Description

type 'Null' is not a subtype of type 'String'

#0      new ExternalHostedReference.fromJson (package:pubspec/src/dependency.dart:138:37)
#1      new DependencyReference.fromJson (package:pubspec/src/dependency.dart:25:42)
#2      new PubSpec.fromJson.<anonymous closure> (package:pubspec/src/pubspec.dart:107:68)
#3      JsonParser.mapValues.<anonymous closure> (package:pubspec/src/json_utils.dart:113:45)
#4      MapBase.forEach (dart:collection/maps.dart:35:13)
#5      JsonParser.mapValues (package:pubspec/src/json_utils.dart:112:7)
#6      new PubSpec.fromJson (package:pubspec/src/pubspec.dart:107:15)
#7      PubSpec.loadFile (package:pubspec/src/pubspec.dart:128:15)

Steps to reproduce

  1. Add a hosted dependency with no version specified
  2. run: melos bootstrap

Expected behavior

bootstrap should succeed

Screenshots

No response

Additional context and comments

No response

@MohiuddinM MohiuddinM added the bug Something isn't working label Oct 16, 2024
@spydon
Copy link
Collaborator

spydon commented Oct 16, 2024

Curious, I just tried and it works fine for me.
Can you share a full reproduction?

@MohiuddinM
Copy link
Contributor Author

Curious, I just tried and it works fine for me. Can you share a full reproduction?

There is no way this works, because this is the json being passed:
{hosted: https://dart.pkg.jetbrains.space/xyz/p/main/pub/}

And ofc this is gonna throw a null error because there is no null check before calling:
VersionConstraint.parse(json['version']),

@MohiuddinM
Copy link
Contributor Author

Probably we need to change this line to:
json['version'] is String ? VersionConstraint.parse(json['version']) : null,

@spydon
Copy link
Collaborator

spydon commented Oct 16, 2024

Aah, I missed the fact that you are talking about hosted dependencies.

Probably we need to change this line to:
json['version'] is String ? VersionConstraint.parse(json['version']) : null,

Sounds good, do you want to provide a PR?

@MohiuddinM
Copy link
Contributor Author

But this change is in the pubspec package, not in melos. And that package is discontniued.

@spydon
Copy link
Collaborator

spydon commented Oct 16, 2024

Ah of course, I though we already had an issue for migrating away from that package, but I couldn't find one so I opened #778

@spydon
Copy link
Collaborator

spydon commented Nov 22, 2024

This should be solved by #794

@spydon spydon closed this as completed Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants