invertase / melos

🌋 A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
https://melos.invertase.dev/~melos-latest
Apache License 2.0
1.19k stars 206 forks source link

request: add support for message in shared dependencies #692

Open xsahil03x opened 7 months ago

xsahil03x commented 7 months ago

Is there an existing feature request for this?

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 commented 7 months ago

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 commented 7 months ago

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

xsahil03x commented 7 months ago

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 commented 7 months ago

Hey @spydon, any help here? Thanks

spydon commented 7 months ago

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 commented 7 months ago

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