cronus-ui 0.6.0 → 0.6.2

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/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare const CONFIG_FILE = "cronus-ui.json";
2
- export declare const CLI_VERSION = "0.6.0";
3
- export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.0/registry";
2
+ export declare const CLI_VERSION = "0.6.2";
3
+ export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.2/registry";
4
4
  /** Manifest entry `add`/`upgrade` record per installed registry item. */
5
5
  export interface InstalledRecord {
6
6
  /** Registry release the files came from (git tag without the leading "v"). */
package/dist/config.js CHANGED
@@ -2,7 +2,7 @@ import { existsSync } from "node:fs";
2
2
  import { readFile, writeFile } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  export const CONFIG_FILE = "cronus-ui.json";
5
- export const CLI_VERSION = "0.6.0";
5
+ export const CLI_VERSION = "0.6.2";
6
6
  export const DEFAULT_REGISTRY = `https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v${CLI_VERSION}/registry`;
7
7
  export const DEFAULT_CONFIG = {
8
8
  aliases: { ui: "@/components/ui", lib: "@/lib", blocks: "@/components/blocks" },
package/dist/utils.d.ts CHANGED
@@ -60,6 +60,28 @@ export declare function assertValidDependency(dep: string): void;
60
60
  * package-manager spawn — so an injected/malformed spec throws before install.
61
61
  */
62
62
  export declare function collectDependencies(items: RegistryItem[]): string[];
63
+ /**
64
+ * Split a registry npm spec (`lucide-react@^0.577.0`, `@cronus-ui/ui@0.6.1`)
65
+ * into name + range. A bare name (no `@range`) leaves `range` undefined so we
66
+ * never write an empty pin into package.json.
67
+ */
68
+ export declare function splitDependencySpec(spec: string): {
69
+ name: string;
70
+ range: string | undefined;
71
+ };
72
+ /**
73
+ * Merge versioned registry specs into a package.json document. Existing pins
74
+ * win (`??=`) so a scaffold range is not clobbered by a later compose. Specs
75
+ * without a range are skipped. Returns the original string when nothing changes
76
+ * so we do not reformat an untouched file.
77
+ */
78
+ export declare function mergeDependencySpecsIntoPackageJson(raw: string, specs: string[]): string;
79
+ /**
80
+ * Persist registry npm pins into `<cwd>/package.json` even when install is
81
+ * skipped, so a later `bun install` / `npm install` picks up lucide-react,
82
+ * recharts, etc. No-ops when there is no package.json or nothing new to add.
83
+ */
84
+ export declare function recordDependencies(cwd: string, specs: string[]): Promise<void>;
63
85
  /** Levenshtein edit distance between two strings (small inputs: registry names). */
64
86
  export declare function levenshtein(a: string, b: string): number;
65
87
  /**
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
- import { mkdir, writeFile } from "node:fs/promises";
3
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
4
4
  import { dirname, isAbsolute, join, resolve, sep } from "node:path";
5
5
  import pc from "picocolors";
6
6
  export const log = {
@@ -141,6 +141,74 @@ export function collectDependencies(items) {
141
141
  }
142
142
  return [...set].sort();
143
143
  }
144
+ /**
145
+ * Split a registry npm spec (`lucide-react@^0.577.0`, `@cronus-ui/ui@0.6.1`)
146
+ * into name + range. A bare name (no `@range`) leaves `range` undefined so we
147
+ * never write an empty pin into package.json.
148
+ */
149
+ export function splitDependencySpec(spec) {
150
+ if (spec.startsWith("@")) {
151
+ const at = spec.indexOf("@", 1);
152
+ if (at === -1)
153
+ return { name: spec, range: undefined };
154
+ const range = spec.slice(at + 1);
155
+ return { name: spec.slice(0, at), range: range.length > 0 ? range : undefined };
156
+ }
157
+ const at = spec.indexOf("@");
158
+ if (at <= 0)
159
+ return { name: spec, range: undefined };
160
+ const range = spec.slice(at + 1);
161
+ return { name: spec.slice(0, at), range: range.length > 0 ? range : undefined };
162
+ }
163
+ /**
164
+ * Merge versioned registry specs into a package.json document. Existing pins
165
+ * win (`??=`) so a scaffold range is not clobbered by a later compose. Specs
166
+ * without a range are skipped. Returns the original string when nothing changes
167
+ * so we do not reformat an untouched file.
168
+ */
169
+ export function mergeDependencySpecsIntoPackageJson(raw, specs) {
170
+ if (specs.length === 0)
171
+ return raw;
172
+ const pkg = JSON.parse(raw);
173
+ const dependencies = { ...(pkg.dependencies ?? {}) };
174
+ let changed = false;
175
+ for (const spec of specs) {
176
+ const { name, range } = splitDependencySpec(spec);
177
+ if (range === undefined || name.length === 0)
178
+ continue;
179
+ if (dependencies[name] === undefined) {
180
+ dependencies[name] = range;
181
+ changed = true;
182
+ }
183
+ }
184
+ if (!changed)
185
+ return raw;
186
+ pkg.dependencies = dependencies;
187
+ return `${JSON.stringify(pkg, null, 2)}\n`;
188
+ }
189
+ /**
190
+ * Persist registry npm pins into `<cwd>/package.json` even when install is
191
+ * skipped, so a later `bun install` / `npm install` picks up lucide-react,
192
+ * recharts, etc. No-ops when there is no package.json or nothing new to add.
193
+ */
194
+ export async function recordDependencies(cwd, specs) {
195
+ if (specs.length === 0)
196
+ return;
197
+ const pkgPath = join(cwd, "package.json");
198
+ if (!existsSync(pkgPath))
199
+ return;
200
+ const raw = await readFile(pkgPath, "utf8");
201
+ let next;
202
+ try {
203
+ next = mergeDependencySpecsIntoPackageJson(raw, specs);
204
+ }
205
+ catch {
206
+ return;
207
+ }
208
+ if (next === raw)
209
+ return;
210
+ await writeFile(pkgPath, next, "utf8");
211
+ }
144
212
  /** Levenshtein edit distance between two strings (small inputs: registry names). */
145
213
  export function levenshtein(a, b) {
146
214
  // Single rolling row of the DP matrix (row 0 = distances against an empty `a`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronus-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "cronus-ui — add Cronus UI components to your project, shadcn-style (copy-paste registry).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "registry:check": "bun run scripts/check-registry.ts"
55
55
  },
56
56
  "dependencies": {
57
- "@cronus-ui/ai-kit": "0.6.0",
57
+ "@cronus-ui/ai-kit": "0.6.2",
58
58
  "commander": "^15.0.0",
59
59
  "picocolors": "^1.1.1"
60
60
  },
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "admin",
3
+ "type": "registry:app",
4
+ "planVersion": 1,
5
+ "manifest": {
6
+ "title": "Admin",
7
+ "description": "An admin console: split login, an (app) shell, overview, users, analytics, a sprint board and an audit trail — composed from validated blocks.",
8
+ "chrome": {
9
+ "shell": { "block": "app-shell-chrome" },
10
+ "bare": {}
11
+ },
12
+ "pages": [
13
+ {
14
+ "route": "/login",
15
+ "title": "Sign in",
16
+ "chrome": "bare",
17
+ "blocks": [{ "block": "login", "variant": "split" }]
18
+ },
19
+ {
20
+ "route": "/",
21
+ "title": "Overview",
22
+ "nav": "Overview",
23
+ "chrome": "shell",
24
+ "blocks": [{ "block": "dashboard", "variant": "admin-overview" }]
25
+ },
26
+ {
27
+ "route": "/users",
28
+ "title": "Users",
29
+ "nav": "Users",
30
+ "chrome": "shell",
31
+ "blocks": ["user-management"]
32
+ },
33
+ {
34
+ "route": "/analytics",
35
+ "title": "Analytics",
36
+ "nav": "Analytics",
37
+ "chrome": "shell",
38
+ "blocks": [{ "block": "analytics", "variant": "engagement" }]
39
+ },
40
+ {
41
+ "route": "/board",
42
+ "title": "Board",
43
+ "nav": "Board",
44
+ "chrome": "shell",
45
+ "blocks": ["kanban-board"]
46
+ },
47
+ {
48
+ "route": "/audit",
49
+ "title": "Audit log",
50
+ "nav": "Audit",
51
+ "chrome": "shell",
52
+ "blocks": ["audit-log"]
53
+ }
54
+ ],
55
+ "extras": { "not-found": "not-found" },
56
+ "defaults": { "theme": "midnight", "mode": "dark", "brand": "__APP_NAME__" }
57
+ }
58
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "docs",
3
+ "type": "registry:app",
4
+ "planVersion": 1,
5
+ "manifest": {
6
+ "title": "Docs",
7
+ "description": "A documentation site: changelog home, guides-style blog, an article, FAQ and about — composed from validated content blocks, not a marketing landing.",
8
+ "chrome": {
9
+ "site": { "navbar": "navbar", "footer": "footer" }
10
+ },
11
+ "pages": [
12
+ {
13
+ "route": "/",
14
+ "title": "Changelog",
15
+ "nav": "Changelog",
16
+ "chrome": "site",
17
+ "blocks": ["changelog"]
18
+ },
19
+ {
20
+ "route": "/blog",
21
+ "title": "Guides",
22
+ "nav": "Guides",
23
+ "chrome": "site",
24
+ "blocks": ["blog"]
25
+ },
26
+ {
27
+ "route": "/blog/[slug]",
28
+ "title": "Article",
29
+ "chrome": "site",
30
+ "blocks": [{ "block": "blog-post", "variant": "with-sidebar" }]
31
+ },
32
+ {
33
+ "route": "/faq",
34
+ "title": "FAQ",
35
+ "nav": "FAQ",
36
+ "chrome": "site",
37
+ "blocks": ["faq"]
38
+ },
39
+ {
40
+ "route": "/about",
41
+ "title": "About",
42
+ "nav": "About",
43
+ "chrome": "site",
44
+ "blocks": ["about"]
45
+ }
46
+ ],
47
+ "extras": { "not-found": "not-found" },
48
+ "defaults": { "theme": "neutral", "mode": "light", "brand": "__APP_NAME__" }
49
+ }
50
+ }
@@ -4,7 +4,7 @@
4
4
  "planVersion": 1,
5
5
  "manifest": {
6
6
  "title": "SaaS",
7
- "description": "A complete multi-page SaaS app: split login/signup, and a sidebar-shell dashboard, analytics, team, billing and settings — all from validated blocks.",
7
+ "description": "A complete multi-page SaaS app: split login/signup, password reset, a sidebar-shell dashboard, analytics, team, billing and settings, plus welcome, setup wizard and checklist — all from validated blocks.",
8
8
  "chrome": {
9
9
  "shell": { "block": "app-shell-chrome" },
10
10
  "bare": {}
@@ -22,6 +22,12 @@
22
22
  "chrome": "bare",
23
23
  "blocks": ["signup"]
24
24
  },
25
+ {
26
+ "route": "/forgot-password",
27
+ "title": "Reset password",
28
+ "chrome": "bare",
29
+ "blocks": ["forgot-password"]
30
+ },
25
31
  {
26
32
  "route": "/",
27
33
  "title": "Dashboard",
@@ -56,6 +62,25 @@
56
62
  "nav": "Settings",
57
63
  "chrome": "shell",
58
64
  "blocks": ["settings", "account-security"]
65
+ },
66
+ {
67
+ "route": "/welcome",
68
+ "title": "Welcome",
69
+ "chrome": "shell",
70
+ "blocks": ["welcome"]
71
+ },
72
+ {
73
+ "route": "/setup",
74
+ "title": "Setup",
75
+ "chrome": "shell",
76
+ "blocks": ["setup-wizard"]
77
+ },
78
+ {
79
+ "route": "/checklist",
80
+ "title": "Get started",
81
+ "nav": "Setup",
82
+ "chrome": "shell",
83
+ "blocks": ["setup-checklist"]
59
84
  }
60
85
  ],
61
86
  "extras": { "not-found": "not-found" },