cronus-ui 0.6.6 → 0.6.8
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/compose/gold-path.js +67 -11
- package/dist/config.d.ts +2 -2
- package/dist/config.js +1 -1
- package/package.json +2 -2
- package/templates/apps/admin.json +12 -0
- package/templates/apps/saas.json +6 -0
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.8` 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.8/registry"
|
|
84
84
|
}
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -262,8 +262,8 @@ export const auth = betterAuth({
|
|
|
262
262
|
database: drizzleAdapter(db, { provider: "sqlite", schema }),
|
|
263
263
|
emailAndPassword: {
|
|
264
264
|
enabled: true,
|
|
265
|
-
sendResetPassword: async ({ url }) => {
|
|
266
|
-
console.info(url);
|
|
265
|
+
sendResetPassword: async ({ user, url }) => {
|
|
266
|
+
console.info(\`Reset \${user.email}: \${url}\`);
|
|
267
267
|
},
|
|
268
268
|
},
|
|
269
269
|
databaseHooks: {
|
|
@@ -390,8 +390,23 @@ export async function signUpEmail({
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
export async function requestPasswordReset({ email }: { email: string }) {
|
|
393
|
-
const { error } = await authClient.requestPasswordReset({
|
|
393
|
+
const { error } = await authClient.requestPasswordReset({
|
|
394
|
+
email,
|
|
395
|
+
redirectTo: "/reset-password",
|
|
396
|
+
});
|
|
397
|
+
if (error) throw new Error(error.message || "Reset failed");
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export async function resetPassword({
|
|
401
|
+
token,
|
|
402
|
+
newPassword,
|
|
403
|
+
}: {
|
|
404
|
+
token: string;
|
|
405
|
+
newPassword: string;
|
|
406
|
+
}) {
|
|
407
|
+
const { error } = await authClient.resetPassword({ token, newPassword });
|
|
394
408
|
if (error) throw new Error(error.message || "Reset failed");
|
|
409
|
+
window.location.assign("/login");
|
|
395
410
|
}
|
|
396
411
|
`;
|
|
397
412
|
}
|
|
@@ -407,7 +422,7 @@ function middlewareSource() {
|
|
|
407
422
|
import { NextResponse } from "next/server";
|
|
408
423
|
import { getSessionCookie } from "better-auth/cookies";
|
|
409
424
|
|
|
410
|
-
const AUTH_PAGES = ["/login", "/signup", "/forgot-password"];
|
|
425
|
+
const AUTH_PAGES = ["/login", "/signup", "/forgot-password", "/reset-password"];
|
|
411
426
|
|
|
412
427
|
function invitationOf(request: NextRequest): string | null {
|
|
413
428
|
const { pathname, searchParams } = request.nextUrl;
|
|
@@ -819,7 +834,9 @@ export function InviteMember({ trigger }: { trigger: ReactNode }) {
|
|
|
819
834
|
function sessionUserSource(authClientImport) {
|
|
820
835
|
return `"use client";
|
|
821
836
|
|
|
822
|
-
import { Avatar, AvatarFallback, AvatarImage } from "@cronus-ui/ui";
|
|
837
|
+
import { Avatar, AvatarFallback, AvatarImage, Button } from "@cronus-ui/ui";
|
|
838
|
+
import { LogOut } from "lucide-react";
|
|
839
|
+
import { useState } from "react";
|
|
823
840
|
import { authClient } from ${JSON.stringify(authClientImport)};
|
|
824
841
|
|
|
825
842
|
function initialsOf(name: string, email: string): string {
|
|
@@ -833,6 +850,7 @@ function initialsOf(name: string, email: string): string {
|
|
|
833
850
|
|
|
834
851
|
export function SessionUser({ compact = false }: { compact?: boolean }) {
|
|
835
852
|
const { data } = authClient.useSession();
|
|
853
|
+
const [pending, setPending] = useState(false);
|
|
836
854
|
const user = data?.user;
|
|
837
855
|
if (!user) return null;
|
|
838
856
|
const name = user.name || user.email || "Account";
|
|
@@ -844,14 +862,52 @@ export function SessionUser({ compact = false }: { compact?: boolean }) {
|
|
|
844
862
|
<AvatarFallback>{initials}</AvatarFallback>
|
|
845
863
|
</Avatar>
|
|
846
864
|
);
|
|
847
|
-
|
|
865
|
+
|
|
866
|
+
async function onSignOut() {
|
|
867
|
+
setPending(true);
|
|
868
|
+
const { error } = await authClient.signOut();
|
|
869
|
+
if (error) {
|
|
870
|
+
setPending(false);
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
window.location.assign("/login");
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
const signOutButton = (
|
|
877
|
+
<Button
|
|
878
|
+
type="button"
|
|
879
|
+
variant="ghost"
|
|
880
|
+
size={compact ? "icon-sm" : "sm"}
|
|
881
|
+
className={compact ? undefined : "w-full justify-start"}
|
|
882
|
+
disabled={pending}
|
|
883
|
+
aria-busy={pending}
|
|
884
|
+
aria-label="Sign out"
|
|
885
|
+
onClick={() => void onSignOut()}
|
|
886
|
+
>
|
|
887
|
+
<LogOut aria-hidden="true" />
|
|
888
|
+
{compact ? null : "Sign out"}
|
|
889
|
+
</Button>
|
|
890
|
+
);
|
|
891
|
+
|
|
892
|
+
if (compact) {
|
|
893
|
+
return (
|
|
894
|
+
<div className="flex items-center gap-1">
|
|
895
|
+
{avatar}
|
|
896
|
+
{signOutButton}
|
|
897
|
+
</div>
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
|
|
848
901
|
return (
|
|
849
|
-
<div className="flex
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
<
|
|
853
|
-
|
|
902
|
+
<div className="flex flex-col gap-1">
|
|
903
|
+
<div className="flex items-center gap-2 rounded-lg px-2 py-1.5">
|
|
904
|
+
{avatar}
|
|
905
|
+
<div className="flex min-w-0 flex-col">
|
|
906
|
+
<span className="truncate text-sm font-medium text-fg">{name}</span>
|
|
907
|
+
<span className="truncate text-xs text-fg-tertiary">{email}</span>
|
|
908
|
+
</div>
|
|
854
909
|
</div>
|
|
910
|
+
{signOutButton}
|
|
855
911
|
</div>
|
|
856
912
|
);
|
|
857
913
|
}
|
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.8";
|
|
3
|
+
export declare const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.8/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.8";
|
|
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.8",
|
|
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.8",
|
|
58
58
|
"commander": "^15.0.0",
|
|
59
59
|
"picocolors": "^1.1.1"
|
|
60
60
|
},
|
|
@@ -16,6 +16,18 @@
|
|
|
16
16
|
"chrome": "bare",
|
|
17
17
|
"blocks": [{ "block": "login", "variant": "split" }]
|
|
18
18
|
},
|
|
19
|
+
{
|
|
20
|
+
"route": "/forgot-password",
|
|
21
|
+
"title": "Reset password",
|
|
22
|
+
"chrome": "bare",
|
|
23
|
+
"blocks": ["forgot-password"]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"route": "/reset-password",
|
|
27
|
+
"title": "Set new password",
|
|
28
|
+
"chrome": "bare",
|
|
29
|
+
"blocks": [{ "block": "forgot-password", "variant": "reset" }]
|
|
30
|
+
},
|
|
19
31
|
{
|
|
20
32
|
"route": "/",
|
|
21
33
|
"title": "Overview",
|
package/templates/apps/saas.json
CHANGED
|
@@ -28,6 +28,12 @@
|
|
|
28
28
|
"chrome": "bare",
|
|
29
29
|
"blocks": ["forgot-password"]
|
|
30
30
|
},
|
|
31
|
+
{
|
|
32
|
+
"route": "/reset-password",
|
|
33
|
+
"title": "Set new password",
|
|
34
|
+
"chrome": "bare",
|
|
35
|
+
"blocks": [{ "block": "forgot-password", "variant": "reset" }]
|
|
36
|
+
},
|
|
31
37
|
{
|
|
32
38
|
"route": "/",
|
|
33
39
|
"title": "Dashboard",
|