cronus-ui 0.6.16 → 0.6.18
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/add-page.js +25 -3
- package/dist/commands/upgrade.js +45 -11
- package/dist/compose/gold-path.d.ts +15 -0
- package/dist/compose/gold-path.js +25 -1
- 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.6.
|
|
52
|
+
- The default registry is pinned to the CLI package version (`v0.6.18` 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.6.
|
|
83
|
+
"registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.18/registry"
|
|
84
84
|
}
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { existsSync } from "node:fs";
|
|
22
22
|
import { rm } from "node:fs/promises";
|
|
23
|
-
import { goldPatchAppShellChrome, isGoldPathTemplate } from "../compose/gold-path.js";
|
|
23
|
+
import { goldPatchAppShellChrome, goldPatchHomePage, goldPatchShellLayout, goldPatchTeamPage, isGoldPathTemplate, } from "../compose/gold-path.js";
|
|
24
24
|
import { blockRefParts } from "../compose/manifest.js";
|
|
25
25
|
import { buildComposePlan, ComposePlanError, } from "../compose/plan.js";
|
|
26
26
|
import { baseSnapshotDir, reloadManifest } from "../compose/reload.js";
|
|
@@ -234,7 +234,21 @@ export async function addPage(options) {
|
|
|
234
234
|
skippedFiles.push(pageRel);
|
|
235
235
|
}
|
|
236
236
|
else {
|
|
237
|
-
|
|
237
|
+
let content = renderPage(planPage, config);
|
|
238
|
+
// saas/admin: compose gold-patches / (ItemsPanel) and /team (MembersPanel).
|
|
239
|
+
// Writing the catalog dashboard/stats or TeamBlock would undo that.
|
|
240
|
+
if (isGoldPathTemplate(appName) && chromeGroup === "shell") {
|
|
241
|
+
if (planPage.route === "/") {
|
|
242
|
+
const patched = goldPatchHomePage(content);
|
|
243
|
+
if (patched !== undefined)
|
|
244
|
+
content = patched;
|
|
245
|
+
}
|
|
246
|
+
else if (planPage.route === "/team") {
|
|
247
|
+
const patched = goldPatchTeamPage(content);
|
|
248
|
+
if (patched !== undefined)
|
|
249
|
+
content = patched;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
238
252
|
await writeFileEnsured(pageDest, content);
|
|
239
253
|
generatedFiles.push(pageRel);
|
|
240
254
|
await writeFileEnsured(resolveSafeDest(targetDir, baseSnapshotDir(appName), pageRel), content);
|
|
@@ -404,7 +418,15 @@ async function ensureChromeScaffold(plan, chrome, config, targetDir, appName, ge
|
|
|
404
418
|
if (chrome.block !== undefined && plan.shellExportName !== undefined) {
|
|
405
419
|
await write(chromeWrapperPath(config, "app-shell"), renderShellWrapper("AppShellNav", chrome.block, plan.shellExportName, config));
|
|
406
420
|
}
|
|
407
|
-
|
|
421
|
+
let layout = renderLayout(chrome, config);
|
|
422
|
+
// saas/admin: compose gold-patches the shell layout with a session gate.
|
|
423
|
+
// A brand-new group would otherwise ship the catalog passthrough.
|
|
424
|
+
if (isGoldPathTemplate(appName) && chrome.group === "shell") {
|
|
425
|
+
const patched = goldPatchShellLayout(layout, `${config.aliases.lib}/auth`);
|
|
426
|
+
if (patched !== undefined)
|
|
427
|
+
layout = patched;
|
|
428
|
+
}
|
|
429
|
+
await write(layoutPath(chrome), layout);
|
|
408
430
|
}
|
|
409
431
|
/**
|
|
410
432
|
* Parse the `--blocks hero,cta` / `--blocks login=split,cta` spec into block refs.
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
|
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { createInterface } from "node:readline/promises";
|
|
7
7
|
import pc from "picocolors";
|
|
8
|
-
import { goldPatchAppShellChrome, isGoldPathTemplate } from "../compose/gold-path.js";
|
|
8
|
+
import { goldPatchAppShellChrome, goldPatchHomePage, goldPatchShellLayout, goldPatchTeamPage, isGoldPathTemplate, } from "../compose/gold-path.js";
|
|
9
9
|
import { buildComposePlan } from "../compose/plan.js";
|
|
10
10
|
import { baseSnapshotDest, filterManifestToComposedPages, listBaseSnapshotRels, readBaseSnapshot, reloadManifest, } from "../compose/reload.js";
|
|
11
11
|
import { renderPlan } from "../compose/render.js";
|
|
@@ -422,14 +422,12 @@ function statusLabel(plan) {
|
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
/**
|
|
425
|
-
* saas/admin: upgrade 3-ways
|
|
426
|
-
*
|
|
427
|
-
*
|
|
425
|
+
* saas/admin: upgrade 3-ways chrome against the catalog item (Mara) and
|
|
426
|
+
* layout/team/home against the catalog compose render. After any write (or a
|
|
427
|
+
* catalog file already on disk), re-apply the gold-path identity. Idempotent;
|
|
428
|
+
* skipped when conflict markers are present.
|
|
428
429
|
*/
|
|
429
|
-
async function
|
|
430
|
-
if (!Object.keys(composed).some((key) => isGoldPathTemplate(key)))
|
|
431
|
-
return;
|
|
432
|
-
const rel = join(config.paths.blocks, "app-shell-chrome.tsx");
|
|
430
|
+
async function repatchGoldPathFile(cwd, rel, patch, label) {
|
|
433
431
|
let dest;
|
|
434
432
|
try {
|
|
435
433
|
dest = resolveSafeDest(cwd, ".", rel);
|
|
@@ -442,11 +440,47 @@ async function repatchGoldPathChrome(cwd, config, composed) {
|
|
|
442
440
|
const current = await readFile(dest, "utf8");
|
|
443
441
|
if (current.includes("<<<<<<<"))
|
|
444
442
|
return;
|
|
445
|
-
const patched =
|
|
443
|
+
const patched = patch(current);
|
|
446
444
|
if (patched === undefined || patched === current)
|
|
447
445
|
return;
|
|
448
446
|
await writeFileEnsured(dest, patched);
|
|
449
|
-
log.ok(`gold-path ${rel}: re-applied
|
|
447
|
+
log.ok(`gold-path ${rel}: re-applied ${label}`);
|
|
448
|
+
}
|
|
449
|
+
function goldPathSurfaceRels(cwd, composed) {
|
|
450
|
+
const rels = new Set();
|
|
451
|
+
for (const rec of Object.values(composed)) {
|
|
452
|
+
for (const file of rec.files)
|
|
453
|
+
rels.add(file.replaceAll("\\", "/"));
|
|
454
|
+
}
|
|
455
|
+
for (const rel of [
|
|
456
|
+
"app/(shell)/layout.tsx",
|
|
457
|
+
"src/app/(shell)/layout.tsx",
|
|
458
|
+
"app/(shell)/team/page.tsx",
|
|
459
|
+
"src/app/(shell)/team/page.tsx",
|
|
460
|
+
"app/(shell)/page.tsx",
|
|
461
|
+
"src/app/(shell)/page.tsx",
|
|
462
|
+
]) {
|
|
463
|
+
if (existsSync(join(cwd, rel)))
|
|
464
|
+
rels.add(rel);
|
|
465
|
+
}
|
|
466
|
+
return [...rels];
|
|
467
|
+
}
|
|
468
|
+
async function repatchGoldPathSurfaces(cwd, config, composed) {
|
|
469
|
+
if (!Object.keys(composed).some((key) => isGoldPathTemplate(key)))
|
|
470
|
+
return;
|
|
471
|
+
const authImport = `${config.aliases.lib}/auth`;
|
|
472
|
+
await repatchGoldPathFile(cwd, join(config.paths.blocks, "app-shell-chrome.tsx"), goldPatchAppShellChrome, "WorkspaceMenu / InviteMember / SessionUser");
|
|
473
|
+
for (const rel of goldPathSurfaceRels(cwd, composed)) {
|
|
474
|
+
if (/(^|\/)\(shell\)\/layout\.tsx$/.test(rel)) {
|
|
475
|
+
await repatchGoldPathFile(cwd, rel, (source) => goldPatchShellLayout(source, authImport), "session gate");
|
|
476
|
+
}
|
|
477
|
+
if (/(^|\/)\(shell\)\/team\/page\.tsx$/.test(rel)) {
|
|
478
|
+
await repatchGoldPathFile(cwd, rel, goldPatchTeamPage, "MembersPanel");
|
|
479
|
+
}
|
|
480
|
+
if (/(^|\/)\(shell\)\/page\.tsx$/.test(rel)) {
|
|
481
|
+
await repatchGoldPathFile(cwd, rel, goldPatchHomePage, "ItemsPanel");
|
|
482
|
+
}
|
|
483
|
+
}
|
|
450
484
|
}
|
|
451
485
|
/** Statuses that write the planned content to disk unconditionally. */
|
|
452
486
|
const WRITE_STATUSES = new Set(["fast-forward", "new-file", "merged"]);
|
|
@@ -800,7 +834,7 @@ export async function upgrade(names, options) {
|
|
|
800
834
|
const newlyInstalled = await installPendingBlocks(itemPlans, config, cwd, targetVersion);
|
|
801
835
|
Object.assign(installed, newlyInstalled);
|
|
802
836
|
const written = await applyPlans(itemPlans, options, confirm);
|
|
803
|
-
await
|
|
837
|
+
await repatchGoldPathSurfaces(cwd, config, composed);
|
|
804
838
|
await refreshComposeSnapshots(itemPlans);
|
|
805
839
|
// Manifest: record every item that now fully embodies the target release.
|
|
806
840
|
// Compose items update `composed{}` (never `installed{}`) and never drop
|
|
@@ -10,6 +10,21 @@ export declare function isGoldPathTemplate(name: string): boolean;
|
|
|
10
10
|
* Idempotent. Used by add-page --nav and upgrade so neither restores Mara.
|
|
11
11
|
*/
|
|
12
12
|
export declare function goldPatchAppShellChrome(source: string): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Re-apply the session gate onto a catalog shell layout.
|
|
15
|
+
* Idempotent. Used by add-page (new shell group) and upgrade.
|
|
16
|
+
*/
|
|
17
|
+
export declare function goldPatchShellLayout(source: string, authImport?: string): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Re-apply MembersPanel onto a catalog /team page.
|
|
20
|
+
* Idempotent. Used by add-page --overwrite /team and upgrade.
|
|
21
|
+
*/
|
|
22
|
+
export declare function goldPatchTeamPage(source: string, membersImport?: string): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Re-apply ItemsPanel onto a catalog saas/admin home (drop dashboard/stats).
|
|
25
|
+
* Idempotent. Used by add-page --overwrite / and upgrade.
|
|
26
|
+
*/
|
|
27
|
+
export declare function goldPatchHomePage(source: string, itemsImport?: string): string | undefined;
|
|
13
28
|
/** Production npm specs installed with the gold path (devDeps are merged into package.json). */
|
|
14
29
|
export declare const GOLD_PATH_DEPENDENCIES: readonly ["drizzle-orm@^0.45.2", "better-sqlite3@^12.0.0", "better-auth@^1.7.2"];
|
|
15
30
|
export interface GoldPathLayout {
|
|
@@ -11,10 +11,13 @@ export const GOLD_PATH_TEMPLATES = new Set(["saas", "admin"]);
|
|
|
11
11
|
export function isGoldPathTemplate(name) {
|
|
12
12
|
return GOLD_PATH_TEMPLATES.has(name);
|
|
13
13
|
}
|
|
14
|
-
/** Gold-path
|
|
14
|
+
/** Gold-path identity — same strings compose writes into the authenticated shell. */
|
|
15
15
|
const GOLD_WORKSPACE_IMPORT = "@/components/workspace-menu";
|
|
16
16
|
const GOLD_INVITE_IMPORT = "@/components/invite-member";
|
|
17
17
|
const GOLD_SESSION_IMPORT = "@/components/session-user";
|
|
18
|
+
const GOLD_AUTH_IMPORT = "@/lib/auth";
|
|
19
|
+
const GOLD_MEMBERS_IMPORT = "@/components/members-panel";
|
|
20
|
+
const GOLD_ITEMS_IMPORT = "@/components/items-panel";
|
|
18
21
|
/**
|
|
19
22
|
* Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome.
|
|
20
23
|
* Idempotent. Used by add-page --nav and upgrade so neither restores Mara.
|
|
@@ -22,6 +25,27 @@ const GOLD_SESSION_IMPORT = "@/components/session-user";
|
|
|
22
25
|
export function goldPatchAppShellChrome(source) {
|
|
23
26
|
return patchChromeSource(source, GOLD_WORKSPACE_IMPORT, GOLD_INVITE_IMPORT, GOLD_SESSION_IMPORT);
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Re-apply the session gate onto a catalog shell layout.
|
|
30
|
+
* Idempotent. Used by add-page (new shell group) and upgrade.
|
|
31
|
+
*/
|
|
32
|
+
export function goldPatchShellLayout(source, authImport = GOLD_AUTH_IMPORT) {
|
|
33
|
+
return patchShellLayoutSource(source, authImport);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Re-apply MembersPanel onto a catalog /team page.
|
|
37
|
+
* Idempotent. Used by add-page --overwrite /team and upgrade.
|
|
38
|
+
*/
|
|
39
|
+
export function goldPatchTeamPage(source, membersImport = GOLD_MEMBERS_IMPORT) {
|
|
40
|
+
return patchTeamPageSource(source, membersImport);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Re-apply ItemsPanel onto a catalog saas/admin home (drop dashboard/stats).
|
|
44
|
+
* Idempotent. Used by add-page --overwrite / and upgrade.
|
|
45
|
+
*/
|
|
46
|
+
export function goldPatchHomePage(source, itemsImport = GOLD_ITEMS_IMPORT) {
|
|
47
|
+
return patchHomePageSource(source, itemsImport);
|
|
48
|
+
}
|
|
25
49
|
/** Production npm specs installed with the gold path (devDeps are merged into package.json). */
|
|
26
50
|
export const GOLD_PATH_DEPENDENCIES = [
|
|
27
51
|
"drizzle-orm@^0.45.2",
|
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.
|
|
3
|
-
export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.
|
|
2
|
+
export declare const CLI_VERSION = "0.6.18";
|
|
3
|
+
export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.18/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.
|
|
5
|
+
export const CLI_VERSION = "0.6.18";
|
|
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.6.
|
|
3
|
+
"version": "0.6.18",
|
|
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.
|
|
57
|
+
"@cronus-ui/ai-kit": "0.6.18",
|
|
58
58
|
"commander": "^15.0.0",
|
|
59
59
|
"picocolors": "^1.1.1"
|
|
60
60
|
},
|