Skip to content

Commit

Permalink
feat(graph): update graph lib to latest nx graph
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Jan 27, 2025
1 parent 82c4e17 commit 3ea1732
Show file tree
Hide file tree
Showing 45 changed files with 70 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ErrorToastUI,
ExpandedTargetsProvider,
getExternalApiService,
} from '@nx/graph/shared';
} from '@nx/graph/legacy';
import { useSelector } from '@xstate/react';
import { useCallback } from 'react';
import { Interpreter } from 'xstate';
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/external-api-impl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExternalApi, getExternalApiService } from '@nx/graph/shared';
import { ExternalApi, getExternalApiService } from '@nx/graph/legacy';
import { getRouter } from './get-router';
import { getProjectGraphService } from './machines/get-services';
import { getGraphService } from './machines/graph.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const compositeGraphStateConfig: ProjectGraphStateNodeConfig = {
dependencies: ctx.dependencies,
fileMap: ctx.fileMap,
affectedProjects: ctx.affectedProjects,
touchedProjects: [],
workspaceLayout: ctx.workspaceLayout,
groupByFolder: ctx.groupByFolder,
selectedProjects: ctx.selectedProjects,
Expand All @@ -36,6 +37,7 @@ export const compositeGraphStateConfig: ProjectGraphStateNodeConfig = {
dependencies: ctx.dependencies,
fileMap: ctx.fileMap,
affectedProjects: ctx.affectedProjects,
touchedProjects: [],
workspaceLayout: ctx.workspaceLayout,
groupByFolder: ctx.groupByFolder,
selectedProjects: ctx.selectedProjects,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const projectGraphMachine = createMachine<
dependencies: ctx.dependencies,
fileMap: ctx.fileMap,
affectedProjects: ctx.affectedProjects,
touchedProjects: [],
workspaceLayout: ctx.workspaceLayout,
groupByFolder: ctx.groupByFolder,
collapseEdges: ctx.collapseEdges,
Expand Down Expand Up @@ -150,6 +151,7 @@ export const projectGraphMachine = createMachine<
projects: ctx.projects,
dependencies: ctx.dependencies,
affectedProjects: ctx.affectedProjects,
touchedProjects: [],
fileMap: ctx.fileMap,
workspaceLayout: ctx.workspaceLayout,
groupByFolder: ctx.groupByFolder,
Expand All @@ -172,6 +174,7 @@ export const projectGraphMachine = createMachine<
projects: ctx.projects,
dependencies: ctx.dependencies,
affectedProjects: ctx.affectedProjects,
touchedProjects: [],
fileMap: ctx.fileMap,
workspaceLayout: ctx.workspaceLayout,
groupByFolder: ctx.groupByFolder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DebouncedTextInput } from '@nx/graph/ui-components';
import { DebouncedTextInput } from '@nx/graph/legacy';

