@monorise/cli 3.0.3 → 4.1.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/dist/cli.js +295 -102
- package/dist/cli.js.map +1 -1
- package/dist/templates/files/core-routes.ts +22 -0
- package/dist/templates/files/example-page.tsx +103 -0
- package/dist/templates/files/global-initializer.tsx +16 -0
- package/dist/templates/files/global-loader.tsx +45 -0
- package/dist/templates/files/globals.css +72 -0
- package/dist/templates/files/lib-utils.ts +6 -0
- package/dist/templates/files/monorise.config.ts +7 -0
- package/dist/templates/files/proxy-request.ts +49 -0
- package/dist/templates/files/proxy-route.ts +22 -0
- package/dist/templates/files/sst.config.ts +30 -0
- package/dist/templates/files/team-entity.ts +37 -0
- package/dist/templates/files/team-membership.mutual.ts +16 -0
- package/dist/templates/files/ui-button.tsx +65 -0
- package/dist/templates/files/ui-card.tsx +103 -0
- package/dist/templates/files/ui-input.tsx +19 -0
- package/dist/templates/files/ui-label.tsx +24 -0
- package/dist/templates/files/user-entity.ts +43 -0
- package/package.json +7 -2
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { Slot } from 'radix-ui';
|
|
4
|
+
|
|
5
|
+
import { cn } from '#/lib/utils';
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-none border border-transparent bg-clip-padding text-xs font-medium focus-visible:ring-1 aria-invalid:ring-1 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
|
13
|
+
outline:
|
|
14
|
+
'border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
|
15
|
+
secondary:
|
|
16
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
|
17
|
+
ghost:
|
|
18
|
+
'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
|
19
|
+
destructive:
|
|
20
|
+
'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',
|
|
21
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default:
|
|
25
|
+
'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
26
|
+
xs: "h-6 gap-1 rounded-none px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
27
|
+
sm: "h-7 gap-1 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
28
|
+
lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
|
|
29
|
+
icon: 'size-8',
|
|
30
|
+
'icon-xs': "size-6 rounded-none [&_svg:not([class*='size-'])]:size-3",
|
|
31
|
+
'icon-sm': 'size-7 rounded-none',
|
|
32
|
+
'icon-lg': 'size-9',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: 'default',
|
|
37
|
+
size: 'default',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
function Button({
|
|
43
|
+
className,
|
|
44
|
+
variant = 'default',
|
|
45
|
+
size = 'default',
|
|
46
|
+
asChild = false,
|
|
47
|
+
...props
|
|
48
|
+
}: React.ComponentProps<'button'> &
|
|
49
|
+
VariantProps<typeof buttonVariants> & {
|
|
50
|
+
asChild?: boolean;
|
|
51
|
+
}) {
|
|
52
|
+
const Comp = asChild ? Slot.Root : 'button';
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Comp
|
|
56
|
+
data-slot='button'
|
|
57
|
+
data-variant={variant}
|
|
58
|
+
data-size={size}
|
|
59
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '#/lib/utils';
|
|
4
|
+
|
|
5
|
+
function Card({
|
|
6
|
+
className,
|
|
7
|
+
size = 'default',
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
data-slot='card'
|
|
13
|
+
data-size={size}
|
|
14
|
+
className={cn(
|
|
15
|
+
'ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-none py-4 text-xs/relaxed ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-2 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-none *:[img:last-child]:rounded-none group/card flex flex-col',
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
data-slot='card-header'
|
|
27
|
+
className={cn(
|
|
28
|
+
'gap-1 rounded-none px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]',
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-slot='card-title'
|
|
40
|
+
className={cn(
|
|
41
|
+
'text-sm font-medium group-data-[size=sm]/card:text-sm',
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
data-slot='card-description'
|
|
53
|
+
className={cn('text-muted-foreground text-xs/relaxed', className)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
data-slot='card-action'
|
|
63
|
+
className={cn(
|
|
64
|
+
'col-start-2 row-span-2 row-start-1 self-start justify-self-end',
|
|
65
|
+
className,
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot='card-content'
|
|
76
|
+
className={cn('px-4 group-data-[size=sm]/card:px-3', className)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot='card-footer'
|
|
86
|
+
className={cn(
|
|
87
|
+
'rounded-none border-t p-4 group-data-[size=sm]/card:p-3 flex items-center',
|
|
88
|
+
className,
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
Card,
|
|
97
|
+
CardHeader,
|
|
98
|
+
CardFooter,
|
|
99
|
+
CardTitle,
|
|
100
|
+
CardAction,
|
|
101
|
+
CardDescription,
|
|
102
|
+
CardContent,
|
|
103
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '#/lib/utils';
|
|
4
|
+
|
|
5
|
+
function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
6
|
+
return (
|
|
7
|
+
<input
|
|
8
|
+
type={type}
|
|
9
|
+
data-slot='input'
|
|
10
|
+
className={cn(
|
|
11
|
+
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-none border bg-transparent px-2.5 py-1 text-xs transition-colors file:h-6 file:text-xs file:font-medium focus-visible:ring-1 aria-invalid:ring-1 md:text-xs file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Input };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Label as LabelPrimitive } from 'radix-ui';
|
|
5
|
+
|
|
6
|
+
import { cn } from '#/lib/utils';
|
|
7
|
+
|
|
8
|
+
function Label({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<LabelPrimitive.Root
|
|
14
|
+
data-slot='label'
|
|
15
|
+
className={cn(
|
|
16
|
+
'gap-2 text-xs leading-none group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed',
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Label };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createEntityConfig } from 'monorise/base';
|
|
2
|
+
import type { Entity } from 'monorise/base';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import teamMembership from '../mutuals/team-membership';
|
|
5
|
+
|
|
6
|
+
const baseSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
displayName: z.string().min(1, 'Display name is required'),
|
|
9
|
+
email: z.string().email('Valid email is required'),
|
|
10
|
+
firstName: z.string().optional(),
|
|
11
|
+
lastName: z.string().optional(),
|
|
12
|
+
})
|
|
13
|
+
.partial();
|
|
14
|
+
|
|
15
|
+
const createSchema = z.object({
|
|
16
|
+
displayName: z.string().min(1, 'Display name is required'),
|
|
17
|
+
email: z.string().email('Valid email is required'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const config = createEntityConfig({
|
|
21
|
+
name: 'user',
|
|
22
|
+
displayName: 'User',
|
|
23
|
+
baseSchema,
|
|
24
|
+
createSchema,
|
|
25
|
+
searchableFields: ['displayName', 'email'],
|
|
26
|
+
uniqueFields: ['email'],
|
|
27
|
+
// Example mutual relationship — see monorise/mutuals/team-membership.ts
|
|
28
|
+
mutual: {
|
|
29
|
+
mutualSchema: z
|
|
30
|
+
.object({
|
|
31
|
+
teamIds: z.string().array(),
|
|
32
|
+
})
|
|
33
|
+
.partial(),
|
|
34
|
+
mutualFields: {
|
|
35
|
+
teamIds: {
|
|
36
|
+
entityType: 'team' as unknown as Entity,
|
|
37
|
+
mutual: teamMembership,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monorise/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/monorist/monorise.git",
|
|
7
|
+
"directory": "packages/cli"
|
|
8
|
+
},
|
|
4
9
|
"description": "",
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "dist/index.js",
|
|
@@ -9,7 +14,7 @@
|
|
|
9
14
|
"monorise": "dist/cli.js"
|
|
10
15
|
},
|
|
11
16
|
"scripts": {
|
|
12
|
-
"build": "tsup && chmod +x dist/cli.js",
|
|
17
|
+
"build": "tsup && chmod +x dist/cli.js && mkdir -p dist/templates && cp -r templates/files dist/templates/files",
|
|
13
18
|
"dev": "tsup --watch"
|
|
14
19
|
},
|
|
15
20
|
"keywords": [],
|