kubetsx 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +33 -11
  2. package/dist/cli.js +1 -1
  3. package/package.json +5 -3
package/README.md CHANGED
@@ -46,37 +46,59 @@ render(<App />);
46
46
 
47
47
  ## 📦 Installation
48
48
 
49
+ ### Step 1: Install
50
+
49
51
  ```bash
50
52
  npm install kubetsx
51
53
  ```
52
54
 
53
- Configure `tsconfig.json`:
55
+ ### Step 2: Configure TypeScript
56
+
57
+ Create or update `tsconfig.json`:
54
58
 
55
59
  ```json
56
60
  {
57
61
  "compilerOptions": {
58
62
  "jsx": "react-jsx",
59
- "jsxImportSource": "kubetsx"
63
+ "jsxImportSource": "kubetsx",
64
+ "module": "ESNext",
65
+ "moduleResolution": "bundler"
60
66
  }
61
67
  }
62
68
  ```
63
69
 
64
- Run your config:
70
+ ### Step 3: Create your first config
65
71
 
66
- ```bash
67
- npx kubetsx your-config.tsx
68
- ```
72
+ Create `k8s.tsx`:
69
73
 
70
- Or pipe directly to kubectl:
74
+ ```tsx
75
+ import { render, Manifest, Deployment, Container, Port, Service } from 'kubetsx';
71
76
 
72
- ```bash
73
- npx kubetsx your-config.tsx | kubectl apply -f -
77
+ const App = () => (
78
+ <Manifest>
79
+ <Deployment name="my-app" replicas={2}>
80
+ <Container name="app" image="nginx:latest">
81
+ <Port container={80} />
82
+ </Container>
83
+ </Deployment>
84
+ <Service name="my-app" port={80} targetPort={80} />
85
+ </Manifest>
86
+ );
87
+
88
+ render(<App />);
74
89
  ```
75
90
 
76
- Save to file:
91
+ ### Step 4: Generate YAML
77
92
 
78
93
  ```bash
79
- npx kubetsx your-config.tsx > k8s.yaml
94
+ # Output to terminal
95
+ npx kubetsx k8s.tsx
96
+
97
+ # Save to file
98
+ npx kubetsx k8s.tsx > k8s.yaml
99
+
100
+ # Apply directly to cluster
101
+ npx kubetsx k8s.tsx | kubectl apply -f -
80
102
  ```
81
103
 
82
104
  > **💡 Tip:** Use `console.error()` for debug output. The CLI validates that stdout contains only valid YAML and will error if `console.log()` corrupts the output.
package/dist/cli.js CHANGED
@@ -29,7 +29,7 @@ Examples:
29
29
  process.exit(0);
30
30
  }
31
31
  if (args.includes('--version') || args.includes('-v')) {
32
- console.log('kubetsx v0.1.4');
32
+ console.log('kubetsx v0.1.5');
33
33
  process.exit(0);
34
34
  }
35
35
  // Find tsx CLI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubetsx",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "The Declarative Kubernetes Framework. Write K8s configs with JSX. Yes, really.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,11 +11,13 @@
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js"
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
15
16
  },
16
17
  "./jsx-runtime": {
17
18
  "types": "./dist/jsx-runtime.d.ts",
18
- "import": "./dist/jsx-runtime.js"
19
+ "import": "./dist/jsx-runtime.js",
20
+ "default": "./dist/jsx-runtime.js"
19
21
  }
20
22
  },
21
23
  "files": [