export interface TextFilterPanelProps {
textFilter: string;
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/feature-projects/project-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { ExperimentalFeature } from '../ui-components/experimental-feature';
import { TracingAlgorithmType } from './machines/interfaces';
import { getProjectGraphService } from '../machines/get-services';
import { Link, useNavigate, useNavigation } from 'react-router-dom';
import { useRouteConstructor } from '@nx/graph/shared';
import { useRouteConstructor } from '@nx/graph/legacy';
import { CompositeNode } from '../interfaces';
import { useMemo } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/feature-projects/projects-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
useEnvironmentConfig,
usePoll,
useRouteConstructor,
} from '@nx/graph/shared';
} from '@nx/graph/legacy';
import {
useNavigate,
useParams,
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/feature-tasks/task-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { WorkspaceLayout } from '../interfaces';
import { ExclamationCircleIcon, EyeIcon } from '@heroicons/react/24/outline';
import { ReactNode } from 'react';
import { Tooltip } from '@nx/graph/ui-tooltips';
import { Tooltip } from '@nx/graph/legacy';
import { TaskGraphErrorTooltip } from './task-graph-error-tooltip';

interface SidebarProject {
Expand Down
4 changes: 1 addition & 3 deletions graph/client/src/app/feature-tasks/tasks-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import type {
import { useEffect, useMemo } from 'react';
import { getGraphService } from '../machines/graph.service';
import { CheckboxPanel } from '../ui-components/checkbox-panel';

import { useRouteConstructor } from '@nx/graph/shared';
import { Dropdown } from '@nx/graph/ui-components';
import { Dropdown, useRouteConstructor } from '@nx/graph/legacy';
import { useCurrentPath } from '../hooks/use-current-path';
import { ShowHideAll } from '../ui-components/show-hide-all';
import { createTaskName } from '../util';
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/get-router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createBrowserRouter, createHashRouter } from 'react-router-dom';
import { getRoutesForEnvironment } from './routes';
import { getEnvironmentConfig } from '@nx/graph/shared';
import { getEnvironmentConfig } from '@nx/graph/legacy';

let router;

Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/hooks/use-current-path.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { matchRoutes, useLocation } from 'react-router-dom';
import { getRoutesForEnvironment } from '../routes';
import { useState } from 'react';
import { getEnvironmentConfig } from '@nx/graph/shared';
import { getEnvironmentConfig } from '@nx/graph/legacy';

export const useCurrentPath = () => {
const [lastLocation, setLastLocation] = useState<string>();
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/machines/get-services.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { interpret, InterpreterStatus } from 'xstate';
import { projectGraphMachine } from '../feature-projects/machines/project-graph.machine';
import { getGraphService } from './graph.service';
import { GraphTooltipService } from '@nx/graph/ui-graph';
import { GraphTooltipService } from '@nx/graph/legacy';

let projectGraphService = interpret(projectGraphMachine, {
devTools: !!window.useXstateInspect,
Expand Down
4 changes: 2 additions & 2 deletions graph/client/src/app/machines/graph.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { GraphService } from '@nx/graph/ui-graph';
import {
GraphService,
getEnvironmentConfig,
getProjectGraphDataService,
} from '@nx/graph/shared';
} from '@nx/graph/legacy';
import { selectValueByThemeStatic } from '@nx/graph-internal/ui-theme';

let graphService: GraphService;
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { ProjectGraphProjectNode } from 'nx/src/config/project-graph';
import {
getEnvironmentConfig,
getProjectGraphDataService,
} from '@nx/graph/shared';
} from '@nx/graph/legacy';
import { TasksSidebarErrorBoundary } from './feature-tasks/tasks-sidebar-error-boundary';
import { ProjectDetailsPage } from '@nx/graph-internal/project-details';
import { ErrorBoundary } from './ui-components/error-boundary';
Expand Down
7 changes: 4 additions & 3 deletions graph/client/src/app/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import {
getProjectGraphDataService,
useEnvironmentConfig,
usePoll,
} from '@nx/graph/shared';
import { Dropdown, Spinner } from '@nx/graph/ui-components';
Dropdown,
Spinner,
Tooltip,
} from '@nx/graph/legacy';
import { getSystemTheme, Theme, ThemePanel } from '@nx/graph-internal/ui-theme';
import { Tooltip } from '@nx/graph/ui-tooltips';
import classNames from 'classnames';
import { useEffect, useLayoutEffect, useState } from 'react';
import {
Expand Down
3 changes: 1 addition & 2 deletions graph/client/src/app/ui-components/debugger-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { memo } from 'react';
import { GraphPerfReport } from '../interfaces';
import { Dropdown } from '@nx/graph/ui-components';
import type { WorkspaceData } from '@nx/graph/shared';
import { Dropdown, type WorkspaceData } from '@nx/graph/legacy';

export interface DebuggerPanelProps {
projects: WorkspaceData[];
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/ui-components/error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getProjectGraphDataService,
useEnvironmentConfig,
usePoll,
} from '@nx/graph/shared';
} from '@nx/graph/legacy';
import {
isRouteErrorResponse,
useParams,
Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/ui-components/error-page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @nx/enforce-module-boundaries */
// nx-ignore-next-line
import { ErrorRenderer } from '@nx/graph/ui-components';
import { ErrorRenderer } from '@nx/graph/legacy';
import { GraphError } from 'nx/src/command-line/graph/graph';
/* eslint-enable @nx/enforce-module-boundaries */
import type { JSX } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEnvironmentConfig } from '@nx/graph/shared';
import { useEnvironmentConfig } from '@nx/graph/legacy';
import { Children, cloneElement } from 'react';

export function ExperimentalFeature(props) {
Expand Down
4 changes: 2 additions & 2 deletions graph/client/src/app/ui-tooltips/graph-tooltip-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
ProjectNodeTooltipActions,
TaskNodeTooltip,
Tooltip,
} from '@nx/graph/ui-tooltips';
} from '@nx/graph/legacy';
import { TaskNodeActions } from './task-node-actions';
import { getExternalApiService, useRouteConstructor } from '@nx/graph/shared';
import { getExternalApiService, useRouteConstructor } from '@nx/graph/legacy';
import { useNavigate } from 'react-router-dom';
import { useCallback } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion graph/client/src/app/ui-tooltips/task-node-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
import { TaskNodeTooltipProps } from '@nx/graph/ui-tooltips';
import { TaskNodeTooltipProps } from '@nx/graph/legacy';
import { useEffect, useState } from 'react';

export function TaskNodeActions(props: TaskNodeTooltipProps) {
Expand Down
2 changes: 1 addition & 1 deletion graph/project-details/src/lib/project-details-header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link } from 'react-router-dom';
import { useRouteConstructor } from '@nx/graph/shared';
import { useRouteConstructor } from '@nx/graph/legacy';
import { ThemePanel } from '@nx/graph-internal/ui-theme';

export function ProjectDetailsHeader() {
Expand Down
2 changes: 1 addition & 1 deletion graph/project-details/src/lib/project-details-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
getProjectGraphDataService,
useEnvironmentConfig,
usePoll,
} from '@nx/graph/shared';
} from '@nx/graph/legacy';
import { ProjectDetailsHeader } from './project-details-header';

