fleetbo-cockpit-cli 1.0.183 → 1.0.185
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/cli.js +20 -23
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -142,15 +142,12 @@ const injectRouteIntoAppJs = (moduleName, subPath = '') => {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
const cleanSubPath = subPath ? `${subPath}/` : '';
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
// 🟢 IMPORT UNIFIÉ — Vite résout l'extension automatiquement (React & Vue)
|
|
146
|
+
const importLine = `import ${moduleName} from './app/${cleanSubPath}${moduleName}';`;
|
|
147
|
+
let routeLine;
|
|
147
148
|
if (JS_FRAMEWORK === 'vue') {
|
|
148
|
-
// 🟢 SYNTAXE VUE
|
|
149
|
-
importLine = `import ${moduleName} from './app/${cleanSubPath}${moduleName}.vue';`;
|
|
150
149
|
routeLine = `{ path: '/${cleanSubPath}${moduleName.toLowerCase()}', component: ${moduleName} },`;
|
|
151
150
|
} else {
|
|
152
|
-
// 🔵 SYNTAXE REACT
|
|
153
|
-
importLine = `import ${moduleName} from './app/${cleanSubPath}${moduleName}';`;
|
|
154
151
|
routeLine = `<Route path="/${cleanSubPath}${moduleName.toLowerCase()}" element={<${moduleName} />} />`;
|
|
155
152
|
}
|
|
156
153
|
|
|
@@ -251,12 +248,12 @@ const removeRouteFromAppJs = (moduleName) => {
|
|
|
251
248
|
|
|
252
249
|
let content = fs.readFileSync(targetFile, 'utf8');
|
|
253
250
|
|
|
254
|
-
|
|
251
|
+
// 🟢 IMPORT UNIFIÉ — Vite résout l'extension automatiquement (React & Vue)
|
|
252
|
+
const importLine = `import ${moduleName} from './app/mocks/${moduleName}';`;
|
|
253
|
+
let routeLine;
|
|
255
254
|
if (JS_FRAMEWORK === 'vue') {
|
|
256
|
-
importLine = `import ${moduleName} from './app/mocks/${moduleName}.vue';`;
|
|
257
255
|
routeLine = `{ path: '/mocks/${moduleName.toLowerCase()}', component: ${moduleName} },`;
|
|
258
256
|
} else {
|
|
259
|
-
importLine = `import ${moduleName} from './app/mocks/${moduleName}';`;
|
|
260
257
|
routeLine = `<Route path="/mocks/${moduleName.toLowerCase()}" element={<${moduleName} />} />`;
|
|
261
258
|
}
|
|
262
259
|
|
|
@@ -496,7 +493,7 @@ if (command === 'alex') {
|
|
|
496
493
|
}
|
|
497
494
|
|
|
498
495
|
if (mockCode && mockFileName) {
|
|
499
|
-
const pageName = mockFileName.replace(
|
|
496
|
+
const pageName = mockFileName.replace(/\.(jsx|vue)$/, '');
|
|
500
497
|
writeFile('src/app/mocks/', mockFileName, mockCode);
|
|
501
498
|
const injected = injectRouteIntoAppJs(pageName, 'mocks');
|
|
502
499
|
}
|
|
@@ -986,11 +983,11 @@ else if (command === 'android' || command === 'ios') {
|
|
|
986
983
|
console.error(`\x1b[31m Error:\x1b[0m ${error.message}`);
|
|
987
984
|
|
|
988
985
|
if (error.message.includes('Limit') || error.message.includes('Quota')) {
|
|
989
|
-
console.log(`\n\x1b[33m
|
|
986
|
+
console.log(`\n\x1b[33m Tip:\x1b[0m Upgrade to Senior Pilot for more builds.`);
|
|
990
987
|
} else if (error.message.includes('No native module')) {
|
|
991
|
-
console.log(`\n\x1b[33m
|
|
988
|
+
console.log(`\n\x1b[33m Tip:\x1b[0m Run "npm run fleetbo alex" to create native modules first.`);
|
|
992
989
|
} else if (error.message.includes('Trial Period Ended')) {
|
|
993
|
-
console.log(`\n\x1b[33m
|
|
990
|
+
console.log(`\n\x1b[33m Tip:\x1b[0m Your free sprint is over. Upgrade to Senior Pilot on fleetbo.io.`);
|
|
994
991
|
}
|
|
995
992
|
console.log('');
|
|
996
993
|
process.exit(1);
|
|
@@ -1074,8 +1071,8 @@ else {
|
|
|
1074
1071
|
await axios.post(UPDATE_NETWORK_URL, { keyApp, networkUrl, tester: testerEmail });
|
|
1075
1072
|
console.log('\n\x1b[32mEngine started successfully\x1b[0m');
|
|
1076
1073
|
console.log(`\n\x1b[32mFleetbo OS ❯\x1b[0m -------------------------------------------------------------`);
|
|
1077
|
-
console.log(
|
|
1078
|
-
console.log('\x1b[32mFleetbo OS ❯\x1b[0m You can now start coding and previewing.
|
|
1074
|
+
console.log(`\x1b[32mFleetbo OS ❯\x1b[0m \x1b[1mGO ! ${projectName} running in OS\x1b[0m`);
|
|
1075
|
+
console.log('\x1b[32mFleetbo OS ❯\x1b[0m You can now start coding and previewing.');
|
|
1079
1076
|
console.log(`\x1b[32mFleetbo OS ❯\x1b[0m -------------------------------------------------------------`);
|
|
1080
1077
|
console.log(`\n\x1b[34mPilot Instruction ❯\x1b[0m Return to the Workspace. The Engine is ready for your orders.\n`);
|
|
1081
1078
|
} catch (err) {
|
|
@@ -1084,7 +1081,7 @@ else {
|
|
|
1084
1081
|
}
|
|
1085
1082
|
|
|
1086
1083
|
async function runDevEnvironment() {
|
|
1087
|
-
console.log(`[Fleetbo]
|
|
1084
|
+
console.log(`[Fleetbo] Initializing Universal Dev Environment...`);
|
|
1088
1085
|
|
|
1089
1086
|
killNetworkService();
|
|
1090
1087
|
killProcessOnPort(PORT); // On tue le 3000 par précaution, au cas où
|
|
@@ -1114,7 +1111,7 @@ else {
|
|
|
1114
1111
|
devServer.stdout.on('data', (data) => {
|
|
1115
1112
|
const output = data.toString();
|
|
1116
1113
|
|
|
1117
|
-
//
|
|
1114
|
+
// FILTRE ANTI-PLOMBERIE FLEETBO
|
|
1118
1115
|
const lines = output.split('\n');
|
|
1119
1116
|
const forbiddenTerms = [
|
|
1120
1117
|
'Attempting to bind to HOST', 'If this was unintentional', 'Learn more here:',
|
|
@@ -1131,10 +1128,10 @@ else {
|
|
|
1131
1128
|
process.stdout.write(filteredOutput + '\n');
|
|
1132
1129
|
}
|
|
1133
1130
|
|
|
1134
|
-
//
|
|
1135
|
-
//
|
|
1136
|
-
//
|
|
1137
|
-
//
|
|
1131
|
+
// MAGIE 1 : DÉTECTION DU PORT RÉEL (Vite/Vue ou React)
|
|
1132
|
+
// Cherche un pattern comme http://localhost:5173 ou http://127.0.0.1:3000
|
|
1133
|
+
// LA SOLUTION : On déclenche UNIQUEMENT quand on a trouvé le port !
|
|
1134
|
+
// CAPTURE AGNOSTIQUE DU PORT (S'adapte dynamiquement à Vite)
|
|
1138
1135
|
const portMatch = output.match(/http:\/\/(?:localhost|127\.0\.0\.1):(\d+)/);
|
|
1139
1136
|
|
|
1140
1137
|
if (portMatch) {
|
|
@@ -1159,10 +1156,10 @@ else {
|
|
|
1159
1156
|
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
1160
1157
|
|
|
1161
1158
|
if (attempt > 0) {
|
|
1162
|
-
console.log(`\x1b[33m[Fleetbo]
|
|
1159
|
+
console.log(`\x1b[33m[Fleetbo] Uplink reconnection ${attempt}/${MAX_UPLINK_RETRIES - 1}...\x1b[0m`);
|
|
1163
1160
|
}
|
|
1164
1161
|
|
|
1165
|
-
//
|
|
1162
|
+
// LE TUNNEL CLOUDFLARE UTILISE LE PORT DÉTECTÉ DYNAMIQUEMENT !
|
|
1166
1163
|
const uplinkCommand = `${npxCmd} -y cloudflared tunnel --url http://127.0.0.1:${detectedPort} --http-host-header 127.0.0.1:${detectedPort}`;
|
|
1167
1164
|
uplinkProcess = spawn(uplinkCommand, { shell: true });
|
|
1168
1165
|
|