Skip to content

Commit

Permalink
fix: git dependency overrides should have top-level git field
Browse files Browse the repository at this point in the history
  • Loading branch information
spydon committed Jan 10, 2025
1 parent b26f310 commit 4bb8a41
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 0 additions & 2 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ command:
version:
# Generate commit links in package changelogs.
linkToCommits: true
# Only allow versioning to happen on main branch.
branch: main
# Additionally build a changelog at the root of the workspace.
workspaceChangelog: true
hooks:
Expand Down
22 changes: 13 additions & 9 deletions packages/melos/lib/src/common/extensions/dependency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,26 @@ extension HostedDependencyExtension on HostedDependency {
return inlineVersion
? version.toString()
: {
'version': version.toString(),
if (hosted != null)
'hosted': {
'name': hosted!.declaredName,
'url': hosted!.url?.toString(),
},
'hosted': {
'version': version.toString(),
if (hosted != null)
'hosted': {
'name': hosted!.declaredName,
'url': hosted!.url?.toString(),
},
},
};
}
}

extension GitDependencyExtension on GitDependency {
Map<String, dynamic> toJson() {
return {
'url': url.toString(),
if (ref != null) 'ref': ref,
if (path != null) 'path': path,
'git': {
'url': url.toString(),
if (ref != null) 'ref': ref,
if (path != null) 'path': path,
},
};
}
}
Expand Down

0 comments on commit 4bb8a41

Please sign in to comment.