create-fleetbo-project 1.2.103 → 1.2.105
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 +29 -20
- package/package.json +1 -1
|
@@ -111,12 +111,7 @@ function downloadEngine(url, dest) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
async function setupProject() {
|
|
114
|
-
|
|
115
|
-
const logStep = (text) => {
|
|
116
|
-
process.stdout.write(text + '\n');
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
logStep(`\n ⚡ Initializing Fleetbo Frontend for "${projectName}"...`);
|
|
114
|
+
console.log(`\n ⚡ Initializing Fleetbo Frontend for "${projectName}"...`);
|
|
120
115
|
|
|
121
116
|
try {
|
|
122
117
|
if (fs.existsSync(projectDir)) {
|
|
@@ -125,13 +120,12 @@ async function setupProject() {
|
|
|
125
120
|
fs.mkdirSync(projectDir);
|
|
126
121
|
|
|
127
122
|
const frameworkLabel = jsFramework === 'vue' ? 'Vue' : 'React';
|
|
128
|
-
|
|
129
|
-
logStep(` [1/8] Downloading Fleetbo ${frameworkLabel} Engine...`);
|
|
123
|
+
console.log(` [1/8] Downloading Fleetbo ${frameworkLabel} Engine...`);
|
|
130
124
|
const archiveUrl = await getArchiveUrl();
|
|
131
125
|
const archivePath = path.join(projectDir, 'engine.tar.gz');
|
|
132
126
|
await downloadEngine(archiveUrl, archivePath);
|
|
133
127
|
|
|
134
|
-
|
|
128
|
+
console.log(' [2/8] Scaffolding project structure...');
|
|
135
129
|
try {
|
|
136
130
|
execSync(`tar -xf "${archivePath}" -C "${projectDir}" --strip-components=1`, { stdio: 'ignore' });
|
|
137
131
|
fs.unlinkSync(archivePath);
|
|
@@ -141,7 +135,7 @@ async function setupProject() {
|
|
|
141
135
|
|
|
142
136
|
process.chdir(projectDir);
|
|
143
137
|
|
|
144
|
-
|
|
138
|
+
console.log(' [3/8] Standardizing Architecture (Vite)...');
|
|
145
139
|
// Pour Vite, on s'assure juste que l'arborescence de base est correcte.
|
|
146
140
|
// On retire les vieux renommages CRA (App.js) pour éviter de casser App.jsx
|
|
147
141
|
const oldPath = path.join(projectDir, 'src/pages');
|
|
@@ -150,28 +144,43 @@ async function setupProject() {
|
|
|
150
144
|
try { fs.renameSync(oldPath, newPath); } catch (err) {}
|
|
151
145
|
}
|
|
152
146
|
|
|
153
|
-
|
|
147
|
+
console.log(' [4/8] Authenticating with Fleetbo Cloud...');
|
|
154
148
|
const keys = await fetchProjectKeys(bootstrapTokenArg);
|
|
155
149
|
if (!keys.enterpriseId) throw new Error("Invalid keys.");
|
|
156
150
|
|
|
157
|
-
|
|
158
|
-
const envContent = `VITE_FLEETBO_DB_KEY=${keys.fleetboDBKey}
|
|
151
|
+
console.log(' [5/8] Configuring environment...');
|
|
152
|
+
const envContent = `VITE_FLEETBO_DB_KEY=${keys.fleetboDBKey}
|
|
153
|
+
VITE_FLEETBO_ENTERPRISE_ID=${keys.enterpriseId}
|
|
154
|
+
VITE_FLEETBO_KEY_APP=${projectName}
|
|
155
|
+
VITE_FLEETBO_TESTER_EMAIL=${userEmailArg}
|
|
156
|
+
DANGEROUSLY_DISABLE_HOST_CHECK=true
|
|
157
|
+
WDS_SOCKET_PORT=0`;
|
|
159
158
|
|
|
160
159
|
fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
|
|
161
160
|
|
|
162
|
-
|
|
163
|
-
const gitignoreContent = `# Fleetbo Security
|
|
161
|
+
console.log(' [6/8] Securing environment (adding .gitignore)...');
|
|
162
|
+
const gitignoreContent = `# Fleetbo Security
|
|
163
|
+
.env
|
|
164
|
+
.env.local
|
|
165
|
+
node_modules/
|
|
166
|
+
dist/
|
|
167
|
+
build/
|
|
168
|
+
.DS_Store
|
|
169
|
+
npm-debug.log*
|
|
170
|
+
yarn-debug.log*
|
|
171
|
+
yarn-error.log*
|
|
172
|
+
`;
|
|
164
173
|
fs.writeFileSync(path.join(projectDir, '.gitignore'), gitignoreContent, 'utf8');
|
|
165
174
|
|
|
166
175
|
const npmrcContent = `loglevel=silent\nupdate-notifier=false\n`;
|
|
167
176
|
fs.writeFileSync(path.join(projectDir, '.npmrc'), npmrcContent, 'utf8');
|
|
168
177
|
|
|
169
|
-
|
|
178
|
+
console.log(' [7/8] Installing dependencies...');
|
|
170
179
|
execSync('npm install --no-audit --no-fund --silent', { stdio: 'inherit' });
|
|
171
180
|
|
|
172
181
|
execSync('npm install cloudflared --save-dev --no-audit --no-fund --silent', { stdio: 'ignore' });
|
|
173
182
|
|
|
174
|
-
|
|
183
|
+
console.log(' [8/8] Finalizing setup...');
|
|
175
184
|
|
|
176
185
|
// --- 1. CRÉATION DU DOSSIER CACHÉ ET DU SCRIPT RELAI ---
|
|
177
186
|
const fleetboDir = path.join(projectDir, '.fleetbo');
|
|
@@ -191,7 +200,7 @@ const result = spawnSync('npx', ['-y', 'fleetbo-cockpit-cli@latest', ...args], {
|
|
|
191
200
|
|
|
192
201
|
process.exit(result.status || 0);
|
|
193
202
|
`;
|
|
194
|
-
//
|
|
203
|
+
// 🟢 FIX : On utilise l'extension .cjs pour forcer le CommonJS
|
|
195
204
|
fs.writeFileSync(path.join(fleetboDir, 'engine.cjs'), engineScript, 'utf8');
|
|
196
205
|
|
|
197
206
|
// --- 2. MODIFICATION DU PACKAGE.JSON POUR MASQUER L'ARCHITECTURE ---
|
|
@@ -199,7 +208,7 @@ process.exit(result.status || 0);
|
|
|
199
208
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
200
209
|
packageJson.name = projectName;
|
|
201
210
|
|
|
202
|
-
// On appelle engine.cjs dans les scripts
|
|
211
|
+
// 🟢 FIX : On appelle engine.cjs dans les scripts
|
|
203
212
|
packageJson.scripts = {
|
|
204
213
|
"dev": "vite",
|
|
205
214
|
"build": "vite build",
|
|
@@ -224,7 +233,7 @@ process.exit(result.status || 0);
|
|
|
224
233
|
}
|
|
225
234
|
|
|
226
235
|
// ==========================================
|
|
227
|
-
//
|
|
236
|
+
// 🎯 L'ANNONCE DE SUCCÈS ET LE MINI-TUTO
|
|
228
237
|
// ==========================================
|
|
229
238
|
console.log('\n \x1b[1;32m✓ [Fleetbo] Project successfully created!\x1b[0m');
|
|
230
239
|
console.log(`\n Installation path: \x1b[36m${projectDir}\x1b[0m\n`);
|