@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
|
@@ -1,733 +0,0 @@
|
|
|
1
|
-
import { DASHBOARD_API_ENDPOINTS } from '../constants/api-config';
|
|
2
|
-
import apiClient from './api';
|
|
3
|
-
import type {
|
|
4
|
-
Package,
|
|
5
|
-
DependencyInfo,
|
|
6
|
-
HealthMetric,
|
|
7
|
-
BuildStatus,
|
|
8
|
-
BuildStage,
|
|
9
|
-
ConfigFile,
|
|
10
|
-
} from '../types/monorepo-service.types';
|
|
11
|
-
class MonorepoService {
|
|
12
|
-
// Simulated monorepo data based on typical monorepo structure
|
|
13
|
-
private mockPackages: Package[] = [
|
|
14
|
-
// {
|
|
15
|
-
// name: '@monodog/dashboard',
|
|
16
|
-
// version: '1.0.0',
|
|
17
|
-
// type: 'app',
|
|
18
|
-
// status: 'healthy',
|
|
19
|
-
// lastUpdated: '2024-01-16',
|
|
20
|
-
// dependencies: 12,
|
|
21
|
-
// maintainers: ['team-frontend'],
|
|
22
|
-
// tags: ['core', 'ui', 'application'],
|
|
23
|
-
// description: 'React dashboard for monodog monorepo management',
|
|
24
|
-
// path: 'apps/dashboard',
|
|
25
|
-
// private: false,
|
|
26
|
-
// scripts: {
|
|
27
|
-
// dev: 'vite',
|
|
28
|
-
// build: 'tsc && vite build',
|
|
29
|
-
// preview: 'vite preview',
|
|
30
|
-
// lint: 'eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0',
|
|
31
|
-
// test: 'jest',
|
|
32
|
-
// },
|
|
33
|
-
// dependenciesList: [
|
|
34
|
-
// 'react',
|
|
35
|
-
// 'react-dom',
|
|
36
|
-
// 'react-router-dom',
|
|
37
|
-
// '@heroicons/react',
|
|
38
|
-
// 'recharts',
|
|
39
|
-
// 'clsx',
|
|
40
|
-
// 'date-fns',
|
|
41
|
-
// 'zustand',
|
|
42
|
-
// ],
|
|
43
|
-
// devDependenciesList: [
|
|
44
|
-
// '@types/react',
|
|
45
|
-
// '@types/react-dom',
|
|
46
|
-
// '@vitejs/plugin-react',
|
|
47
|
-
// 'typescript',
|
|
48
|
-
// 'vite',
|
|
49
|
-
// 'tailwindcss',
|
|
50
|
-
// ],
|
|
51
|
-
// },
|
|
52
|
-
// {
|
|
53
|
-
// name: '@monodog/backend',
|
|
54
|
-
// version: '1.0.0',
|
|
55
|
-
// type: 'service',
|
|
56
|
-
// status: 'healthy',
|
|
57
|
-
// lastUpdated: '2024-01-16',
|
|
58
|
-
// dependencies: 8,
|
|
59
|
-
// maintainers: ['team-backend'],
|
|
60
|
-
// tags: ['core', 'api', 'service'],
|
|
61
|
-
// description: 'Backend API server for monodog monorepo dashboard',
|
|
62
|
-
// path: 'packages/backend',
|
|
63
|
-
// private: false,
|
|
64
|
-
// scripts: {
|
|
65
|
-
// dev: 'tsx watch index.ts',
|
|
66
|
-
// start: 'tsx index.ts',
|
|
67
|
-
// build: 'tsc',
|
|
68
|
-
// test: 'jest',
|
|
69
|
-
// },
|
|
70
|
-
// dependenciesList: ['express', 'cors', 'body-parser', '@prisma/client'],
|
|
71
|
-
// devDependenciesList: [
|
|
72
|
-
// '@types/express',
|
|
73
|
-
// '@types/cors',
|
|
74
|
-
// '@types/node',
|
|
75
|
-
// 'tsx',
|
|
76
|
-
// 'typescript',
|
|
77
|
-
// 'prisma',
|
|
78
|
-
// ],
|
|
79
|
-
// },
|
|
80
|
-
// {
|
|
81
|
-
// name: '@monodog/utils',
|
|
82
|
-
// version: '1.0.0',
|
|
83
|
-
// type: 'lib',
|
|
84
|
-
// status: 'healthy',
|
|
85
|
-
// lastUpdated: '2024-01-16',
|
|
86
|
-
// dependencies: 3,
|
|
87
|
-
// maintainers: ['team-shared'],
|
|
88
|
-
// tags: ['shared', 'utilities', 'library'],
|
|
89
|
-
// description: 'Shared utility functions for monodog monorepo dashboard',
|
|
90
|
-
// path: 'libs/utils',
|
|
91
|
-
// private: false,
|
|
92
|
-
// scripts: {
|
|
93
|
-
// build: 'tsc',
|
|
94
|
-
// test: 'jest',
|
|
95
|
-
// },
|
|
96
|
-
// dependenciesList: [],
|
|
97
|
-
// devDependenciesList: ['@types/node', 'typescript'],
|
|
98
|
-
// },
|
|
99
|
-
// {
|
|
100
|
-
// name: '@monodog/monorepo-scanner',
|
|
101
|
-
// version: '0.2.0',
|
|
102
|
-
// type: 'tool',
|
|
103
|
-
// status: 'warning',
|
|
104
|
-
// lastUpdated: '2024-01-15',
|
|
105
|
-
// dependencies: 7,
|
|
106
|
-
// maintainers: ['team-devops'],
|
|
107
|
-
// tags: ['tooling', 'scanner', 'core'],
|
|
108
|
-
// description: 'Monorepo package discovery and analysis tool',
|
|
109
|
-
// path: 'packages/monorepo-scanner',
|
|
110
|
-
// private: false,
|
|
111
|
-
// scripts: {
|
|
112
|
-
// build: 'tsc',
|
|
113
|
-
// test: 'jest',
|
|
114
|
-
// scan: 'node dist/index.js',
|
|
115
|
-
// },
|
|
116
|
-
// dependenciesList: ['chalk', 'commander', 'glob', 'fs-extra'],
|
|
117
|
-
// devDependenciesList: ['@types/node', 'typescript', 'jest'],
|
|
118
|
-
// },
|
|
119
|
-
// {
|
|
120
|
-
// name: '@monodog/ci-status',
|
|
121
|
-
// version: '0.3.1',
|
|
122
|
-
// type: 'tool',
|
|
123
|
-
// status: 'healthy',
|
|
124
|
-
// lastUpdated: '2024-01-14',
|
|
125
|
-
// dependencies: 5,
|
|
126
|
-
// maintainers: ['team-devops'],
|
|
127
|
-
// tags: ['tooling', 'ci', 'monitoring'],
|
|
128
|
-
// description: 'CI/CD status monitoring and reporting tool',
|
|
129
|
-
// path: 'packages/ci-status',
|
|
130
|
-
// private: false,
|
|
131
|
-
// scripts: {
|
|
132
|
-
// build: 'tsc',
|
|
133
|
-
// test: 'jest',
|
|
134
|
-
// start: 'node dist/index.js',
|
|
135
|
-
// },
|
|
136
|
-
// dependenciesList: ['axios', 'ws', 'dotenv'],
|
|
137
|
-
// devDependenciesList: ['@types/node', 'typescript', 'jest'],
|
|
138
|
-
// },
|
|
139
|
-
];
|
|
140
|
-
|
|
141
|
-
async getPackages(): Promise<Package[]> {
|
|
142
|
-
try {
|
|
143
|
-
const response = await apiClient.get<Package[]>(
|
|
144
|
-
DASHBOARD_API_ENDPOINTS.PACKAGES.LIST
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
if (response.success) {
|
|
148
|
-
return response.data;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Log the failure and attempt a refresh, but don't throw so tests
|
|
152
|
-
// that expect a graceful fallback will remain deterministic.
|
|
153
|
-
console.error(
|
|
154
|
-
`getPackages: initial fetch failed with status ${response.error.status}. Attempting refresh...`
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
try {
|
|
158
|
-
const refreshedData = await this.refreshPackages();
|
|
159
|
-
return refreshedData;
|
|
160
|
-
} catch (refreshError) {
|
|
161
|
-
console.error('getPackages: refresh failed', refreshError);
|
|
162
|
-
return [];
|
|
163
|
-
}
|
|
164
|
-
} catch (error) {
|
|
165
|
-
console.error('getPackages: unexpected error', error);
|
|
166
|
-
// Final fallback: return empty list so callers don't receive a thrown error
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async getPackage(name: string): Promise<Package[]> {
|
|
172
|
-
const response = await apiClient.get<Package[]>(
|
|
173
|
-
DASHBOARD_API_ENDPOINTS.PACKAGES.DETAILS(name)
|
|
174
|
-
);
|
|
175
|
-
if (!response.success) {
|
|
176
|
-
throw new Error(
|
|
177
|
-
`Failed to fetch package details for "${name}" (Status: ${response.error.status})`
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
return response.data;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
async getDependencies(): Promise<DependencyInfo[]> {
|
|
184
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
185
|
-
const allDeps = new Set<string>();
|
|
186
|
-
try {
|
|
187
|
-
const packages = await this.getPackages();
|
|
188
|
-
|
|
189
|
-
packages.forEach(pkg => {
|
|
190
|
-
pkg.dependencies?.forEach(dep => allDeps.add(dep));
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
const dependencyInfoArray: DependencyInfo[] = Array.from(allDeps).map(
|
|
194
|
-
dep => ({
|
|
195
|
-
name: dep,
|
|
196
|
-
version: 'unknown',
|
|
197
|
-
type: 'dependency',
|
|
198
|
-
status: 'active',
|
|
199
|
-
})
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
return dependencyInfoArray;
|
|
203
|
-
} catch (error) {
|
|
204
|
-
console.error('Error fetching dependencies:', error);
|
|
205
|
-
return [];
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
async refreshPackages(): Promise<Package[]> {
|
|
210
|
-
try {
|
|
211
|
-
const response = await apiClient.post<Package[]>(
|
|
212
|
-
DASHBOARD_API_ENDPOINTS.PACKAGES.REFRESH
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
if (!response.success) {
|
|
216
|
-
console.error(
|
|
217
|
-
`refreshPackages: fetch failed with status ${response.error.status}`
|
|
218
|
-
);
|
|
219
|
-
return [];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return response.data;
|
|
223
|
-
} catch (error) {
|
|
224
|
-
console.error('refreshPackages: unexpected error', error);
|
|
225
|
-
return [];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
// async getHealthStatus(): Promise<{
|
|
229
|
-
// overallScore: number;
|
|
230
|
-
// metrics: HealthMetric[];
|
|
231
|
-
// packageHealth: Array<{ package: string; score: number; issues: string[] }>;
|
|
232
|
-
// }> {
|
|
233
|
-
// console.log('Fetching health status...');
|
|
234
|
-
// try {
|
|
235
|
-
// // Call your real backend API
|
|
236
|
-
// const healthRes = await fetch(`${API_BASE}/health/packages`);
|
|
237
|
-
|
|
238
|
-
// if (!healthRes.ok) {
|
|
239
|
-
// throw new Error('Failed to fetch health data');
|
|
240
|
-
// }
|
|
241
|
-
|
|
242
|
-
// const healthData = await healthRes.json();
|
|
243
|
-
// console.log('Health data:', healthData);
|
|
244
|
-
|
|
245
|
-
// // Transform the data to match your frontend expectations
|
|
246
|
-
// return this.transformHealthData(healthData);
|
|
247
|
-
// } catch (error) {
|
|
248
|
-
// console.error('Error fetching health data:', error);
|
|
249
|
-
// // Fallback to the existing mock implementation
|
|
250
|
-
// return await this.getFallbackHealthStatus();
|
|
251
|
-
// }
|
|
252
|
-
// }
|
|
253
|
-
|
|
254
|
-
async getHealthStatus(): Promise<{
|
|
255
|
-
overallScore: number;
|
|
256
|
-
metrics: HealthMetric[];
|
|
257
|
-
packageHealth: Array<{ package: string; score: number; issues: string[] }>;
|
|
258
|
-
}> {
|
|
259
|
-
try {
|
|
260
|
-
// First attempt to get health data
|
|
261
|
-
let response = await apiClient.get(DASHBOARD_API_ENDPOINTS.HEALTH.PACKAGES);
|
|
262
|
-
|
|
263
|
-
if (!response.success) {
|
|
264
|
-
// If initial fetch fails, try to refresh the data
|
|
265
|
-
const refreshResponse = await apiClient.post(
|
|
266
|
-
DASHBOARD_API_ENDPOINTS.HEALTH.REFRESH
|
|
267
|
-
);
|
|
268
|
-
|
|
269
|
-
if (!refreshResponse.success) {
|
|
270
|
-
throw new Error('Failed to refresh health data');
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Wait a moment for the refresh to complete, then fetch again
|
|
274
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
275
|
-
|
|
276
|
-
// Second attempt to get health data after refresh
|
|
277
|
-
response = await apiClient.get(DASHBOARD_API_ENDPOINTS.HEALTH.PACKAGES);
|
|
278
|
-
|
|
279
|
-
if (!response.success) {
|
|
280
|
-
throw new Error('Failed to fetch health data after refresh');
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return response.data as any;
|
|
285
|
-
} catch (error) {
|
|
286
|
-
console.error('Error fetching health data:', error);
|
|
287
|
-
throw error;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
async refreshHealthStatus(): Promise<{
|
|
292
|
-
overallScore: number;
|
|
293
|
-
metrics: HealthMetric[];
|
|
294
|
-
packageHealth: Array<{ package: string; score: number; issues: string[] }>;
|
|
295
|
-
}> {
|
|
296
|
-
try {
|
|
297
|
-
// Call your real backend API
|
|
298
|
-
const healthRes = await apiClient.post(DASHBOARD_API_ENDPOINTS.HEALTH.REFRESH);
|
|
299
|
-
|
|
300
|
-
if (!healthRes.success) {
|
|
301
|
-
throw new Error('Failed to fetch health data');
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const healthData = healthRes.data;
|
|
305
|
-
// console.log('Health data from refreshHealthStatus:', healthData);
|
|
306
|
-
|
|
307
|
-
// Transform the data to match your frontend expectations
|
|
308
|
-
// return this.transformHealthData(healthData);
|
|
309
|
-
return healthData;
|
|
310
|
-
} catch (error) {
|
|
311
|
-
console.error('Error fetching health data:', error);
|
|
312
|
-
// Fallback to the existing mock implementation
|
|
313
|
-
// return await this.getFallbackHealthStatus();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
// Add this private method for fallback data
|
|
317
|
-
// async getHealthStatus(): Promise<{
|
|
318
|
-
// overallScore: number;
|
|
319
|
-
// metrics: HealthMetric[];
|
|
320
|
-
// packageHealth: Array<{ package: string; score: number; issues: string[] }>;
|
|
321
|
-
// }> {
|
|
322
|
-
// const healthRes = await fetch(`${API_BASE}/health/packages`);
|
|
323
|
-
// await new Promise(resolve => setTimeout(resolve, 400));
|
|
324
|
-
|
|
325
|
-
// const metrics: HealthMetric[] = [];
|
|
326
|
-
// let totalScore = 0;
|
|
327
|
-
|
|
328
|
-
// // Package count metric
|
|
329
|
-
// const packageCount = this.mockPackages.length;
|
|
330
|
-
// const packageCountScore = Math.min(100, (packageCount / 10) * 100);
|
|
331
|
-
// metrics.push({
|
|
332
|
-
// name: 'Package Count',
|
|
333
|
-
// value: packageCount,
|
|
334
|
-
// status:
|
|
335
|
-
// packageCountScore >= 80
|
|
336
|
-
// ? 'healthy'
|
|
337
|
-
// : packageCountScore >= 60
|
|
338
|
-
// ? 'warning'
|
|
339
|
-
// : 'error',
|
|
340
|
-
// description: `${packageCount} packages in monorepo`,
|
|
341
|
-
// });
|
|
342
|
-
// totalScore += packageCountScore;
|
|
343
|
-
|
|
344
|
-
// // Dependency health metric
|
|
345
|
-
// const avgDependencies =
|
|
346
|
-
// this.mockPackages.reduce((sum, pkg) => sum + pkg.dependencies, 0) /
|
|
347
|
-
// this.mockPackages.length;
|
|
348
|
-
// const dependencyScore =
|
|
349
|
-
// avgDependencies <= 15 ? 100 : avgDependencies <= 25 ? 80 : 60;
|
|
350
|
-
// metrics.push({
|
|
351
|
-
// name: 'Dependency Health',
|
|
352
|
-
// value: Math.round(avgDependencies),
|
|
353
|
-
// status:
|
|
354
|
-
// dependencyScore >= 80
|
|
355
|
-
// ? 'healthy'
|
|
356
|
-
// : dependencyScore >= 60
|
|
357
|
-
// ? 'warning'
|
|
358
|
-
// : 'error',
|
|
359
|
-
// description: `Average ${Math.round(avgDependencies)} dependencies per package`,
|
|
360
|
-
// });
|
|
361
|
-
// totalScore += dependencyScore;
|
|
362
|
-
|
|
363
|
-
// // Version consistency metric
|
|
364
|
-
// const versions = this.mockPackages.map(pkg => pkg.version);
|
|
365
|
-
// const uniqueVersions = new Set(versions).size;
|
|
366
|
-
// const versionScore =
|
|
367
|
-
// uniqueVersions <= 3 ? 100 : uniqueVersions <= 5 ? 80 : 60;
|
|
368
|
-
// metrics.push({
|
|
369
|
-
// name: 'Version Consistency',
|
|
370
|
-
// value: uniqueVersions,
|
|
371
|
-
// status:
|
|
372
|
-
// versionScore >= 80
|
|
373
|
-
// ? 'healthy'
|
|
374
|
-
// : versionScore >= 60
|
|
375
|
-
// ? 'warning'
|
|
376
|
-
// : 'error',
|
|
377
|
-
// description: `${uniqueVersions} different versions in use`,
|
|
378
|
-
// });
|
|
379
|
-
// totalScore += versionScore;
|
|
380
|
-
|
|
381
|
-
// // Package health analysis
|
|
382
|
-
// const packageHealth = this.mockPackages.map(pkg => {
|
|
383
|
-
// let score = 100;
|
|
384
|
-
// const issues: string[] = [];
|
|
385
|
-
|
|
386
|
-
// if (!pkg.description || pkg.description === 'No description provided') {
|
|
387
|
-
// score -= 20;
|
|
388
|
-
// issues.push('Missing description');
|
|
389
|
-
// }
|
|
390
|
-
|
|
391
|
-
// if (pkg.dependencies > 20) {
|
|
392
|
-
// score -= 15;
|
|
393
|
-
// issues.push('High dependency count');
|
|
394
|
-
// }
|
|
395
|
-
|
|
396
|
-
// if (pkg.private && !pkg.scripts?.build) {
|
|
397
|
-
// score -= 10;
|
|
398
|
-
// issues.push('Private package without build script');
|
|
399
|
-
// }
|
|
400
|
-
|
|
401
|
-
// return { package: pkg.name, score: Math.max(0, score), issues };
|
|
402
|
-
// });
|
|
403
|
-
|
|
404
|
-
// const overallScore = Math.round(totalScore / metrics.length);
|
|
405
|
-
|
|
406
|
-
// return {
|
|
407
|
-
// overallScore,
|
|
408
|
-
// metrics,
|
|
409
|
-
// packageHealth,
|
|
410
|
-
// };
|
|
411
|
-
// }
|
|
412
|
-
private async getFallbackHealthStatus(): Promise<{
|
|
413
|
-
overallScore: number;
|
|
414
|
-
metrics: HealthMetric[];
|
|
415
|
-
packageHealth: Array<{ package: string; score: number; issues: string[] }>;
|
|
416
|
-
}> {
|
|
417
|
-
await new Promise(resolve => setTimeout(resolve, 400));
|
|
418
|
-
|
|
419
|
-
const metrics: HealthMetric[] = [
|
|
420
|
-
{
|
|
421
|
-
name: 'Package Count',
|
|
422
|
-
value: this.mockPackages.length,
|
|
423
|
-
status: 'healthy',
|
|
424
|
-
description: `${this.mockPackages.length} packages in monorepo`,
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
name: 'Dependency Health',
|
|
428
|
-
value: 85,
|
|
429
|
-
status: 'healthy',
|
|
430
|
-
description: 'Dependencies are up to date',
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
name: 'Build Status',
|
|
434
|
-
value: 95,
|
|
435
|
-
status: 'healthy',
|
|
436
|
-
description: 'Most builds are successful',
|
|
437
|
-
},
|
|
438
|
-
];
|
|
439
|
-
|
|
440
|
-
const packageHealth = this.mockPackages.map(pkg => ({
|
|
441
|
-
package: pkg.name,
|
|
442
|
-
score: pkg.status === 'healthy' ? 90 : pkg.status === 'warning' ? 70 : 50,
|
|
443
|
-
issues: pkg.status === 'healthy' ? [] : ['Needs attention'],
|
|
444
|
-
}));
|
|
445
|
-
|
|
446
|
-
const overallScore = 85;
|
|
447
|
-
|
|
448
|
-
return {
|
|
449
|
-
overallScore,
|
|
450
|
-
metrics,
|
|
451
|
-
packageHealth,
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// Add this private transform method
|
|
456
|
-
// private transformHealthData(healthData: any): {
|
|
457
|
-
// overallScore: number;
|
|
458
|
-
// metrics: HealthMetric[];
|
|
459
|
-
// packageHealth: Array<{ package: string; score: number; issues: string[] }>;
|
|
460
|
-
// } {
|
|
461
|
-
// console.log('-->', healthData);
|
|
462
|
-
// const overallScore = healthData.summary?.averageScore || 75;
|
|
463
|
-
|
|
464
|
-
// // Create metrics from health data
|
|
465
|
-
// const metrics: HealthMetric[] = [
|
|
466
|
-
// {
|
|
467
|
-
// name: 'Package Health',
|
|
468
|
-
// value: healthData.summary?.healthy || 0,
|
|
469
|
-
// status: this.calculateHealthStatus(
|
|
470
|
-
// healthData.summary?.healthy,
|
|
471
|
-
// healthData.summary?.total
|
|
472
|
-
// ),
|
|
473
|
-
// description: `${healthData.summary?.healthy || 0} healthy packages out of ${healthData.summary?.total || 0}`,
|
|
474
|
-
// },
|
|
475
|
-
// {
|
|
476
|
-
// name: 'Overall Score',
|
|
477
|
-
// value: Math.round(overallScore),
|
|
478
|
-
// status:
|
|
479
|
-
// Math.round(overallScore) >= 80
|
|
480
|
-
// ? 'healthy'
|
|
481
|
-
// : Math.round(overallScore) >= 60
|
|
482
|
-
// ? 'warning'
|
|
483
|
-
// : 'error',
|
|
484
|
-
// description: `Average health score: ${Math.round(overallScore)}/100`,
|
|
485
|
-
// },
|
|
486
|
-
// {
|
|
487
|
-
// name: 'Unhealthy Packages',
|
|
488
|
-
// value: healthData.summary?.unhealthy || 0,
|
|
489
|
-
// status:
|
|
490
|
-
// (healthData.summary?.unhealthy || 0) === 0
|
|
491
|
-
// ? 'healthy'
|
|
492
|
-
// : (healthData.summary?.unhealthy || 0) <= 2
|
|
493
|
-
// ? 'warning'
|
|
494
|
-
// : 'error',
|
|
495
|
-
// description: `${healthData.summary?.unhealthy || 0} packages need attention`,
|
|
496
|
-
// },
|
|
497
|
-
// ];
|
|
498
|
-
|
|
499
|
-
// // Transform package health data
|
|
500
|
-
// const packageHealth = healthData.packages.map((pkg: any) => ({
|
|
501
|
-
// package: pkg.packageName,
|
|
502
|
-
// score: pkg.health?.overallScore || 0,
|
|
503
|
-
// issues: pkg.error
|
|
504
|
-
// ? [pkg.error]
|
|
505
|
-
// : (pkg.health?.overallScore || 0) < 80
|
|
506
|
-
// ? ['Needs improvement']
|
|
507
|
-
// : [],
|
|
508
|
-
// }));
|
|
509
|
-
|
|
510
|
-
// return {
|
|
511
|
-
// overallScore,
|
|
512
|
-
// metrics,
|
|
513
|
-
// packageHealth,
|
|
514
|
-
// };
|
|
515
|
-
// }
|
|
516
|
-
|
|
517
|
-
// Add this helper method (RENAMED to avoid conflict)
|
|
518
|
-
// private calculateHealthStatus(
|
|
519
|
-
// healthy: number,
|
|
520
|
-
// total: number
|
|
521
|
-
// ): 'healthy' | 'warning' | 'error' {
|
|
522
|
-
// if (total === 0) return 'healthy';
|
|
523
|
-
// const ratio = healthy / total;
|
|
524
|
-
// if (ratio >= 0.8) return 'healthy';
|
|
525
|
-
// if (ratio >= 0.6) return 'warning';
|
|
526
|
-
// return 'error';
|
|
527
|
-
// }
|
|
528
|
-
|
|
529
|
-
// Add this method to your MonorepoService class
|
|
530
|
-
async updatePackageConfiguration(
|
|
531
|
-
packageName: string,
|
|
532
|
-
config: string,
|
|
533
|
-
packagePath: string
|
|
534
|
-
): Promise<{
|
|
535
|
-
success: boolean;
|
|
536
|
-
message: string;
|
|
537
|
-
package: Package;
|
|
538
|
-
healthRefreshed?: boolean;
|
|
539
|
-
preservedFields?: boolean;
|
|
540
|
-
}> {
|
|
541
|
-
try {
|
|
542
|
-
// console.log(
|
|
543
|
-
// '📤 Updating package configuration via MonorepoService:',
|
|
544
|
-
// packageName
|
|
545
|
-
// );
|
|
546
|
-
|
|
547
|
-
const response = await apiClient.put(DASHBOARD_API_ENDPOINTS.PACKAGES.UPDATE_CONFIG, JSON.stringify({
|
|
548
|
-
packageName,
|
|
549
|
-
config,
|
|
550
|
-
packagePath,
|
|
551
|
-
}));
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (!response.success) {
|
|
555
|
-
throw new Error(`HTTP error: ${response.error?.message}`);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
const result = response.data;
|
|
559
|
-
|
|
560
|
-
return result;
|
|
561
|
-
} catch (error) {
|
|
562
|
-
console.error('Error updating package configuration:', error);
|
|
563
|
-
throw error;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
async getBuildStatus(): Promise<BuildStatus[]> {
|
|
568
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
569
|
-
|
|
570
|
-
const builds: BuildStatus[] = [];
|
|
571
|
-
|
|
572
|
-
for (const pkg of this.mockPackages) {
|
|
573
|
-
const hasBuildScript = pkg.scripts && pkg.scripts.build;
|
|
574
|
-
const hasTestScript = pkg.scripts && pkg.scripts.test;
|
|
575
|
-
|
|
576
|
-
if (hasBuildScript || hasTestScript) {
|
|
577
|
-
const startTime = new Date(
|
|
578
|
-
Date.now() - Math.random() * 86400000
|
|
579
|
-
).toISOString();
|
|
580
|
-
const status: 'success' | 'failed' | 'building' | 'queued' =
|
|
581
|
-
Math.random() > 0.8
|
|
582
|
-
? 'failed'
|
|
583
|
-
: Math.random() > 0.6
|
|
584
|
-
? 'building'
|
|
585
|
-
: Math.random() > 0.4
|
|
586
|
-
? 'queued'
|
|
587
|
-
: 'success';
|
|
588
|
-
|
|
589
|
-
builds.push({
|
|
590
|
-
id: `build-${pkg.name}-${Date.now()}`,
|
|
591
|
-
package: pkg.name,
|
|
592
|
-
status,
|
|
593
|
-
startTime,
|
|
594
|
-
endTime:
|
|
595
|
-
status !== 'building'
|
|
596
|
-
? new Date(Date.now() - Math.random() * 3600000).toISOString()
|
|
597
|
-
: undefined,
|
|
598
|
-
duration:
|
|
599
|
-
status !== 'building'
|
|
600
|
-
? Math.floor(Math.random() * 300) + 60
|
|
601
|
-
: undefined,
|
|
602
|
-
stages: this.generateBuildStages(pkg, status),
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
return builds;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
async getConfigurationFiles(): Promise<ConfigFile[]> {
|
|
611
|
-
try {
|
|
612
|
-
// console.log('Fetching configuration files from backend...');
|
|
613
|
-
|
|
614
|
-
// Call your real backend API
|
|
615
|
-
const res = await apiClient.get(DASHBOARD_API_ENDPOINTS.CONFIG.FILES);
|
|
616
|
-
|
|
617
|
-
if (!res.success) {
|
|
618
|
-
throw new Error(
|
|
619
|
-
`Failed to fetch config files: ${res.error?.message}`
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
const response = res.data;
|
|
624
|
-
|
|
625
|
-
// console.log('Response from config files API:', response);
|
|
626
|
-
|
|
627
|
-
if (response.success && response.files) {
|
|
628
|
-
// console.log(
|
|
629
|
-
// `Successfully fetched ${response.files.length} configuration files`
|
|
630
|
-
// );
|
|
631
|
-
return response.files;
|
|
632
|
-
} else {
|
|
633
|
-
throw new Error('Invalid response format from config files API');
|
|
634
|
-
}
|
|
635
|
-
} catch (error) {
|
|
636
|
-
console.error('Error fetching configuration files from backend:', error);
|
|
637
|
-
|
|
638
|
-
// Fallback to empty array if backend call fails
|
|
639
|
-
// console.log('Returning empty config files list due to error...');
|
|
640
|
-
return [];
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
async saveConfigurationFile(
|
|
645
|
-
fileId: string,
|
|
646
|
-
content: string
|
|
647
|
-
): Promise<ConfigFile> {
|
|
648
|
-
try {
|
|
649
|
-
// console.log('Saving configuration file:', fileId);
|
|
650
|
-
|
|
651
|
-
const res = await apiClient.put(
|
|
652
|
-
DASHBOARD_API_ENDPOINTS.CONFIG.FILE(fileId),
|
|
653
|
-
JSON.stringify({ content })
|
|
654
|
-
);
|
|
655
|
-
|
|
656
|
-
if (!res.success) {
|
|
657
|
-
throw new Error(
|
|
658
|
-
res.error?.message ||
|
|
659
|
-
`Failed to save file`
|
|
660
|
-
);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
const response = res.data;
|
|
664
|
-
|
|
665
|
-
if (response.success && response.file) {
|
|
666
|
-
// console.log('File saved successfully:', fileId);
|
|
667
|
-
return response.file;
|
|
668
|
-
} else {
|
|
669
|
-
throw new Error('Invalid response format from save file API');
|
|
670
|
-
}
|
|
671
|
-
} catch (error) {
|
|
672
|
-
console.error('Error saving configuration file:', error);
|
|
673
|
-
throw error; // Re-throw to let the component handle it
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
private generateBuildStages(pkg: Package, status: string): BuildStage[] {
|
|
678
|
-
const stages: BuildStage[] = [
|
|
679
|
-
{
|
|
680
|
-
name: 'Install',
|
|
681
|
-
status: 'success',
|
|
682
|
-
duration: Math.floor(Math.random() * 30) + 10,
|
|
683
|
-
logs: [
|
|
684
|
-
'Installing dependencies...',
|
|
685
|
-
'Dependencies installed successfully',
|
|
686
|
-
],
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
name: 'Lint',
|
|
690
|
-
status:
|
|
691
|
-
status === 'failed' && Math.random() > 0.7 ? 'failed' : 'success',
|
|
692
|
-
duration: Math.floor(Math.random() * 20) + 5,
|
|
693
|
-
logs: ['Running ESLint...', 'Linting completed'],
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
name: 'Test',
|
|
697
|
-
status:
|
|
698
|
-
status === 'failed' && Math.random() > 0.5 ? 'failed' : 'success',
|
|
699
|
-
duration: Math.floor(Math.random() * 60) + 30,
|
|
700
|
-
logs: ['Running tests...', 'Test suite completed'],
|
|
701
|
-
},
|
|
702
|
-
{
|
|
703
|
-
name: 'Build',
|
|
704
|
-
status: status === 'failed' ? 'failed' : 'success',
|
|
705
|
-
duration: Math.floor(Math.random() * 120) + 60,
|
|
706
|
-
logs: ['Building package...', 'Build completed successfully'],
|
|
707
|
-
},
|
|
708
|
-
];
|
|
709
|
-
|
|
710
|
-
if (status === 'building') {
|
|
711
|
-
const buildingStage = Math.floor(Math.random() * stages.length);
|
|
712
|
-
stages[buildingStage].status = 'running';
|
|
713
|
-
stages
|
|
714
|
-
.slice(buildingStage + 1)
|
|
715
|
-
.forEach(stage => (stage.status = 'pending'));
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
return stages;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
export const monorepoService = new MonorepoService();
|
|
723
|
-
|
|
724
|
-
// Re-export types for backward compatibility
|
|
725
|
-
export type {
|
|
726
|
-
Package,
|
|
727
|
-
DependencyInfo,
|
|
728
|
-
HealthMetric,
|
|
729
|
-
BuildStatus,
|
|
730
|
-
BuildStage,
|
|
731
|
-
ConfigFile,
|
|
732
|
-
} from '../types/monorepo-service.types';
|
|
733
|
-
|