docs: implement Phase 2 - API documentation with TypeDoc
Set up TypeDoc to auto-generate comprehensive API reference documentation from TypeScript source code. Changes: - Installed typedoc and typedoc-plugin-markdown (v0.2.0 plugins) - Created typedoc.json configuration with 9 entry points - Added docs:api and docs:watch npm scripts - Fixed test file imports (validateNamespace → isValidNamespace) - Updated tsconfig.json to exclude test files from compilation - Generated markdown API documentation in docs/api-reference/generated/ Generated API documentation: - 9 modules documented (lib/, hooks/, types/) - lib/crypto - 14 encryption/certificate functions - lib/controller - 5 Kubernetes API functions - lib/validators - 6 validation functions - lib/retry - Exponential backoff utilities - lib/rbac - RBAC permission checking - types - Result types, branded types, interfaces - hooks/useSealedSecretEncryption - Encryption React hook - hooks/usePermissions - RBAC React hooks - hooks/useControllerHealth - Health monitoring hook Benefits: - Auto-generated from TypeScript source (stays in sync) - Markdown format for easy integration - Type signatures and JSDoc included - Function parameters and return types documented - Links between related types and functions Phase 2 deliverables (2-3 days estimated, completed in 1 session): ✅ TypeDoc installed and configured ✅ Entry points identified for all core modules ✅ API documentation generated (9 modules, 40+ functions) ✅ npm scripts added for docs generation ✅ Test files excluded from documentation Next: Phase 3 - User tutorials and guides Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -15,7 +15,7 @@ const localStorageMock = {
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
validateNamespace,
|
||||
isValidNamespace,
|
||||
validatePEMCertificate,
|
||||
validateSecretKey,
|
||||
validateSecretName,
|
||||
@@ -83,22 +83,22 @@ describe('validators', () => {
|
||||
|
||||
describe('validateNamespace', () => {
|
||||
it('should accept valid namespace names', () => {
|
||||
expect(validateNamespace('default').valid).toBe(true);
|
||||
expect(validateNamespace('kube-system').valid).toBe(true);
|
||||
expect(validateNamespace('my-namespace').valid).toBe(true);
|
||||
expect(validateNamespace('ns-123').valid).toBe(true);
|
||||
expect(isValidNamespace('default').valid).toBe(true);
|
||||
expect(isValidNamespace('kube-system').valid).toBe(true);
|
||||
expect(isValidNamespace('my-namespace').valid).toBe(true);
|
||||
expect(isValidNamespace('ns-123').valid).toBe(true);
|
||||
});
|
||||
|
||||
it('should reject invalid namespace names', () => {
|
||||
expect(validateNamespace('').valid).toBe(false);
|
||||
expect(validateNamespace('My-Namespace').valid).toBe(false);
|
||||
expect(validateNamespace('-namespace').valid).toBe(false);
|
||||
expect(validateNamespace('namespace-').valid).toBe(false);
|
||||
expect(validateNamespace('namespace_name').valid).toBe(false);
|
||||
expect(isValidNamespace('').valid).toBe(false);
|
||||
expect(isValidNamespace('My-Namespace').valid).toBe(false);
|
||||
expect(isValidNamespace('-namespace').valid).toBe(false);
|
||||
expect(isValidNamespace('namespace-').valid).toBe(false);
|
||||
expect(isValidNamespace('namespace_name').valid).toBe(false);
|
||||
});
|
||||
|
||||
it('should reject namespaces exceeding 63 characters', () => {
|
||||
const result = validateNamespace('x'.repeat(64));
|
||||
const result = isValidNamespace('x'.repeat(64));
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toContain('63 characters');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user