rrousselGit / riverpod

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
https://riverpod.dev
MIT License
6.33k stars 959 forks source link

riverpod_graph generates no output when run with -f=d2 #2765

Closed freemansoft closed 1 year ago

freemansoft commented 1 year ago

Describe the bug riverpod_graph generates mermaid output but not d2 output

To Reproduce The only example I could find for running riverpod_graph was here. It publishes locally from git. I can't figure out how to do this from the local tree.

cd examples\todo
dart pub global activate -sgit https://github.com/rrousselGit/riverpod.git --git-path packages/riverpod_graph

generate mermaid output - the mermaid markup shows up on stdout.

dart pub global run riverpod_graph:riverpod_graph 

or

dart pub global run riverpod_graph:riverpod_graph -f=mermaid

No output at all

dart pub global run riverpod_graph:riverpod_graph -f=d2

Expected behavior I expect there should be d2 output that is an analog to the mermaid js output

freemansoft commented 1 year ago

VSCode built the run command for me that runs a graph analysis on a directory.

mermaid generates reasonable outlet

C:\Users\...\riverpod\packages\riverpod_graph> dart run .\bin\riverpod_graph.dart ..\..\examples\todo\lib

d2 still generates no output

C:\Users\...\riverpod\packages\riverpod_graph> dart run .\bin\riverpod_graph.dart ..\..\examples\todo\lib

launch.json configuration looks like

        {
            "name": "riverpod_graph examples/todo d2",
            "cwd": "packages/riverpod_graph",
            "request": "launch",
            "type": "dart",
            "program": "bin/riverpod_graph.dart",
            "args": [
                "../../examples/todo/lib",
                "-f",
                "d2"
            ]
        },
        {
            "name": "riverpod_graph examples/todo mermaid",
            "cwd": "packages/riverpod_graph",
            "request": "launch",
            "type": "dart",
            "program": "bin/riverpod_graph.dart",
            "args": [
                "../../examples/todo/lib",
                "-f",
                "mermaid"
            ]
        },

Will probably do a documentation PR for this.

utamori commented 1 year ago

you must specify the PATH you wish to analyze riverpod_graph . -f d2

freemansoft commented 1 year ago

Figured it out. On my Windows machine, the analysis package does not throw an error if the analysis target directory does not exist.


For future notes

This worked for me when operating with just code from the repo and not activate

../riverpod/packages/riverpod_graph$ dart run riverpod_graph:riverpod_graph ../../examples/odos/lib -f d2

This works for me in the VSCode launch.json. I had the directory as examples/todo when it actually was examples/todos.

        {
            "name": "riverpod_graph examples/todos d2",
            "cwd": "packages/riverpod_graph",
            "request": "launch",
            "type": "dart",
            "program": "bin/riverpod_graph.dart",
            "args": [
                "../../examples/todos/lib",
                "-f",
                "d2"
            ]
        },
        {
            "name": "riverpod_graph examples/todos mermaid",
            "cwd": "packages/riverpod_graph",
            "request": "launch",
            "type": "dart",
            "program": "bin/riverpod_graph.dart",
            "args": [
                "../../examples/todos/lib",
                "-f",
                "mermaid"
            ]
        },
freemansoft commented 1 year ago

https://joe.blog.freemansoft.com/2023/07/get-better-understanding-of-your.html