kubetsx 0.1.2 → 0.1.3
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/dist/cli.js +1 -1
- package/package.json +6 -1
- package/examples/basic.tsx +0 -71
- package/examples/full-stack.tsx +0 -339
- package/examples/tsconfig.json +0 -21
- package/src/cli.ts +0 -111
- package/src/components/index.ts +0 -241
- package/src/index.ts +0 -123
- package/src/jsx-runtime.ts +0 -71
- package/src/render.ts +0 -863
- package/src/types.ts +0 -362
- package/tsconfig.examples.json +0 -18
- package/tsconfig.json +0 -22
package/src/types.ts
DELETED
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 🎯 Kubetsx - TypeScript Types for Kubernetes Resources
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Core JSX Types
|
|
7
|
-
// ============================================================================
|
|
8
|
-
|
|
9
|
-
export interface KubexElement {
|
|
10
|
-
type: string | KubexComponent;
|
|
11
|
-
props: Record<string, unknown>;
|
|
12
|
-
children: KubexNode[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type KubexNode = KubexElement | string | number | boolean | null | undefined | KubexNode[];
|
|
16
|
-
|
|
17
|
-
export type KubexComponent<P = Record<string, unknown>> = (props: P) => KubexElement | null;
|
|
18
|
-
|
|
19
|
-
// ============================================================================
|
|
20
|
-
// Kubernetes Resource Types
|
|
21
|
-
// ============================================================================
|
|
22
|
-
|
|
23
|
-
export interface K8sMetadata {
|
|
24
|
-
name: string;
|
|
25
|
-
namespace?: string;
|
|
26
|
-
labels?: Record<string, string>;
|
|
27
|
-
annotations?: Record<string, string>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface K8sResource {
|
|
31
|
-
apiVersion: string;
|
|
32
|
-
kind: string;
|
|
33
|
-
metadata: K8sMetadata;
|
|
34
|
-
spec?: Record<string, unknown>;
|
|
35
|
-
data?: Record<string, string>;
|
|
36
|
-
stringData?: Record<string, string>;
|
|
37
|
-
type?: string;
|
|
38
|
-
rules?: unknown[];
|
|
39
|
-
roleRef?: Record<string, unknown>;
|
|
40
|
-
subjects?: unknown[];
|
|
41
|
-
[key: string]: unknown;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// ============================================================================
|
|
45
|
-
// Component Props
|
|
46
|
-
// ============================================================================
|
|
47
|
-
|
|
48
|
-
// --- Manifest (Fragment alternative) ---
|
|
49
|
-
export interface ManifestProps {
|
|
50
|
-
name?: string;
|
|
51
|
-
children?: KubexNode;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// --- Cluster & Namespace ---
|
|
55
|
-
export interface ClusterProps {
|
|
56
|
-
name: string;
|
|
57
|
-
children?: KubexNode;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface NamespaceProps {
|
|
61
|
-
name: string;
|
|
62
|
-
labels?: Record<string, string>;
|
|
63
|
-
children?: KubexNode;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// --- Deployment ---
|
|
67
|
-
export interface DeploymentProps {
|
|
68
|
-
name: string;
|
|
69
|
-
namespace?: string;
|
|
70
|
-
replicas?: number;
|
|
71
|
-
labels?: Record<string, string>;
|
|
72
|
-
annotations?: Record<string, string>;
|
|
73
|
-
selector?: Record<string, string>;
|
|
74
|
-
strategy?: 'RollingUpdate' | 'Recreate';
|
|
75
|
-
children?: KubexNode;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// --- Container ---
|
|
79
|
-
export interface ContainerProps {
|
|
80
|
-
name: string;
|
|
81
|
-
image: string;
|
|
82
|
-
imagePullPolicy?: 'Always' | 'IfNotPresent' | 'Never';
|
|
83
|
-
command?: string[];
|
|
84
|
-
args?: string[];
|
|
85
|
-
workingDir?: string;
|
|
86
|
-
children?: KubexNode;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// --- Port ---
|
|
90
|
-
export interface PortProps {
|
|
91
|
-
container: number;
|
|
92
|
-
name?: string;
|
|
93
|
-
protocol?: 'TCP' | 'UDP' | 'SCTP';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// --- Environment Variables ---
|
|
97
|
-
export interface EnvProps {
|
|
98
|
-
key?: string;
|
|
99
|
-
name: string;
|
|
100
|
-
value?: string;
|
|
101
|
-
children?: KubexNode;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface SecretRefProps {
|
|
105
|
-
name: string;
|
|
106
|
-
secretKey: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface ConfigMapRefProps {
|
|
110
|
-
name: string;
|
|
111
|
-
configKey: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// --- Resources ---
|
|
115
|
-
export interface ResourcesProps {
|
|
116
|
-
requestMemory?: string;
|
|
117
|
-
requestCpu?: string;
|
|
118
|
-
limitMemory?: string;
|
|
119
|
-
limitCpu?: string;
|
|
120
|
-
requestEphemeralStorage?: string;
|
|
121
|
-
limitEphemeralStorage?: string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// --- Probes ---
|
|
125
|
-
export interface ProbeProps {
|
|
126
|
-
key?: string;
|
|
127
|
-
type: 'liveness' | 'readiness' | 'startup';
|
|
128
|
-
delay?: number;
|
|
129
|
-
period?: number;
|
|
130
|
-
timeout?: number;
|
|
131
|
-
successThreshold?: number;
|
|
132
|
-
failureThreshold?: number;
|
|
133
|
-
children?: KubexNode;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface HttpProbeProps {
|
|
137
|
-
path: string;
|
|
138
|
-
port: number;
|
|
139
|
-
scheme?: 'HTTP' | 'HTTPS';
|
|
140
|
-
headers?: Record<string, string>;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface TcpProbeProps {
|
|
144
|
-
port: number;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface ExecProbeProps {
|
|
148
|
-
command: string[];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// --- Service ---
|
|
152
|
-
export interface ServiceProps {
|
|
153
|
-
name: string;
|
|
154
|
-
namespace?: string;
|
|
155
|
-
type?: 'ClusterIP' | 'NodePort' | 'LoadBalancer' | 'ExternalName';
|
|
156
|
-
port: number;
|
|
157
|
-
targetPort?: number;
|
|
158
|
-
nodePort?: number;
|
|
159
|
-
selector?: Record<string, string>;
|
|
160
|
-
labels?: Record<string, string>;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// --- Ingress ---
|
|
164
|
-
export interface IngressProps {
|
|
165
|
-
name: string;
|
|
166
|
-
namespace?: string;
|
|
167
|
-
className?: string;
|
|
168
|
-
ssl?: boolean;
|
|
169
|
-
annotations?: Record<string, string>;
|
|
170
|
-
children?: KubexNode;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export interface IngressHostProps {
|
|
174
|
-
host: string;
|
|
175
|
-
children?: KubexNode;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface RouteProps {
|
|
179
|
-
path: string;
|
|
180
|
-
pathType?: 'Prefix' | 'Exact' | 'ImplementationSpecific';
|
|
181
|
-
service: string;
|
|
182
|
-
port: number;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// --- ConfigMap ---
|
|
186
|
-
export interface ConfigMapProps {
|
|
187
|
-
name: string;
|
|
188
|
-
namespace?: string;
|
|
189
|
-
data?: Record<string, string>;
|
|
190
|
-
labels?: Record<string, string>;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// --- Secret ---
|
|
194
|
-
export interface SecretProps {
|
|
195
|
-
name: string;
|
|
196
|
-
namespace?: string;
|
|
197
|
-
type?: 'Opaque' | 'kubernetes.io/tls' | 'kubernetes.io/dockerconfigjson' | string;
|
|
198
|
-
data?: Record<string, string>;
|
|
199
|
-
stringData?: Record<string, string>;
|
|
200
|
-
labels?: Record<string, string>;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// --- Volumes ---
|
|
204
|
-
export interface VolumeProps {
|
|
205
|
-
name: string;
|
|
206
|
-
children?: KubexNode;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export interface VolumeMountProps {
|
|
210
|
-
name: string;
|
|
211
|
-
mountPath: string;
|
|
212
|
-
subPath?: string;
|
|
213
|
-
readOnly?: boolean;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export interface EmptyDirProps {
|
|
217
|
-
medium?: 'Memory' | '';
|
|
218
|
-
sizeLimit?: string;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export interface PvcVolumeProps {
|
|
222
|
-
claimName: string;
|
|
223
|
-
readOnly?: boolean;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export interface ConfigMapVolumeProps {
|
|
227
|
-
name: string;
|
|
228
|
-
items?: { key: string; path: string }[];
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export interface SecretVolumeProps {
|
|
232
|
-
secretName: string;
|
|
233
|
-
items?: { key: string; path: string }[];
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// --- PersistentVolumeClaim ---
|
|
237
|
-
export interface PvcProps {
|
|
238
|
-
name: string;
|
|
239
|
-
namespace?: string;
|
|
240
|
-
storage: string;
|
|
241
|
-
accessModes?: ('ReadWriteOnce' | 'ReadOnlyMany' | 'ReadWriteMany')[];
|
|
242
|
-
storageClassName?: string;
|
|
243
|
-
labels?: Record<string, string>;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// --- HorizontalPodAutoscaler ---
|
|
247
|
-
export interface HpaProps {
|
|
248
|
-
name: string;
|
|
249
|
-
namespace?: string;
|
|
250
|
-
target: string;
|
|
251
|
-
minReplicas?: number;
|
|
252
|
-
maxReplicas: number;
|
|
253
|
-
targetCpuUtilization?: number;
|
|
254
|
-
targetMemoryUtilization?: number;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// --- Job & CronJob ---
|
|
258
|
-
export interface JobProps {
|
|
259
|
-
name: string;
|
|
260
|
-
namespace?: string;
|
|
261
|
-
backoffLimit?: number;
|
|
262
|
-
ttlSecondsAfterFinished?: number;
|
|
263
|
-
labels?: Record<string, string>;
|
|
264
|
-
children?: KubexNode;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export interface CronJobProps {
|
|
268
|
-
name: string;
|
|
269
|
-
namespace?: string;
|
|
270
|
-
schedule: string;
|
|
271
|
-
concurrencyPolicy?: 'Allow' | 'Forbid' | 'Replace';
|
|
272
|
-
suspend?: boolean;
|
|
273
|
-
labels?: Record<string, string>;
|
|
274
|
-
children?: KubexNode;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// --- ServiceAccount ---
|
|
278
|
-
export interface ServiceAccountProps {
|
|
279
|
-
name: string;
|
|
280
|
-
namespace?: string;
|
|
281
|
-
labels?: Record<string, string>;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// --- RBAC ---
|
|
285
|
-
export interface RoleProps {
|
|
286
|
-
name: string;
|
|
287
|
-
namespace?: string;
|
|
288
|
-
rules: RoleRule[];
|
|
289
|
-
labels?: Record<string, string>;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export interface ClusterRoleProps {
|
|
293
|
-
name: string;
|
|
294
|
-
rules: RoleRule[];
|
|
295
|
-
labels?: Record<string, string>;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export interface RoleRule {
|
|
299
|
-
apiGroups: string[];
|
|
300
|
-
resources: string[];
|
|
301
|
-
verbs: ('get' | 'list' | 'watch' | 'create' | 'update' | 'patch' | 'delete' | '*')[];
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
export interface RoleBindingProps {
|
|
305
|
-
name: string;
|
|
306
|
-
namespace?: string;
|
|
307
|
-
roleRef: { kind: 'Role' | 'ClusterRole'; name: string };
|
|
308
|
-
subjects: { kind: 'User' | 'Group' | 'ServiceAccount'; name: string; namespace?: string }[];
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export interface ClusterRoleBindingProps {
|
|
312
|
-
name: string;
|
|
313
|
-
roleRef: { kind: 'ClusterRole'; name: string };
|
|
314
|
-
subjects: { kind: 'User' | 'Group' | 'ServiceAccount'; name: string; namespace?: string }[];
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// ============================================================================
|
|
318
|
-
// Render Options
|
|
319
|
-
// ============================================================================
|
|
320
|
-
|
|
321
|
-
export interface RenderOptions {
|
|
322
|
-
/** Output directory for YAML files (default: stdout) */
|
|
323
|
-
output?: string;
|
|
324
|
-
/** Split resources into separate files */
|
|
325
|
-
splitFiles?: boolean;
|
|
326
|
-
/** Add separators between resources */
|
|
327
|
-
separators?: boolean;
|
|
328
|
-
/** Dry run - don't write files, just return YAML */
|
|
329
|
-
dryRun?: boolean;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// ============================================================================
|
|
333
|
-
// Internal Types
|
|
334
|
-
// ============================================================================
|
|
335
|
-
|
|
336
|
-
export interface ParsedContainer {
|
|
337
|
-
name: string;
|
|
338
|
-
image: string;
|
|
339
|
-
imagePullPolicy?: string;
|
|
340
|
-
command?: string[];
|
|
341
|
-
args?: string[];
|
|
342
|
-
workingDir?: string;
|
|
343
|
-
ports?: { containerPort: number; name?: string; protocol?: string }[];
|
|
344
|
-
env?: { name: string; value?: string; valueFrom?: unknown }[];
|
|
345
|
-
resources?: {
|
|
346
|
-
requests?: { memory?: string; cpu?: string; 'ephemeral-storage'?: string };
|
|
347
|
-
limits?: { memory?: string; cpu?: string; 'ephemeral-storage'?: string };
|
|
348
|
-
};
|
|
349
|
-
livenessProbe?: unknown;
|
|
350
|
-
readinessProbe?: unknown;
|
|
351
|
-
startupProbe?: unknown;
|
|
352
|
-
volumeMounts?: { name: string; mountPath: string; subPath?: string; readOnly?: boolean }[];
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
export interface ParsedVolume {
|
|
356
|
-
name: string;
|
|
357
|
-
emptyDir?: { medium?: string; sizeLimit?: string };
|
|
358
|
-
persistentVolumeClaim?: { claimName: string; readOnly?: boolean };
|
|
359
|
-
configMap?: { name: string; items?: { key: string; path: string }[] };
|
|
360
|
-
secret?: { secretName: string; items?: { key: string; path: string }[] };
|
|
361
|
-
}
|
|
362
|
-
|
package/tsconfig.examples.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"lib": ["ES2022"],
|
|
7
|
-
"outDir": "./dist-examples",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"jsx": "react-jsx",
|
|
13
|
-
"jsxImportSource": "kubetsx"
|
|
14
|
-
},
|
|
15
|
-
"include": ["examples/**/*"],
|
|
16
|
-
"exclude": ["node_modules"]
|
|
17
|
-
}
|
|
18
|
-
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"lib": ["ES2022"],
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"rootDir": "./src",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"sourceMap": true,
|
|
16
|
-
"jsx": "react-jsx",
|
|
17
|
-
"jsxImportSource": "kubetsx"
|
|
18
|
-
},
|
|
19
|
-
"include": ["src/**/*"],
|
|
20
|
-
"exclude": ["node_modules", "dist", "examples"]
|
|
21
|
-
}
|
|
22
|
-
|