@ikas/component-cli 0.131.0 → 0.132.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/component-cli",
3
- "version": "0.131.0",
3
+ "version": "0.132.0",
4
4
  "description": "CLI for developing ikas code components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,9 +8,9 @@ Never guess function signatures or type shapes — the MCP server is the source
8
8
 
9
9
  ## CRITICAL: Auto-Generated Files
10
10
 
11
- **NEVER manually create or edit `ikas.config.json`, `types.ts` or `global-types.ts`** — they are auto-generated by CLI commands.
12
- Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage props.
13
- These commands update `ikas.config.json`, `types.ts`, and `global-types.ts` automatically.
11
+ **NEVER manually create or edit `ikas.config.json`, `types.ts`, `global-types.ts`, or `src/components/index.ts`** — they are all auto-generated by CLI commands.
12
+ Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage components and props.
13
+ These commands update `ikas.config.json`, `types.ts`, `global-types.ts`, AND `src/components/index.ts` (including the component export) automatically.
14
14
 
15
15
  **The CLI does NOT edit your component source.** `remove-prop` and `remove-enum` update `ikas.config.json` and the generated `types.ts` / `global-types.ts` only — `index.tsx`, sub-components, and `styles.css` are untouched. After removing a prop or enum, grep the source for the old identifier and clean up dead references yourself before building.
16
16
 
@@ -10,9 +10,9 @@ Never guess function signatures or type shapes — the MCP server is the source
10
10
 
11
11
  ## CRITICAL: Auto-Generated Files
12
12
 
13
- **NEVER manually create or edit `types.ts`** — it is auto-generated by CLI commands.
14
- Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage props.
15
- These commands update BOTH `ikas.config.json` AND `types.ts` automatically.
13
+ **NEVER manually create or edit `ikas.config.json`, `types.ts`, `global-types.ts`, or `src/components/index.ts`** — they are all auto-generated by CLI commands.
14
+ Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage components and props.
15
+ These commands update `ikas.config.json`, `types.ts`, `global-types.ts`, AND `src/components/index.ts` (including the component export) automatically.
16
16
 
17
17
  **The CLI does NOT edit your component source.** `remove-prop` and `remove-enum` update `ikas.config.json` and the generated `types.ts` / `global-types.ts` only — `index.tsx`, sub-components, and `styles.css` are untouched. After removing a prop or enum, grep the source for the old identifier and clean up dead references yourself before building.
18
18
 
@@ -412,6 +412,25 @@ const CartBadge = observer(function CartBadge() {
412
412
  });
413
413
  ```
414
414
 
415
+ ```tsx
416
+ // ALSO wrap EXTRACTED HELPER COMPONENTS declared inside a component file —
417
+ // especially list items rendered via .map() that read/write MobX state
418
+ // (e.g., offer.isSelected, option.values). Without observer(), the helper
419
+ // won't re-render when the observable changes.
420
+ const OfferCard = observer(function OfferCard({ offer }) {
421
+ const isSelected = offer.isSelected;
422
+ return <div>{isSelected ? "ON" : "OFF"}</div>;
423
+ });
424
+
425
+ export function MySection({ product }: Props) {
426
+ return product.offers.map((offer) => (
427
+ <OfferCard key={offer.id} offer={offer} />
428
+ ));
429
+ }
430
+ ```
431
+
432
+ **Rule of thumb:** if a non-root component reads or writes MobX observables (store fields, `offer.isSelected`, `option.values`, etc.), wrap it with `observer()`. Without it, MobX mutations won't trigger re-renders.
433
+
415
434
  ### Null Safety
416
435
 
417
436
  ```tsx