@lastbrain/app 0.1.23 → 0.1.25

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.
Files changed (51) hide show
  1. package/dist/__tests__/module-registry.test.d.ts +2 -0
  2. package/dist/__tests__/module-registry.test.d.ts.map +1 -0
  3. package/dist/__tests__/module-registry.test.js +64 -0
  4. package/dist/app-shell/(admin)/layout.d.ts +3 -2
  5. package/dist/app-shell/(admin)/layout.d.ts.map +1 -1
  6. package/dist/app-shell/(admin)/layout.js +1 -1
  7. package/dist/app-shell/(auth)/layout.d.ts +3 -2
  8. package/dist/app-shell/(auth)/layout.d.ts.map +1 -1
  9. package/dist/app-shell/(auth)/layout.js +1 -1
  10. package/dist/cli.js +50 -0
  11. package/dist/layouts/AdminLayout.d.ts +3 -2
  12. package/dist/layouts/AdminLayout.d.ts.map +1 -1
  13. package/dist/layouts/AppProviders.d.ts +3 -2
  14. package/dist/layouts/AppProviders.d.ts.map +1 -1
  15. package/dist/layouts/AuthLayout.d.ts +3 -2
  16. package/dist/layouts/AuthLayout.d.ts.map +1 -1
  17. package/dist/layouts/PublicLayout.d.ts +3 -2
  18. package/dist/layouts/PublicLayout.d.ts.map +1 -1
  19. package/dist/layouts/RootLayout.d.ts +3 -2
  20. package/dist/layouts/RootLayout.d.ts.map +1 -1
  21. package/dist/scripts/db-init.js +1 -1
  22. package/dist/scripts/db-migrations-sync.js +5 -5
  23. package/dist/scripts/init-app.d.ts.map +1 -1
  24. package/dist/scripts/init-app.js +355 -23
  25. package/dist/scripts/module-add.d.ts.map +1 -1
  26. package/dist/scripts/module-add.js +1 -1
  27. package/dist/scripts/script-runner.d.ts +5 -0
  28. package/dist/scripts/script-runner.d.ts.map +1 -0
  29. package/dist/scripts/script-runner.js +25 -0
  30. package/dist/styles.css +1 -1
  31. package/dist/templates/DefaultDoc.d.ts.map +1 -1
  32. package/dist/templates/DefaultDoc.js +16 -1
  33. package/dist/templates/DocPage.d.ts.map +1 -1
  34. package/dist/templates/DocPage.js +23 -17
  35. package/package.json +19 -20
  36. package/src/__tests__/module-registry.test.ts +74 -0
  37. package/src/app-shell/(admin)/layout.tsx +5 -3
  38. package/src/app-shell/(auth)/layout.tsx +5 -3
  39. package/src/cli.ts +50 -0
  40. package/src/layouts/AdminLayout.tsx +1 -3
  41. package/src/layouts/AppProviders.tsx +2 -4
  42. package/src/layouts/AuthLayout.tsx +1 -3
  43. package/src/layouts/PublicLayout.tsx +1 -3
  44. package/src/layouts/RootLayout.tsx +1 -2
  45. package/src/scripts/db-init.ts +2 -2
  46. package/src/scripts/db-migrations-sync.ts +1 -1
  47. package/src/scripts/init-app.ts +366 -23
  48. package/src/scripts/module-add.ts +1 -3
  49. package/src/scripts/script-runner.ts +28 -0
  50. package/src/templates/DefaultDoc.tsx +127 -0
  51. package/src/templates/DocPage.tsx +83 -49
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=module-registry.test.d.ts.map
@@ -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
- import type { PropsWithChildren } from "react";
2
- export default function AdminShellLayout({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
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,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAQ3E"}
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
- import type { PropsWithChildren } from "react";
2
- export default function AuthLayout({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
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,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAQrE"}
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
  }
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();
@@ -1,3 +1,4 @@
1
- import type { PropsWithChildren } from "react";
2
- export declare function AdminLayout({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
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,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAE9D"}
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"}
@@ -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 }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
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":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAelD,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,iBAAiB,CAAC,EAAE,CAAC,2CA0B/D"}
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
- import type { PropsWithChildren } from "react";
2
- export declare function AuthLayout({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
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,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAE7D"}
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"}
@@ -1,3 +1,4 @@
1
- import type { PropsWithChildren } from "react";
2
- export declare function PublicLayout({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
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,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAE/D"}
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
- import type { PropsWithChildren } from "react";
2
- export declare function RootLayout({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
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":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/C,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAmB7D"}
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"}
@@ -229,7 +229,7 @@ async function main() {
229
229
  try {
230
230
  runSupabase("start");
231
231
  }
232
- catch (error) {
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 CopyStrategy;
11
- (function (CopyStrategy) {
12
- CopyStrategy[CopyStrategy["overwrite"] = 0] = "overwrite";
13
- CopyStrategy[CopyStrategy["skip"] = 1] = "skip";
14
- })(CopyStrategy || (CopyStrategy = {}));
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
  }
@@ -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,iBAqJpD"}
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,iBAwJpD"}