VeryGoodOpenSource / very_good_cli

A Very Good Command-Line Interface for Dart created by Very Good Ventures 🦄
http://cli.vgv.dev
MIT License
2.2k stars 196 forks source link

fix: local very_good create doesn't use imported templates #1161

Closed SareXx closed 3 weeks ago

SareXx commented 1 month ago

Description

While working with the local very_good_cli and very_good_templates I ran into the issue that the very_good_cli doesn't use the modified very_good_core_bundle.dart and therefore very_good create flutter_app doesn't create a customized app.

Steps To Reproduce

Prerequires

  1. Using Ubuntu 22.04
  2. Installing Flutter 3.24.3
  3. Clone very_good_cli
  4. Clone very_goog_templates
  5. Activating mason_cli
  6. Activating very_good_cli with the code locally

Steps to reproduce unexpected behavior

  1. Customize very_good_core template in the the very_good_templates: (very_good_templates/very_good_core/brick/{{project_name.snakeCase()}}) 1.1 Adding an additional File 1.2 Adding additional dependencies in the pubspec.yaml
  2. Bundle the existing very_good_core brick mason bundle . -t dart -o /path/to/export/
  3. Copy the created very_good_core_bundle.dart and replace it in the very_good_cli directory: (very_good_cli/lib/src/commands/create/templates/very_good_core/)
  4. (Format the code inside the very_good_core_bundle.dart that it's recognizable by the language styling of dart)
  5. Create a new flutter app with the modified local very_good_cli very_good create flutter_app AppName
  6. See that no additional file is present as well as no customized dependencies in the pubspec.yaml

Expected Behavior

very_good create flutter_app AppName creates a flutter app while using the very_good_core template, including the modified very_good_core_bundle.dart

Additional Context

I haven't changed any code in the cli, besides mentioned below, so I would assume that if the filename of the very_good_core_bundle.dart is correct, it should be used and my changes become created/implemented when I create a new app. Am I missing an implementation step somewhere or is this what I'm trying to use your projects for even possible?

I can verify the following things:

  1. I'm using the local very_good_cli: To confirm that I'm using my local cli, I changed the comment block after when an app gets created in the very_good_core_template.dart in the cli project.
  2. The changes I've made in the very_good_core template are there: With a base64 decoder I can see from the pubspec.yaml string that my modifications are inside the bundle. Not to mention the new lines of my additional file.
  3. As I'm getting no errors whatsoever I assume that there shouldn't be any issues.
tomarra commented 1 month ago

This may be a duplicate of #1078

SareXx commented 1 month ago

On the first glance my problem looks very much like #4295, which is mentioned inside #1078, that the local cli is not used, even if it was activated with the proper command and also successfully shown in the terminal.

But as I mentioned in my additional context, when I activate the local cli and create a flutter_app, the very_good_core_templates.dart is used - which I would expect to actually include the very_good_core_bundle.dart.

Therefore, it looks to me as if my local cli is being used on the one hand, but on the other hand, since the very_good_core_bundle.dart is not included/used, that the online version is being used there? If my very_good_core_templates.dart wasn't used while creating an app with the local activated cli I would confirm that it is a duplicate of #1078.

Maybe I expect dart to work differently here than it does. So I'm a little unsure.

I also tried as mentioned in #4295 to activate my local cli after I cleaned / deleted my pub-cache folder but with no success.

From matthew-carroll: I've discovered that if I delete all the references I can find in my Pub cache for this package, then I can get Pub to truly activate my local version.

tomarra commented 3 weeks ago

Hi @SareXx, thanks for opening this issue and the explanation.

Overall I don't see this as an issue on the CLI package and more of a local setup issue overall. The update process for our bundles is working as expected. As was noted before, we do know of some issues with the pub cache when installing packages but this isn't something that we can fix inside of this package. Also we can't provide support for people forking our repo just given our staffing. If this is something you feel like you can work on and provide a PR for please let us know.

Given this I'm going to close this out as a won't fix as I don't see a need for a change/update on the CLI package.