@lastbrain/app 0.1.2 → 0.1.4
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.js +18 -6
- package/package.json +1 -1
package/dist/scripts/init-app.js
CHANGED
|
@@ -43,7 +43,7 @@ export async function initApp(options) {
|
|
|
43
43
|
// 1. Vérifier/créer package.json
|
|
44
44
|
await ensurePackageJson(targetDir, projectName);
|
|
45
45
|
// 2. Installer les dépendances
|
|
46
|
-
await addDependencies(targetDir, useHeroUI, withAuth);
|
|
46
|
+
await addDependencies(targetDir, useHeroUI, withAuth, selectedModules);
|
|
47
47
|
// 3. Créer la structure Next.js
|
|
48
48
|
await createNextStructure(targetDir, force, useHeroUI, withAuth);
|
|
49
49
|
// 4. Créer les fichiers de configuration
|
|
@@ -137,23 +137,35 @@ async function ensurePackageJson(targetDir, projectName) {
|
|
|
137
137
|
console.log(chalk.green("✓ package.json existe"));
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
async function addDependencies(targetDir, useHeroUI, withAuth) {
|
|
140
|
+
async function addDependencies(targetDir, useHeroUI, withAuth, selectedModules = []) {
|
|
141
141
|
const pkgPath = path.join(targetDir, "package.json");
|
|
142
142
|
const pkg = await fs.readJson(pkgPath);
|
|
143
143
|
console.log(chalk.yellow("\n📦 Configuration des dépendances..."));
|
|
144
|
+
// Détecter si on est dans le monorepo (développement local)
|
|
145
|
+
// Vérifier si le projet cible est à l'intérieur du monorepo
|
|
146
|
+
const targetIsInMonorepo = fs.existsSync(path.join(targetDir, "../../../packages/core/package.json")) ||
|
|
147
|
+
fs.existsSync(path.join(targetDir, "../../packages/core/package.json"));
|
|
148
|
+
const latestVersion = targetIsInMonorepo ? "workspace:*" : "latest";
|
|
144
149
|
// Dependencies
|
|
145
150
|
const requiredDeps = {
|
|
146
151
|
next: "^15.0.3",
|
|
147
152
|
react: "^18.3.1",
|
|
148
153
|
"react-dom": "^18.3.1",
|
|
149
|
-
"@lastbrain/app":
|
|
150
|
-
"@lastbrain/core":
|
|
151
|
-
"@lastbrain/ui":
|
|
154
|
+
"@lastbrain/app": latestVersion,
|
|
155
|
+
"@lastbrain/core": latestVersion,
|
|
156
|
+
"@lastbrain/ui": latestVersion,
|
|
152
157
|
"next-themes": "^0.4.6",
|
|
153
158
|
};
|
|
154
159
|
// Ajouter module-auth si demandé
|
|
155
160
|
if (withAuth) {
|
|
156
|
-
requiredDeps["@lastbrain/module-auth"] =
|
|
161
|
+
requiredDeps["@lastbrain/module-auth"] = latestVersion;
|
|
162
|
+
}
|
|
163
|
+
// Ajouter les autres modules sélectionnés
|
|
164
|
+
for (const moduleName of selectedModules) {
|
|
165
|
+
const moduleInfo = AVAILABLE_MODULES.find(m => m.name === moduleName);
|
|
166
|
+
if (moduleInfo && moduleInfo.package !== "@lastbrain/module-auth") {
|
|
167
|
+
requiredDeps[moduleInfo.package] = latestVersion;
|
|
168
|
+
}
|
|
157
169
|
}
|
|
158
170
|
// Ajouter les dépendances HeroUI si nécessaire
|
|
159
171
|
if (useHeroUI) {
|