export function ProjectDetailsPage() {
Expand Down
4 changes: 2 additions & 2 deletions graph/project-details/src/lib/project-details-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
getExternalApiService,
useEnvironmentConfig,
useRouteConstructor,
} from '@nx/graph/shared';
import { Spinner } from '@nx/graph/ui-components';
} from '@nx/graph/legacy';
import { Spinner } from '@nx/graph/legacy';

import { ProjectDetails } from '@nx/graph-internal/ui-project-details';
import { useCallback, useContext, useEffect } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion graph/ui-code-block/src/lib/json-code-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import SyntaxHighlighter, { createElement } from 'react-syntax-highlighter';
import { JSX, ReactNode, useMemo } from 'react';
import { twMerge } from 'tailwind-merge';
import { CopyToClipboardButton } from '@nx/graph/ui-components';
import { CopyToClipboardButton } from '@nx/graph/legacy';

export function JsonCodeBlockPreTag({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta } from '@storybook/react';
import { ProjectDetails } from './project-details';
import { ExpandedTargetsProvider } from '@nx/graph/shared';
import { ExpandedTargetsProvider } from '@nx/graph/legacy';

const meta: Meta<typeof ProjectDetails> = {
component: ProjectDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ProjectGraphProjectNode } from '@nx/devkit';
import { GraphError } from 'nx/src/command-line/graph/graph';
/* eslint-enable @nx/enforce-module-boundaries */
import { EyeIcon } from '@heroicons/react/24/outline';
import { PropertyInfoTooltip, Tooltip } from '@nx/graph/ui-tooltips';
import { PropertyInfoTooltip, Tooltip } from '@nx/graph/legacy';
import { twMerge } from 'tailwind-merge';
import { TagList } from '../tag-list/tag-list';
import { OwnersList } from '../owners-list/owners-list';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Fragment, ReactNode, useMemo, useState } from 'react';
import { PlayIcon, XMarkIcon } from '@heroicons/react/24/outline';
import { Transition } from '@headlessui/react';
import { getExternalApiService, useEnvironmentConfig } from '@nx/graph/shared';
import { getExternalApiService, useEnvironmentConfig } from '@nx/graph/legacy';
/* eslint-disable @nx/enforce-module-boundaries */
// nx-ignore-next-line
import type { TargetConfiguration } from '@nx/devkit';
import { TerminalOutput } from '@nx/nx-dev/ui-fence';
import { Tooltip } from '@nx/graph/ui-tooltips';
import { Tooltip } from '@nx/graph/legacy';
import { TooltipTriggerText } from '../target-configuration-details/tooltip-trigger-text';

interface ShowOptionsHelpProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SourcemapInfoToolTip, Tooltip } from '@nx/graph/ui-tooltips';
import { SourcemapInfoToolTip, Tooltip } from '@nx/graph/legacy';
import { InformationCircleIcon } from '@heroicons/react/24/outline';
import { twMerge } from 'tailwind-merge';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
TargetConfigurationGroupList,
TargetConfigurationGroupListProps,
} from './target-configuration-details-group-list';
import { ExpandedTargetsProvider } from '@nx/graph/shared';
import { ExpandedTargetsProvider } from '@nx/graph/legacy';

