gitdartpackage

How do people actually develop Dart packages locally?


Let's say I develop the 4 packages. My workspace looks like this:

- ios_transmogrify > depends on core_transmogrify
- android_transmogrify > depends on core_transmogrify
- core_transmogrify > depends on core_tools
- core_tools

In the pubspect.yaml of each project repo, they each point to the released version (or remote git) of their dependencies. For example, in ios_transmogrify, we could see:

dependencies:
  core_transmogrify: ^1.1.0

Now, I want to edit files in all 4 packages and see the change during dev in the running program.

My step:

The problem

That is so manual, prone to human error. And this repeats on every commit followed by a Git push.

What I tried

I explored every options I know.

Ideal solution that I hope exists but I am not aware of:

It will be so great if we can override specific pubspec.yaml dependencies with another file, let's say pubspect.local.yaml . If the package is in the local.yaml file, it will behave like dependency_override. The advantage here is that pubspect.local.yaml is not checked in Git and pubspec.yaml remain untouched.

I understand that this feature require the dart compiler to be smart enough to do this override.

My question applies for NodeJS, Python, and other langugages. So if there is a tool that is language agnostic, it will be even better.


Solution

  • "It will be so great if we can override specific pubspec.yaml dependencies with another file,"

    You mean like dart.dev/tools/pub/dependencies#dependency-overrides which has been in place for years now?

    Melos (in the pub) can help you manage those files as well.