create-fleetbo-project 1.2.25 → 1.2.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 +27 -9
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const branchName = 'master';
|
|
|
12
12
|
const archiveUrl = `https://github.com/${repoOwner}/${repoName}/archive/refs/heads/${branchName}.tar.gz`;
|
|
13
13
|
const bootstrapUrl = 'https://us-central1-myapp-259bf.cloudfunctions.net/bootstrapProject';
|
|
14
14
|
|
|
15
|
-
// --- LE CONTENU DU CLI (Version
|
|
15
|
+
// --- LE CONTENU DU CLI (Version avec Email Dynamique) ---
|
|
16
16
|
const CLI_SCRIPT_CONTENT = `#!/usr/bin/env node
|
|
17
17
|
|
|
18
18
|
const { spawn, execSync } = require('child_process');
|
|
@@ -55,11 +55,15 @@ async function cleanupAndExit(code = 0) {
|
|
|
55
55
|
process.on('SIGINT', () => cleanupAndExit(0));
|
|
56
56
|
process.on('SIGTERM', () => cleanupAndExit(0));
|
|
57
57
|
|
|
58
|
-
async function syncFirebase(keyApp, networkUrl) {
|
|
58
|
+
async function syncFirebase(keyApp, networkUrl, testerEmail) {
|
|
59
59
|
try {
|
|
60
|
-
await axios.post(UPDATE_NETWORK_URL, {
|
|
60
|
+
await axios.post(UPDATE_NETWORK_URL, {
|
|
61
|
+
keyApp,
|
|
62
|
+
networkUrl,
|
|
63
|
+
tester: testerEmail
|
|
64
|
+
});
|
|
61
65
|
console.log('\\n[Fleetbo] ---------------------------------------------------');
|
|
62
|
-
console.log(\`[Fleetbo] ✅ Uplink Status: Online\`);
|
|
66
|
+
console.log(\`[Fleetbo] ✅ Uplink Status: Online for \${testerEmail}\`);
|
|
63
67
|
console.log(\`[Fleetbo] 🚀 Simulator: https://fleetbo.io/studio/view/\${keyApp}\`);
|
|
64
68
|
console.log('[Fleetbo] ---------------------------------------------------\\n');
|
|
65
69
|
} catch (err) {
|
|
@@ -81,6 +85,12 @@ async function runDevEnvironment() {
|
|
|
81
85
|
}
|
|
82
86
|
dotenv.config({ path: envPath });
|
|
83
87
|
const keyApp = process.env.REACT_KEY_APP;
|
|
88
|
+
const testerEmail = process.env.REACT_APP_TESTER_EMAIL;
|
|
89
|
+
|
|
90
|
+
if (!testerEmail) {
|
|
91
|
+
console.error('Error: REACT_APP_TESTER_EMAIL missing in .env');
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
84
94
|
|
|
85
95
|
// 2. DÉMARRAGE DU SERVEUR LOCAL
|
|
86
96
|
console.log(\`[Fleetbo] 📦 Starting Local Server...\`);
|
|
@@ -117,7 +127,7 @@ async function runDevEnvironment() {
|
|
|
117
127
|
const url = match[0];
|
|
118
128
|
if (global.currentUrl !== url) {
|
|
119
129
|
global.currentUrl = url;
|
|
120
|
-
syncFirebase(keyApp, url);
|
|
130
|
+
syncFirebase(keyApp, url, testerEmail);
|
|
121
131
|
}
|
|
122
132
|
}
|
|
123
133
|
});
|
|
@@ -136,10 +146,13 @@ runDevEnvironment();
|
|
|
136
146
|
const args = process.argv.slice(2);
|
|
137
147
|
const projectNameArg = args.find(arg => !arg.startsWith('--'));
|
|
138
148
|
const tokenArg = args.find(arg => arg.startsWith('--token='));
|
|
149
|
+
const emailArg = args.find(arg => arg.startsWith('--email='));
|
|
150
|
+
|
|
139
151
|
const bootstrapTokenArg = tokenArg ? tokenArg.split('=')[1] : null;
|
|
152
|
+
const userEmailArg = emailArg ? emailArg.split('=')[1] : null;
|
|
140
153
|
|
|
141
|
-
if (!projectNameArg || !bootstrapTokenArg) {
|
|
142
|
-
console.error('\n ❌ Usage: npx create-fleetbo-project <name> --token=<token>');
|
|
154
|
+
if (!projectNameArg || !bootstrapTokenArg || !userEmailArg) {
|
|
155
|
+
console.error('\n ❌ Usage: npx create-fleetbo-project <name> --token=<token> --email=<email>');
|
|
143
156
|
process.exit(1);
|
|
144
157
|
}
|
|
145
158
|
|
|
@@ -219,8 +232,13 @@ async function setupProject() {
|
|
|
219
232
|
|
|
220
233
|
console.log(' [4/6] ⚙️ Configuring environment & CLI...');
|
|
221
234
|
|
|
222
|
-
|
|
223
|
-
|
|
235
|
+
const envContent = `REACT_APP_FLEETBO_DB_KEY=${keys.fleetboDBKey}
|
|
236
|
+
REACT_APP_ENTERPRISE_ID=${keys.enterpriseId}
|
|
237
|
+
REACT_KEY_APP=${projectName}
|
|
238
|
+
REACT_APP_TESTER_EMAIL=${userEmailArg}
|
|
239
|
+
DANGEROUSLY_DISABLE_HOST_CHECK=true
|
|
240
|
+
WDS_SOCKET_PORT=0
|
|
241
|
+
`;
|
|
224
242
|
|
|
225
243
|
fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
|
|
226
244
|
fs.writeFileSync(path.join(projectDir, 'cli.js'), CLI_SCRIPT_CONTENT, 'utf8');
|