does deno_graph natively resolve the path of workspaces?
Hi everyone,
I'm working on a project that includes multiple workspace members defined in my deno.json file using the workspaces field. I'm using deno_graph to resolve dependencies, but I noticed that while it allows specifying an import_map, there's no option to include the deno.json file directly.
Does deno_graph natively understand and resolve workspaces specified in deno.json? If so, how can I configure it to resolve dependencies across all workspace members? If not, what would be the recommended approach to handle dependencies in a multi-workspace setup using deno_graph?
Any guidance would be greatly appreciated!
reference:
deno_grpah
jsr
Thank you.
5 Replies
@bartlomieju @kitsonk @dsherret Any solution? Please help
deno_graph doesn't understand workspaces. You need to use deno_config to resolve workspace members
is this correct i asked in ai in deno docs website?
To configure a Deno workspace that can be resolved using the Deno graph, you need to set up a
deno.json
file at the root of your workspace. This file should define the workspace members and any necessary imports.
Here’s an example of how your deno.json
file might look:
In this configuration, the workspace
key specifies the directories that contain your workspace members, such as add
and subtract
. The imports
key allows you to define any external dependencies that your workspace will use.
Each workspace member can also have its own deno.json
file. For example, in the add
directory, you might have:
This setup allows you to reference the workspace members using bare specifiers in your code. For instance, in your main.ts
file, you can import the functions from the workspace members like this:
To visualize the dependencies and how they connect within your workspace, you can use the Deno graph command:
This command will generate a graph of your module dependencies, showing how everything is interconnected within your workspace. It provides a clear view of the relationships between your modules and their imports.It is until the
deno graph
subcommand. There's no such commandok