cronus-ui 0.6.15 → 0.6.17
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 +19 -4
- package/dist/commands/upgrade.js +58 -0
- package/dist/compose/gold-path.d.ts +15 -0
- package/dist/compose/gold-path.js +27 -0
- 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.17` 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.17/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 { isGoldPathTemplate,
|
|
23
|
+
import { goldPatchAppShellChrome, 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,14 @@ 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 /team (MembersPanel). Writing the
|
|
239
|
+
// catalog TeamBlock would undo that — re-apply the same idempotent patch.
|
|
240
|
+
if (isGoldPathTemplate(appName) && planPage.route === "/team" && chromeGroup === "shell") {
|
|
241
|
+
const patched = goldPatchTeamPage(content);
|
|
242
|
+
if (patched !== undefined)
|
|
243
|
+
content = patched;
|
|
244
|
+
}
|
|
238
245
|
await writeFileEnsured(pageDest, content);
|
|
239
246
|
generatedFiles.push(pageRel);
|
|
240
247
|
await writeFileEnsured(resolveSafeDest(targetDir, baseSnapshotDir(appName), pageRel), content);
|
|
@@ -283,7 +290,7 @@ export async function addPage(options) {
|
|
|
283
290
|
// restore Mara + WORKSPACES. Re-apply the same idempotent patch so --nav
|
|
284
291
|
// grows the sidebar without undoing the authenticated shell.
|
|
285
292
|
if (isGoldPathTemplate(appName) && slug === "app-shell-chrome") {
|
|
286
|
-
const patched =
|
|
293
|
+
const patched = goldPatchAppShellChrome(content);
|
|
287
294
|
if (patched !== undefined)
|
|
288
295
|
content = patched;
|
|
289
296
|
}
|
|
@@ -404,7 +411,15 @@ async function ensureChromeScaffold(plan, chrome, config, targetDir, appName, ge
|
|
|
404
411
|
if (chrome.block !== undefined && plan.shellExportName !== undefined) {
|
|
405
412
|
await write(chromeWrapperPath(config, "app-shell"), renderShellWrapper("AppShellNav", chrome.block, plan.shellExportName, config));
|
|
406
413
|
}
|
|
407
|
-
|
|
414
|
+
let layout = renderLayout(chrome, config);
|
|
415
|
+
// saas/admin: compose gold-patches the shell layout with a session gate.
|
|
416
|
+
// A brand-new group would otherwise ship the catalog passthrough.
|
|
417
|
+
if (isGoldPathTemplate(appName) && chrome.group === "shell") {
|
|
418
|
+
const patched = goldPatchShellLayout(layout, `${config.aliases.lib}/auth`);
|
|
419
|
+
if (patched !== undefined)
|
|
420
|
+
layout = patched;
|
|
421
|
+
}
|
|
422
|
+
await write(layoutPath(chrome), layout);
|
|
408
423
|
}
|
|
409
424
|
/**
|
|
410
425
|
* Parse the `--blocks hero,cta` / `--blocks login=split,cta` spec into block refs.
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -5,6 +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, goldPatchShellLayout, goldPatchTeamPage, isGoldPathTemplate, } from "../compose/gold-path.js";
|
|
8
9
|
import { buildComposePlan } from "../compose/plan.js";
|
|
9
10
|
import { baseSnapshotDest, filterManifestToComposedPages, listBaseSnapshotRels, readBaseSnapshot, reloadManifest, } from "../compose/reload.js";
|
|
10
11
|
import { renderPlan } from "../compose/render.js";
|
|
@@ -420,6 +421,62 @@ function statusLabel(plan) {
|
|
|
420
421
|
return plan.status;
|
|
421
422
|
}
|
|
422
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* saas/admin: upgrade 3-ways chrome against the catalog item (Mara) and
|
|
426
|
+
* layout/team 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.
|
|
429
|
+
*/
|
|
430
|
+
async function repatchGoldPathFile(cwd, rel, patch, label) {
|
|
431
|
+
let dest;
|
|
432
|
+
try {
|
|
433
|
+
dest = resolveSafeDest(cwd, ".", rel);
|
|
434
|
+
}
|
|
435
|
+
catch {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
if (!existsSync(dest))
|
|
439
|
+
return;
|
|
440
|
+
const current = await readFile(dest, "utf8");
|
|
441
|
+
if (current.includes("<<<<<<<"))
|
|
442
|
+
return;
|
|
443
|
+
const patched = patch(current);
|
|
444
|
+
if (patched === undefined || patched === current)
|
|
445
|
+
return;
|
|
446
|
+
await writeFileEnsured(dest, patched);
|
|
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
|
+
]) {
|
|
461
|
+
if (existsSync(join(cwd, rel)))
|
|
462
|
+
rels.add(rel);
|
|
463
|
+
}
|
|
464
|
+
return [...rels];
|
|
465
|
+
}
|
|
466
|
+
async function repatchGoldPathSurfaces(cwd, config, composed) {
|
|
467
|
+
if (!Object.keys(composed).some((key) => isGoldPathTemplate(key)))
|
|
468
|
+
return;
|
|
469
|
+
const authImport = `${config.aliases.lib}/auth`;
|
|
470
|
+
await repatchGoldPathFile(cwd, join(config.paths.blocks, "app-shell-chrome.tsx"), goldPatchAppShellChrome, "WorkspaceMenu / InviteMember / SessionUser");
|
|
471
|
+
for (const rel of goldPathSurfaceRels(cwd, composed)) {
|
|
472
|
+
if (/(^|\/)\(shell\)\/layout\.tsx$/.test(rel)) {
|
|
473
|
+
await repatchGoldPathFile(cwd, rel, (source) => goldPatchShellLayout(source, authImport), "session gate");
|
|
474
|
+
}
|
|
475
|
+
if (/(^|\/)\(shell\)\/team\/page\.tsx$/.test(rel)) {
|
|
476
|
+
await repatchGoldPathFile(cwd, rel, goldPatchTeamPage, "MembersPanel");
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
423
480
|
/** Statuses that write the planned content to disk unconditionally. */
|
|
424
481
|
const WRITE_STATUSES = new Set(["fast-forward", "new-file", "merged"]);
|
|
425
482
|
function fileWasWritten(plan) {
|
|
@@ -772,6 +829,7 @@ export async function upgrade(names, options) {
|
|
|
772
829
|
const newlyInstalled = await installPendingBlocks(itemPlans, config, cwd, targetVersion);
|
|
773
830
|
Object.assign(installed, newlyInstalled);
|
|
774
831
|
const written = await applyPlans(itemPlans, options, confirm);
|
|
832
|
+
await repatchGoldPathSurfaces(cwd, config, composed);
|
|
775
833
|
await refreshComposeSnapshots(itemPlans);
|
|
776
834
|
// Manifest: record every item that now fully embodies the target release.
|
|
777
835
|
// Compose items update `composed{}` (never `installed{}`) and never drop
|
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
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
|
+
/**
|
|
9
|
+
* Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome.
|
|
10
|
+
* Idempotent. Used by add-page --nav and upgrade so neither restores Mara.
|
|
11
|
+
*/
|
|
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;
|
|
8
23
|
/** Production npm specs installed with the gold path (devDeps are merged into package.json). */
|
|
9
24
|
export declare const GOLD_PATH_DEPENDENCIES: readonly ["drizzle-orm@^0.45.2", "better-sqlite3@^12.0.0", "better-auth@^1.7.2"];
|
|
10
25
|
export interface GoldPathLayout {
|
|
@@ -11,6 +11,33 @@ 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 identity — same strings compose writes into the authenticated shell. */
|
|
15
|
+
const GOLD_WORKSPACE_IMPORT = "@/components/workspace-menu";
|
|
16
|
+
const GOLD_INVITE_IMPORT = "@/components/invite-member";
|
|
17
|
+
const GOLD_SESSION_IMPORT = "@/components/session-user";
|
|
18
|
+
const GOLD_AUTH_IMPORT = "@/lib/auth";
|
|
19
|
+
const GOLD_MEMBERS_IMPORT = "@/components/members-panel";
|
|
20
|
+
/**
|
|
21
|
+
* Re-apply WorkspaceMenu / InviteMember / SessionUser onto catalog app-shell-chrome.
|
|
22
|
+
* Idempotent. Used by add-page --nav and upgrade so neither restores Mara.
|
|
23
|
+
*/
|
|
24
|
+
export function goldPatchAppShellChrome(source) {
|
|
25
|
+
return patchChromeSource(source, GOLD_WORKSPACE_IMPORT, GOLD_INVITE_IMPORT, GOLD_SESSION_IMPORT);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Re-apply the session gate onto a catalog shell layout.
|
|
29
|
+
* Idempotent. Used by add-page (new shell group) and upgrade.
|
|
30
|
+
*/
|
|
31
|
+
export function goldPatchShellLayout(source, authImport = GOLD_AUTH_IMPORT) {
|
|
32
|
+
return patchShellLayoutSource(source, authImport);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Re-apply MembersPanel onto a catalog /team page.
|
|
36
|
+
* Idempotent. Used by add-page --overwrite /team and upgrade.
|
|
37
|
+
*/
|
|
38
|
+
export function goldPatchTeamPage(source, membersImport = GOLD_MEMBERS_IMPORT) {
|
|
39
|
+
return patchTeamPageSource(source, membersImport);
|
|
40
|
+
}
|
|
14
41
|
/** Production npm specs installed with the gold path (devDeps are merged into package.json). */
|
|
15
42
|
export const GOLD_PATH_DEPENDENCIES = [
|
|
16
43
|
"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.17";
|
|
3
|
+
export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.17/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.17";
|
|
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.17",
|
|
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.17",
|
|
58
58
|
"commander": "^15.0.0",
|
|
59
59
|
"picocolors": "^1.1.1"
|
|
60
60
|
},
|