create-fleetbo-project 1.2.11 → 1.2.12
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.
|
@@ -103,16 +103,15 @@ runGuardian();
|
|
|
103
103
|
const args = process.argv.slice(2);
|
|
104
104
|
const projectNameArg = args.find(arg => !arg.startsWith('--'));
|
|
105
105
|
const tokenArg = args.find(arg => arg.startsWith('--token='));
|
|
106
|
+
const bootstrapTokenArg = tokenArg ? tokenArg.split('=')[1] : null;
|
|
106
107
|
|
|
107
|
-
if (!projectNameArg || !
|
|
108
|
+
if (!projectNameArg || !bootstrapTokenArg) {
|
|
108
109
|
console.error('\n ❌ Usage: npx create-fleetbo-project <project-name> --token=<your-token>');
|
|
109
110
|
process.exit(1);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
function bootstrapToken(arg) { return arg ? arg.split('=')[1] : null; }
|
|
113
113
|
const projectName = projectNameArg;
|
|
114
114
|
const projectDir = path.join(process.cwd(), projectName);
|
|
115
|
-
const bToken = bootstrapToken(tokenArg);
|
|
116
115
|
|
|
117
116
|
|
|
118
117
|
// --- Fonctions Utilitaires ---
|
|
@@ -176,22 +175,20 @@ async function setupProject() {
|
|
|
176
175
|
|
|
177
176
|
// 3. Auth
|
|
178
177
|
console.log(' [3/6] 🔑 Authenticating with Fleetbo Cloud...');
|
|
179
|
-
const keys = await fetchProjectKeys(
|
|
178
|
+
const keys = await fetchProjectKeys(bootstrapTokenArg);
|
|
180
179
|
if (!keys.enterpriseId) throw new Error("Invalid keys.");
|
|
181
180
|
|
|
182
181
|
// 4. Environment & CLI Generation
|
|
183
182
|
console.log(' [4/6] ⚙️ Configuring environment & CLI...');
|
|
184
183
|
const envContent = `REACT_APP_FLEETBO_DB_KEY=${keys.fleetboDBKey}\nREACT_APP_ENTERPRISE_ID=${keys.enterpriseId}\nREACT_KEY_APP=${projectName}\nDANGEROUSLY_DISABLE_HOST_CHECK=true\n`;
|
|
185
184
|
fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
|
|
186
|
-
|
|
187
|
-
// --- ICI ON CRÉE LE FICHIER CLI.JS ---
|
|
188
185
|
fs.writeFileSync(path.join(projectDir, 'cli.js'), CLI_SCRIPT_CONTENT, 'utf8');
|
|
189
|
-
// -------------------------------------
|
|
190
186
|
|
|
191
187
|
// 5. Deps
|
|
192
188
|
console.log(' [5/6] 📚 Installing dependencies...');
|
|
193
189
|
execSync('npm install', { stdio: 'inherit' });
|
|
194
|
-
|
|
190
|
+
// AJOUT DE AXIOS ICI
|
|
191
|
+
execSync('npm install ngrok dotenv axios --save-dev', { stdio: 'ignore' });
|
|
195
192
|
|
|
196
193
|
// 6. Finalize
|
|
197
194
|
console.log(' [6/6] ✨ Finalizing setup...');
|