@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
|
@@ -83,14 +83,14 @@ function getLastBrainPackageVersions(rootDir: string): {
|
|
|
83
83
|
const corePackageJson = JSON.parse(
|
|
84
84
|
fs.readFileSync(
|
|
85
85
|
path.join(rootDir, "packages", "core", "package.json"),
|
|
86
|
-
"utf-8"
|
|
87
|
-
)
|
|
86
|
+
"utf-8"
|
|
87
|
+
)
|
|
88
88
|
);
|
|
89
89
|
const uiPackageJson = JSON.parse(
|
|
90
90
|
fs.readFileSync(
|
|
91
91
|
path.join(rootDir, "packages", "ui", "package.json"),
|
|
92
|
-
"utf-8"
|
|
93
|
-
)
|
|
92
|
+
"utf-8"
|
|
93
|
+
)
|
|
94
94
|
);
|
|
95
95
|
|
|
96
96
|
return {
|
|
@@ -100,8 +100,8 @@ function getLastBrainPackageVersions(rootDir: string): {
|
|
|
100
100
|
} catch {
|
|
101
101
|
console.warn(
|
|
102
102
|
chalk.yellow(
|
|
103
|
-
"⚠️ Impossible de lire les versions des packages, utilisation des versions par défaut"
|
|
104
|
-
)
|
|
103
|
+
"⚠️ Impossible de lire les versions des packages, utilisation des versions par défaut"
|
|
104
|
+
)
|
|
105
105
|
);
|
|
106
106
|
return {
|
|
107
107
|
core: "^0.1.0",
|
|
@@ -116,7 +116,7 @@ function getLastBrainPackageVersions(rootDir: string): {
|
|
|
116
116
|
function generatePackageJson(
|
|
117
117
|
moduleName: string,
|
|
118
118
|
slug: string,
|
|
119
|
-
rootDir: string
|
|
119
|
+
rootDir: string
|
|
120
120
|
): string {
|
|
121
121
|
const versions = getLastBrainPackageVersions(rootDir);
|
|
122
122
|
const moduleNameOnly = slug.replace("module-", "");
|
|
@@ -165,7 +165,7 @@ function generatePackageJson(
|
|
|
165
165
|
sideEffects: false,
|
|
166
166
|
},
|
|
167
167
|
null,
|
|
168
|
-
2
|
|
168
|
+
2
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -184,7 +184,7 @@ function generateTsConfig(): string {
|
|
|
184
184
|
include: ["src"],
|
|
185
185
|
},
|
|
186
186
|
null,
|
|
187
|
-
2
|
|
187
|
+
2
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -210,7 +210,7 @@ function generateBuildConfig(config: ModuleConfig): string {
|
|
|
210
210
|
function buildMenuPath(
|
|
211
211
|
section: string,
|
|
212
212
|
pagePath: string,
|
|
213
|
-
pageName: string
|
|
213
|
+
pageName: string
|
|
214
214
|
): string {
|
|
215
215
|
const cleanedPagePath = pagePath.replace(/^\/+/g, "");
|
|
216
216
|
switch (section) {
|
|
@@ -336,7 +336,7 @@ ${menuSections
|
|
|
336
336
|
.map(
|
|
337
337
|
({ section, items }) => ` ${section}: [
|
|
338
338
|
${items.join(",\n")}
|
|
339
|
-
]
|
|
339
|
+
]`
|
|
340
340
|
)
|
|
341
341
|
.join(",\n")}
|
|
342
342
|
}`
|
|
@@ -405,7 +405,7 @@ function generateServerTs(tables: TableConfig[]): string {
|
|
|
405
405
|
for (const table of tables) {
|
|
406
406
|
for (const section of table.sections) {
|
|
407
407
|
exports.push(
|
|
408
|
-
`export { GET, POST, PUT, DELETE } from "./api/${section}/${table.name}.js"
|
|
408
|
+
`export { GET, POST, PUT, DELETE } from "./api/${section}/${table.name}.js";`
|
|
409
409
|
);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
@@ -1030,7 +1030,7 @@ ${pagesSection}${apisSection}${tablesSection}${installSection}${usageSection}${d
|
|
|
1030
1030
|
*/
|
|
1031
1031
|
async function generateModuleReadme(
|
|
1032
1032
|
config: ModuleConfig & { description?: string },
|
|
1033
|
-
moduleDir: string
|
|
1033
|
+
moduleDir: string
|
|
1034
1034
|
) {
|
|
1035
1035
|
const moduleNameClean = config.slug.replace("module-", "");
|
|
1036
1036
|
|
|
@@ -1199,12 +1199,12 @@ async function updateModuleRegistry(config: ModuleConfig, rootDir: string) {
|
|
|
1199
1199
|
"core",
|
|
1200
1200
|
"src",
|
|
1201
1201
|
"config",
|
|
1202
|
-
"modules.ts"
|
|
1202
|
+
"modules.ts"
|
|
1203
1203
|
);
|
|
1204
1204
|
|
|
1205
1205
|
if (!fs.existsSync(moduleRegistryPath)) {
|
|
1206
1206
|
console.log(
|
|
1207
|
-
chalk.yellow(" ⚠️ Fichier de registre non trouvé, création...")
|
|
1207
|
+
chalk.yellow(" ⚠️ Fichier de registre non trouvé, création...")
|
|
1208
1208
|
);
|
|
1209
1209
|
// Si le fichier n'existe pas, on le crée avec le module actuel
|
|
1210
1210
|
const content = `/**
|
|
@@ -1269,16 +1269,14 @@ export function getAvailableModuleNames(): string[] {
|
|
|
1269
1269
|
// Vérifier si le module existe déjà
|
|
1270
1270
|
if (content.includes(`name: "${moduleName}"`)) {
|
|
1271
1271
|
console.log(
|
|
1272
|
-
chalk.yellow(
|
|
1273
|
-
` ⚠️ Module ${moduleName} déjà présent dans le registre`,
|
|
1274
|
-
),
|
|
1272
|
+
chalk.yellow(` ⚠️ Module ${moduleName} déjà présent dans le registre`)
|
|
1275
1273
|
);
|
|
1276
1274
|
return;
|
|
1277
1275
|
}
|
|
1278
1276
|
|
|
1279
1277
|
// Trouver le tableau AVAILABLE_MODULES et ajouter le module
|
|
1280
1278
|
const arrayMatch = content.match(
|
|
1281
|
-
/export const AVAILABLE_MODULES: ModuleMetadata\[\] = \[([\s\S]*?)\]
|
|
1279
|
+
/export const AVAILABLE_MODULES: ModuleMetadata\[\] = \[([\s\S]*?)\];/
|
|
1282
1280
|
);
|
|
1283
1281
|
if (arrayMatch) {
|
|
1284
1282
|
const arrayContent = arrayMatch[1];
|
|
@@ -1289,7 +1287,7 @@ export function getAvailableModuleNames(): string[] {
|
|
|
1289
1287
|
arrayContent.trimEnd() + "\n" + moduleEntry + "\n";
|
|
1290
1288
|
content = content.replace(
|
|
1291
1289
|
/export const AVAILABLE_MODULES: ModuleMetadata\[\] = \[([\s\S]*?)\];/,
|
|
1292
|
-
`export const AVAILABLE_MODULES: ModuleMetadata[] = [${newArrayContent}]
|
|
1290
|
+
`export const AVAILABLE_MODULES: ModuleMetadata[] = [${newArrayContent}];`
|
|
1293
1291
|
);
|
|
1294
1292
|
|
|
1295
1293
|
await fs.writeFile(moduleRegistryPath, content, "utf-8");
|
|
@@ -1297,16 +1295,16 @@ export function getAvailableModuleNames(): string[] {
|
|
|
1297
1295
|
} else {
|
|
1298
1296
|
console.log(
|
|
1299
1297
|
chalk.yellow(
|
|
1300
|
-
" ⚠️ Format du registre non reconnu, ajout manuel requis"
|
|
1301
|
-
)
|
|
1298
|
+
" ⚠️ Format du registre non reconnu, ajout manuel requis"
|
|
1299
|
+
)
|
|
1302
1300
|
);
|
|
1303
1301
|
}
|
|
1304
1302
|
} catch (error) {
|
|
1305
1303
|
console.log(
|
|
1306
|
-
chalk.yellow(` ⚠️ Erreur lors de la mise à jour du registre: ${error}`)
|
|
1304
|
+
chalk.yellow(` ⚠️ Erreur lors de la mise à jour du registre: ${error}`)
|
|
1307
1305
|
);
|
|
1308
1306
|
console.log(
|
|
1309
|
-
chalk.gray(" Vous devrez ajouter manuellement le module au registre")
|
|
1307
|
+
chalk.gray(" Vous devrez ajouter manuellement le module au registre")
|
|
1310
1308
|
);
|
|
1311
1309
|
}
|
|
1312
1310
|
}
|
|
@@ -1329,7 +1327,7 @@ export function findWorkspaceRoot(): string {
|
|
|
1329
1327
|
}
|
|
1330
1328
|
|
|
1331
1329
|
throw new Error(
|
|
1332
|
-
"Impossible de trouver le répertoire racine du workspace (pnpm-workspace.yaml non trouvé)"
|
|
1330
|
+
"Impossible de trouver le répertoire racine du workspace (pnpm-workspace.yaml non trouvé)"
|
|
1333
1331
|
);
|
|
1334
1332
|
}
|
|
1335
1333
|
|
|
@@ -1338,7 +1336,7 @@ export function findWorkspaceRoot(): string {
|
|
|
1338
1336
|
*/
|
|
1339
1337
|
export async function createModuleStructure(
|
|
1340
1338
|
config: ModuleConfig,
|
|
1341
|
-
rootDir: string
|
|
1339
|
+
rootDir: string
|
|
1342
1340
|
) {
|
|
1343
1341
|
const moduleDir = path.join(rootDir, "packages", config.slug);
|
|
1344
1342
|
|
|
@@ -1357,7 +1355,7 @@ export async function createModuleStructure(
|
|
|
1357
1355
|
console.log(chalk.yellow(" 📄 package.json"));
|
|
1358
1356
|
await fs.writeFile(
|
|
1359
1357
|
path.join(moduleDir, "package.json"),
|
|
1360
|
-
generatePackageJson(config.moduleName, config.slug, rootDir)
|
|
1358
|
+
generatePackageJson(config.moduleName, config.slug, rootDir)
|
|
1361
1359
|
);
|
|
1362
1360
|
|
|
1363
1361
|
// Créer tsconfig.json
|
|
@@ -1370,14 +1368,14 @@ export async function createModuleStructure(
|
|
|
1370
1368
|
console.log(chalk.yellow(` 📄 src/${buildConfigFileName}`));
|
|
1371
1369
|
await fs.writeFile(
|
|
1372
1370
|
path.join(moduleDir, "src", buildConfigFileName),
|
|
1373
|
-
generateBuildConfig(config)
|
|
1371
|
+
generateBuildConfig(config)
|
|
1374
1372
|
);
|
|
1375
1373
|
|
|
1376
1374
|
// Créer index.ts
|
|
1377
1375
|
console.log(chalk.yellow(" 📄 src/index.ts"));
|
|
1378
1376
|
await fs.writeFile(
|
|
1379
1377
|
path.join(moduleDir, "src", "index.ts"),
|
|
1380
|
-
generateIndexTs(config.pages, moduleNameOnly)
|
|
1378
|
+
generateIndexTs(config.pages, moduleNameOnly)
|
|
1381
1379
|
);
|
|
1382
1380
|
|
|
1383
1381
|
// Note: server.ts n'est plus généré pour éviter les conflits d'exports
|
|
@@ -1387,7 +1385,7 @@ export async function createModuleStructure(
|
|
|
1387
1385
|
console.log(chalk.yellow(" 📄 src/components/Doc.tsx"));
|
|
1388
1386
|
await fs.writeFile(
|
|
1389
1387
|
path.join(moduleDir, "src", "components", "Doc.tsx"),
|
|
1390
|
-
generateDocComponent(config)
|
|
1388
|
+
generateDocComponent(config)
|
|
1391
1389
|
);
|
|
1392
1390
|
|
|
1393
1391
|
// Créer les pages
|
|
@@ -1405,7 +1403,7 @@ export async function createModuleStructure(
|
|
|
1405
1403
|
console.log(chalk.yellow(` 📄 src/web/${page.section}/${fileName}`));
|
|
1406
1404
|
await fs.writeFile(
|
|
1407
1405
|
path.join(pagePath, fileName),
|
|
1408
|
-
generatePageComponent(page.name, page.section)
|
|
1406
|
+
generatePageComponent(page.name, page.section)
|
|
1409
1407
|
);
|
|
1410
1408
|
}
|
|
1411
1409
|
|
|
@@ -1421,7 +1419,7 @@ export async function createModuleStructure(
|
|
|
1421
1419
|
console.log(chalk.yellow(` 📄 src/api/${section}/${fileName}`));
|
|
1422
1420
|
await fs.writeFile(
|
|
1423
1421
|
path.join(apiPath, fileName),
|
|
1424
|
-
generateApiRoute(table.name, section)
|
|
1422
|
+
generateApiRoute(table.name, section)
|
|
1425
1423
|
);
|
|
1426
1424
|
}
|
|
1427
1425
|
}
|
|
@@ -1440,7 +1438,7 @@ export async function createModuleStructure(
|
|
|
1440
1438
|
console.log(chalk.yellow(` 📄 supabase/migrations/${migrationFileName}`));
|
|
1441
1439
|
await fs.writeFile(
|
|
1442
1440
|
path.join(moduleDir, "supabase", "migrations", migrationFileName),
|
|
1443
|
-
generateMigration(config.tables, config.slug)
|
|
1441
|
+
generateMigration(config.tables, config.slug)
|
|
1444
1442
|
);
|
|
1445
1443
|
|
|
1446
1444
|
// Génération du fichier DOWN correspondant pour rollback
|
|
@@ -1448,13 +1446,13 @@ export async function createModuleStructure(
|
|
|
1448
1446
|
const downContent = config.tables
|
|
1449
1447
|
.map(
|
|
1450
1448
|
(t) =>
|
|
1451
|
-
`-- Rollback for table ${t.name}\nDROP POLICY IF EXISTS ${t.name}_owner_delete ON public.${t.name};\nDROP POLICY IF EXISTS ${t.name}_owner_update ON public.${t.name};\nDROP POLICY IF EXISTS ${t.name}_owner_insert ON public.${t.name};\nDROP POLICY IF EXISTS ${t.name}_owner_select ON public.${t.name};\nDROP TRIGGER IF EXISTS set_${t.name}_updated_at ON public.${t.name};\nDROP INDEX IF EXISTS idx_${t.name}_owner_id;\nDROP TABLE IF EXISTS public.${t.name};\n
|
|
1449
|
+
`-- Rollback for table ${t.name}\nDROP POLICY IF EXISTS ${t.name}_owner_delete ON public.${t.name};\nDROP POLICY IF EXISTS ${t.name}_owner_update ON public.${t.name};\nDROP POLICY IF EXISTS ${t.name}_owner_insert ON public.${t.name};\nDROP POLICY IF EXISTS ${t.name}_owner_select ON public.${t.name};\nDROP TRIGGER IF EXISTS set_${t.name}_updated_at ON public.${t.name};\nDROP INDEX IF EXISTS idx_${t.name}_owner_id;\nDROP TABLE IF EXISTS public.${t.name};\n`
|
|
1452
1450
|
)
|
|
1453
1451
|
.join("\n");
|
|
1454
1452
|
console.log(chalk.yellow(` 📄 supabase/migrations-down/${downFileName}`));
|
|
1455
1453
|
await fs.writeFile(
|
|
1456
1454
|
path.join(moduleDir, "supabase", "migrations-down", downFileName),
|
|
1457
|
-
`-- DOWN migration for ${config.slug}\n${downContent}
|
|
1455
|
+
`-- DOWN migration for ${config.slug}\n${downContent}`
|
|
1458
1456
|
);
|
|
1459
1457
|
}
|
|
1460
1458
|
|
|
@@ -1477,8 +1475,8 @@ export async function createModuleStructure(
|
|
|
1477
1475
|
} catch (error) {
|
|
1478
1476
|
console.log(
|
|
1479
1477
|
chalk.yellow(
|
|
1480
|
-
"\n⚠️ Erreur lors de l'installation, veuillez exécuter manuellement:"
|
|
1481
|
-
)
|
|
1478
|
+
"\n⚠️ Erreur lors de l'installation, veuillez exécuter manuellement:"
|
|
1479
|
+
)
|
|
1482
1480
|
);
|
|
1483
1481
|
console.log(chalk.gray(` cd ${moduleDir} && pnpm install`));
|
|
1484
1482
|
}
|
|
@@ -1499,7 +1497,7 @@ export async function createModuleStructure(
|
|
|
1499
1497
|
console.log(
|
|
1500
1498
|
chalk.yellow("⚠️ Build automatique échoué, exécutez: cd"),
|
|
1501
1499
|
config.slug,
|
|
1502
|
-
"&& pnpm build"
|
|
1500
|
+
"&& pnpm build"
|
|
1503
1501
|
);
|
|
1504
1502
|
}
|
|
1505
1503
|
|
|
@@ -1508,13 +1506,13 @@ export async function createModuleStructure(
|
|
|
1508
1506
|
console.log(chalk.blue("Prochaines étapes:"));
|
|
1509
1507
|
console.log(
|
|
1510
1508
|
chalk.gray(
|
|
1511
|
-
` 1. Ajouter à une app: pnpm lastbrain add-module ${config.slug.replace("module-", "")}
|
|
1512
|
-
)
|
|
1509
|
+
` 1. Ajouter à une app: pnpm lastbrain add-module ${config.slug.replace("module-", "")}`
|
|
1510
|
+
)
|
|
1513
1511
|
);
|
|
1514
1512
|
console.log(
|
|
1515
1513
|
chalk.gray(
|
|
1516
|
-
" 2. (Optionnel) Modifier Doc.tsx pour documentation personnalisée"
|
|
1517
|
-
)
|
|
1514
|
+
" 2. (Optionnel) Modifier Doc.tsx pour documentation personnalisée"
|
|
1515
|
+
)
|
|
1518
1516
|
);
|
|
1519
1517
|
console.log(chalk.gray(" 3. Publier: pnpm publish:" + config.slug));
|
|
1520
1518
|
console.log(chalk.gray(" 4. Générer docs globales: pnpm generate:all\n"));
|
|
@@ -1596,13 +1594,13 @@ export async function createModule() {
|
|
|
1596
1594
|
if (invalidPublic.length) {
|
|
1597
1595
|
console.error(
|
|
1598
1596
|
chalk.red(
|
|
1599
|
-
`❌ Noms de pages publiques réservés détectés: ${invalidPublic.join(", ")}
|
|
1600
|
-
)
|
|
1597
|
+
`❌ Noms de pages publiques réservés détectés: ${invalidPublic.join(", ")}`
|
|
1598
|
+
)
|
|
1601
1599
|
);
|
|
1602
1600
|
console.error(
|
|
1603
1601
|
chalk.yellow(
|
|
1604
|
-
"Noms interdits: layout, page, api, admin, auth, public. Choisissez des noms métier distincts."
|
|
1605
|
-
)
|
|
1602
|
+
"Noms interdits: layout, page, api, admin, auth, public. Choisissez des noms métier distincts."
|
|
1603
|
+
)
|
|
1606
1604
|
);
|
|
1607
1605
|
process.exit(1);
|
|
1608
1606
|
}
|
|
@@ -1621,13 +1619,13 @@ export async function createModule() {
|
|
|
1621
1619
|
if (invalidAuth.length) {
|
|
1622
1620
|
console.error(
|
|
1623
1621
|
chalk.red(
|
|
1624
|
-
`❌ Noms de pages auth réservés détectés: ${invalidAuth.join(", ")}
|
|
1625
|
-
)
|
|
1622
|
+
`❌ Noms de pages auth réservés détectés: ${invalidAuth.join(", ")}`
|
|
1623
|
+
)
|
|
1626
1624
|
);
|
|
1627
1625
|
console.error(
|
|
1628
1626
|
chalk.yellow(
|
|
1629
|
-
"Noms interdits: layout, page, api, admin, auth, public. Utilisez des noms métier (ex: dashboard, profile)."
|
|
1630
|
-
)
|
|
1627
|
+
"Noms interdits: layout, page, api, admin, auth, public. Utilisez des noms métier (ex: dashboard, profile)."
|
|
1628
|
+
)
|
|
1631
1629
|
);
|
|
1632
1630
|
process.exit(1);
|
|
1633
1631
|
}
|
|
@@ -1646,13 +1644,13 @@ export async function createModule() {
|
|
|
1646
1644
|
if (invalidAdmin.length) {
|
|
1647
1645
|
console.error(
|
|
1648
1646
|
chalk.red(
|
|
1649
|
-
`❌ Noms de pages admin réservés détectés: ${invalidAdmin.join(", ")}
|
|
1650
|
-
)
|
|
1647
|
+
`❌ Noms de pages admin réservés détectés: ${invalidAdmin.join(", ")}`
|
|
1648
|
+
)
|
|
1651
1649
|
);
|
|
1652
1650
|
console.error(
|
|
1653
1651
|
chalk.yellow(
|
|
1654
|
-
"Noms interdits: layout, page, api, admin, auth, public. Utilisez des noms métier (ex: settings, users)."
|
|
1655
|
-
)
|
|
1652
|
+
"Noms interdits: layout, page, api, admin, auth, public. Utilisez des noms métier (ex: settings, users)."
|
|
1653
|
+
)
|
|
1656
1654
|
);
|
|
1657
1655
|
process.exit(1);
|
|
1658
1656
|
}
|
|
@@ -19,15 +19,15 @@ export async function deleteModule() {
|
|
|
19
19
|
const rootDir = path.resolve(__dirname, "../../../..");
|
|
20
20
|
|
|
21
21
|
console.log(
|
|
22
|
-
chalk.blue("\n🗑️ Suppression d'un module du monorepo LastBrain\n")
|
|
22
|
+
chalk.blue("\n🗑️ Suppression d'un module du monorepo LastBrain\n")
|
|
23
23
|
);
|
|
24
24
|
console.log(
|
|
25
25
|
chalk.yellow(
|
|
26
|
-
"⚠️ ATTENTION: Cette opération supprime physiquement le module du monorepo!"
|
|
27
|
-
)
|
|
26
|
+
"⚠️ ATTENTION: Cette opération supprime physiquement le module du monorepo!"
|
|
27
|
+
)
|
|
28
28
|
);
|
|
29
29
|
console.log(
|
|
30
|
-
chalk.gray("Cette commande est réservée aux développeurs du framework.\n")
|
|
30
|
+
chalk.gray("Cette commande est réservée aux développeurs du framework.\n")
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
// Lister les modules disponibles
|
|
@@ -69,7 +69,7 @@ export async function deleteModule() {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
console.log(
|
|
72
|
-
chalk.blue(`\n🗑️ Suppression du module ${moduleMeta.package}...\n`)
|
|
72
|
+
chalk.blue(`\n🗑️ Suppression du module ${moduleMeta.package}...\n`)
|
|
73
73
|
);
|
|
74
74
|
|
|
75
75
|
// 1. Supprimer le répertoire du module
|
|
@@ -96,7 +96,7 @@ export async function deleteModule() {
|
|
|
96
96
|
"core",
|
|
97
97
|
"src",
|
|
98
98
|
"config",
|
|
99
|
-
"modules.ts"
|
|
99
|
+
"modules.ts"
|
|
100
100
|
);
|
|
101
101
|
|
|
102
102
|
if (fs.existsSync(moduleRegistryPath)) {
|
|
@@ -106,12 +106,12 @@ export async function deleteModule() {
|
|
|
106
106
|
// Vérifier si le module est dans le registre
|
|
107
107
|
if (!content.includes(`name: "${moduleName}"`)) {
|
|
108
108
|
console.log(
|
|
109
|
-
chalk.yellow(` ⚠️ Module ${moduleName} n'est pas dans le registre`)
|
|
109
|
+
chalk.yellow(` ⚠️ Module ${moduleName} n'est pas dans le registre`)
|
|
110
110
|
);
|
|
111
111
|
} else {
|
|
112
112
|
// Parser et reconstruire le tableau proprement
|
|
113
113
|
const arrayMatch = content.match(
|
|
114
|
-
/export const AVAILABLE_MODULES: ModuleMetadata\[\] = \[([\s\S]*?)\]
|
|
114
|
+
/export const AVAILABLE_MODULES: ModuleMetadata\[\] = \[([\s\S]*?)\];/
|
|
115
115
|
);
|
|
116
116
|
|
|
117
117
|
if (arrayMatch) {
|
|
@@ -146,12 +146,12 @@ export async function deleteModule() {
|
|
|
146
146
|
|
|
147
147
|
content = content.replace(
|
|
148
148
|
/export const AVAILABLE_MODULES: ModuleMetadata\[\] = \[([\s\S]*?)\];/,
|
|
149
|
-
`export const AVAILABLE_MODULES: ModuleMetadata[] = [${newArrayContent}]
|
|
149
|
+
`export const AVAILABLE_MODULES: ModuleMetadata[] = [${newArrayContent}];`
|
|
150
150
|
);
|
|
151
151
|
|
|
152
152
|
await fs.writeFile(moduleRegistryPath, content, "utf-8");
|
|
153
153
|
console.log(
|
|
154
|
-
chalk.green(` ✓ Module ${moduleName} supprimé du registre`)
|
|
154
|
+
chalk.green(` ✓ Module ${moduleName} supprimé du registre`)
|
|
155
155
|
);
|
|
156
156
|
} else {
|
|
157
157
|
console.log(chalk.yellow(" ⚠️ Format du registre non reconnu"));
|
|
@@ -159,7 +159,7 @@ export async function deleteModule() {
|
|
|
159
159
|
}
|
|
160
160
|
} catch (error) {
|
|
161
161
|
console.log(
|
|
162
|
-
chalk.red(` ❌ Erreur lors de la mise à jour du registre: ${error}`)
|
|
162
|
+
chalk.red(` ❌ Erreur lors de la mise à jour du registre: ${error}`)
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -181,7 +181,7 @@ export async function deleteModule() {
|
|
|
181
181
|
}
|
|
182
182
|
} catch (error) {
|
|
183
183
|
console.log(
|
|
184
|
-
chalk.yellow(` ⚠️ Erreur lors de la mise à jour: ${error}`)
|
|
184
|
+
chalk.yellow(` ⚠️ Erreur lors de la mise à jour: ${error}`)
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -190,7 +190,7 @@ export async function deleteModule() {
|
|
|
190
190
|
console.log(chalk.yellow("Prochaines étapes:"));
|
|
191
191
|
console.log(chalk.gray(" 1. cd packages/core && pnpm build"));
|
|
192
192
|
console.log(
|
|
193
|
-
chalk.gray(" 2. Vérifier les projets qui utilisaient ce module")
|
|
193
|
+
chalk.gray(" 2. Vérifier les projets qui utilisaient ce module")
|
|
194
194
|
);
|
|
195
195
|
console.log(chalk.gray(" 3. Commiter les changements\n"));
|
|
196
196
|
}
|
|
@@ -45,8 +45,8 @@ export async function listModules(targetDir: string) {
|
|
|
45
45
|
|
|
46
46
|
console.log(
|
|
47
47
|
chalk.bold(
|
|
48
|
-
`${module.emoji} ${module.name.charAt(0).toUpperCase() + module.name.slice(1)}
|
|
49
|
-
)
|
|
48
|
+
`${module.emoji} ${module.name.charAt(0).toUpperCase() + module.name.slice(1)}`
|
|
49
|
+
)
|
|
50
50
|
);
|
|
51
51
|
console.log(chalk.gray(` Nom: ${module.name}`));
|
|
52
52
|
console.log(chalk.gray(` Package: ${module.package}`));
|
|
@@ -56,7 +56,7 @@ export async function listModules(targetDir: string) {
|
|
|
56
56
|
// Afficher la commande appropriée selon le statut
|
|
57
57
|
if (isInstalled) {
|
|
58
58
|
console.log(
|
|
59
|
-
chalk.cyan(` → pnpm lastbrain remove-module ${module.name}`)
|
|
59
|
+
chalk.cyan(` → pnpm lastbrain remove-module ${module.name}`)
|
|
60
60
|
);
|
|
61
61
|
} else if (isInactive || !isInstalled) {
|
|
62
62
|
console.log(chalk.cyan(` → pnpm lastbrain add-module ${module.name}`));
|
|
@@ -69,10 +69,10 @@ export async function listModules(targetDir: string) {
|
|
|
69
69
|
console.log(chalk.gray("\nCommandes disponibles:"));
|
|
70
70
|
console.log(
|
|
71
71
|
chalk.cyan(" pnpm lastbrain add-module <nom> ") +
|
|
72
|
-
chalk.gray("- Ajouter un module")
|
|
72
|
+
chalk.gray("- Ajouter un module")
|
|
73
73
|
);
|
|
74
74
|
console.log(
|
|
75
75
|
chalk.cyan(" pnpm lastbrain remove-module <nom> ") +
|
|
76
|
-
chalk.gray("- Supprimer un module\n")
|
|
76
|
+
chalk.gray("- Supprimer un module\n")
|
|
77
77
|
);
|
|
78
78
|
}
|