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

request: add support for message in shared dependencies #692

Open
1 task done
xsahil03x opened this issue Apr 10, 2024 · 6 comments
Open
1 task done

request: add support for message in shared dependencies #692

xsahil03x opened this issue Apr 10, 2024 · 6 comments

Comments

@xsahil03x
Copy link
Contributor

xsahil03x commented Apr 10, 2024

Is there an existing feature request for this?

  • I have searched the existing issues.

Command

No response

Description

There should be an option to also generate message while updating shared dependencies.

In projects where multiple developers are working, there can be instance where they might not know it's a generated dependency and coming from melos.yaml. To ensure no-one modifies the generated dependency directly in the package we should also generate a message mentioning the same.

Similar approach is being used in the Flutter repo
https://github.com/flutter/flutter/blob/master/packages/flutter/pubspec.yaml#L33-L49

eg:

name: package_a

environment:
	sdk: ^3.3.1 # THIS LINE IS AUTOGENERATED - TO UPDATE MODIFY "melos.yaml"
	
dependencies:
	retrofit: 4.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE MODIFY "melos.yaml"

The message can be configured directly in the melos.yaml file.

@spydon
Copy link
Collaborator

spydon commented Apr 10, 2024

It makes sense, it's very intrusive though, so definitely as an opt-in.
Do we really needed to have the message configurable though? I think that's a bit overkill.

@xsahil03x
Copy link
Contributor Author

We don't have to, we can decide on a message and use it

@xsahil03x
Copy link
Contributor Author

Hey, do you have any idea on how can i add a comment using pubspecEditor? I didn't find anything similar in the code and docs.

I tried something like this but it generates it as a whole string.

pubspecEditor.update(
        [pubspecKey, entry.key],
        wrapAsYamlNode(
          entry.value.toJson() + ' # Generated',
          collectionStyle: CollectionStyle.BLOCK,
        ),
      );

Output:

  args: "^2.4.1 # Generated"

@xsahil03x
Copy link
Contributor Author

Hey @spydon, any help here? Thanks

@spydon
Copy link
Collaborator

spydon commented Apr 15, 2024

Hey @spydon, any help here? Thanks

Have a look if this package supports that:
https://pub.dev/packages/pubspec_manager

We have been thinking of migrating to that package.

@xsahil03x
Copy link
Contributor Author

Hey @spydon, any help here? Thanks

Have a look if this package supports that: pub.dev/packages/pubspec_manager

We have been thinking of migrating to that package.

Thanks, i will take a look

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

No branches or pull requests

2 participants