@lastbrain/app 0.1.24 → 0.1.26
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/__tests__/module-registry.test.d.ts +2 -0
- package/dist/__tests__/module-registry.test.d.ts.map +1 -0
- package/dist/__tests__/module-registry.test.js +64 -0
- package/dist/app-shell/(admin)/layout.d.ts +3 -2
- package/dist/app-shell/(admin)/layout.d.ts.map +1 -1
- package/dist/app-shell/(admin)/layout.js +1 -1
- package/dist/app-shell/(auth)/layout.d.ts +3 -2
- package/dist/app-shell/(auth)/layout.d.ts.map +1 -1
- package/dist/app-shell/(auth)/layout.js +1 -1
- package/dist/app-shell/(public)/page.d.ts.map +1 -1
- package/dist/cli.js +50 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/layouts/AdminLayout.d.ts +3 -2
- package/dist/layouts/AdminLayout.d.ts.map +1 -1
- package/dist/layouts/AdminLayoutWithSidebar.d.ts +8 -0
- package/dist/layouts/AdminLayoutWithSidebar.d.ts.map +1 -0
- package/dist/layouts/AdminLayoutWithSidebar.js +9 -0
- package/dist/layouts/AppProviders.d.ts +3 -2
- package/dist/layouts/AppProviders.d.ts.map +1 -1
- package/dist/layouts/AuthLayout.d.ts +3 -2
- package/dist/layouts/AuthLayout.d.ts.map +1 -1
- package/dist/layouts/AuthLayoutWithSidebar.d.ts +8 -0
- package/dist/layouts/AuthLayoutWithSidebar.d.ts.map +1 -0
- package/dist/layouts/AuthLayoutWithSidebar.js +9 -0
- package/dist/layouts/PublicLayout.d.ts +3 -2
- package/dist/layouts/PublicLayout.d.ts.map +1 -1
- package/dist/layouts/RootLayout.d.ts +3 -2
- package/dist/layouts/RootLayout.d.ts.map +1 -1
- package/dist/scripts/db-init.js +2 -2
- package/dist/scripts/db-migrations-sync.js +5 -5
- package/dist/scripts/dev-sync.js +21 -10
- package/dist/scripts/init-app.d.ts.map +1 -1
- package/dist/scripts/init-app.js +126 -21
- package/dist/scripts/module-add.d.ts.map +1 -1
- package/dist/scripts/module-add.js +20 -7
- package/dist/scripts/module-build.d.ts.map +1 -1
- package/dist/scripts/module-build.js +285 -30
- package/dist/scripts/module-create.d.ts.map +1 -1
- package/dist/scripts/module-create.js +25 -15
- package/dist/scripts/module-remove.d.ts.map +1 -1
- package/dist/scripts/module-remove.js +24 -11
- package/dist/scripts/script-runner.d.ts +5 -0
- package/dist/scripts/script-runner.d.ts.map +1 -0
- package/dist/scripts/script-runner.js +25 -0
- package/dist/styles.css +1 -1
- package/dist/templates/DefaultDoc.js +1 -7
- package/dist/templates/DocPage.d.ts.map +1 -1
- package/dist/templates/DocPage.js +14 -14
- package/dist/templates/components/AppAside.d.ts +6 -0
- package/dist/templates/components/AppAside.d.ts.map +1 -0
- package/dist/templates/components/AppAside.js +9 -0
- package/dist/templates/layouts/admin-layout.d.ts +4 -0
- package/dist/templates/layouts/admin-layout.d.ts.map +1 -0
- package/dist/templates/layouts/admin-layout.js +6 -0
- package/dist/templates/layouts/auth-layout.d.ts +4 -0
- package/dist/templates/layouts/auth-layout.d.ts.map +1 -0
- package/dist/templates/layouts/auth-layout.js +6 -0
- package/package.json +2 -1
- package/src/__tests__/module-registry.test.ts +74 -0
- package/src/app-shell/(admin)/layout.tsx +5 -3
- package/src/app-shell/(auth)/layout.tsx +5 -3
- package/src/app-shell/(public)/page.tsx +6 -2
- package/src/auth/useAuthSession.ts +1 -1
- package/src/cli.ts +51 -1
- package/src/index.ts +6 -0
- package/src/layouts/AdminLayout.tsx +1 -3
- package/src/layouts/AdminLayoutWithSidebar.tsx +35 -0
- package/src/layouts/AppProviders.tsx +3 -5
- package/src/layouts/AuthLayout.tsx +1 -3
- package/src/layouts/AuthLayoutWithSidebar.tsx +35 -0
- package/src/layouts/PublicLayout.tsx +1 -3
- package/src/layouts/RootLayout.tsx +1 -2
- package/src/scripts/db-init.ts +13 -8
- package/src/scripts/db-migrations-sync.ts +4 -4
- package/src/scripts/dev-sync.ts +49 -18
- package/src/scripts/init-app.ts +246 -73
- package/src/scripts/module-add.ts +49 -23
- package/src/scripts/module-build.ts +393 -88
- package/src/scripts/module-create.ts +85 -49
- package/src/scripts/module-remove.ts +116 -57
- package/src/scripts/readme-build.ts +2 -2
- package/src/scripts/script-runner.ts +28 -0
- package/src/templates/AuthGuidePage.tsx +1 -1
- package/src/templates/DefaultDoc.tsx +7 -7
- package/src/templates/DocPage.tsx +74 -46
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Exécute un script via node en ajustant le chemin
|
|
6
|
+
*/
|
|
7
|
+
export async function runScript(scriptName: string, args: string[] = []) {
|
|
8
|
+
return new Promise<void>((resolve, reject) => {
|
|
9
|
+
const scriptPath = path.join(__dirname, `${scriptName}.js`);
|
|
10
|
+
|
|
11
|
+
const child = spawn("node", [scriptPath, ...args], {
|
|
12
|
+
stdio: "inherit",
|
|
13
|
+
env: { ...process.env, PROJECT_ROOT: process.cwd() },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
child.on("close", (code) => {
|
|
17
|
+
if (code === 0) {
|
|
18
|
+
resolve();
|
|
19
|
+
} else {
|
|
20
|
+
reject(new Error(`Script ${scriptName} exited with code ${code}`));
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
child.on("error", (error) => {
|
|
25
|
+
reject(error);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -330,13 +330,13 @@ export function DefaultDocumentation() {
|
|
|
330
330
|
</p>
|
|
331
331
|
<div className="ml-6">
|
|
332
332
|
<Snippet symbol="" hideSymbol className="text-sm">
|
|
333
|
-
{`update auth.users
|
|
334
|
-
set raw_app_meta_data = jsonb_set(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
)
|
|
339
|
-
where email = 'votre@email.com';`}
|
|
333
|
+
<span>{`update auth.users`}</span>
|
|
334
|
+
<span>{`set raw_app_meta_data = jsonb_set(`}</span>
|
|
335
|
+
<span>{`coalesce(raw_app_meta_data, '{}'::jsonb),`}</span>
|
|
336
|
+
<span>{`'{roles}',`}</span>
|
|
337
|
+
<span>{`'["admin"]'::jsonb`}</span>
|
|
338
|
+
<span>{`)`}</span>
|
|
339
|
+
<span>{`where email = 'votre@email.com';`}</span>
|
|
340
340
|
</Snippet>
|
|
341
341
|
</div>
|
|
342
342
|
</li>
|
|
@@ -31,6 +31,68 @@ import {
|
|
|
31
31
|
} from "lucide-react";
|
|
32
32
|
import { DefaultDocumentation } from "./DefaultDoc.js";
|
|
33
33
|
|
|
34
|
+
// Composant NavigationListbox séparé pour éviter la recréation
|
|
35
|
+
interface NavigationListboxProps {
|
|
36
|
+
navigationItems: Array<{
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
icon: any;
|
|
41
|
+
color?: string;
|
|
42
|
+
number?: number;
|
|
43
|
+
}>;
|
|
44
|
+
selectedModule: string;
|
|
45
|
+
scrollToSection: (id: string) => void;
|
|
46
|
+
setSelectedModule: (id: string) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const NavigationListbox: React.FC<NavigationListboxProps> = ({
|
|
50
|
+
navigationItems,
|
|
51
|
+
selectedModule,
|
|
52
|
+
scrollToSection,
|
|
53
|
+
setSelectedModule,
|
|
54
|
+
}) => (
|
|
55
|
+
<Listbox
|
|
56
|
+
aria-label="Navigation"
|
|
57
|
+
selectionMode="single"
|
|
58
|
+
selectedKeys={selectedModule ? [selectedModule] : []}
|
|
59
|
+
onSelectionChange={(keys) => {
|
|
60
|
+
const key = Array.from(keys)[0] as string;
|
|
61
|
+
if (key) {
|
|
62
|
+
scrollToSection(key);
|
|
63
|
+
} else {
|
|
64
|
+
setSelectedModule("");
|
|
65
|
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
66
|
+
}
|
|
67
|
+
}}
|
|
68
|
+
items={navigationItems}
|
|
69
|
+
>
|
|
70
|
+
{(item: any) => {
|
|
71
|
+
const IconComponent = item.icon;
|
|
72
|
+
return (
|
|
73
|
+
<ListboxItem
|
|
74
|
+
key={item.id}
|
|
75
|
+
textValue={item.name}
|
|
76
|
+
description={item.description}
|
|
77
|
+
color={item.color}
|
|
78
|
+
variant="solid"
|
|
79
|
+
endContent={
|
|
80
|
+
item.number && (
|
|
81
|
+
<Chip size="sm" color="primary">
|
|
82
|
+
{item.number ?? 0}
|
|
83
|
+
</Chip>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
className={`${selectedModule === item.id ? "bg-default-200/40" : ""}`}
|
|
87
|
+
startContent={<IconComponent size={18} className="shrink-0" />}
|
|
88
|
+
>
|
|
89
|
+
{item.name}
|
|
90
|
+
</ListboxItem>
|
|
91
|
+
);
|
|
92
|
+
}}
|
|
93
|
+
</Listbox>
|
|
94
|
+
);
|
|
95
|
+
|
|
34
96
|
interface ModuleDocConfig {
|
|
35
97
|
id: string;
|
|
36
98
|
name: string;
|
|
@@ -207,50 +269,6 @@ export function DocPage({ modules = [], defaultContent }: DocPageProps) {
|
|
|
207
269
|
})),
|
|
208
270
|
];
|
|
209
271
|
|
|
210
|
-
const NavigationListbox = () => (
|
|
211
|
-
<Listbox
|
|
212
|
-
aria-label="Navigation"
|
|
213
|
-
selectionMode="single"
|
|
214
|
-
selectedKeys={selectedModule ? [selectedModule] : []}
|
|
215
|
-
onSelectionChange={(keys) => {
|
|
216
|
-
const key = Array.from(keys)[0] as string;
|
|
217
|
-
if (key) {
|
|
218
|
-
scrollToSection(key);
|
|
219
|
-
} else {
|
|
220
|
-
setSelectedModule("");
|
|
221
|
-
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
222
|
-
}
|
|
223
|
-
}}
|
|
224
|
-
items={navigationItems}
|
|
225
|
-
>
|
|
226
|
-
{(item: any) => {
|
|
227
|
-
const IconComponent = item.icon;
|
|
228
|
-
return (
|
|
229
|
-
<ListboxItem
|
|
230
|
-
key={item.id}
|
|
231
|
-
textValue={item.name}
|
|
232
|
-
description={item.description}
|
|
233
|
-
color={item.color}
|
|
234
|
-
variant="solid"
|
|
235
|
-
endContent={
|
|
236
|
-
item.number && (
|
|
237
|
-
<Chip size="sm" color="primary">
|
|
238
|
-
{item.number ?? 0}
|
|
239
|
-
</Chip>
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
className={`${
|
|
243
|
-
selectedModule === item.id ? "bg-default-200/40" : ""
|
|
244
|
-
}`}
|
|
245
|
-
startContent={<IconComponent size={18} className="shrink-0" />}
|
|
246
|
-
>
|
|
247
|
-
{item.name}
|
|
248
|
-
</ListboxItem>
|
|
249
|
-
);
|
|
250
|
-
}}
|
|
251
|
-
</Listbox>
|
|
252
|
-
);
|
|
253
|
-
|
|
254
272
|
return (
|
|
255
273
|
<div className="w-full pt-8 md:pt-12 pb-24 lg:pb-8">
|
|
256
274
|
<div className="container mx-auto md:px-4 py-8">
|
|
@@ -278,7 +296,12 @@ export function DocPage({ modules = [], defaultContent }: DocPageProps) {
|
|
|
278
296
|
<h2 className="text-xl font-semibold">Navigation</h2>
|
|
279
297
|
</DrawerHeader>
|
|
280
298
|
<DrawerBody>
|
|
281
|
-
<NavigationListbox
|
|
299
|
+
<NavigationListbox
|
|
300
|
+
navigationItems={navigationItems}
|
|
301
|
+
selectedModule={selectedModule}
|
|
302
|
+
scrollToSection={scrollToSection}
|
|
303
|
+
setSelectedModule={setSelectedModule}
|
|
304
|
+
/>
|
|
282
305
|
</DrawerBody>
|
|
283
306
|
</DrawerContent>
|
|
284
307
|
</Drawer>
|
|
@@ -291,7 +314,12 @@ export function DocPage({ modules = [], defaultContent }: DocPageProps) {
|
|
|
291
314
|
<h2 className="text-xl font-semibold">Navigation</h2>
|
|
292
315
|
</CardHeader>
|
|
293
316
|
<CardBody>
|
|
294
|
-
<NavigationListbox
|
|
317
|
+
<NavigationListbox
|
|
318
|
+
navigationItems={navigationItems}
|
|
319
|
+
selectedModule={selectedModule}
|
|
320
|
+
scrollToSection={scrollToSection}
|
|
321
|
+
setSelectedModule={setSelectedModule}
|
|
322
|
+
/>
|
|
295
323
|
</CardBody>
|
|
296
324
|
</Card>
|
|
297
325
|
</aside>
|