iurysza / module-graph

A Gradle Plugin for visualizing your project's structure, powered by mermaidjs
https://plugins.gradle.org/plugin/dev.iurysouza.modulegraph
MIT License
345 stars 13 forks source link

Tried adding to my project but did not work. #8

Closed KaustubhPatange closed 1 year ago

KaustubhPatange commented 1 year ago

I was trying to add this plugin to my project but it seems to be no luck. The task completes successfully (no error) but nothing is added to the Readme file.

Here's what I've done,

  1. Added the plugin (legacy approach) Groovy DSL.
  2. Configured the plugin,
 moduleGraphConfig {
      readmePath = '$projectDir/test.md' // created this new file under root, seems like an output file parameter.
      heading = '### Dependency Diagram'
  }
  1. Ran the gradle command as mentioned ./gradlew createModuleGraph. The task completes successfully but produces no output i.e no change to test.md file.

Also, I was looking at the source code & it seems there is an additional configuration property outputFile but when I set it, it says no such property exists. Seems like the latest version is not published on the gradle plugins portal.

axel-legue commented 1 year ago

Hello, Same issue for me

stephanepechard commented 1 year ago

Hello, Same issue for me too. I also had to create an empty test.md because I didn't change the path. I'd say the plugin could create the file if it does not exist.

iurysza commented 1 year ago

Hey there! I just checked your repo here and I was able to get it to work. You can see it working on this PR. Let me know if it still doesn't work.

I'm suspecting my README is using the wrong syntax for groovy. 😅 I'll fix that.

As for the others, can you make sure you're setting the readmePath correctly?

In groovy it should be:

moduleGraphConfig {
    readmePath = "${projectDir}/README.md"
    heading = '### Dependency Diagram'
}
stephanepechard commented 1 year ago

My version used readmePath = 'test.md' to be sure not to have this problem, and I still have no result in the file. Could it be because the file is to high in the file hierarchy?

KaustubhPatange commented 1 year ago

@iurysza Did not work for me, left some comments on the PR if you can take a look.

iurysza commented 1 year ago

My version used readmePath = 'test.md' to be sure not to have this problem, and I still have no result in the file. Could it be because the file is to high in the file hierarchy?

Hey @stephanepechard , can you please run ./gradlew projects and post the output?

emitchel commented 1 year ago

Looks like you need to add the heading in your README for it to work. I expected to see errors after running the command, maybe it should throw an error for us to diagnose.

After adding the header in my README it worked! @KaustubhPatange @stephanepechard @axel-legue

https://github.com/iurysza/module-graph/blob/main/plugin-build/modulegraph/src/main/kotlin/dev/iurysouza/modulegraph/MermaidGraph.kt#L108

emitchel commented 1 year ago

Rather, we should just append the heading to the supplied readme, if it doesn't exist, since I believe that's what most are thinking here.

iurysza commented 1 year ago

@emitchel Oh shoot! That must be it. Sorry, I think the docs weren't clear and this UX is pretty bad after all. I'll merge #9 and will include that in the next release.

I'll close it for now. Cheers 🤘