diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7dee6594a53..0b0f66c4f3f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest # strategy: # matrix: - # bench: [dep_graph_benchmark, emitter_benchmark, pipeline_benchmark] + # bench: [emitter_benchmark, pipeline_benchmark] # fail-fast: false steps: - run: echo ${{ github.event.pull_request.head.sha }} @@ -37,8 +37,8 @@ jobs: - name: Run benchmarks # args: --workspace --bench ${{ matrix.bench }} -- --save-baseline base-sha run: - cargo bench --workspace --bench dep_graph_benchmark --bench emitter_benchmark --bench - pipeline_benchmark --bench tar_benchmark -- --save-baseline head-sha + cargo bench --workspace --bench emitter_benchmark --bench pipeline_benchmark --bench + tar_benchmark -- --save-baseline head-sha # Run on base branch to get a baseline - name: Checkout base branch @@ -49,8 +49,8 @@ jobs: - name: Run benchmarks # args: --workspace --bench ${{ matrix.bench }} -- --save-baseline base-sha run: - cargo bench --workspace --bench dep_graph_benchmark --bench emitter_benchmark --bench - pipeline_benchmark --bench tar_benchmark -- --save-baseline base-sha + cargo bench --workspace --bench emitter_benchmark --bench pipeline_benchmark --bench + tar_benchmark -- --save-baseline base-sha # Compare diffs - name: Install critcmp diff --git a/crates/cli/src/app.rs b/crates/cli/src/app.rs index b38baaecf09..2eed58de202 100644 --- a/crates/cli/src/app.rs +++ b/crates/cli/src/app.rs @@ -7,7 +7,7 @@ use crate::commands::clean::CleanArgs; use crate::commands::completions::CompletionsArgs; use crate::commands::docker::DockerScaffoldArgs; use crate::commands::generate::GenerateArgs; -use crate::commands::graph::dep::DepGraphArgs; +use crate::commands::graph::action::ActionGraphArgs; use crate::commands::graph::project::ProjectGraphArgs; use crate::commands::init::InitArgs; use crate::commands::migrate::FromPackageJsonArgs; @@ -178,13 +178,22 @@ pub enum Commands { // PROJECTS + // moon action-graph [target] + #[command( + alias = "ag", + name = "action-graph", + about = "Display an interactive dependency graph of all tasks and actions." + )] + ActionGraph(ActionGraphArgs), + // moon dep-graph [target] #[command( name = "dep-graph", about = "Display an interactive dependency graph of all tasks and actions.", - alias = "dg" + alias = "dg", + hide = true )] - DepGraph(DepGraphArgs), + DepGraph(ActionGraphArgs), // moon project #[command( diff --git a/crates/cli/src/commands/graph/action.rs b/crates/cli/src/commands/graph/action.rs new file mode 100644 index 00000000000..7fe2778b092 --- /dev/null +++ b/crates/cli/src/commands/graph/action.rs @@ -0,0 +1,75 @@ +use crate::commands::graph::utils::{action_graph_repr, respond_to_request, setup_server}; +use clap::Args; +use miette::IntoDiagnostic; +use moon::{build_dep_graph, generate_project_graph}; +use moon_target::TargetLocator; +use moon_workspace::Workspace; +use starbase::{system, SystemResult}; + +#[derive(Args, Clone, Debug)] +pub struct ActionGraphArgs { + #[arg(help = "Target to *only* graph")] + target: Option, + + #[arg(long, help = "Print the graph in DOT format")] + dot: bool, + + #[arg(long, help = "Print the graph in JSON format")] + json: bool, +} + +pub async fn internal_action_graph( + args: &ActionGraphArgs, + workspace: &mut Workspace, +) -> SystemResult { + let project_graph = generate_project_graph(workspace).await?; + let mut action_graph_builder = build_dep_graph(&project_graph); + + // Focus a target and its dependencies/dependents + if let Some(locator) = args.target.clone() { + for target in action_graph_builder.run_targets_by_locator(&[locator], None)? { + action_graph_builder.run_dependents_for_target(&target)?; + } + + // Show all targets and actions + } else { + for project in project_graph.get_all_unexpanded() { + for task in project.tasks.values() { + action_graph_builder.run_target(&task.target, None)?; + } + } + } + + let action_graph = action_graph_builder.build(); + + if args.dot { + println!("{}", action_graph.to_dot()); + + return Ok(()); + } + + let graph_info = action_graph_repr(&action_graph).await; + + if args.json { + println!("{}", serde_json::to_string(&graph_info).into_diagnostic()?); + + return Ok(()); + } + + let (server, mut tera) = setup_server().await?; + let url = format!("http://{}", server.server_addr()); + let _ = open::that(&url); + + println!("Started server on {url}"); + + for req in server.incoming_requests() { + respond_to_request(req, &mut tera, &graph_info, "Action graph".to_owned())?; + } + + Ok(()) +} + +#[system] +pub async fn action_graph(args: ArgsRef, workspace: ResourceMut) { + internal_action_graph(args, workspace).await?; +} diff --git a/crates/cli/src/commands/graph/dep.rs b/crates/cli/src/commands/graph/dep.rs index 7d1921c0bbd..c1cccba5336 100644 --- a/crates/cli/src/commands/graph/dep.rs +++ b/crates/cli/src/commands/graph/dep.rs @@ -1,66 +1,15 @@ -use crate::commands::graph::utils::{dep_graph_repr, respond_to_request, setup_server}; -use clap::Args; -use miette::IntoDiagnostic; -use moon::{build_dep_graph, generate_project_graph}; -use moon_target::TargetLocator; +use super::action::*; +use moon_common::color; use moon_workspace::Workspace; use starbase::system; - -#[derive(Args, Clone, Debug)] -pub struct DepGraphArgs { - #[arg(help = "Target to *only* graph")] - target: Option, - - #[arg(long, help = "Print the graph in DOT format")] - dot: bool, - - #[arg(long, help = "Print the graph in JSON format")] - json: bool, -} +use tracing::warn; #[system] -pub async fn dep_graph(args: ArgsRef, workspace: ResourceMut) { - let project_graph = generate_project_graph(workspace).await?; - let mut dep_builder = build_dep_graph(&project_graph); - - // Focus a target and its dependencies/dependents - if let Some(locator) = args.target.clone() { - for target in dep_builder.run_targets_by_locator(&[locator], None)? { - dep_builder.run_dependents_for_target(&target)?; - } - - // Show all targets and actions - } else { - for project in project_graph.get_all_unexpanded() { - for task in project.tasks.values() { - dep_builder.run_target(&task.target, None)?; - } - } - } - - let dep_graph = dep_builder.build(); - - if args.dot { - println!("{}", dep_graph.to_dot()); - - return Ok(()); - } - - let graph_info = dep_graph_repr(&dep_graph).await; - - if args.json { - println!("{}", serde_json::to_string(&graph_info).into_diagnostic()?); - - return Ok(()); - } - - let (server, mut tera) = setup_server().await?; - let url = format!("http://{}", server.server_addr()); - let _ = open::that(&url); - - println!("Started server on {url}"); +pub async fn dep_graph(args: ArgsRef, workspace: ResourceMut) { + warn!( + "This command is deprecated. Use {} instead.", + color::shell("moon action-graph") + ); - for req in server.incoming_requests() { - respond_to_request(req, &mut tera, &graph_info, "Dependency graph".to_owned())?; - } + internal_action_graph(args, workspace).await?; } diff --git a/crates/cli/src/commands/graph/mod.rs b/crates/cli/src/commands/graph/mod.rs index c10e3a5284b..b441f32da5e 100644 --- a/crates/cli/src/commands/graph/mod.rs +++ b/crates/cli/src/commands/graph/mod.rs @@ -1,3 +1,4 @@ +pub mod action; pub mod dep; mod dto; pub mod project; diff --git a/crates/cli/src/commands/graph/utils.rs b/crates/cli/src/commands/graph/utils.rs index ea1eaf715af..ae858905abd 100644 --- a/crates/cli/src/commands/graph/utils.rs +++ b/crates/cli/src/commands/graph/utils.rs @@ -84,7 +84,7 @@ pub async fn project_graph_repr(project_graph: &ProjectGraph) -> GraphInfoDto { } /// Get a serialized representation of the dependency graph. -pub async fn dep_graph_repr(dep_graph: &DepGraph) -> GraphInfoDto { +pub async fn action_graph_repr(dep_graph: &DepGraph) -> GraphInfoDto { let labeled_graph = dep_graph.labeled_graph(); extract_nodes_and_edges_from_graph(&labeled_graph, false) } diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index dc23eb7d190..87bc399194b 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -15,7 +15,7 @@ use crate::commands::clean::clean; use crate::commands::completions; use crate::commands::docker; use crate::commands::generate::generate; -use crate::commands::graph::{dep::dep_graph, project::project_graph}; +use crate::commands::graph::{action::action_graph, dep::dep_graph, project::project_graph}; use crate::commands::init::init; use crate::commands::migrate; use crate::commands::node; @@ -138,6 +138,7 @@ pub async fn run_cli() -> AppResult { app.startup(systems::load_workspace); match cli.command { + Commands::ActionGraph(args) => app.execute_with_args(action_graph, args), Commands::Bin(args) => app.execute_with_args(bin, args), Commands::Ci(args) => { app.execute(systems::check_for_new_version); diff --git a/crates/cli/tests/action_graph_test.rs b/crates/cli/tests/action_graph_test.rs new file mode 100644 index 00000000000..897032ae97d --- /dev/null +++ b/crates/cli/tests/action_graph_test.rs @@ -0,0 +1,164 @@ +use moon_test_utils::{ + assert_snapshot, create_sandbox_with_config, get_project_graph_aliases_fixture_configs, + get_tasks_fixture_configs, +}; + +mod action_graph { + use super::*; + + #[test] + fn all_by_default() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("action-graph").arg("--dot"); + }); + + let dot = assert.output(); + + // Snapshot is not deterministic + assert_eq!(dot.split('\n').count(), 568); + } + + #[test] + fn focused_by_target() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("ag").arg("--dot").arg("basic:lint"); + }); + + assert_snapshot!(assert.output()); + } + + #[test] + fn focused_by_task_in_cwd() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("action-graph").arg("--dot").arg("lint"); + cmd.current_dir(sandbox.path().join("basic")); + }); + + assert_snapshot!(assert.output()); + } + + #[test] + fn includes_dependencies_when_focused() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("action-graph").arg("--dot").arg("chain:e"); + }); + + assert_snapshot!(assert.output()); + } + + #[test] + fn includes_dependents_when_focused() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("action-graph").arg("--dot").arg("basic:build"); + }); + + assert_snapshot!(assert.output()); + } + + #[test] + fn outputs_json() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("action-graph").arg("--json").arg("basic:lint"); + }); + + assert_snapshot!(assert.output()); + } + + mod aliases { + use super::*; + + #[test] + fn can_focus_using_an_alias() { + let (workspace_config, toolchain_config, tasks_config) = + get_project_graph_aliases_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "project-graph/aliases", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("action-graph") + .arg("--dot") + .arg("@scope/pkg-foo:test"); + }); + + assert_snapshot!(assert.output()); + } + + #[test] + fn resolves_aliases_in_task_deps() { + let (workspace_config, toolchain_config, tasks_config) = + get_project_graph_aliases_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "project-graph/aliases", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("action-graph").arg("--dot").arg("node:aliasDeps"); + }); + + assert_snapshot!(assert.output()); + } + } +} diff --git a/crates/cli/tests/dep_graph_test.rs b/crates/cli/tests/dep_graph_test.rs deleted file mode 100644 index b4cc902b775..00000000000 --- a/crates/cli/tests/dep_graph_test.rs +++ /dev/null @@ -1,158 +0,0 @@ -use moon_test_utils::{ - assert_snapshot, create_sandbox_with_config, get_project_graph_aliases_fixture_configs, - get_tasks_fixture_configs, -}; - -#[test] -fn all_by_default() { - let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "tasks", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--dot"); - }); - - let dot = assert.output(); - - // Snapshot is not deterministic - assert_eq!(dot.split('\n').count(), 568); -} - -#[test] -fn focused_by_target() { - let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "tasks", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--dot").arg("basic:lint"); - }); - - assert_snapshot!(assert.output()); -} - -#[test] -fn focused_by_task_in_cwd() { - let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "tasks", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--dot").arg("lint"); - cmd.current_dir(sandbox.path().join("basic")); - }); - - assert_snapshot!(assert.output()); -} - -#[test] -fn includes_dependencies_when_focused() { - let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "tasks", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--dot").arg("chain:e"); - }); - - assert_snapshot!(assert.output()); -} - -#[test] -fn includes_dependents_when_focused() { - let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "tasks", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--dot").arg("basic:build"); - }); - - assert_snapshot!(assert.output()); -} - -#[test] -fn outputs_json() { - let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "tasks", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--json").arg("basic:lint"); - }); - - assert_snapshot!(assert.output()); -} - -mod aliases { - use super::*; - - #[test] - fn can_focus_using_an_alias() { - let (workspace_config, toolchain_config, tasks_config) = - get_project_graph_aliases_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "project-graph/aliases", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--dot").arg("@scope/pkg-foo:test"); - }); - - assert_snapshot!(assert.output()); - } - - #[test] - fn resolves_aliases_in_task_deps() { - let (workspace_config, toolchain_config, tasks_config) = - get_project_graph_aliases_fixture_configs(); - - let sandbox = create_sandbox_with_config( - "project-graph/aliases", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); - - let assert = sandbox.run_moon(|cmd| { - cmd.arg("dep-graph").arg("--dot").arg("node:aliasDeps"); - }); - - assert_snapshot!(assert.output()); - } -} diff --git a/crates/cli/tests/snapshots/dep_graph_test__aliases__can_focus_using_an_alias.snap b/crates/cli/tests/snapshots/action_graph_test__action_graph__aliases__can_focus_using_an_alias.snap similarity index 96% rename from crates/cli/tests/snapshots/dep_graph_test__aliases__can_focus_using_an_alias.snap rename to crates/cli/tests/snapshots/action_graph_test__action_graph__aliases__can_focus_using_an_alias.snap index f44262d50d1..ca6462de586 100644 --- a/crates/cli/tests/snapshots/dep_graph_test__aliases__can_focus_using_an_alias.snap +++ b/crates/cli/tests/snapshots/action_graph_test__action_graph__aliases__can_focus_using_an_alias.snap @@ -1,5 +1,5 @@ --- -source: crates/cli/tests/dep_graph_test.rs +source: crates/cli/tests/action_graph_test.rs expression: assert.output() --- digraph { diff --git a/crates/cli/tests/snapshots/dep_graph_test__aliases__resolves_aliases_in_task_deps.snap b/crates/cli/tests/snapshots/action_graph_test__action_graph__aliases__resolves_aliases_in_task_deps.snap similarity index 97% rename from crates/cli/tests/snapshots/dep_graph_test__aliases__resolves_aliases_in_task_deps.snap rename to crates/cli/tests/snapshots/action_graph_test__action_graph__aliases__resolves_aliases_in_task_deps.snap index d186394e820..48d5317a03a 100644 --- a/crates/cli/tests/snapshots/dep_graph_test__aliases__resolves_aliases_in_task_deps.snap +++ b/crates/cli/tests/snapshots/action_graph_test__action_graph__aliases__resolves_aliases_in_task_deps.snap @@ -1,5 +1,5 @@ --- -source: crates/cli/tests/dep_graph_test.rs +source: crates/cli/tests/action_graph_test.rs expression: assert.output() --- digraph { diff --git a/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap b/crates/cli/tests/snapshots/action_graph_test__action_graph__focused_by_target.snap similarity index 93% rename from crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap rename to crates/cli/tests/snapshots/action_graph_test__action_graph__focused_by_target.snap index 97327f0d549..83966a2ce42 100644 --- a/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap +++ b/crates/cli/tests/snapshots/action_graph_test__action_graph__focused_by_target.snap @@ -1,5 +1,5 @@ --- -source: crates/cli/tests/dep_graph_test.rs +source: crates/cli/tests/action_graph_test.rs expression: assert.output() --- digraph { diff --git a/crates/cli/tests/snapshots/dep_graph_test__focused_by_target.snap b/crates/cli/tests/snapshots/action_graph_test__action_graph__focused_by_task_in_cwd.snap similarity index 93% rename from crates/cli/tests/snapshots/dep_graph_test__focused_by_target.snap rename to crates/cli/tests/snapshots/action_graph_test__action_graph__focused_by_task_in_cwd.snap index 97327f0d549..83966a2ce42 100644 --- a/crates/cli/tests/snapshots/dep_graph_test__focused_by_target.snap +++ b/crates/cli/tests/snapshots/action_graph_test__action_graph__focused_by_task_in_cwd.snap @@ -1,5 +1,5 @@ --- -source: crates/cli/tests/dep_graph_test.rs +source: crates/cli/tests/action_graph_test.rs expression: assert.output() --- digraph { diff --git a/crates/cli/tests/snapshots/dep_graph_test__includes_dependencies_when_focused.snap b/crates/cli/tests/snapshots/action_graph_test__action_graph__includes_dependencies_when_focused.snap similarity index 95% rename from crates/cli/tests/snapshots/dep_graph_test__includes_dependencies_when_focused.snap rename to crates/cli/tests/snapshots/action_graph_test__action_graph__includes_dependencies_when_focused.snap index 3dd11d10b8c..98dcdfe1ac2 100644 --- a/crates/cli/tests/snapshots/dep_graph_test__includes_dependencies_when_focused.snap +++ b/crates/cli/tests/snapshots/action_graph_test__action_graph__includes_dependencies_when_focused.snap @@ -1,5 +1,5 @@ --- -source: crates/cli/tests/dep_graph_test.rs +source: crates/cli/tests/action_graph_test.rs expression: assert.output() --- digraph { diff --git a/crates/cli/tests/snapshots/dep_graph_test__includes_dependents_when_focused.snap b/crates/cli/tests/snapshots/action_graph_test__action_graph__includes_dependents_when_focused.snap similarity index 97% rename from crates/cli/tests/snapshots/dep_graph_test__includes_dependents_when_focused.snap rename to crates/cli/tests/snapshots/action_graph_test__action_graph__includes_dependents_when_focused.snap index e0cf39256be..12f095418da 100644 --- a/crates/cli/tests/snapshots/dep_graph_test__includes_dependents_when_focused.snap +++ b/crates/cli/tests/snapshots/action_graph_test__action_graph__includes_dependents_when_focused.snap @@ -1,5 +1,5 @@ --- -source: crates/cli/tests/dep_graph_test.rs +source: crates/cli/tests/action_graph_test.rs expression: assert.output() --- digraph { diff --git a/crates/cli/tests/snapshots/dep_graph_test__outputs_json.snap b/crates/cli/tests/snapshots/action_graph_test__action_graph__outputs_json.snap similarity index 90% rename from crates/cli/tests/snapshots/dep_graph_test__outputs_json.snap rename to crates/cli/tests/snapshots/action_graph_test__action_graph__outputs_json.snap index 5758c460cc9..534f5387238 100644 --- a/crates/cli/tests/snapshots/dep_graph_test__outputs_json.snap +++ b/crates/cli/tests/snapshots/action_graph_test__action_graph__outputs_json.snap @@ -1,5 +1,5 @@ --- -source: crates/cli/tests/dep_graph_test.rs +source: crates/cli/tests/action_graph_test.rs expression: assert.output() --- {"nodes":[{"id":2,"label":"InstallNodeDeps(18.0.0)"},{"id":4,"label":"RunTarget(basic:lint)"},{"id":1,"label":"SetupNodeTool(18.0.0)"},{"id":3,"label":"SyncNodeProject(basic)"}],"edges":[{"id":"2 -> 1","label":"","source":2,"target":1},{"id":"3 -> 1","label":"","source":3,"target":1},{"id":"4 -> 2","label":"","source":4,"target":2},{"id":"4 -> 3","label":"","source":4,"target":3}]} diff --git a/website/blog/2022-12-19_v0.21.mdx b/website/blog/2022-12-19_v0.21.mdx index d44c09c073a..0351aded720 100644 --- a/website/blog/2022-12-19_v0.21.mdx +++ b/website/blog/2022-12-19_v0.21.mdx @@ -84,7 +84,7 @@ tasks: Thanks to the amazing contribution from [Diptesh Choudhuri](https://github.com/IgnisDa), we now have interactive project and dependency graphs when running the [`moon project-graph`](../docs/commands/project-graph) and -[`moon dep-graph`](../docs/commands/dep-graph) commands respectively. +[`moon dep-graph`](../docs/commands/action-graph) commands respectively. This is only the first iteration of these graphs. Expect more advanced features in the future, like filtering, node/edge inspection, exporting, and more! diff --git a/website/docs/commands/dep-graph.mdx b/website/docs/commands/action-graph.mdx similarity index 70% rename from website/docs/commands/dep-graph.mdx rename to website/docs/commands/action-graph.mdx index 7ed5439c1eb..bc4e517d171 100644 --- a/website/docs/commands/dep-graph.mdx +++ b/website/docs/commands/action-graph.mdx @@ -1,21 +1,22 @@ --- -title: dep-graph +title: action-graph --- -The `moon dep-graph [target]` (or `moon dg`) command will generate and serve a visual dependency -graph of all actions, targets, and tasks within the workspace, and can also output the graph in -[Graphviz DOT format](https://graphviz.org/doc/info/lang.html). +The `moon action-graph [target]` (or `moon ag`) command will generate and serve a visual graph of +all actions and tasks within the workspace, known as the +[action graph](../how-it-works/action-graph). In other tools, this is sometimes referred to as a +dependency graph or task graph. ```shell # Run the visualizer locally -$ moon dep-graph +$ moon action-graph # Export to DOT format -$ moon dep-graph --dot > graph.dot +$ moon action-graph --dot > graph.dot ``` > A target can be passed to focus the graph, including dependencies _and_ dependents. For example, -> `moon dep-graph app:build`. +> `moon action-graph app:build`. ### Arguments diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index aa683167fb3..e33332855d9 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -215,6 +215,10 @@ const config = { from: '/docs/how-it-works/dep-graph', to: '/docs/how-it-works/action-graph', }, + { + from: '/docs/commands/dep-graph', + to: '/docs/commands/action-graph', + }, { from: '/docs/config/global-project', to: '/docs/config/tasks', diff --git a/website/sidebars.js b/website/sidebars.js index d9cfca902b6..346a5822d06 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -21,8 +21,10 @@ const sidebars = { 'mental-model', 'languages', 'project-graph', + 'action-graph', 'dep-graph', 'dependency-graph', + 'task-graph', ], }, }, @@ -97,12 +99,12 @@ const sidebars = { label: 'Commands', items: [ 'commands/overview', + 'commands/action-graph', 'commands/bin', 'commands/ci', 'commands/check', 'commands/clean', 'commands/completions', - 'commands/dep-graph', { type: 'category', label: 'docker',