feat: scaffold headlamp-argocd-plugin with standard plugin structure

Adds the full plugin scaffold matching the Headlamp plugin pattern
(polaris, kube-vip, etc.):
- package.json with full devDependencies (Vitest, TypeScript, ESLint, Prettier)
- tsconfig.json, vitest.config.mts, vitest.setup.ts
- src/index.tsx with ArgoCDErrorBoundary and stub Applications route
- src/index.test.tsx smoke test to verify module importability
- CLAUDE.md documentation for future development
- .gitignore for node_modules/dist
- pnpm-lock.yaml pinned via packageManager field

ArtifactHub metadata already present (created by Hugh in PRI-186).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Test User
2026-04-21 20:16:07 +00:00
parent d81b728d4d
commit a0031fc59a
9 changed files with 12449 additions and 10 deletions
+16
View File
@@ -0,0 +1,16 @@
import React from 'react';
import { describe, it, expect } from 'vitest';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom';
/**
* Minimal test to verify the plugin index module loads without throwing.
* Full component tests will be added in subsequent tasks.
*/
describe('ArgoCD Plugin Scaffold', () => {
it('index module is importable', async () => {
// Dynamic import to verify the module parses and exports correctly
const mod = await import('./index');
expect(mod).toBeDefined();
});
});
+76
View File
@@ -0,0 +1,76 @@
import {
registerRoute,
registerSidebarEntry,
} from '@kinvolk/headlamp-plugin/lib';
import { SectionBox, StatusLabel } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
import React from 'react';
// --- Error boundary for plugin components ---
interface ErrorBoundaryState {
error: string | null;
}
class ArgoCDErrorBoundary extends React.Component<
{ children: React.ReactNode },
ErrorBoundaryState
> {
state: ErrorBoundaryState = { error: null };
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
return { error: error.message };
}
render() {
if (this.state.error) {
return (
<SectionBox title="ArgoCD Plugin Error">
<StatusLabel status="error">{this.state.error}</StatusLabel>
</SectionBox>
);
}
return this.props.children;
}
}
// --- Stub Applications List View ---
function ArgoCDStubView() {
return (
<SectionBox title="ArgoCD Applications">
<StatusLabel status="info">Plugin scaffold features coming soon.</StatusLabel>
</SectionBox>
);
}
// --- Sidebar entry ---
registerSidebarEntry({
parent: null,
name: 'argocd',
label: 'ArgoCD',
url: '/argocd',
icon: 'mdi:git',
});
registerSidebarEntry({
parent: 'argocd',
name: 'argocd-overview',
label: 'Applications',
url: '/argocd',
icon: 'mdi:view-list',
});
// --- Routes ---
registerRoute({
path: '/argocd',
sidebar: 'argocd-overview',
name: 'argocd',
exact: true,
component: () => (
<ArgoCDErrorBoundary>
<ArgoCDStubView />
</ArgoCDErrorBoundary>
),
});