fleetbo-cockpit-cli 1.0.78 → 1.0.80
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 +25 -25
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -38,9 +38,11 @@ if (!fs.existsSync(envPath)) {
|
|
|
38
38
|
|
|
39
39
|
dotenv.config({ path: envPath, quiet: true });
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
41
|
+
// CORRECT — correspond à ton .env actuel
|
|
42
|
+
const projectId = process.env.FLEETBO_APP_ENTERPRISE_ID;
|
|
43
|
+
const keyApp = process.env.FLEETBO_KEY_APP;
|
|
44
|
+
const testerEmail = process.env.FLEETBO_APP_TESTER_EMAIL;
|
|
45
|
+
|
|
44
46
|
|
|
45
47
|
if (!projectId) {
|
|
46
48
|
console.error('\n\x1b[31m❌ Error: Project ID missing in .env.\x1b[0m\n');
|
|
@@ -96,7 +98,9 @@ const checkGitSecurity = () => {
|
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
const injectRouteIntoAppJs = (moduleName, subPath = '') => {
|
|
99
|
-
const appJsPath = path.join(process.cwd(), 'src', 'App.
|
|
101
|
+
const appJsPath = fs.existsSync(path.join(process.cwd(), 'src', 'App.jsx'))
|
|
102
|
+
? path.join(process.cwd(), 'src', 'App.jsx')
|
|
103
|
+
: path.join(process.cwd(), 'src', 'App.js');
|
|
100
104
|
if (!fs.existsSync(appJsPath)) {
|
|
101
105
|
console.error(` \x1b[31m[Safety Stop]\x1b[0m App.js missing.`);
|
|
102
106
|
return false;
|
|
@@ -184,7 +188,9 @@ const getModuleCache = async ({ projectId, moduleName }) => {
|
|
|
184
188
|
};
|
|
185
189
|
|
|
186
190
|
const removeRouteFromAppJs = (moduleName) => {
|
|
187
|
-
const appJsPath = path.join(process.cwd(), 'src', 'App.
|
|
191
|
+
const appJsPath = fs.existsSync(path.join(process.cwd(), 'src', 'App.jsx'))
|
|
192
|
+
? path.join(process.cwd(), 'src', 'App.jsx')
|
|
193
|
+
: path.join(process.cwd(), 'src', 'App.js');
|
|
188
194
|
if (!fs.existsSync(appJsPath)) return false;
|
|
189
195
|
|
|
190
196
|
let content = fs.readFileSync(appJsPath, 'utf8');
|
|
@@ -876,33 +882,24 @@ else {
|
|
|
876
882
|
async function runDevEnvironment() {
|
|
877
883
|
console.log(`[Fleetbo] 🛡️ Initializing Dev Environment...`);
|
|
878
884
|
|
|
879
|
-
|
|
880
|
-
try {
|
|
881
|
-
const npxExec = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
882
|
-
execSync(`${npxExec} -y update-browserslist-db@latest`, { stdio: 'ignore' });
|
|
883
|
-
} catch (e) {}
|
|
885
|
+
|
|
884
886
|
|
|
885
887
|
killNetworkService();
|
|
886
888
|
killProcessOnPort(PORT);
|
|
887
889
|
|
|
888
890
|
if (!testerEmail) {
|
|
889
|
-
console.error('\x1b[31mError:
|
|
891
|
+
console.error('\x1b[31mError: FLEETBO_APP_TESTER_EMAIL missing in .env\x1b[0m');
|
|
890
892
|
process.exit(1);
|
|
891
893
|
}
|
|
892
894
|
|
|
893
895
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
894
|
-
const devServer = spawn(npmCmd, ['
|
|
896
|
+
const devServer = spawn(npmCmd, ['run', 'dev', '--silent'], {
|
|
895
897
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
896
898
|
shell: true,
|
|
897
899
|
env: {
|
|
898
900
|
...process.env,
|
|
899
901
|
NODE_OPTIONS: '--no-deprecation',
|
|
900
|
-
|
|
901
|
-
PORT: PORT.toString(),
|
|
902
|
-
DANGEROUSLY_DISABLE_HOST_CHECK: 'true',
|
|
903
|
-
HOST: '0.0.0.0',
|
|
904
|
-
WDS_SOCKET_HOST: 'localhost',
|
|
905
|
-
WDS_SOCKET_PORT: PORT.toString()
|
|
902
|
+
PORT: PORT.toString(),
|
|
906
903
|
}
|
|
907
904
|
});
|
|
908
905
|
|
|
@@ -922,11 +919,14 @@ else {
|
|
|
922
919
|
'Learn more here:',
|
|
923
920
|
'Starting the development server',
|
|
924
921
|
'You can now view',
|
|
925
|
-
'
|
|
926
|
-
'
|
|
927
|
-
'
|
|
928
|
-
'
|
|
929
|
-
'
|
|
922
|
+
'vite v',
|
|
923
|
+
'VITE v', // Vite en majuscules
|
|
924
|
+
'ready in', // Cache "ready in 180 ms"
|
|
925
|
+
'➜ Local', // Cache l'URL locale
|
|
926
|
+
'➜ Network', // Cache l'URL réseau
|
|
927
|
+
'press h + enter',
|
|
928
|
+
'> vite', // Au cas où npm force l'affichage
|
|
929
|
+
'> fleetbo'
|
|
930
930
|
];
|
|
931
931
|
|
|
932
932
|
// On filtre les lignes pour ne garder que le vrai code/debug
|
|
@@ -940,7 +940,7 @@ else {
|
|
|
940
940
|
}
|
|
941
941
|
|
|
942
942
|
// 🚀 DÉTECTION DU DÉMARRAGE ET LANCEMENT DE L'UPLINK
|
|
943
|
-
if (!connectionStarted && (output.includes('
|
|
943
|
+
if (!connectionStarted && (output.includes('localhost') || output.includes('ready in'))){
|
|
944
944
|
connectionStarted = true;
|
|
945
945
|
|
|
946
946
|
console.log('\x1b[33mFleetbo OS ❯\x1b[0m ---------------------------------------------------');
|
|
@@ -980,7 +980,7 @@ else {
|
|
|
980
980
|
uplinkFound = true;
|
|
981
981
|
// ⚡ Stabilisation du noyau : on attend 1.5s
|
|
982
982
|
setTimeout(() => {
|
|
983
|
-
syncFirebase(process.env.
|
|
983
|
+
syncFirebase(process.env.FLEETBO_KEY_APP, match[0], process.env.FLEETBO_APP_TESTER_EMAIL);
|
|
984
984
|
}, 1500);
|
|
985
985
|
}
|
|
986
986
|
};
|