rahman-resources 1.14.2 → 1.16.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.
@@ -74,6 +74,7 @@
74
74
  "slug": { "type": "string" },
75
75
  "version": { "type": "string" },
76
76
  "category": { "type": "string" },
77
+ "variant": { "type": "string", "description": "Installed variant id, when added with `add <slug> <variant>`." },
77
78
  "addedAt": { "type": "string", "format": "date" }
78
79
  }
79
80
  }
package/lib/rr.mjs CHANGED
@@ -98,9 +98,10 @@ export function addSlice(rr, slug, opts = {}) {
98
98
  if (existing) {
99
99
  if (opts.version) existing.version = opts.version;
100
100
  if (opts.category) existing.category = opts.category;
101
+ if (opts.variant) existing.variant = opts.variant;
101
102
  return rr;
102
103
  }
103
- rr.slices.push({ slug, version: opts.version ?? "main", category: opts.category, addedAt: today() });
104
+ rr.slices.push({ slug, version: opts.version ?? "main", category: opts.category, addedAt: today(), ...(opts.variant ? { variant: opts.variant } : {}) });
104
105
  return rr;
105
106
  }
106
107
 
@@ -51,6 +51,42 @@
51
51
  ],
52
52
  "description": "Slice shape \u2014 ui (no convex), backend (no UI), full (both)."
53
53
  },
54
+ "variants": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["default", "items"],
58
+ "description": "shadcn-style variants. Each item's files live at variants/<id>/; an optional shared/ folder is copied for every variant. `npx rr add <slug> <id>` installs one variant (flattened to slice root); `npx rr add <slug>` installs all + a root index.ts switcher selected via a `variant` prop.",
59
+ "properties": {
60
+ "default": {
61
+ "type": "string",
62
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
63
+ "description": "Fallback variant id for the all-mode switcher. Must be one of items[].id."
64
+ },
65
+ "shared": {
66
+ "type": "string",
67
+ "description": "Folder (relative to slice root) copied for every variant. Omit if variants are self-contained."
68
+ },
69
+ "items": {
70
+ "type": "array",
71
+ "minItems": 2,
72
+ "items": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": ["id"],
76
+ "properties": {
77
+ "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
78
+ "title": { "type": "string" },
79
+ "description": { "type": "string" },
80
+ "convex": {
81
+ "type": "array",
82
+ "items": { "type": "string" },
83
+ "description": "Convex root paths for THIS variant. When installing this variant the CLI pulls only these (not the slice-level union). Should be a subset of convex.rootPaths."
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ },
54
90
  "title": {
55
91
  "type": "string",
56
92
  "minLength": 3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rahman-resources",
3
- "version": "1.14.2",
3
+ "version": "1.16.0",
4
4
  "description": "Rahman Resources (rr) — shadcn-style installer for vertical slices. `npx resources add <slug>` copies slice into your project's `slices/<slug>/`. You own the files.",
5
5
  "type": "module",
6
6
  "license": "MIT",