cronus-ui 0.6.21 → 0.7.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/README.md +2 -2
- package/dist/commands/upgrade.js +1 -1
- package/dist/compose/gold-path.d.ts +13 -6
- package/dist/compose/gold-path.js +102 -32
- package/dist/config.d.ts +2 -2
- package/dist/config.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ Notes that match the commander surface:
|
|
|
49
49
|
`packages/cli/scripts/build-registry.ts` — each item carries its source, its npm
|
|
50
50
|
`dependencies`, and its `registryDependencies` (other components it imports),
|
|
51
51
|
derived by parsing imports.
|
|
52
|
-
- The default registry is pinned to the CLI package version (`v0.
|
|
52
|
+
- The default registry is pinned to the CLI package version (`v0.7.0` here), not
|
|
53
53
|
mutable `main`, so a published CLI reads the registry snapshot it was released
|
|
54
54
|
with. Use `-r, --registry ./registry` when testing local registry changes before
|
|
55
55
|
a release tag exists.
|
|
@@ -80,7 +80,7 @@ Notes that match the commander surface:
|
|
|
80
80
|
"lib": "lib",
|
|
81
81
|
"blocks": "components/blocks"
|
|
82
82
|
},
|
|
83
|
-
"registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.
|
|
83
|
+
"registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.7.0/registry"
|
|
84
84
|
}
|
|
85
85
|
```
|
|
86
86
|
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -484,7 +484,7 @@ async function repatchGoldPathSurfaces(cwd, config, composed) {
|
|
|
484
484
|
if (!Object.keys(composed).some((key) => isGoldPathTemplate(key)))
|
|
485
485
|
return;
|
|
486
486
|
const authImport = `${config.aliases.lib}/auth`;
|
|
487
|
-
await repatchGoldPathFile(cwd, join(config.paths.blocks, "app-shell-chrome.tsx"), goldPatchAppShellChrome, "WorkspaceMenu / InviteMember / SessionUser");
|
|
487
|
+
await repatchGoldPathFile(cwd, join(config.paths.blocks, "app-shell-chrome.tsx"), goldPatchAppShellChrome, "WorkspaceMenu / InviteMember / SessionUser / nav");
|
|
488
488
|
for (const rel of goldPathSurfaceRels(cwd, composed)) {
|
|
489
489
|
if (/(^|\/)\(shell\)\/layout\.tsx$/.test(rel)) {
|
|
490
490
|
await repatchGoldPathFile(cwd, rel, (source) => goldPatchShellLayout(source, authImport), "session gate");
|
|
@@ -6,8 +6,9 @@ import type { CronusUIConfig } from "../config.js";
|
|
|
6
6
|
export declare const GOLD_PATH_TEMPLATES: Set<string>;
|
|
7
7
|
export declare function isGoldPathTemplate(name: string): boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome
|
|
10
|
-
* Idempotent. Used by add-page --nav
|
|
9
|
+
* Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome
|
|
10
|
+
* and drop catalog demo routes from APP_NAV. Idempotent. Used by add-page --nav
|
|
11
|
+
* and upgrade so neither restores Mara nor Analytics/Billing/Settings in the nav.
|
|
11
12
|
*/
|
|
12
13
|
export declare function goldPatchAppShellChrome(source: string): string | undefined;
|
|
13
14
|
/**
|
|
@@ -49,10 +50,16 @@ export interface ApplyGoldPathResult {
|
|
|
49
50
|
}
|
|
50
51
|
export declare function goldPathLayout(config: CronusUIConfig): GoldPathLayout;
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
* Drop catalog demo hrefs from `const APP_NAV`. Idempotent. Keeps Items, Team,
|
|
54
|
+
* and any user-added link. Returns undefined when the const is missing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function patchGoldPathAppNav(source: string): string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Wire the installed app-shell-chrome copy to live Better-Auth orgs + session,
|
|
59
|
+
* and drop catalog demo routes from the sidebar nav.
|
|
60
|
+
* Idempotent: already-gold widgets still re-strip nav (add-page / upgrade
|
|
61
|
+
* rewrite APP_NAV from the template). Returns undefined when neither the
|
|
62
|
+
* WorkspaceSwitcher / InviteDialog anchors nor an APP_NAV const are present.
|
|
56
63
|
*/
|
|
57
64
|
export declare function patchChromeSource(source: string, workspaceImport: string, inviteImport: string, sessionImport?: string): string | undefined;
|
|
58
65
|
/** Insert ItemsPanel and drop catalog dashboard/stats from a generated home. */
|
|
@@ -20,8 +20,9 @@ const GOLD_AUTH_IMPORT = "@/lib/auth";
|
|
|
20
20
|
const GOLD_MEMBERS_IMPORT = "@/components/members-panel";
|
|
21
21
|
const GOLD_ITEMS_IMPORT = "@/components/items-panel";
|
|
22
22
|
/**
|
|
23
|
-
* Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome
|
|
24
|
-
* Idempotent. Used by add-page --nav
|
|
23
|
+
* Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome
|
|
24
|
+
* and drop catalog demo routes from APP_NAV. Idempotent. Used by add-page --nav
|
|
25
|
+
* and upgrade so neither restores Mara nor Analytics/Billing/Settings in the nav.
|
|
25
26
|
*/
|
|
26
27
|
export function goldPatchAppShellChrome(source) {
|
|
27
28
|
return patchChromeSource(source, GOLD_WORKSPACE_IMPORT, GOLD_INVITE_IMPORT, GOLD_SESSION_IMPORT);
|
|
@@ -1099,16 +1100,72 @@ function insertImport(source, line) {
|
|
|
1099
1100
|
return `${line}\n${source}`;
|
|
1100
1101
|
}
|
|
1101
1102
|
/**
|
|
1102
|
-
*
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1105
|
-
|
|
1103
|
+
* Catalog demo routes that must not appear in gold-path shell nav.
|
|
1104
|
+
* The pages stay on disk (catalog / add-page); only the sidebar drops them.
|
|
1105
|
+
* `/` (Items) and `/team` are live and stay. Unknown hrefs (add-page --nav) stay.
|
|
1106
|
+
*/
|
|
1107
|
+
const GOLD_PATH_CATALOG_NAV_HREFS = new Set([
|
|
1108
|
+
"/analytics",
|
|
1109
|
+
"/billing",
|
|
1110
|
+
"/settings",
|
|
1111
|
+
"/checklist",
|
|
1112
|
+
"/welcome",
|
|
1113
|
+
"/setup",
|
|
1114
|
+
"/users",
|
|
1115
|
+
"/board",
|
|
1116
|
+
"/audit",
|
|
1117
|
+
]);
|
|
1118
|
+
const APP_NAV_CONST_RE = /const APP_NAV = \[([\s\S]*?)\](?:\s*as const)?;/;
|
|
1119
|
+
const APP_NAV_LINK_RE = /\{\s*label:\s*"((?:\\.|[^"\\])*)"\s*,\s*href:\s*"((?:\\.|[^"\\])*)"\s*\}/g;
|
|
1120
|
+
function serializeGoldPathAppNav(links) {
|
|
1121
|
+
if (links.length === 0)
|
|
1122
|
+
return "const APP_NAV = [];";
|
|
1123
|
+
const rows = links
|
|
1124
|
+
.map((link) => ` { label: ${JSON.stringify(link.label)}, href: ${JSON.stringify(link.href)} },`)
|
|
1125
|
+
.join("\n");
|
|
1126
|
+
return `const APP_NAV = [\n${rows}\n];`;
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Drop catalog demo hrefs from `const APP_NAV`. Idempotent. Keeps Items, Team,
|
|
1130
|
+
* and any user-added link. Returns undefined when the const is missing.
|
|
1131
|
+
*/
|
|
1132
|
+
export function patchGoldPathAppNav(source) {
|
|
1133
|
+
const match = APP_NAV_CONST_RE.exec(source);
|
|
1134
|
+
if (!match || match.index === undefined)
|
|
1135
|
+
return undefined;
|
|
1136
|
+
const body = match[1] ?? "";
|
|
1137
|
+
const links = [];
|
|
1138
|
+
APP_NAV_LINK_RE.lastIndex = 0;
|
|
1139
|
+
for (const row of body.matchAll(APP_NAV_LINK_RE)) {
|
|
1140
|
+
const label = row[1];
|
|
1141
|
+
const href = row[2];
|
|
1142
|
+
if (label === undefined || href === undefined)
|
|
1143
|
+
continue;
|
|
1144
|
+
links.push({
|
|
1145
|
+
label: JSON.parse(`"${label}"`),
|
|
1146
|
+
href: JSON.parse(`"${href}"`),
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
if (links.length === 0 && body.trim().length > 0)
|
|
1150
|
+
return source;
|
|
1151
|
+
const kept = links.filter((link) => !GOLD_PATH_CATALOG_NAV_HREFS.has(link.href));
|
|
1152
|
+
if (kept.length === links.length)
|
|
1153
|
+
return source;
|
|
1154
|
+
return (source.slice(0, match.index) +
|
|
1155
|
+
serializeGoldPathAppNav(kept) +
|
|
1156
|
+
source.slice(match.index + match[0].length));
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Wire the installed app-shell-chrome copy to live Better-Auth orgs + session,
|
|
1160
|
+
* and drop catalog demo routes from the sidebar nav.
|
|
1161
|
+
* Idempotent: already-gold widgets still re-strip nav (add-page / upgrade
|
|
1162
|
+
* rewrite APP_NAV from the template). Returns undefined when neither the
|
|
1163
|
+
* WorkspaceSwitcher / InviteDialog anchors nor an APP_NAV const are present.
|
|
1106
1164
|
*/
|
|
1107
1165
|
export function patchChromeSource(source, workspaceImport, inviteImport, sessionImport) {
|
|
1108
1166
|
const hasMenu = source.includes("WorkspaceMenu");
|
|
1109
1167
|
const hasSession = source.includes("SessionUser");
|
|
1110
|
-
|
|
1111
|
-
return source;
|
|
1168
|
+
const alreadyGoldWidgets = hasMenu && hasSession;
|
|
1112
1169
|
const canPatchMenu = !hasMenu &&
|
|
1113
1170
|
/<WorkspaceSwitcher[\s\S]*?\/>/.test(source) &&
|
|
1114
1171
|
/<InviteDialog[\s\S]*?\/>/.test(source);
|
|
@@ -1116,32 +1173,45 @@ export function patchChromeSource(source, workspaceImport, inviteImport, session
|
|
|
1116
1173
|
!hasSession &&
|
|
1117
1174
|
source.includes("{USER.email}") &&
|
|
1118
1175
|
source.includes("<SidebarFooter>");
|
|
1119
|
-
if (!canPatchMenu && !canPatchSession) {
|
|
1120
|
-
return hasMenu ? source : undefined;
|
|
1121
|
-
}
|
|
1122
1176
|
let out = source;
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1177
|
+
let widgetsTouched = alreadyGoldWidgets;
|
|
1178
|
+
if (!alreadyGoldWidgets) {
|
|
1179
|
+
if (!canPatchMenu && !canPatchSession) {
|
|
1180
|
+
widgetsTouched = hasMenu;
|
|
1181
|
+
}
|
|
1182
|
+
else {
|
|
1183
|
+
widgetsTouched = true;
|
|
1184
|
+
if (canPatchMenu) {
|
|
1185
|
+
out = insertImport(out, `import { WorkspaceMenu } from ${JSON.stringify(workspaceImport)};`);
|
|
1186
|
+
out = insertImport(out, `import { InviteMember } from ${JSON.stringify(inviteImport)};`);
|
|
1187
|
+
out = out.replace(/<WorkspaceSwitcher[\s\S]*?\/>/, "<WorkspaceMenu />");
|
|
1188
|
+
out = out.replace(/<InviteDialog([\s\S]*?)\/>/, "<InviteMember$1/>");
|
|
1189
|
+
out = out.replace(/\nconst WORKSPACES = \[[\s\S]*?\];\n/, "\n");
|
|
1190
|
+
out = out.replace(/\s*const \[workspaceId, setWorkspaceId\] = useState\("[^"]*"\);\n/, "\n");
|
|
1191
|
+
out = out.replace(/,\s*useState/, "");
|
|
1192
|
+
out = out.replace(/\s*InviteDialog,\n/, "\n");
|
|
1193
|
+
out = out.replace(/\s*WorkspaceSwitcher,\n/, "\n");
|
|
1194
|
+
}
|
|
1195
|
+
if (canPatchSession && sessionImport !== undefined) {
|
|
1196
|
+
out = insertImport(out, `import { SessionUser } from ${JSON.stringify(sessionImport)};`);
|
|
1197
|
+
out = out.replace(/<SidebarFooter>\s*<div className="flex items-center gap-2 rounded-lg px-2 py-1\.5">[\s\S]*?<\/SidebarFooter>/, "<SidebarFooter>\n <SessionUser />\n </SidebarFooter>");
|
|
1198
|
+
out = out.replace(/<Avatar className="size-8">\s*\{OWNER\?\.avatar \? <AvatarImage src=\{OWNER\.avatar\} alt=\{USER\.name\} \/> : null\}\s*<AvatarFallback>\{USER\.initials\}<\/AvatarFallback>\s*<\/Avatar>/, "<SessionUser compact />");
|
|
1199
|
+
out = out.replace(/\nimport \{ TEAM, USER \} from "[^"]+";\n/, "\n");
|
|
1200
|
+
out = out.replace(/\nconst OWNER = TEAM\.find\(\(m\) => m\.email === USER\.email\);\n/, "\n");
|
|
1201
|
+
out = out.replace(/\s*Avatar,\n/, "\n");
|
|
1202
|
+
out = out.replace(/\s*AvatarFallback,\n/, "\n");
|
|
1203
|
+
out = out.replace(/\s*AvatarImage,\n/, "\n");
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1143
1206
|
}
|
|
1144
|
-
|
|
1207
|
+
const navPatched = patchGoldPathAppNav(out);
|
|
1208
|
+
if (navPatched !== undefined)
|
|
1209
|
+
out = navPatched;
|
|
1210
|
+
if (out !== source)
|
|
1211
|
+
return out;
|
|
1212
|
+
if (widgetsTouched || navPatched !== undefined)
|
|
1213
|
+
return source;
|
|
1214
|
+
return undefined;
|
|
1145
1215
|
}
|
|
1146
1216
|
function nextConfigSource() {
|
|
1147
1217
|
return `/** @type {import('next').NextConfig} */
|
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.
|
|
3
|
-
export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.
|
|
2
|
+
export declare const CLI_VERSION = "0.7.0";
|
|
3
|
+
export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.7.0/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.
|
|
5
|
+
export const CLI_VERSION = "0.7.0";
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cronus-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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.
|
|
57
|
+
"@cronus-ui/ai-kit": "0.7.0",
|
|
58
58
|
"commander": "^15.0.0",
|
|
59
59
|
"picocolors": "^1.1.1"
|
|
60
60
|
},
|