create-fleetbo-project 1.0.25 → 1.0.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/install-react-template.js +16 -8
- package/package.json +1 -1
|
@@ -98,15 +98,23 @@ async function setupProject() {
|
|
|
98
98
|
|
|
99
99
|
console.log(' [2/5] ✅ Template décompressé. Réorganisation des fichiers...');
|
|
100
100
|
|
|
101
|
-
// *** DÉBUT DE LA
|
|
101
|
+
// *** DÉBUT DE LA LOGIQUE CORRIGÉE POUR TROUVER LA RACINE DU PROJET ***
|
|
102
102
|
let sourceDir = tempDir;
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
// Si package.json n'est pas à la racine du dossier temporaire...
|
|
104
|
+
if (!fs.existsSync(path.join(tempDir, 'package.json'))) {
|
|
105
|
+
const tempDirContents = fs.readdirSync(tempDir);
|
|
106
|
+
// ...on cherche le premier sous-dossier qui le contient.
|
|
107
|
+
const projectSubDir = tempDirContents.find(f => {
|
|
108
|
+
const fullPath = path.join(tempDir, f);
|
|
109
|
+
return fs.statSync(fullPath).isDirectory() && fs.existsSync(path.join(fullPath, 'package.json'));
|
|
110
|
+
});
|
|
105
111
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
if (projectSubDir) {
|
|
113
|
+
console.log(` -> Structure imbriquée détectée. Utilisation du sous-dossier "${projectSubDir}".`);
|
|
114
|
+
sourceDir = path.join(tempDir, projectSubDir);
|
|
115
|
+
} else {
|
|
116
|
+
throw new Error('Impossible de localiser le fichier package.json dans le template. La structure du dépôt est peut-être incorrecte.');
|
|
117
|
+
}
|
|
110
118
|
}
|
|
111
119
|
|
|
112
120
|
// Crée le dossier final du projet
|
|
@@ -117,7 +125,7 @@ async function setupProject() {
|
|
|
117
125
|
for (const item of sourceContents) {
|
|
118
126
|
fs.renameSync(path.join(sourceDir, item), path.join(projectDir, item));
|
|
119
127
|
}
|
|
120
|
-
// *** FIN DE LA
|
|
128
|
+
// *** FIN DE LA LOGIQUE CORRIGÉE ***
|
|
121
129
|
|
|
122
130
|
process.chdir(projectDir);
|
|
123
131
|
console.log(' [3/5] 🔑 Récupération des clés de projet...');
|