@lastbrain/app 0.1.44 → 0.1.46
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/scripts/init-app.d.ts +1 -0
- package/dist/scripts/init-app.d.ts.map +1 -1
- package/dist/scripts/init-app.js +61 -15
- package/dist/scripts/module-build.js +3 -1
- package/dist/scripts/module-create.d.ts.map +1 -1
- package/dist/templates/DefaultDoc.d.ts.map +1 -1
- package/dist/templates/DefaultDoc.js +1 -1
- package/package.json +1 -1
- package/src/auth/useAuthSession.ts +1 -1
- package/src/cli.ts +1 -1
- package/src/hooks/useNotifications.ts +7 -7
- package/src/layouts/AdminLayoutWithSidebar.tsx +3 -3
- package/src/layouts/AppProviders.tsx +1 -1
- package/src/layouts/AuthLayoutWithSidebar.tsx +3 -3
- package/src/layouts/PublicLayoutWithSidebar.tsx +3 -3
- package/src/scripts/db-init.ts +7 -7
- package/src/scripts/db-migrations-sync.ts +2 -2
- package/src/scripts/dev-sync.ts +8 -8
- package/src/scripts/init-app.ts +137 -71
- package/src/scripts/module-add.ts +26 -26
- package/src/scripts/module-build.ts +31 -31
- package/src/scripts/module-create.ts +52 -54
- package/src/scripts/module-delete.ts +13 -13
- package/src/scripts/module-list.ts +5 -5
- package/src/scripts/module-remove.ts +36 -36
- package/src/scripts/readme-build.ts +2 -2
- package/src/templates/DefaultDoc.tsx +28 -0
|
@@ -34,7 +34,7 @@ function toModuleDefinition(meta: ModuleMetadata): ModuleDefinition {
|
|
|
34
34
|
async function removeGeneratedFiles(
|
|
35
35
|
moduleName: string,
|
|
36
36
|
modulePackage: string,
|
|
37
|
-
targetDir: string
|
|
37
|
+
targetDir: string
|
|
38
38
|
) {
|
|
39
39
|
console.log(chalk.yellow("\n🗑️ Suppression des pages générées..."));
|
|
40
40
|
|
|
@@ -64,7 +64,7 @@ async function removeGeneratedFiles(
|
|
|
64
64
|
) {
|
|
65
65
|
await fs.remove(fullPath);
|
|
66
66
|
console.log(
|
|
67
|
-
chalk.gray(` ✓ Supprimé ${path.relative(targetDir, fullPath)}`)
|
|
67
|
+
chalk.gray(` ✓ Supprimé ${path.relative(targetDir, fullPath)}`)
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
// Supprimer le dossier parent si vide
|
|
@@ -97,7 +97,7 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
97
97
|
const moduleMeta = AVAILABLE_MODULES.find((m) => m.name === moduleName);
|
|
98
98
|
if (!moduleMeta) {
|
|
99
99
|
console.error(
|
|
100
|
-
chalk.red(`❌ Module "${moduleName}" non trouvé. Modules disponibles:`)
|
|
100
|
+
chalk.red(`❌ Module "${moduleName}" non trouvé. Modules disponibles:`)
|
|
101
101
|
);
|
|
102
102
|
AVAILABLE_MODULES.forEach((m) => {
|
|
103
103
|
console.log(chalk.gray(` - ${m.emoji} ${m.name}: ${m.description}`));
|
|
@@ -130,14 +130,14 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
130
130
|
|
|
131
131
|
if (!isInstalledInPackage && !isInstalledInConfig) {
|
|
132
132
|
console.log(
|
|
133
|
-
chalk.yellow(`⚠️ Module ${module.package} n'est pas installé`)
|
|
133
|
+
chalk.yellow(`⚠️ Module ${module.package} n'est pas installé`)
|
|
134
134
|
);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// 2. Retirer la dépendance du package.json
|
|
139
139
|
console.log(
|
|
140
|
-
chalk.yellow(`📦 Suppression de ${module.package} des dépendances...`)
|
|
140
|
+
chalk.yellow(`📦 Suppression de ${module.package} des dépendances...`)
|
|
141
141
|
);
|
|
142
142
|
if (pkg.dependencies?.[module.package]) {
|
|
143
143
|
delete pkg.dependencies[module.package];
|
|
@@ -151,7 +151,7 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
151
151
|
if (fs.existsSync(modulesConfigPath)) {
|
|
152
152
|
const modulesConfig = await fs.readJson(modulesConfigPath);
|
|
153
153
|
modulesConfig.modules = modulesConfig.modules.filter(
|
|
154
|
-
(m: string) => m !== module.package
|
|
154
|
+
(m: string) => m !== module.package
|
|
155
155
|
);
|
|
156
156
|
await fs.writeJson(modulesConfigPath, modulesConfig, { spaces: 2 });
|
|
157
157
|
}
|
|
@@ -169,14 +169,14 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
169
169
|
const modulesConfigPath = path.join(
|
|
170
170
|
targetDir,
|
|
171
171
|
".lastbrain",
|
|
172
|
-
"modules.json"
|
|
172
|
+
"modules.json"
|
|
173
173
|
);
|
|
174
174
|
let migrationFiles: string[] = [];
|
|
175
175
|
|
|
176
176
|
if (fs.existsSync(modulesConfigPath)) {
|
|
177
177
|
const modulesConfig = await fs.readJson(modulesConfigPath);
|
|
178
178
|
const moduleEntry = modulesConfig.modules.find(
|
|
179
|
-
(m: any) => (typeof m === "string" ? m : m.package) === module.package
|
|
179
|
+
(m: any) => (typeof m === "string" ? m : m.package) === module.package
|
|
180
180
|
);
|
|
181
181
|
|
|
182
182
|
if (
|
|
@@ -187,8 +187,8 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
187
187
|
migrationFiles = moduleEntry.migrations;
|
|
188
188
|
console.log(
|
|
189
189
|
chalk.gray(
|
|
190
|
-
`DEBUG: Migrations from config: ${migrationFiles.join(", ")}
|
|
191
|
-
)
|
|
190
|
+
`DEBUG: Migrations from config: ${migrationFiles.join(", ")}`
|
|
191
|
+
)
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -198,12 +198,12 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
198
198
|
const modulePackagePath = path.join(
|
|
199
199
|
targetDir,
|
|
200
200
|
"node_modules",
|
|
201
|
-
...module.package.split("/")
|
|
201
|
+
...module.package.split("/")
|
|
202
202
|
);
|
|
203
203
|
|
|
204
204
|
const moduleMigrationsDir = path.join(
|
|
205
205
|
modulePackagePath,
|
|
206
|
-
module.migrationsPath || "supabase/migrations"
|
|
206
|
+
module.migrationsPath || "supabase/migrations"
|
|
207
207
|
);
|
|
208
208
|
|
|
209
209
|
if (fs.existsSync(moduleMigrationsDir)) {
|
|
@@ -212,12 +212,12 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
212
212
|
.filter((f) => f.endsWith(".sql"));
|
|
213
213
|
console.log(
|
|
214
214
|
chalk.gray(
|
|
215
|
-
`DEBUG: Found ${migrationFiles.length} migration files from node_modules: ${migrationFiles.join(", ")}
|
|
216
|
-
)
|
|
215
|
+
`DEBUG: Found ${migrationFiles.length} migration files from node_modules: ${migrationFiles.join(", ")}`
|
|
216
|
+
)
|
|
217
217
|
);
|
|
218
218
|
} else {
|
|
219
219
|
console.log(
|
|
220
|
-
chalk.gray(`DEBUG: No migrations found in config or node_modules`)
|
|
220
|
+
chalk.gray(`DEBUG: No migrations found in config or node_modules`)
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -226,12 +226,12 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
226
226
|
const modulePackagePath = path.join(
|
|
227
227
|
targetDir,
|
|
228
228
|
"node_modules",
|
|
229
|
-
...module.package.split("/")
|
|
229
|
+
...module.package.split("/")
|
|
230
230
|
);
|
|
231
231
|
|
|
232
232
|
const moduleMigrationsDownDir = path.join(
|
|
233
233
|
modulePackagePath,
|
|
234
|
-
module.migrationsDownPath || "supabase/migrations-down"
|
|
234
|
+
module.migrationsDownPath || "supabase/migrations-down"
|
|
235
235
|
);
|
|
236
236
|
|
|
237
237
|
let hasDownMigrations = false;
|
|
@@ -294,7 +294,7 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
294
294
|
{
|
|
295
295
|
cwd: targetDir,
|
|
296
296
|
stdio: "inherit",
|
|
297
|
-
}
|
|
297
|
+
}
|
|
298
298
|
);
|
|
299
299
|
|
|
300
300
|
// Supprimer l'entrée de supabase_migrations.schema_migrations
|
|
@@ -305,18 +305,18 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
305
305
|
{
|
|
306
306
|
cwd: targetDir,
|
|
307
307
|
encoding: "utf-8",
|
|
308
|
-
}
|
|
308
|
+
}
|
|
309
309
|
);
|
|
310
310
|
console.log(
|
|
311
311
|
chalk.gray(
|
|
312
|
-
` ✓ Supprimé ${migrationVersion} de schema_migrations (${result.trim()})
|
|
313
|
-
)
|
|
312
|
+
` ✓ Supprimé ${migrationVersion} de schema_migrations (${result.trim()})`
|
|
313
|
+
)
|
|
314
314
|
);
|
|
315
315
|
} catch (error: any) {
|
|
316
316
|
console.error(
|
|
317
317
|
chalk.red(
|
|
318
|
-
` ❌ Erreur lors de la suppression de ${migrationVersion}: ${error.message}
|
|
319
|
-
)
|
|
318
|
+
` ❌ Erreur lors de la suppression de ${migrationVersion}: ${error.message}`
|
|
319
|
+
)
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
322
|
|
|
@@ -330,7 +330,7 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
330
330
|
|
|
331
331
|
// D'abord supprimer les fichiers de migration du projet
|
|
332
332
|
console.log(
|
|
333
|
-
chalk.yellow("\n📋 Suppression des fichiers de migration...")
|
|
333
|
+
chalk.yellow("\n📋 Suppression des fichiers de migration...")
|
|
334
334
|
);
|
|
335
335
|
for (const file of migrationFiles) {
|
|
336
336
|
const filePath = path.join(projectMigrationsDir, file);
|
|
@@ -349,15 +349,15 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
349
349
|
} else {
|
|
350
350
|
console.log(
|
|
351
351
|
chalk.gray(
|
|
352
|
-
"\n⚠️ Données conservées en base. Nettoyez manuellement si nécessaire.\n"
|
|
353
|
-
)
|
|
352
|
+
"\n⚠️ Données conservées en base. Nettoyez manuellement si nécessaire.\n"
|
|
353
|
+
)
|
|
354
354
|
);
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
// Supprimer les fichiers de migration du projet (si pas déjà fait)
|
|
358
358
|
if (migrationAction !== "reset") {
|
|
359
359
|
console.log(
|
|
360
|
-
chalk.yellow("\n📋 Suppression des fichiers de migration...")
|
|
360
|
+
chalk.yellow("\n📋 Suppression des fichiers de migration...")
|
|
361
361
|
);
|
|
362
362
|
for (const file of migrationFiles) {
|
|
363
363
|
const filePath = path.join(projectMigrationsDir, file);
|
|
@@ -386,12 +386,12 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
386
386
|
{
|
|
387
387
|
cwd: targetDir,
|
|
388
388
|
encoding: "utf-8",
|
|
389
|
-
}
|
|
389
|
+
}
|
|
390
390
|
);
|
|
391
391
|
console.log(
|
|
392
392
|
chalk.gray(
|
|
393
|
-
` ✓ Supprimé ${migrationFiles.length} entrées de schema_migrations
|
|
394
|
-
)
|
|
393
|
+
` ✓ Supprimé ${migrationFiles.length} entrées de schema_migrations`
|
|
394
|
+
)
|
|
395
395
|
);
|
|
396
396
|
console.log(chalk.gray(` ${result.trim()}`));
|
|
397
397
|
} catch (error: any) {
|
|
@@ -406,10 +406,10 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
406
406
|
if (fs.existsSync(modulesJsonPath)) {
|
|
407
407
|
try {
|
|
408
408
|
const modulesConfig = JSON.parse(
|
|
409
|
-
fs.readFileSync(modulesJsonPath, "utf-8")
|
|
409
|
+
fs.readFileSync(modulesJsonPath, "utf-8")
|
|
410
410
|
);
|
|
411
411
|
const moduleEntry = modulesConfig.modules.find(
|
|
412
|
-
(m: any) => m.package === module.package
|
|
412
|
+
(m: any) => m.package === module.package
|
|
413
413
|
);
|
|
414
414
|
if (moduleEntry) {
|
|
415
415
|
moduleEntry.active = false;
|
|
@@ -417,11 +417,11 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
417
417
|
}
|
|
418
418
|
fs.writeFileSync(modulesJsonPath, JSON.stringify(modulesConfig, null, 2));
|
|
419
419
|
console.log(
|
|
420
|
-
chalk.gray("\n✓ Module marqué comme inactif dans modules.json")
|
|
420
|
+
chalk.gray("\n✓ Module marqué comme inactif dans modules.json")
|
|
421
421
|
);
|
|
422
422
|
} catch {
|
|
423
423
|
console.error(
|
|
424
|
-
chalk.red("❌ Erreur lors de la mise à jour de modules.json")
|
|
424
|
+
chalk.red("❌ Erreur lors de la mise à jour de modules.json")
|
|
425
425
|
);
|
|
426
426
|
}
|
|
427
427
|
}
|
|
@@ -440,7 +440,7 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
console.log(
|
|
443
|
-
chalk.green(`\n✅ Module ${module.displayName} supprimé avec succès!\n`)
|
|
443
|
+
chalk.green(`\n✅ Module ${module.displayName} supprimé avec succès!\n`)
|
|
444
444
|
);
|
|
445
445
|
|
|
446
446
|
// 7. Rebuilder les modules pour mettre à jour les fichiers générés
|
|
@@ -453,6 +453,6 @@ export async function removeModule(moduleName: string, targetDir: string) {
|
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
console.log(
|
|
456
|
-
chalk.gray("Le serveur de développement redémarrera automatiquement.\n")
|
|
456
|
+
chalk.gray("Le serveur de développement redémarrera automatiquement.\n")
|
|
457
457
|
);
|
|
458
458
|
}
|
|
@@ -16,13 +16,13 @@ function resolveModuleReadme(moduleName: string) {
|
|
|
16
16
|
projectRoot,
|
|
17
17
|
"packages",
|
|
18
18
|
moduleName.replace("@lastbrain/", ""),
|
|
19
|
-
"README.md"
|
|
19
|
+
"README.md"
|
|
20
20
|
),
|
|
21
21
|
path.join(
|
|
22
22
|
projectRoot,
|
|
23
23
|
"node_modules",
|
|
24
24
|
...moduleName.split("/"),
|
|
25
|
-
"README.md"
|
|
25
|
+
"README.md"
|
|
26
26
|
),
|
|
27
27
|
];
|
|
28
28
|
|
|
@@ -1562,6 +1562,34 @@ export function DocUsageCustom() {
|
|
|
1562
1562
|
</a>
|
|
1563
1563
|
</CardBody>
|
|
1564
1564
|
</Card>
|
|
1565
|
+
<Card className="hover:shadow-lg transition-shadow border-l-4 border-l-blue-500">
|
|
1566
|
+
<CardBody className="space-y-3">
|
|
1567
|
+
<div className="flex items-start justify-between">
|
|
1568
|
+
<h3 className="text-lg font-semibold">Project Board</h3>
|
|
1569
|
+
<span className="text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded">
|
|
1570
|
+
FREE
|
|
1571
|
+
</span>
|
|
1572
|
+
</div>
|
|
1573
|
+
<p className="text-sm text-slate-600 dark:text-slate-400">
|
|
1574
|
+
Module LastBrain
|
|
1575
|
+
</p>
|
|
1576
|
+
<p className="text-xs text-slate-500 dark:text-slate-500">
|
|
1577
|
+
<strong>Pages:</strong> 2 auth
|
|
1578
|
+
</p>
|
|
1579
|
+
|
|
1580
|
+
<Snippet symbol="💻" hideSymbol className="text-sm">
|
|
1581
|
+
{`pnpm lastbrain add-module project-board`}
|
|
1582
|
+
</Snippet>
|
|
1583
|
+
<a
|
|
1584
|
+
href="https://github.com/Lastbrain-labs/lb-starter/tree/main/packages/module-project-board"
|
|
1585
|
+
className="text-sm text-blue-600 dark:text-blue-400 hover:underline inline-flex items-center gap-1"
|
|
1586
|
+
target="_blank"
|
|
1587
|
+
rel="noopener noreferrer"
|
|
1588
|
+
>
|
|
1589
|
+
📖 Documentation →
|
|
1590
|
+
</a>
|
|
1591
|
+
</CardBody>
|
|
1592
|
+
</Card>
|
|
1565
1593
|
<Card className="hover:shadow-lg transition-shadow border-l-4 border-l-purple-500">
|
|
1566
1594
|
<CardBody className="space-y-3">
|
|
1567
1595
|
<div className="flex items-start justify-between">
|