@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 @@
|
|
|
1
|
+
{"version":3,"file":"module-registry.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/module-registry.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { AVAILABLE_MODULES } from "../scripts/module-add";
|
|
3
|
+
describe("Module Registry", () => {
|
|
4
|
+
describe("AVAILABLE_MODULES", () => {
|
|
5
|
+
it("should have at least one module defined", () => {
|
|
6
|
+
expect(AVAILABLE_MODULES.length).toBeGreaterThan(0);
|
|
7
|
+
});
|
|
8
|
+
it("should have auth module defined", () => {
|
|
9
|
+
const authModule = AVAILABLE_MODULES.find((m) => m.name === "auth");
|
|
10
|
+
expect(authModule).toBeDefined();
|
|
11
|
+
expect(authModule?.package).toBe("@lastbrain/module-auth");
|
|
12
|
+
expect(authModule?.hasMigrations).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
it("should have ai module defined", () => {
|
|
15
|
+
const aiModule = AVAILABLE_MODULES.find((m) => m.name === "ai");
|
|
16
|
+
expect(aiModule).toBeDefined();
|
|
17
|
+
expect(aiModule?.package).toBe("@lastbrain/module-ai");
|
|
18
|
+
expect(aiModule?.hasMigrations).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
it("should have all required properties for each module", () => {
|
|
21
|
+
AVAILABLE_MODULES.forEach((module) => {
|
|
22
|
+
expect(module.name).toBeDefined();
|
|
23
|
+
expect(module.package).toBeDefined();
|
|
24
|
+
expect(module.displayName).toBeDefined();
|
|
25
|
+
expect(module.description).toBeDefined();
|
|
26
|
+
expect(typeof module.hasMigrations).toBe("boolean");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it("should have migrations paths when hasMigrations is true", () => {
|
|
30
|
+
AVAILABLE_MODULES.forEach((module) => {
|
|
31
|
+
if (module.hasMigrations) {
|
|
32
|
+
expect(module.migrationsPath).toBeDefined();
|
|
33
|
+
expect(module.migrationsDownPath).toBeDefined();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
it("should have unique module names", () => {
|
|
38
|
+
const names = AVAILABLE_MODULES.map((m) => m.name);
|
|
39
|
+
const uniqueNames = new Set(names);
|
|
40
|
+
expect(names.length).toBe(uniqueNames.size);
|
|
41
|
+
});
|
|
42
|
+
it("should have unique package names", () => {
|
|
43
|
+
const packages = AVAILABLE_MODULES.map((m) => m.package);
|
|
44
|
+
const uniquePackages = new Set(packages);
|
|
45
|
+
expect(packages.length).toBe(uniquePackages.size);
|
|
46
|
+
});
|
|
47
|
+
it("should have display names with emoji", () => {
|
|
48
|
+
AVAILABLE_MODULES.forEach((module) => {
|
|
49
|
+
// Check if displayName contains at least one emoji (basic check)
|
|
50
|
+
expect(module.displayName).toMatch(/[\u{1F300}-\u{1F9FF}]/u);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
it("should have non-empty descriptions", () => {
|
|
54
|
+
AVAILABLE_MODULES.forEach((module) => {
|
|
55
|
+
expect(module.description.length).toBeGreaterThan(0);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
it("should have valid package names", () => {
|
|
59
|
+
AVAILABLE_MODULES.forEach((module) => {
|
|
60
|
+
expect(module.package).toMatch(/^@lastbrain\/module-/);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export default function AdminShellLayout({ children, }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/app-shell/(admin)/layout.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/app-shell/(admin)/layout.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAQA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
export default function AdminShellLayout({ children }) {
|
|
3
|
+
export default function AdminShellLayout({ children, }) {
|
|
4
4
|
return (_jsxs("div", { className: "mx-auto max-w-5xl px-4 py-16", children: [_jsx("h1", { className: "text-3xl font-bold", children: "Section Admin" }), _jsx("p", { className: "text-slate-600", children: "Gestion avanc\u00E9e des modules." }), children] }));
|
|
5
5
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export default function AuthLayout({ children, }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/app-shell/(auth)/layout.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/app-shell/(auth)/layout.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAQA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
export default function AuthLayout({ children }) {
|
|
3
|
+
export default function AuthLayout({ children, }) {
|
|
4
4
|
return (_jsxs("div", { className: "mx-auto max-w-5xl px-4 py-16", children: [_jsx("h1", { className: "text-3xl font-bold", children: "Section Auth" }), _jsx("p", { className: "text-slate-600", children: "Les pages authentifi\u00E9es regroup\u00E9es ici." }), children] }));
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/app-shell/(public)/page.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,UAAU,
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/app-shell/(public)/page.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,UAAU,4CAYjC"}
|
package/dist/cli.js
CHANGED
|
@@ -85,4 +85,54 @@ program
|
|
|
85
85
|
process.exit(1);
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
+
// Commandes de build et maintenance
|
|
89
|
+
program
|
|
90
|
+
.command("module:build")
|
|
91
|
+
.description("Build les configurations de modules")
|
|
92
|
+
.action(async () => {
|
|
93
|
+
try {
|
|
94
|
+
const { runModuleBuild } = await import("./scripts/module-build.js");
|
|
95
|
+
await runModuleBuild();
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error("❌ Erreur lors du build des modules:", error);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
program
|
|
103
|
+
.command("db:init")
|
|
104
|
+
.description("Initialise la base de données Supabase")
|
|
105
|
+
.action(async () => {
|
|
106
|
+
try {
|
|
107
|
+
await import("./scripts/db-init.js");
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.error("❌ Erreur lors de l'initialisation de la DB:", error);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
program
|
|
115
|
+
.command("db:migrations:sync")
|
|
116
|
+
.description("Synchronise les migrations de modules")
|
|
117
|
+
.action(async () => {
|
|
118
|
+
try {
|
|
119
|
+
await import("./scripts/db-migrations-sync.js");
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
console.error("❌ Erreur lors de la sync des migrations:", error);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
program
|
|
127
|
+
.command("readme:create")
|
|
128
|
+
.description("Génère le fichier README")
|
|
129
|
+
.action(async () => {
|
|
130
|
+
try {
|
|
131
|
+
await import("./scripts/readme-build.js");
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error("❌ Erreur lors de la création du README:", error);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
88
138
|
program.parse();
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,12 @@ export { signOut, signIn } from "./auth/authHelpers.js";
|
|
|
4
4
|
export { RootLayout } from "./layouts/RootLayout.js";
|
|
5
5
|
export { PublicLayout } from "./layouts/PublicLayout.js";
|
|
6
6
|
export { AuthLayout } from "./layouts/AuthLayout.js";
|
|
7
|
+
export { AuthLayoutWithSidebar } from "./layouts/AuthLayoutWithSidebar.js";
|
|
7
8
|
export { AdminLayout } from "./layouts/AdminLayout.js";
|
|
9
|
+
export { AdminLayoutWithSidebar } from "./layouts/AdminLayoutWithSidebar.js";
|
|
8
10
|
export { getModuleConfigs } from "./modules/module-loader.js";
|
|
11
|
+
export { AppAside } from "@lastbrain/ui";
|
|
12
|
+
export type { AppAsideMenuItem, AppAsideMenuConfig } from "@lastbrain/ui";
|
|
9
13
|
export { SimpleHomePage } from "./templates/SimpleHomePage.js";
|
|
10
14
|
export { DocPage } from "./templates/DocPage.js";
|
|
11
15
|
export { SimpleDocPage } from "./templates/SimpleDocPage.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,OAAO,EACP,UAAU,EACV,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,OAAO,EACP,UAAU,EACV,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,12 @@ export { signOut, signIn } from "./auth/authHelpers.js";
|
|
|
4
4
|
export { RootLayout } from "./layouts/RootLayout.js";
|
|
5
5
|
export { PublicLayout } from "./layouts/PublicLayout.js";
|
|
6
6
|
export { AuthLayout } from "./layouts/AuthLayout.js";
|
|
7
|
+
export { AuthLayoutWithSidebar } from "./layouts/AuthLayoutWithSidebar.js";
|
|
7
8
|
export { AdminLayout } from "./layouts/AdminLayout.js";
|
|
9
|
+
export { AdminLayoutWithSidebar } from "./layouts/AdminLayoutWithSidebar.js";
|
|
8
10
|
export { getModuleConfigs } from "./modules/module-loader.js";
|
|
11
|
+
// Components
|
|
12
|
+
export { AppAside } from "@lastbrain/ui";
|
|
9
13
|
// Templates de pages (starter + docs)
|
|
10
14
|
export { SimpleHomePage } from "./templates/SimpleHomePage.js";
|
|
11
15
|
export { DocPage } from "./templates/DocPage.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function AdminLayout({ children }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
//# sourceMappingURL=AdminLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/AdminLayout.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"AdminLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/AdminLayout.tsx"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAEtE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface AdminLayoutWithSidebarProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
menuConfig?: any;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function AdminLayoutWithSidebar({ children, menuConfig, className, }: AdminLayoutWithSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=AdminLayoutWithSidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminLayoutWithSidebar.d.ts","sourceRoot":"","sources":["../../src/layouts/AdminLayoutWithSidebar.tsx"],"names":[],"mappings":"AAMA,UAAU,2BAA2B;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,UAAU,EACV,SAAc,GACf,EAAE,2BAA2B,2CAkB7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AdminLayout } from "./AdminLayout.js";
|
|
4
|
+
import { AppAside } from "@lastbrain/ui";
|
|
5
|
+
import { useAuthSession } from "../auth/useAuthSession.js";
|
|
6
|
+
export function AdminLayoutWithSidebar({ children, menuConfig, className = "", }) {
|
|
7
|
+
const { isSuperAdmin } = useAuthSession();
|
|
8
|
+
return (_jsxs("div", { className: "flex min-h-screen", children: [menuConfig && (_jsx(AppAside, { menuConfig: menuConfig, isSuperAdmin: isSuperAdmin, className: className })), _jsx("div", { className: `flex-1 ${menuConfig ? "lg:ml-72" : ""}`, children: _jsx(AdminLayout, { children: children }) })] }));
|
|
9
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PropsWithChildren } from "react";
|
|
2
1
|
import type { User } from "@supabase/supabase-js";
|
|
3
2
|
export declare function useModules(): import("@lastbrain/core").ModuleBuildConfig[];
|
|
4
3
|
export declare function useNotifications(): {
|
|
@@ -9,5 +8,7 @@ export declare function useAuth(): {
|
|
|
9
8
|
loading: boolean;
|
|
10
9
|
isSuperAdmin: boolean;
|
|
11
10
|
};
|
|
12
|
-
export declare function AppProviders({ children }:
|
|
11
|
+
export declare function AppProviders({ children }: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
//# sourceMappingURL=AppProviders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppProviders.d.ts","sourceRoot":"","sources":["../../src/layouts/AppProviders.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppProviders.d.ts","sourceRoot":"","sources":["../../src/layouts/AppProviders.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAclD,wBAAgB,UAAU,kDAEzB;AAED,wBAAgB,gBAAgB;cAf4B,MAAM,EAAE;EAiBnE;AAED,wBAAgB,OAAO;UAjBf,IAAI,GAAG,IAAI;aACR,OAAO;kBACF,OAAO;EAiBtB;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CA0BvE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function AuthLayout({ children }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
//# sourceMappingURL=AuthLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/AuthLayout.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"AuthLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/AuthLayout.tsx"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAErE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface AuthLayoutWithSidebarProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
menuConfig?: any;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function AuthLayoutWithSidebar({ children, menuConfig, className, }: AuthLayoutWithSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=AuthLayoutWithSidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthLayoutWithSidebar.d.ts","sourceRoot":"","sources":["../../src/layouts/AuthLayoutWithSidebar.tsx"],"names":[],"mappings":"AAMA,UAAU,0BAA0B;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,UAAU,EACV,SAAc,GACf,EAAE,0BAA0B,2CAkB5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AuthLayout } from "./AuthLayout.js";
|
|
4
|
+
import { AppAside } from "@lastbrain/ui";
|
|
5
|
+
import { useAuthSession } from "../auth/useAuthSession.js";
|
|
6
|
+
export function AuthLayoutWithSidebar({ children, menuConfig, className = "", }) {
|
|
7
|
+
const { isSuperAdmin } = useAuthSession();
|
|
8
|
+
return (_jsxs("div", { className: "flex min-h-screen", children: [menuConfig && (_jsx(AppAside, { menuConfig: menuConfig, isSuperAdmin: isSuperAdmin, className: className })), _jsx("div", { className: `flex-1 ${menuConfig ? "lg:ml-72" : ""}`, children: _jsx(AuthLayout, { children: children }) })] }));
|
|
9
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function PublicLayout({ children }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
//# sourceMappingURL=PublicLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/PublicLayout.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"PublicLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/PublicLayout.tsx"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAEvE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function RootLayout({ children }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
//# sourceMappingURL=RootLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/RootLayout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/RootLayout.tsx"],"names":[],"mappings":"AAMA,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAmBrE"}
|
package/dist/scripts/db-init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
1
|
+
import { spawn, spawnSync, } from "node:child_process";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -229,7 +229,7 @@ async function main() {
|
|
|
229
229
|
try {
|
|
230
230
|
runSupabase("start");
|
|
231
231
|
}
|
|
232
|
-
catch (
|
|
232
|
+
catch (_error) {
|
|
233
233
|
console.warn("⚠️ Supabase start had issues, continuing...");
|
|
234
234
|
}
|
|
235
235
|
console.log("🔄 Resetting database...");
|
|
@@ -7,11 +7,11 @@ const migrationsDir = path.join(projectRoot, "supabase/migrations");
|
|
|
7
7
|
function ensureDirectory(dir) {
|
|
8
8
|
fs.mkdirSync(dir, { recursive: true });
|
|
9
9
|
}
|
|
10
|
-
var
|
|
11
|
-
(function (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})(
|
|
10
|
+
var _CopyStrategy;
|
|
11
|
+
(function (_CopyStrategy) {
|
|
12
|
+
_CopyStrategy[_CopyStrategy["overwrite"] = 0] = "overwrite";
|
|
13
|
+
_CopyStrategy[_CopyStrategy["skip"] = 1] = "skip";
|
|
14
|
+
})(_CopyStrategy || (_CopyStrategy = {}));
|
|
15
15
|
function getModulePackageDir(moduleName) {
|
|
16
16
|
return path.join(projectRoot, "node_modules", ...moduleName.split("/"));
|
|
17
17
|
}
|
package/dist/scripts/dev-sync.js
CHANGED
|
@@ -14,12 +14,12 @@ const scriptsToEnsure = {
|
|
|
14
14
|
"build:modules": "pnpm --filter @lastbrain/app module:build",
|
|
15
15
|
"db:migrations:sync": "pnpm --filter @lastbrain/app db:migrations:sync",
|
|
16
16
|
"db:init": "pnpm --filter @lastbrain/app db:init",
|
|
17
|
-
"readme:create": "pnpm --filter @lastbrain/app readme:create"
|
|
17
|
+
"readme:create": "pnpm --filter @lastbrain/app readme:create",
|
|
18
18
|
};
|
|
19
19
|
const dependenciesToEnsure = {
|
|
20
20
|
"@lastbrain/app": "workspace:*",
|
|
21
21
|
"@lastbrain/core": "workspace:*",
|
|
22
|
-
"@lastbrain/ui": "workspace:*"
|
|
22
|
+
"@lastbrain/ui": "workspace:*",
|
|
23
23
|
};
|
|
24
24
|
const gitignoreTemplate = path.join(projectRoot, "packages/app/src/templates/gitignore/.gitignore");
|
|
25
25
|
const consumerGitignore = path.join(projectRoot, "apps/web/.gitignore");
|
|
@@ -30,7 +30,9 @@ function ensureDirectory(dir) {
|
|
|
30
30
|
fs.mkdirSync(dir, { recursive: true });
|
|
31
31
|
}
|
|
32
32
|
function normalizeContent(data) {
|
|
33
|
-
const trimmed = data.startsWith(GENERATED_HEADER)
|
|
33
|
+
const trimmed = data.startsWith(GENERATED_HEADER)
|
|
34
|
+
? data.slice(GENERATED_HEADER.length)
|
|
35
|
+
: data;
|
|
34
36
|
const sanitized = trimmed.trimStart();
|
|
35
37
|
return `${GENERATED_HEADER}\n${sanitized}`;
|
|
36
38
|
}
|
|
@@ -86,7 +88,7 @@ function syncAppShell() {
|
|
|
86
88
|
function cleanupStaleGroupFiles() {
|
|
87
89
|
const staleFiles = [
|
|
88
90
|
path.join(destAppShell, "(auth)", "page.tsx"),
|
|
89
|
-
path.join(destAppShell, "(admin)", "page.tsx")
|
|
91
|
+
path.join(destAppShell, "(admin)", "page.tsx"),
|
|
90
92
|
];
|
|
91
93
|
staleFiles.forEach((file) => {
|
|
92
94
|
if (fs.existsSync(file)) {
|
|
@@ -95,7 +97,7 @@ function cleanupStaleGroupFiles() {
|
|
|
95
97
|
});
|
|
96
98
|
const staleDirs = [
|
|
97
99
|
path.join(destAppShell, "(auth)", "dashboard"),
|
|
98
|
-
path.join(destAppShell, "(admin)", "dashboard")
|
|
100
|
+
path.join(destAppShell, "(admin)", "dashboard"),
|
|
99
101
|
];
|
|
100
102
|
staleDirs.forEach((dir) => {
|
|
101
103
|
if (fs.existsSync(dir)) {
|
|
@@ -112,20 +114,27 @@ function syncPackageJson() {
|
|
|
112
114
|
name: "web",
|
|
113
115
|
private: true,
|
|
114
116
|
version: "0.1.0",
|
|
115
|
-
type: "module"
|
|
117
|
+
type: "module",
|
|
116
118
|
};
|
|
117
|
-
const pkg = fs.existsSync(webPackage)
|
|
119
|
+
const pkg = fs.existsSync(webPackage)
|
|
120
|
+
? JSON.parse(fs.readFileSync(webPackage, "utf-8"))
|
|
121
|
+
: defaultPkg;
|
|
118
122
|
pkg.scripts = mergeScripts(pkg.scripts ?? {}, scriptsToEnsure);
|
|
119
123
|
pkg.dependencies = { ...(pkg.dependencies ?? {}), ...dependenciesToEnsure };
|
|
120
124
|
fs.writeFileSync(webPackage, JSON.stringify(pkg, null, 2) + "\n");
|
|
121
|
-
return {
|
|
125
|
+
return {
|
|
126
|
+
scripts: Object.keys(scriptsToEnsure),
|
|
127
|
+
dependencies: Object.keys(dependenciesToEnsure),
|
|
128
|
+
};
|
|
122
129
|
}
|
|
123
130
|
function syncEnvExample() {
|
|
124
131
|
if (!fs.existsSync(envTemplate)) {
|
|
125
132
|
return null;
|
|
126
133
|
}
|
|
127
134
|
const shouldOverwrite = !fs.existsSync(consumerEnvExample) ||
|
|
128
|
-
fs
|
|
135
|
+
fs
|
|
136
|
+
.readFileSync(consumerEnvExample, "utf-8")
|
|
137
|
+
.includes("GENERATED BY LASTBRAIN");
|
|
129
138
|
if (!shouldOverwrite) {
|
|
130
139
|
return null;
|
|
131
140
|
}
|
|
@@ -147,7 +156,9 @@ function syncGitignore() {
|
|
|
147
156
|
return null;
|
|
148
157
|
}
|
|
149
158
|
const shouldOverwrite = !fs.existsSync(consumerGitignore) ||
|
|
150
|
-
fs
|
|
159
|
+
fs
|
|
160
|
+
.readFileSync(consumerGitignore, "utf-8")
|
|
161
|
+
.includes("GENERATED BY LASTBRAIN");
|
|
151
162
|
if (!shouldOverwrite) {
|
|
152
163
|
return null;
|
|
153
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-app.d.ts","sourceRoot":"","sources":["../../src/scripts/init-app.ts"],"names":[],"mappings":"AAWA,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"init-app.d.ts","sourceRoot":"","sources":["../../src/scripts/init-app.ts"],"names":[],"mappings":"AAWA,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,iBAgMpD"}
|