fleetbo-cockpit-cli 1.0.77 → 1.0.79
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 -26
- 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');
|
|
@@ -863,7 +869,7 @@ else {
|
|
|
863
869
|
try {
|
|
864
870
|
await axios.post(UPDATE_NETWORK_URL, { keyApp, networkUrl, tester: testerEmail });
|
|
865
871
|
console.log('\n\x1b[32mEngine started successfully\x1b[0m');
|
|
866
|
-
console.log(`\x1b[32mFleetbo OS ❯\x1b[0m -------------------------------------------------------------`);
|
|
872
|
+
console.log(`\n\x1b[32mFleetbo OS ❯\x1b[0m -------------------------------------------------------------`);
|
|
867
873
|
console.log('\x1b[32mFleetbo OS ❯\x1b[0m \x1b[1mGO GO GO ! OS IS READY\x1b[0m');
|
|
868
874
|
console.log('\x1b[32mFleetbo OS ❯\x1b[0m You can now start coding and previewing. 🚀');
|
|
869
875
|
console.log(`\x1b[32mFleetbo OS ❯\x1b[0m -------------------------------------------------------------`);
|
|
@@ -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'], {
|
|
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,8 @@ else {
|
|
|
922
919
|
'Learn more here:',
|
|
923
920
|
'Starting the development server',
|
|
924
921
|
'You can now view',
|
|
925
|
-
'
|
|
926
|
-
'
|
|
927
|
-
'Note that the development build',
|
|
928
|
-
'To create a production build',
|
|
929
|
-
'webpack compiled successfully'
|
|
922
|
+
'vite v',
|
|
923
|
+
'press h + enter'
|
|
930
924
|
];
|
|
931
925
|
|
|
932
926
|
// On filtre les lignes pour ne garder que le vrai code/debug
|
|
@@ -940,7 +934,7 @@ else {
|
|
|
940
934
|
}
|
|
941
935
|
|
|
942
936
|
// 🚀 DÉTECTION DU DÉMARRAGE ET LANCEMENT DE L'UPLINK
|
|
943
|
-
if (!connectionStarted && (output.includes('
|
|
937
|
+
if (!connectionStarted && (output.includes('localhost') || output.includes('ready in'))){
|
|
944
938
|
connectionStarted = true;
|
|
945
939
|
|
|
946
940
|
console.log('\x1b[33mFleetbo OS ❯\x1b[0m ---------------------------------------------------');
|
|
@@ -980,7 +974,7 @@ else {
|
|
|
980
974
|
uplinkFound = true;
|
|
981
975
|
// ⚡ Stabilisation du noyau : on attend 1.5s
|
|
982
976
|
setTimeout(() => {
|
|
983
|
-
syncFirebase(process.env.
|
|
977
|
+
syncFirebase(process.env.FLEETBO_KEY_APP, match[0], process.env.FLEETBO_APP_TESTER_EMAIL);
|
|
984
978
|
}, 1500);
|
|
985
979
|
}
|
|
986
980
|
};
|