diff --git a/dep-graph/client/src/app/sidebar/sidebar.tsx b/dep-graph/client/src/app/sidebar/sidebar.tsx index b2e11d79f1..8e932a4a38 100644 --- a/dep-graph/client/src/app/sidebar/sidebar.tsx +++ b/dep-graph/client/src/app/sidebar/sidebar.tsx @@ -103,7 +103,7 @@ export function Sidebar() {
nx dep-graph+
nx graph
# see what's been affected by changes -nx affected:dep-graph +nx affected:graph # run tests for current changes nx affected:test diff --git a/packages/next/src/generators/application/lib/create-application-files.helpers.ts b/packages/next/src/generators/application/lib/create-application-files.helpers.ts index 4cfe5ff453..6150fb1908 100644 --- a/packages/next/src/generators/application/lib/create-application-files.helpers.ts +++ b/packages/next/src/generators/application/lib/create-application-files.helpers.ts @@ -352,9 +352,9 @@ export function createAppJsx(name: string) { d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" /> - View interactive dependency graph + View interactive project graph -nx dep-graph+nx graph
# see what's been affected by changes
- nx affected:dep-graph
+ nx affected:graph
# run tests for current changes
nx affected:test
# run e2e tests for current changes
diff --git a/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template b/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template
index cecd30c78e..d039996946 100644
--- a/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template
+++ b/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template
@@ -298,13 +298,13 @@ const App = () => {
- View interactive dependency graph
+ View interactive project graph
- nx dep-graph
+ nx graph
@@ -324,7 +324,7 @@ const App = () => {
styles.marginBottomMd,
]}
>
- nx affected:dep-graph
+ nx affected:graph
# run tests for current changes
diff --git a/packages/react/src/generators/application/files/common/src/app/nx-welcome.tsx b/packages/react/src/generators/application/files/common/src/app/nx-welcome.tsx
index 914eaabfbc..6278272a11 100644
--- a/packages/react/src/generators/application/files/common/src/app/nx-welcome.tsx
+++ b/packages/react/src/generators/application/files/common/src/app/nx-welcome.tsx
@@ -763,9 +763,9 @@ export function NxWelcome({ title }: { title: string }) {
d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
/>
- View interactive dependency graph
+ View interactive project graph
- nx dep-graph
+ nx graph
# see what's been affected by changes
- nx affected:dep-graph
+ nx affected:graph
# run tests for current changes
nx affected:test
# run e2e tests for current changes
diff --git a/packages/tao/src/shared/workspace.ts b/packages/tao/src/shared/workspace.ts
index 0a25bb07a6..f270f87f5e 100644
--- a/packages/tao/src/shared/workspace.ts
+++ b/packages/tao/src/shared/workspace.ts
@@ -97,7 +97,7 @@ export interface ProjectConfiguration {
implicitDependencies?: string[];
/**
- * List of tags used by nx-enforce-module-boundaries / dep-graph
+ * List of tags used by nx-enforce-module-boundaries / project graph
*/
tags?: string[];
}
diff --git a/packages/web/src/generators/application/files/app/src/app/app.element.ts__tmpl__ b/packages/web/src/generators/application/files/app/src/app/app.element.ts__tmpl__
index 0ccf6a8920..3066f1f7f2 100644
--- a/packages/web/src/generators/application/files/app/src/app/app.element.ts__tmpl__
+++ b/packages/web/src/generators/application/files/app/src/app/app.element.ts__tmpl__
@@ -329,9 +329,9 @@ nx g @nrwl/angular:component button --project ui
d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
/>
- View interactive dependency graph
+ View interactive project graph
- nx dep-graph+
nx graph
# see what's been affected by changes -nx affected:dep-graph +nx affected:graph # run tests for current changes nx affected:test diff --git a/packages/workspace/docs/run-commands-examples.md b/packages/workspace/docs/run-commands-examples.md index be94e0208c..372b433b4b 100644 --- a/packages/workspace/docs/run-commands-examples.md +++ b/packages/workspace/docs/run-commands-examples.md @@ -122,7 +122,7 @@ The above commands will finish immediately, instead of waiting for 5 seconds. ##### Nx Affected -The true power of `run-commands` comes from the fact that it runs through `nx`, which knows about your dependency graph. So you can run **custom commands** only for the projects that have been affected by a change. +The true power of `run-commands` comes from the fact that it runs through `nx`, which knows about your project graph. So you can run **custom commands** only for the projects that have been affected by a change. We can create some configurations to generate docs, and if run using `nx affected`, it will only generate documentation for the projects that have been changed: diff --git a/packages/workspace/src/command-line/affected.ts b/packages/workspace/src/command-line/affected.ts index e96614c1eb..480ace04aa 100644 --- a/packages/workspace/src/command-line/affected.ts +++ b/packages/workspace/src/command-line/affected.ts @@ -24,7 +24,7 @@ import { performance } from 'perf_hooks'; import type { Environment } from '../core/shared-interfaces'; export async function affected( - command: 'apps' | 'libs' | 'dep-graph' | 'print-affected' | 'affected', + command: 'apps' | 'libs' | 'graph' | 'print-affected' | 'affected', parsedArgs: yargs.Arguments & RawNxArgs ): Promise{ performance.mark('command-execution-begins'); @@ -78,7 +78,7 @@ export async function affected( } break; - case 'dep-graph': + case 'graph': const projectNames = filteredProjects.map((p) => p.name); await generateGraph(parsedArgs as any, projectNames); break; diff --git a/packages/workspace/src/command-line/dep-graph.ts b/packages/workspace/src/command-line/dep-graph.ts index 1bdb68c8df..3c514f5210 100644 --- a/packages/workspace/src/command-line/dep-graph.ts +++ b/packages/workspace/src/command-line/dep-graph.ts @@ -370,7 +370,7 @@ async function startServer( app.listen(port, host); output.note({ - title: `Dep graph started at http://${host}:${port}`, + title: `Project graph started at http://${host}:${port}`, }); if (openBrowser) { @@ -416,7 +416,7 @@ function getIgnoredGlobs(root: string) { function startWatcher() { createFileWatcher(appRootPath, async () => { - output.note({ title: 'Recalculating dependency graph...' }); + output.note({ title: 'Recalculating project graph...' }); const newGraphClientResponse = await createDepGraphClientResponse(); @@ -467,12 +467,12 @@ function createFileWatcher(root: string, changeHandler: () => Promise ) { } async function createDepGraphClientResponse(): Promise { - performance.mark('dep graph watch calculation:start'); + performance.mark('project graph watch calculation:start'); await defaultFileHasher.init(); let graph = pruneExternalNodes(await createProjectGraphAsync()); - performance.mark('dep graph watch calculation:end'); - performance.mark('dep graph response generation:start'); + performance.mark('project graph watch calculation:end'); + performance.mark('project graph response generation:start'); const layout = workspaceLayout(); const projects: ProjectGraphProjectNode[] = Object.values(graph.nodes).map( @@ -495,18 +495,18 @@ async function createDepGraphClientResponse(): Promise { const hash = hasher.digest('hex'); - performance.mark('dep graph response generation:end'); + performance.mark('project graph response generation:end'); performance.measure( - 'dep graph watch calculation', - 'dep graph watch calculation:start', - 'dep graph watch calculation:end' + 'project graph watch calculation', + 'project graph watch calculation:start', + 'project graph watch calculation:end' ); performance.measure( - 'dep graph response generation', - 'dep graph response generation:start', - 'dep graph response generation:end' + 'project graph response generation', + 'project graph response generation:start', + 'project graph response generation:end' ); return { diff --git a/packages/workspace/src/command-line/examples.ts b/packages/workspace/src/command-line/examples.ts index 527c74c721..8fba4c4db7 100644 --- a/packages/workspace/src/command-line/examples.ts +++ b/packages/workspace/src/command-line/examples.ts @@ -8,7 +8,7 @@ export const examples: Record = { { command: 'print-affected', description: - 'Print information about affected projects and the dependency graph', + 'Print information about affected projects and the project graph', }, { command: 'print-affected --base=main --head=HEAD', @@ -196,74 +196,74 @@ export const examples: Record = { ], 'format:write': [], 'format:check': [], - 'dep-graph': [ + graph: [ { - command: 'dep-graph', - description: 'Open the dep graph of the workspace in the browser', + command: 'graph', + description: 'Open the project graph of the workspace in the browser', }, { - command: 'dep-graph --file=output.json', - description: 'Save the dep graph into a json file', + command: 'graph --file=output.json', + description: 'Save the project graph into a json file', }, { - command: 'dep-graph --file=output.html', + command: 'graph --file=output.html', description: - 'Generate a static website with dep graph into an html file, accompanied by an asset folder called static', + 'Generate a static website with project graph into an html file, accompanied by an asset folder called static', }, { - command: 'dep-graph --focus=todos-feature-main', + command: 'graph --focus=todos-feature-main', description: 'Show the graph where every node is either an ancestor or a descendant of todos-feature-main', }, { - command: 'dep-graph --include=project-one,project-two', - description: 'Include project-one and project-two in the dep graph', + command: 'graph --include=project-one,project-two', + description: 'Include project-one and project-two in the project graph', }, { - command: 'dep-graph --exclude=project-one,project-two', - description: 'Exclude project-one and project-two from the dep graph', + command: 'graph --exclude=project-one,project-two', + description: 'Exclude project-one and project-two from the project graph', }, { command: - 'dep-graph --focus=todos-feature-main --exclude=project-one,project-two', + 'graph --focus=todos-feature-main --exclude=project-one,project-two', description: 'Show the graph where every node is either an ancestor or a descendant of todos-feature-main, but exclude project-one and project-two', }, { - command: 'dep-graph --watch', - description: 'Watch for changes to dep graph and update in-browser', + command: 'graph --watch', + description: 'Watch for changes to project graph and update in-browser', }, ], - 'affected:dep-graph': [ + 'affected:graph': [ { - command: 'affected:dep-graph --files=libs/mylib/src/index.ts', + command: 'affected:graph --files=libs/mylib/src/index.ts', description: - 'Open the dep graph of the workspace in the browser, and highlight the projects affected by changing the index.ts file', + 'Open the project graph of the workspace in the browser, and highlight the projects affected by changing the index.ts file', }, { - command: 'affected:dep-graph --base=main --head=HEAD', + command: 'affected:graph --base=main --head=HEAD', description: - 'Open the dep graph of the workspace in the browser, and highlight the projects affected by the changes between main and HEAD (e.g., PR)', + 'Open the project graph of the workspace in the browser, and highlight the projects affected by the changes between main and HEAD (e.g., PR)', }, { - command: 'affected:dep-graph --base=main --head=HEAD --file=output.json', + command: 'affected:graph --base=main --head=HEAD --file=output.json', description: - 'Save the dep graph of the workspace in a json file, and highlight the projects affected by the changes between main and HEAD (e.g., PR)', + 'Save the project graph of the workspace in a json file, and highlight the projects affected by the changes between main and HEAD (e.g., PR)', }, { - command: 'affected:dep-graph --base=main --head=HEAD --file=output.html', + command: 'affected:graph --base=main --head=HEAD --file=output.html', description: - 'Generate a static website with dep graph data in an html file, highlighting the projects affected by the changes between main and HEAD (e.g., PR)', + 'Generate a static website with project graph data in an html file, highlighting the projects affected by the changes between main and HEAD (e.g., PR)', }, { - command: 'affected:dep-graph --base=main~1 --head=main', + command: 'affected:graph --base=main~1 --head=main', description: - 'Open the dep graph of the workspace in the browser, and highlight the projects affected by the last commit on main', + 'Open the project graph of the workspace in the browser, and highlight the projects affected by the last commit on main', }, { - command: 'affected:dep-graph --exclude=project-one,project-two', + command: 'affected:graph --exclude=project-one,project-two', description: - 'Open the dep graph of the workspace in the browser, highlight the projects affected, but exclude project-one and project-two', + 'Open the project graph of the workspace in the browser, highlight the projects affected, but exclude project-one and project-two', }, ], 'workspace-generator': [], diff --git a/packages/workspace/src/command-line/nx-commands.ts b/packages/workspace/src/command-line/nx-commands.ts index 487c51df2f..59e207cc99 100644 --- a/packages/workspace/src/command-line/nx-commands.ts +++ b/packages/workspace/src/command-line/nx-commands.ts @@ -150,19 +150,22 @@ ${daemonHelpOutput} target: 'e2e', }) ) - .command( - 'affected:dep-graph', - chalk.bold('Graph dependencies affected by changes'), - (yargs) => + .command({ + command: 'affected:graph', + describe: chalk.bold( + 'Graph dependencies affected by changes. Alias: affected:dep-graph' + ), + aliases: ['affected:dep-graph'], + builder: (yargs) => linkToNxDevAndExamples( withAffectedOptions(withDepGraphOptions(yargs)), - 'affected:dep-graph' + 'affected:graph' ), - async (args) => - (await import('./affected')).affected('dep-graph', { + handler: async (args) => + (await import('./affected')).affected('graph', { ...args, - }) - ) + }), + }) .command( 'print-affected', chalk.bold( @@ -207,12 +210,17 @@ npx nx daemon async (args) => (await import('./daemon')).daemonHandler(args) ) - .command( - 'dep-graph', - chalk.bold('Graph dependencies within workspace'), - (yargs) => linkToNxDevAndExamples(withDepGraphOptions(yargs), 'dep-graph'), - async (args) => (await import('./dep-graph')).generateGraph(args as any, []) - ) + .command({ + command: 'graph', + describe: chalk.bold( + 'Graph dependencies within workspace. Alias: dep-graph' + ), + aliases: ['dep-graph'], + builder: (yargs) => + linkToNxDevAndExamples(withDepGraphOptions(yargs), 'dep-graph'), + handler: async (args) => + (await import('./dep-graph')).generateGraph(args as any, []), + }) .command( 'format:check', @@ -517,34 +525,34 @@ function withDepGraphOptions(yargs: yargs.Argv): yargs.Argv { }) .option('focus', { describe: - 'Use to show the dependency graph for a particular project and every node that is either an ancestor or a descendant.', + 'Use to show the project graph for a particular project and every node that is either an ancestor or a descendant.', type: 'string', }) .option('exclude', { describe: - 'List of projects delimited by commas to exclude from the dependency graph.', + 'List of projects delimited by commas to exclude from the project graph.', type: 'array', coerce: parseCSV, }) .option('groupByFolder', { - describe: 'Group projects by folder in the dependency graph', + describe: 'Group projects by folder in the project graph', type: 'boolean', }) .option('host', { - describe: 'Bind the dependency graph server to a specific ip address.', + describe: 'Bind the project graph server to a specific ip address.', type: 'string', }) .option('port', { - describe: 'Bind the dependency graph server to a specific port.', + describe: 'Bind the project graph server to a specific port.', type: 'number', }) .option('watch', { - describe: 'Watch for changes to dependency graph and update in-browser', + describe: 'Watch for changes to project graph and update in-browser', type: 'boolean', default: false, }) .option('open', { - describe: 'Open the dependency graph in the browser.', + describe: 'Open the project graph in the browser.', type: 'boolean', default: true, }); diff --git a/packages/workspace/src/command-line/supported-nx-commands.ts b/packages/workspace/src/command-line/supported-nx-commands.ts index 527abc8765..38265bf8ec 100644 --- a/packages/workspace/src/command-line/supported-nx-commands.ts +++ b/packages/workspace/src/command-line/supported-nx-commands.ts @@ -6,10 +6,12 @@ export const supportedNxCommands: string[] = [ 'affected:test', 'affected:e2e', 'affected:dep-graph', + 'affected:graph', 'affected:lint', 'print-affected', 'daemon', 'dep-graph', + 'graph', 'format', 'format:check', 'format:write', diff --git a/packages/workspace/src/generators/init/init.ts b/packages/workspace/src/generators/init/init.ts index b181f86ad9..cf7bc2f829 100755 --- a/packages/workspace/src/generators/init/init.ts +++ b/packages/workspace/src/generators/init/init.ts @@ -46,7 +46,7 @@ function updatePackageJson(tree) { 'affected:e2e': 'nx affected:e2e', 'affected:test': 'nx affected:test', 'affected:lint': 'nx affected:lint', - 'affected:dep-graph': 'nx affected:dep-graph', + 'affected:graph': 'nx affected:graph', affected: 'nx affected', format: 'nx format:write', 'format:write': 'nx format:write', @@ -54,7 +54,7 @@ function updatePackageJson(tree) { update: 'ng update @nrwl/workspace', 'update:check': 'ng update', lint: 'nx workspace-lint && ng lint', - 'dep-graph': 'nx dep-graph', + graph: 'nx graph', 'workspace-schematic': 'nx workspace-schematic', help: 'nx help', }; diff --git a/packages/workspace/src/generators/workspace/files/README.md__tmpl__ b/packages/workspace/src/generators/workspace/files/README.md__tmpl__ index 2abd4d1f38..3ffd22504a 100644 --- a/packages/workspace/src/generators/workspace/files/README.md__tmpl__ +++ b/packages/workspace/src/generators/workspace/files/README.md__tmpl__ @@ -81,7 +81,7 @@ Run `nx affected:e2e` to execute the end-to-end tests affected by a change. ## Understand your workspace -Run `nx dep-graph` to see a diagram of the dependencies of your projects. +Run `nx graph` to see a diagram of the dependencies of your projects. ## Further help @@ -165,7 +165,7 @@ Run `nx affected:e2e` to execute the end-to-end tests affected by a change. ## Understand your workspace -Run `nx dep-graph` to see a diagram of the dependencies of your projects. +Run `nx graph` to see a diagram of the dependencies of your projects. ## Further help diff --git a/scripts/copy-dep-graph-environment.ts b/scripts/copy-dep-graph-environment.ts index c457038f31..00e60a7386 100644 --- a/scripts/copy-dep-graph-environment.ts +++ b/scripts/copy-dep-graph-environment.ts @@ -4,7 +4,7 @@ import { argv } from 'yargs'; type Mode = 'dev' | 'watch'; const mode = argv._[0]; -console.log(`Setting up dep-graph for ${mode}`); +console.log(`Setting up graph for ${mode}`); copyFileSync( `dep-graph/client/src/assets/environment.${mode}.js`,