@manojkmfsi/monodog 1.1.37 → 1.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/monodog-dashboard/dist/assets/index-C08ciT3A.js +20 -0
- package/monodog-dashboard/dist/assets/index-C08ciT3A.js.map +1 -0
- package/monodog-dashboard/dist/assets/index-Dc2vaUOq.css +1 -0
- package/monodog-dashboard/{index.html → dist/index.html} +2 -1
- package/monodog-dashboard/package.json +0 -3
- package/package.json +2 -2
- package/monodog-dashboard/THEME_SYSTEM.md +0 -309
- package/monodog-dashboard/__tests__/AuthCallbackPage.test.ts +0 -138
- package/monodog-dashboard/__tests__/ConfigInspector.test.ts +0 -33
- package/monodog-dashboard/__tests__/DependencyGraph.test.ts +0 -72
- package/monodog-dashboard/__tests__/HealthStatus.test.ts +0 -69
- package/monodog-dashboard/__tests__/LoginPage.test.ts +0 -79
- package/monodog-dashboard/__tests__/PackageDetail.test.ts +0 -22
- package/monodog-dashboard/__tests__/ReleaseManager.test.tsx +0 -510
- package/monodog-dashboard/__tests__/api-client.test.ts +0 -475
- package/monodog-dashboard/__tests__/components.test.ts +0 -117
- package/monodog-dashboard/__tests__/dashboard.utils.test.ts +0 -144
- package/monodog-dashboard/__tests__/dependency.utils.test.ts +0 -125
- package/monodog-dashboard/__tests__/monorepoService.unit.test.ts +0 -103
- package/monodog-dashboard/__tests__/packages.utils.test.ts +0 -37
- package/monodog-dashboard/__tests__/pages.test.ts +0 -103
- package/monodog-dashboard/package-lock.json +0 -4587
- package/monodog-dashboard/postcss.config.js +0 -6
- package/monodog-dashboard/src/components/App.tsx +0 -36
- package/monodog-dashboard/src/components/LoadingState.tsx +0 -18
- package/monodog-dashboard/src/components/PermissionGuard.tsx +0 -92
- package/monodog-dashboard/src/components/ProtectedRoute.tsx +0 -24
- package/monodog-dashboard/src/components/configuration/Configuration.tsx +0 -91
- package/monodog-dashboard/src/components/configuration/components/BrandingSettings.tsx +0 -128
- package/monodog-dashboard/src/components/configuration/components/ConfigurationHeader.tsx +0 -34
- package/monodog-dashboard/src/components/configuration/components/ConfigurationModal.tsx +0 -20
- package/monodog-dashboard/src/components/configuration/components/ConfigurationTabs.tsx +0 -30
- package/monodog-dashboard/src/components/configuration/components/FeatureToggles.tsx +0 -66
- package/monodog-dashboard/src/components/configuration/components/GeneralSettings.tsx +0 -77
- package/monodog-dashboard/src/components/configuration/components/MonorepoSettings.tsx +0 -179
- package/monodog-dashboard/src/components/configuration/components/index.ts +0 -8
- package/monodog-dashboard/src/components/configuration/types/config.types.ts +0 -52
- package/monodog-dashboard/src/components/configuration/utils/config.utils.tsx +0 -115
- package/monodog-dashboard/src/components/main-dashboard/Dashboard.tsx +0 -242
- package/monodog-dashboard/src/components/main-dashboard/Layout.tsx +0 -112
- package/monodog-dashboard/src/components/main-dashboard/components/Header.tsx +0 -47
- package/monodog-dashboard/src/components/main-dashboard/components/PackageDistribution.tsx +0 -35
- package/monodog-dashboard/src/components/main-dashboard/components/PackageSearchFilter.tsx +0 -47
- package/monodog-dashboard/src/components/main-dashboard/components/PackageTable.tsx +0 -87
- package/monodog-dashboard/src/components/main-dashboard/components/QuickActions.tsx +0 -60
- package/monodog-dashboard/src/components/main-dashboard/components/StatsCards.tsx +0 -73
- package/monodog-dashboard/src/components/main-dashboard/components/index.ts +0 -7
- package/monodog-dashboard/src/components/main-dashboard/types/dashboard.types.ts +0 -33
- package/monodog-dashboard/src/components/main-dashboard/utils/dashboard.utils.tsx +0 -70
- package/monodog-dashboard/src/components/modules/ci-integration/CIIntegration.tsx +0 -277
- package/monodog-dashboard/src/components/modules/ci-integration/components/BuildDetails.tsx +0 -228
- package/monodog-dashboard/src/components/modules/ci-integration/components/BuildList.tsx +0 -212
- package/monodog-dashboard/src/components/modules/ci-integration/components/BuildOverview.tsx +0 -158
- package/monodog-dashboard/src/components/modules/ci-integration/components/CIIntegrationHeader.tsx +0 -38
- package/monodog-dashboard/src/components/modules/ci-integration/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/ci-integration/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/ci-integration/components/PipelineStatus.tsx +0 -223
- package/monodog-dashboard/src/components/modules/ci-integration/components/index.ts +0 -8
- package/monodog-dashboard/src/components/modules/ci-integration/types/ci.types.ts +0 -97
- package/monodog-dashboard/src/components/modules/ci-integration/utils/ci.utils.tsx +0 -264
- package/monodog-dashboard/src/components/modules/config-inspector/ConfigInspector.tsx +0 -324
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigEditor.tsx +0 -93
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigInspectorHeader.tsx +0 -36
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigPreview.tsx +0 -89
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigSidebar.tsx +0 -141
- package/monodog-dashboard/src/components/modules/config-inspector/components/ConfigToolbar.tsx +0 -184
- package/monodog-dashboard/src/components/modules/config-inspector/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/config-inspector/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/config-inspector/components/ValidationPanel.tsx +0 -155
- package/monodog-dashboard/src/components/modules/config-inspector/components/index.ts +0 -9
- package/monodog-dashboard/src/components/modules/config-inspector/types/config.types.ts +0 -100
- package/monodog-dashboard/src/components/modules/config-inspector/utils/config.utils.tsx +0 -704
- package/monodog-dashboard/src/components/modules/dependency-graph/DependencyGraph.tsx +0 -224
- package/monodog-dashboard/src/components/modules/dependency-graph/components/CircularDependencies.tsx +0 -177
- package/monodog-dashboard/src/components/modules/dependency-graph/components/DependencyDetails.tsx +0 -192
- package/monodog-dashboard/src/components/modules/dependency-graph/components/DependencyGraphHeader.tsx +0 -30
- package/monodog-dashboard/src/components/modules/dependency-graph/components/DependencyList.tsx +0 -177
- package/monodog-dashboard/src/components/modules/dependency-graph/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphLegend.tsx +0 -89
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphStats.tsx +0 -141
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphToolbar.tsx +0 -107
- package/monodog-dashboard/src/components/modules/dependency-graph/components/GraphVisualization.tsx +0 -179
- package/monodog-dashboard/src/components/modules/dependency-graph/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/dependency-graph/components/index.ts +0 -11
- package/monodog-dashboard/src/components/modules/dependency-graph/types/dependency.types.ts +0 -105
- package/monodog-dashboard/src/components/modules/dependency-graph/utils/dependency.utils.tsx +0 -433
- package/monodog-dashboard/src/components/modules/health-status/HealthStatus.tsx +0 -739
- package/monodog-dashboard/src/components/modules/health-status/components/ErrorState.tsx +0 -25
- package/monodog-dashboard/src/components/modules/health-status/components/HealthActions.tsx +0 -122
- package/monodog-dashboard/src/components/modules/health-status/components/HealthAlerts.tsx +0 -151
- package/monodog-dashboard/src/components/modules/health-status/components/HealthMetrics.tsx +0 -132
- package/monodog-dashboard/src/components/modules/health-status/components/HealthStatusHeader.tsx +0 -30
- package/monodog-dashboard/src/components/modules/health-status/components/LoadingState.tsx +0 -16
- package/monodog-dashboard/src/components/modules/health-status/components/OverallHealthScore.tsx +0 -122
- package/monodog-dashboard/src/components/modules/health-status/components/PackageHealthList.tsx +0 -195
- package/monodog-dashboard/src/components/modules/health-status/types/health.types.ts +0 -80
- package/monodog-dashboard/src/components/modules/health-status/utils/health.utils.tsx +0 -220
- package/monodog-dashboard/src/components/modules/packages/PackageDetail.tsx +0 -255
- package/monodog-dashboard/src/components/modules/packages/PackagesOverview.tsx +0 -166
- package/monodog-dashboard/src/components/modules/packages/components/ConfigurationTab.tsx +0 -311
- package/monodog-dashboard/src/components/modules/packages/components/DependenciesTab.tsx +0 -154
- package/monodog-dashboard/src/components/modules/packages/components/ErrorState.tsx +0 -21
- package/monodog-dashboard/src/components/modules/packages/components/HealthMetricsTab.tsx +0 -275
- package/monodog-dashboard/src/components/modules/packages/components/LoadingState.tsx +0 -14
- package/monodog-dashboard/src/components/modules/packages/components/PackageDetailHeader.tsx +0 -167
- package/monodog-dashboard/src/components/modules/packages/components/PackageDetailTabs.tsx +0 -49
- package/monodog-dashboard/src/components/modules/packages/components/PackageStats.tsx +0 -70
- package/monodog-dashboard/src/components/modules/packages/components/PackagesTable.tsx +0 -163
- package/monodog-dashboard/src/components/modules/packages/components/RecentCommitsTab.tsx +0 -90
- package/monodog-dashboard/src/components/modules/packages/components/SearchAndFilter.tsx +0 -66
- package/monodog-dashboard/src/components/modules/packages/components/index.ts +0 -12
- package/monodog-dashboard/src/components/modules/packages/types/packages.types.ts +0 -101
- package/monodog-dashboard/src/components/modules/packages/utils/packages.utils.tsx +0 -178
- package/monodog-dashboard/src/components/pipeline/JobsList.tsx +0 -83
- package/monodog-dashboard/src/components/pipeline/LogViewer.tsx +0 -392
- package/monodog-dashboard/src/components/pipeline/PipelineManager.tsx +0 -562
- package/monodog-dashboard/src/components/pipeline/WorkflowRunsList.tsx +0 -272
- package/monodog-dashboard/src/components/pipeline/WorkflowTrigger.tsx +0 -182
- package/monodog-dashboard/src/components/pipeline/utils/pipeline.utils.tsx +0 -11
- package/monodog-dashboard/src/components/publish-control/PublishControl.tsx +0 -229
- package/monodog-dashboard/src/components/publish-control/components/ChangelogViewer.tsx +0 -103
- package/monodog-dashboard/src/components/publish-control/components/ErrorState.tsx +0 -23
- package/monodog-dashboard/src/components/publish-control/components/LoadingState.tsx +0 -10
- package/monodog-dashboard/src/components/publish-control/components/PackageReleaseTable.tsx +0 -140
- package/monodog-dashboard/src/components/publish-control/components/PublishHeader.tsx +0 -30
- package/monodog-dashboard/src/components/publish-control/components/QuickActionCards.tsx +0 -56
- package/monodog-dashboard/src/components/publish-control/components/ReleaseSchedule.tsx +0 -104
- package/monodog-dashboard/src/components/publish-control/components/index.ts +0 -8
- package/monodog-dashboard/src/components/publish-control/types/publish.types.ts +0 -39
- package/monodog-dashboard/src/components/publish-control/utils/publish.utils.ts +0 -59
- package/monodog-dashboard/src/components/release-manager/ReleaseManager.tsx +0 -342
- package/monodog-dashboard/src/components/release-manager/components/ChangesetPreview.tsx +0 -123
- package/monodog-dashboard/src/components/release-manager/components/ErrorState.tsx +0 -38
- package/monodog-dashboard/src/components/release-manager/components/LoadingState.tsx +0 -18
- package/monodog-dashboard/src/components/release-manager/components/PackageSelector.tsx +0 -137
- package/monodog-dashboard/src/components/release-manager/components/PublishConfirmation.tsx +0 -150
- package/monodog-dashboard/src/components/release-manager/components/ReleaseValidation.tsx +0 -138
- package/monodog-dashboard/src/components/release-manager/components/VersionBumpSelector.tsx +0 -142
- package/monodog-dashboard/src/components/release-manager/types/index.ts +0 -9
- package/monodog-dashboard/src/components/release-manager/types/release-manager.types.ts +0 -29
- package/monodog-dashboard/src/components/setup-guide/SetupGuide.tsx +0 -96
- package/monodog-dashboard/src/components/setup-guide/components/SetupHeader.tsx +0 -24
- package/monodog-dashboard/src/components/setup-guide/components/SetupModal.tsx +0 -24
- package/monodog-dashboard/src/components/setup-guide/components/SetupProgress.tsx +0 -29
- package/monodog-dashboard/src/components/setup-guide/components/StepContent.tsx +0 -272
- package/monodog-dashboard/src/components/setup-guide/components/StepNavigation.tsx +0 -62
- package/monodog-dashboard/src/components/setup-guide/components/index.ts +0 -6
- package/monodog-dashboard/src/components/setup-guide/types/setup.types.ts +0 -38
- package/monodog-dashboard/src/components/setup-guide/utils/setup.utils.ts +0 -79
- package/monodog-dashboard/src/constants/api-config.ts +0 -81
- package/monodog-dashboard/src/constants/index.ts +0 -9
- package/monodog-dashboard/src/constants/messages.ts +0 -40
- package/monodog-dashboard/src/icons/heroicons.ts +0 -65
- package/monodog-dashboard/src/icons/index.tsx +0 -1788
- package/monodog-dashboard/src/index.css +0 -175
- package/monodog-dashboard/src/main.tsx +0 -9
- package/monodog-dashboard/src/pages/AuthCallbackPage.tsx +0 -103
- package/monodog-dashboard/src/pages/CIPage.tsx +0 -6
- package/monodog-dashboard/src/pages/ConfigPage.tsx +0 -6
- package/monodog-dashboard/src/pages/DashboardPage.tsx +0 -6
- package/monodog-dashboard/src/pages/DependenciesPage.tsx +0 -6
- package/monodog-dashboard/src/pages/HealthPage.tsx +0 -6
- package/monodog-dashboard/src/pages/LoginPage.tsx +0 -77
- package/monodog-dashboard/src/pages/PackageDetailPage.tsx +0 -6
- package/monodog-dashboard/src/pages/PackagesPage.tsx +0 -6
- package/monodog-dashboard/src/pages/PipelinePage.tsx +0 -22
- package/monodog-dashboard/src/pages/PublishPage.tsx +0 -6
- package/monodog-dashboard/src/pages/ReleaseManagerPage.tsx +0 -9
- package/monodog-dashboard/src/pages/index.ts +0 -28
- package/monodog-dashboard/src/routes/AppRouter.tsx +0 -89
- package/monodog-dashboard/src/routes/AppRouterPages.tsx +0 -56
- package/monodog-dashboard/src/routes/index.ts +0 -10
- package/monodog-dashboard/src/routes/routes.config.ts +0 -94
- package/monodog-dashboard/src/services/api/api-client.ts +0 -189
- package/monodog-dashboard/src/services/api/index.ts +0 -30
- package/monodog-dashboard/src/services/api/types/api.types.ts +0 -63
- package/monodog-dashboard/src/services/auth-context.tsx +0 -344
- package/monodog-dashboard/src/services/monorepoService.ts +0 -733
- package/monodog-dashboard/src/services/permission-context.tsx +0 -193
- package/monodog-dashboard/src/theme/COMPONENT_UPDATES.md +0 -273
- package/monodog-dashboard/src/theme/INTEGRATION.md +0 -381
- package/monodog-dashboard/src/theme/README.md +0 -239
- package/monodog-dashboard/src/theme/examples.tsx +0 -386
- package/monodog-dashboard/src/theme/index.ts +0 -402
- package/monodog-dashboard/src/theme/migration-guide.md +0 -335
- package/monodog-dashboard/src/types/auth-context.types.ts +0 -51
- package/monodog-dashboard/src/types/component.types.ts +0 -96
- package/monodog-dashboard/src/types/icons.types.ts +0 -13
- package/monodog-dashboard/src/types/index.ts +0 -68
- package/monodog-dashboard/src/types/monorepo-service.types.ts +0 -53
- package/monodog-dashboard/src/types/permission-context.types.ts +0 -49
- package/monodog-dashboard/src/types/pipeline.types.ts +0 -89
- package/monodog-dashboard/src/types/routes.types.ts +0 -12
- package/monodog-dashboard/src/utils/cookies.ts +0 -47
- package/monodog-dashboard/tailwind.config.js +0 -68
- package/monodog-dashboard/tsconfig.app.json +0 -14
- package/monodog-dashboard/tsconfig.json +0 -17
- package/monodog-dashboard/tsconfig.node.json +0 -10
- package/monodog-dashboard/vite.config.ts +0 -9
package/monodog-dashboard/src/components/modules/dependency-graph/utils/dependency.utils.tsx
DELETED
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PackageNode,
|
|
3
|
-
CircularDependency,
|
|
4
|
-
GraphStats,
|
|
5
|
-
DependentsMap,
|
|
6
|
-
} from '../types/dependency.types';
|
|
7
|
-
import { BuildingLibraryIcon } from '../../../../icons/heroicons';
|
|
8
|
-
import { RocketLaunchIcon } from '../../../../icons/heroicons';
|
|
9
|
-
import { CubeIcon } from '../../../../icons/heroicons';
|
|
10
|
-
|
|
11
|
-
// Get status color classes
|
|
12
|
-
export const getStatusColor = (status: string): string => {
|
|
13
|
-
switch (status) {
|
|
14
|
-
case 'healthy':
|
|
15
|
-
return 'text-green-600 bg-green-100';
|
|
16
|
-
case 'warning':
|
|
17
|
-
return 'text-yellow-600 bg-yellow-100';
|
|
18
|
-
case 'error':
|
|
19
|
-
return 'text-red-600 bg-red-100';
|
|
20
|
-
default:
|
|
21
|
-
return 'text-gray-600 bg-gray-100';
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Get type color classes
|
|
26
|
-
export const getTypeColor = (type: string): string => {
|
|
27
|
-
switch (type) {
|
|
28
|
-
case 'app':
|
|
29
|
-
return 'text-blue-600 bg-blue-100';
|
|
30
|
-
case 'lib':
|
|
31
|
-
return 'text-purple-600 bg-purple-100';
|
|
32
|
-
case 'tool':
|
|
33
|
-
return 'text-orange-600 bg-orange-100';
|
|
34
|
-
default:
|
|
35
|
-
return 'text-gray-600 bg-gray-100';
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// Get dependency status color for visualization
|
|
40
|
-
export const getDependencyStatusColor = (
|
|
41
|
-
depName: string,
|
|
42
|
-
packages: PackageNode[]
|
|
43
|
-
): string => {
|
|
44
|
-
const dep = packages.find(pkg => pkg.name === depName);
|
|
45
|
-
if (!dep) return 'text-gray-400';
|
|
46
|
-
|
|
47
|
-
switch (dep.status) {
|
|
48
|
-
case 'healthy':
|
|
49
|
-
return 'text-green-500';
|
|
50
|
-
case 'warning':
|
|
51
|
-
return 'text-yellow-500';
|
|
52
|
-
case 'error':
|
|
53
|
-
return 'text-red-500';
|
|
54
|
-
default:
|
|
55
|
-
return 'text-gray-400';
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// Calculate graph statistics
|
|
60
|
-
export const calculateGraphStats = (packages: PackageNode[]): GraphStats => {
|
|
61
|
-
const totalPackages = packages.length;
|
|
62
|
-
const totalDependencies = packages.reduce(
|
|
63
|
-
(sum, pkg) => sum + Object.keys(pkg.dependencies).length,
|
|
64
|
-
0
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
// Find packages with no dependencies (leaf packages)
|
|
68
|
-
const leafPackages = packages.filter(
|
|
69
|
-
pkg => Object.keys(pkg.dependencies).length === 0
|
|
70
|
-
).length;
|
|
71
|
-
|
|
72
|
-
// Find packages with no dependents (root packages)
|
|
73
|
-
const rootPackages = packages.filter(
|
|
74
|
-
pkg => pkg.dependents.length === 0
|
|
75
|
-
).length;
|
|
76
|
-
|
|
77
|
-
// Calculate max depth and average dependencies
|
|
78
|
-
const maxDepth = calculateMaxDepth(packages);
|
|
79
|
-
const avgDependencies =
|
|
80
|
-
totalPackages > 0 ? totalDependencies / totalPackages : 0;
|
|
81
|
-
|
|
82
|
-
// Detect circular dependencies
|
|
83
|
-
const cycles = detectCircularDependencies(packages);
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
totalPackages,
|
|
87
|
-
totalDependencies,
|
|
88
|
-
circularDependencies: cycles.length,
|
|
89
|
-
leafPackages,
|
|
90
|
-
rootPackages,
|
|
91
|
-
maxDepth,
|
|
92
|
-
avgDependencies: Math.round(avgDependencies * 10) / 10,
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// Calculate maximum dependency depth
|
|
97
|
-
export const calculateMaxDepth = (packages: PackageNode[]): number => {
|
|
98
|
-
const visited = new Set<string>();
|
|
99
|
-
let maxDepth = 0;
|
|
100
|
-
|
|
101
|
-
const dfs = (packageName: string, depth: number): number => {
|
|
102
|
-
if (visited.has(packageName)) return depth;
|
|
103
|
-
visited.add(packageName);
|
|
104
|
-
|
|
105
|
-
const pkg = packages.find(p => p.name === packageName);
|
|
106
|
-
if (!pkg) return depth;
|
|
107
|
-
|
|
108
|
-
let currentMaxDepth = depth;
|
|
109
|
-
for (const depId of Object.keys(pkg.dependencies)) {
|
|
110
|
-
const depDepth = dfs(depId, depth + 1);
|
|
111
|
-
currentMaxDepth = Math.max(currentMaxDepth, depDepth);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return currentMaxDepth;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
for (const pkg of packages) {
|
|
118
|
-
if (!visited.has(pkg.name)) {
|
|
119
|
-
const depth = dfs(pkg.name, 0);
|
|
120
|
-
maxDepth = Math.max(maxDepth, depth);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return maxDepth;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
// Detect circular dependencies
|
|
128
|
-
export const detectCircularDependencies = (
|
|
129
|
-
packages: PackageNode[]
|
|
130
|
-
): CircularDependency[] => {
|
|
131
|
-
const cycles: CircularDependency[] = [];
|
|
132
|
-
const visited = new Set<string>();
|
|
133
|
-
const recursionStack = new Set<string>();
|
|
134
|
-
const currentPath: string[] = [];
|
|
135
|
-
|
|
136
|
-
const dfs = (packageName: string): boolean => {
|
|
137
|
-
if (recursionStack.has(packageName)) {
|
|
138
|
-
// Found a cycle
|
|
139
|
-
const cycleStart = currentPath.indexOf(packageName);
|
|
140
|
-
const cycle = currentPath.slice(cycleStart).concat(packageName);
|
|
141
|
-
|
|
142
|
-
cycles.push({
|
|
143
|
-
cycle,
|
|
144
|
-
severity:
|
|
145
|
-
cycle.length > 5 ? 'high' : cycle.length > 3 ? 'medium' : 'low',
|
|
146
|
-
impact: `Circular dependency involving ${cycle.length} packages`,
|
|
147
|
-
});
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (visited.has(packageName)) return false;
|
|
152
|
-
|
|
153
|
-
visited.add(packageName);
|
|
154
|
-
recursionStack.add(packageName);
|
|
155
|
-
currentPath.push(packageName);
|
|
156
|
-
|
|
157
|
-
const pkg = packages.find(p => p.name === packageName);
|
|
158
|
-
if (pkg) {
|
|
159
|
-
for (const depId of Object.keys(pkg.dependencies)) {
|
|
160
|
-
if (dfs(depId)) return true;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
recursionStack.delete(packageName);
|
|
165
|
-
currentPath.pop();
|
|
166
|
-
return false;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
for (const pkg of packages) {
|
|
170
|
-
if (!visited.has(pkg.name)) {
|
|
171
|
-
dfs(pkg.name);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return cycles;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// Sort packages by different criteria
|
|
179
|
-
export const sortPackages = (
|
|
180
|
-
packages: PackageNode[],
|
|
181
|
-
sortBy: 'name' | 'dependencies' | 'dependents' | 'status',
|
|
182
|
-
order: 'asc' | 'desc'
|
|
183
|
-
): PackageNode[] => {
|
|
184
|
-
return [...packages].sort((a, b) => {
|
|
185
|
-
let aValue: string | number;
|
|
186
|
-
let bValue: string | number;
|
|
187
|
-
|
|
188
|
-
switch (sortBy) {
|
|
189
|
-
case 'name':
|
|
190
|
-
aValue = a.name.toLowerCase();
|
|
191
|
-
bValue = b.name.toLowerCase();
|
|
192
|
-
break;
|
|
193
|
-
case 'dependencies':
|
|
194
|
-
aValue = Object.keys(a.dependencies).length;
|
|
195
|
-
bValue = Object.keys(b.dependencies).length;
|
|
196
|
-
break;
|
|
197
|
-
case 'dependents':
|
|
198
|
-
aValue = a.dependents.length;
|
|
199
|
-
bValue = b.dependents.length;
|
|
200
|
-
break;
|
|
201
|
-
case 'status': {
|
|
202
|
-
const statusOrder = { error: 0, warning: 1, healthy: 2 };
|
|
203
|
-
aValue = statusOrder[a.status] || 3;
|
|
204
|
-
bValue = statusOrder[b.status] || 3;
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
default:
|
|
208
|
-
return 0;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (aValue < bValue) return order === 'asc' ? -1 : 1;
|
|
212
|
-
if (aValue > bValue) return order === 'asc' ? 1 : -1;
|
|
213
|
-
return 0;
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
// Calculate layout positions for different algorithms
|
|
218
|
-
export const calculateLayout = (
|
|
219
|
-
packages: PackageNode[],
|
|
220
|
-
layout: 'hierarchical' | 'circular' | 'force',
|
|
221
|
-
width: number = 800,
|
|
222
|
-
height: number = 600
|
|
223
|
-
): PackageNode[] => {
|
|
224
|
-
switch (layout) {
|
|
225
|
-
case 'hierarchical':
|
|
226
|
-
return calculateHierarchicalLayout(packages, width, height);
|
|
227
|
-
case 'circular':
|
|
228
|
-
return calculateCircularLayout(packages, width, height);
|
|
229
|
-
case 'force':
|
|
230
|
-
return calculateForceLayout(packages, width, height);
|
|
231
|
-
default:
|
|
232
|
-
return packages;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// Hierarchical layout algorithm
|
|
237
|
-
const calculateHierarchicalLayout = (
|
|
238
|
-
packages: PackageNode[],
|
|
239
|
-
width: number,
|
|
240
|
-
height: number
|
|
241
|
-
): PackageNode[] => {
|
|
242
|
-
const layers: string[][] = [];
|
|
243
|
-
const visited = new Set<string>();
|
|
244
|
-
|
|
245
|
-
// Group packages by dependency level
|
|
246
|
-
const assignLayers = (packageName: string, layer: number) => {
|
|
247
|
-
if (visited.has(packageName)) return;
|
|
248
|
-
visited.add(packageName);
|
|
249
|
-
|
|
250
|
-
if (!layers[layer]) layers[layer] = [];
|
|
251
|
-
layers[layer].push(packageName);
|
|
252
|
-
|
|
253
|
-
const pkg = packages.find(p => p.name === packageName);
|
|
254
|
-
if (pkg) {
|
|
255
|
-
pkg.dependents.forEach(depName => assignLayers(depName, layer + 1));
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
// Start with packages that have no dependencies and build downwards with their dependents
|
|
259
|
-
packages
|
|
260
|
-
.filter(
|
|
261
|
-
pkg =>
|
|
262
|
-
Object.keys(pkg.dependencies).length === 0 && pkg.dependents.length > 0
|
|
263
|
-
)
|
|
264
|
-
.forEach(pkg => {
|
|
265
|
-
assignLayers(pkg.name, 0);
|
|
266
|
-
});
|
|
267
|
-
if (layers.length === 0) {
|
|
268
|
-
// In case there are no root packages with dependents, start with others
|
|
269
|
-
packages
|
|
270
|
-
.filter(
|
|
271
|
-
pkg =>
|
|
272
|
-
Object.keys(pkg.dependencies).length > 0 && pkg.dependents.length > 0
|
|
273
|
-
)
|
|
274
|
-
.forEach(pkg => {
|
|
275
|
-
assignLayers(pkg.name, 0);
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Position packages
|
|
280
|
-
return packages.map(pkg => {
|
|
281
|
-
const layer = layers.findIndex(l => l.includes(pkg.name));
|
|
282
|
-
const positionInLayer = layers[layer]?.indexOf(pkg.name) || 0;
|
|
283
|
-
const layerSize = layers[layer]?.length || 1;
|
|
284
|
-
|
|
285
|
-
return {
|
|
286
|
-
...pkg,
|
|
287
|
-
x: (width / (layers.length + 1)) * (layer + 1) - 50,
|
|
288
|
-
y: (height / (layerSize + 1)) * (positionInLayer + 1) - 25,
|
|
289
|
-
};
|
|
290
|
-
});
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
// Circular layout algorithm
|
|
294
|
-
const calculateCircularLayout = (
|
|
295
|
-
packages: PackageNode[],
|
|
296
|
-
width: number,
|
|
297
|
-
height: number
|
|
298
|
-
): PackageNode[] => {
|
|
299
|
-
const centerX = width / 2;
|
|
300
|
-
const centerY = height / 2;
|
|
301
|
-
const radius = Math.min(width, height) / 3;
|
|
302
|
-
|
|
303
|
-
return packages.map((pkg, index) => {
|
|
304
|
-
const angle = (2 * Math.PI * index) / packages.length;
|
|
305
|
-
return {
|
|
306
|
-
...pkg,
|
|
307
|
-
x: centerX + radius * Math.cos(angle) - 50,
|
|
308
|
-
y: centerY + radius * Math.sin(angle) - 25,
|
|
309
|
-
};
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
// Force-directed layout algorithm (simplified)
|
|
314
|
-
const calculateForceLayout = (
|
|
315
|
-
packages: PackageNode[],
|
|
316
|
-
width: number,
|
|
317
|
-
height: number
|
|
318
|
-
): PackageNode[] => {
|
|
319
|
-
// This is a simplified version - in a real implementation you'd use a proper force simulation
|
|
320
|
-
const positioned = packages.map((pkg, index) => ({
|
|
321
|
-
...pkg,
|
|
322
|
-
x: Math.random() * (width - 100),
|
|
323
|
-
y: Math.random() * (height - 50),
|
|
324
|
-
}));
|
|
325
|
-
|
|
326
|
-
// Apply simple force-based positioning
|
|
327
|
-
for (let iteration = 0; iteration < 50; iteration++) {
|
|
328
|
-
positioned.forEach(pkg => {
|
|
329
|
-
let forceX = 0;
|
|
330
|
-
let forceY = 0;
|
|
331
|
-
|
|
332
|
-
// Repulsion from other nodes
|
|
333
|
-
positioned.forEach(other => {
|
|
334
|
-
if (other.name !== pkg.name) {
|
|
335
|
-
const dx = pkg.x - other.x;
|
|
336
|
-
const dy = pkg.y - other.y;
|
|
337
|
-
const distance = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
338
|
-
const force = 1000 / (distance * distance);
|
|
339
|
-
forceX += (dx / distance) * force;
|
|
340
|
-
forceY += (dy / distance) * force;
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
// Attraction to connected nodes
|
|
345
|
-
Object.keys(pkg.dependencies).forEach(depId => {
|
|
346
|
-
const dep = positioned.find(p => p.name === depId);
|
|
347
|
-
if (dep) {
|
|
348
|
-
const dx = dep.x - pkg.x;
|
|
349
|
-
const dy = dep.y - pkg.y;
|
|
350
|
-
const distance = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
351
|
-
const force = distance * 0.01;
|
|
352
|
-
forceX += (dx / distance) * force;
|
|
353
|
-
forceY += (dy / distance) * force;
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
// Apply forces with damping
|
|
358
|
-
pkg.x += forceX * 0.1;
|
|
359
|
-
pkg.y += forceY * 0.1;
|
|
360
|
-
|
|
361
|
-
// Keep within bounds
|
|
362
|
-
pkg.x = Math.max(50, Math.min(width - 100, pkg.x));
|
|
363
|
-
pkg.y = Math.max(25, Math.min(height - 50, pkg.y));
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return positioned;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
// Get package type icon
|
|
371
|
-
export const getPackageTypeIcon = (type: string): React.ReactNode => {
|
|
372
|
-
switch (type) {
|
|
373
|
-
case 'app':
|
|
374
|
-
return <RocketLaunchIcon className="w-6 h-6 text-primary-600" />;
|
|
375
|
-
case 'lib':
|
|
376
|
-
return <BuildingLibraryIcon className="w-6 h-6 text-primary-600" />;
|
|
377
|
-
case 'tool':
|
|
378
|
-
return '🔧';
|
|
379
|
-
default:
|
|
380
|
-
return <CubeIcon className="w-6 h-6 text-primary-600" />;
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
// Format package name for display
|
|
385
|
-
export const formatPackageName = (name: string): string => {
|
|
386
|
-
return name.length > 12 ? `${name.substring(0, 12)}...` : name;
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
// --- DATA TRANSFORMATION UTILITY ---
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Calculates and returns a map of all packages that depend on every other package
|
|
393
|
-
* and third-party library in the monorepo.
|
|
394
|
-
* * @param packages The array of packages, where dependency lists are already parsed into string arrays.
|
|
395
|
-
* @returns A map where keys are dependencies and values are arrays of dependents.
|
|
396
|
-
*/
|
|
397
|
-
export const mapAllDependents = (packages: PackageNode[]): DependentsMap => {
|
|
398
|
-
// Use a Record to build the map efficiently.
|
|
399
|
-
const allDependentsMap: DependentsMap = {};
|
|
400
|
-
|
|
401
|
-
// 1. First, ensure every package itself is registered as a dependency, even if nothing
|
|
402
|
-
// currently depends on it (it will start with an empty array).
|
|
403
|
-
packages.forEach(pkg => {
|
|
404
|
-
allDependentsMap[pkg.name] = [];
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
// 2. Iterate through every package to find out what depends on them.
|
|
408
|
-
packages.forEach(dependentPkg => {
|
|
409
|
-
const dependentName = dependentPkg.name;
|
|
410
|
-
|
|
411
|
-
// Combine runtime and dev dependencies into a single set for efficient iteration
|
|
412
|
-
const allDependencies = [
|
|
413
|
-
...Object.keys(dependentPkg.dependencies ?? {}),
|
|
414
|
-
...Object.keys(dependentPkg.devDependencies ?? {}),
|
|
415
|
-
...Object.keys(dependentPkg.peerDependencies ?? {}),
|
|
416
|
-
];
|
|
417
|
-
|
|
418
|
-
allDependencies.forEach(dependencyName => {
|
|
419
|
-
// Initialize the array for the dependency if it doesn't exist yet (for external libraries)
|
|
420
|
-
if (!allDependentsMap[dependencyName]) {
|
|
421
|
-
allDependentsMap[dependencyName] = [];
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// Add the current package (the dependent) to the dependency's list
|
|
425
|
-
// Check to prevent duplicates, although it's rare in this context
|
|
426
|
-
if (!allDependentsMap[dependencyName].includes(dependentName)) {
|
|
427
|
-
allDependentsMap[dependencyName].push(dependentName);
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
return allDependentsMap;
|
|
433
|
-
};
|