const meta: Meta<typeof TargetConfigurationGroupList> = {
component: TargetConfigurationGroupList,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
/* eslint-disable @nx/enforce-module-boundaries */
// nx-ignore-next-line
import type { TargetConfiguration } from '@nx/devkit';
import { CopyToClipboardButton } from '@nx/graph/ui-components';
import {
ChevronDownIcon,
ChevronUpIcon,
EyeIcon,
PlayIcon,
} from '@heroicons/react/24/outline';

import {
CopyToClipboardButton,
AtomizerTooltip,
PropertyInfoTooltip,
Tooltip,
} from '@nx/graph/ui-tooltips';
} from '@nx/graph/legacy';
import { twMerge } from 'tailwind-merge';
import { Pill } from '../pill';
import { TargetTechnologies } from '../target-technologies/target-technologies';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// nx-ignore-next-line
import type { TargetConfiguration } from '@nx/devkit';
import { JsonCodeBlock } from '@nx/graph-internal/ui-code-block';
import { ExpandedTargetsContext } from '@nx/graph/shared';
import { CopyToClipboardButton } from '@nx/graph/ui-components';
import { PropertyInfoTooltip, Tooltip } from '@nx/graph/ui-tooltips';
import { ExpandedTargetsContext } from '@nx/graph/legacy';
import { CopyToClipboardButton } from '@nx/graph/legacy';
import { PropertyInfoTooltip, Tooltip } from '@nx/graph/legacy';
import { useCallback, useContext, useEffect, useState } from 'react';
import { Pill } from '../pill';
import { ShowOptionsHelp } from '../show-all-options/show-options-help';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tooltip } from '@nx/graph/ui-tooltips';
import { Tooltip } from '@nx/graph/legacy';
import { JSX, ReactNode } from 'react';
import { TooltipTriggerText } from './tooltip-trigger-text';
import { QuestionMarkCircleIcon } from '@heroicons/react/24/outline';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PropertyInfoTooltip, Tooltip } from '@nx/graph/ui-tooltips';
import { CopyToClipboardButton } from '@nx/graph/ui-components';
import { PropertyInfoTooltip, Tooltip } from '@nx/graph/legacy';
import { CopyToClipboardButton } from '@nx/graph/legacy';
import { TooltipTriggerText } from '../target-configuration-details/tooltip-trigger-text';

export function TargetExecutorTitle({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExternalLink } from '@nx/graph/ui-tooltips';
import { ExternalLink } from '@nx/graph/legacy';

export interface TargetExecutorProps {
command?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TechnologyIcon } from '@nx/graph/ui-icons';
import { TechnologyIcon } from '@nx/graph/legacy';
import { HTMLProps } from 'react';

export interface TargetTechnologiesProps extends HTMLProps<HTMLDivElement> {
Expand Down
2 changes: 1 addition & 1 deletion graph/ui-theme/src/lib/theme-resolver.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getEnvironmentConfig } from '@nx/graph/shared';
import { getEnvironmentConfig } from '@nx/graph/legacy';

const htmlEl = document.documentElement;
export const localStorageThemeKey = 'nx-dep-graph-theme';
Expand Down
17 changes: 3 additions & 14 deletions nx-dev/feature-ai/src/lib/feed/feed-answer.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
import { normalizeContent } from './feed-answer';

jest.mock('@nx/graph/ui-icons', () => {
return {
Icon: jest.fn(() => null),
};
});
jest.mock('@nx/graph/ui-tooltips', () => {
jest.mock('@nx/graph/legacy', () => {
return {
Tooltip: jest.fn(() => null),
PropertyInfoTooltip: jest.fn(() => null),
};
});
jest.mock('@nx/graph/ui-components', () => {
return {
Icon: jest.fn(() => null),
CopyToClipboardButton: jest.fn(() => null),
};
});
jest.mock('@nx/graph/shared', () => {
return {
ExpandedTargetsContext: jest.fn(() => null),
};
});

jest.mock('@nx/nx-dev/ui-primitives', () => {
return {
cx: jest.fn(() => null),
Expand Down
2 changes: 1 addition & 1 deletion nx-dev/nx-dev/pages/tips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { NextSeo } from 'next-seo';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { frameworkIcons } from '@nx/graph/ui-icons';
import { frameworkIcons } from '@nx/graph/legacy';
import { ReactNode, useEffect, useState } from 'react';

interface NewYearTip {
Expand Down
Loading

0 comments on commit 3ea1732

Please sign in to comment.