create-fleetbo-project 1.2.102 → 1.2.104

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.
@@ -28,15 +28,35 @@ if (!projectNameArg || !bootstrapTokenArg || !userEmailArg) {
28
28
  // 🌐 RÉSOLUTION UNIFIÉE DEPUIS NPM
29
29
  // React : my-fleetbo-react | Vue : my-fleetbo-vue
30
30
  // NPM = CDN industriel, SemVer, zéro rate limit GitHub
31
+ // 🌐 RÉSOLUTION UNIFIÉE DEPUIS NPM (Via API HTTP directe, sans execSync)
31
32
  const getArchiveUrl = () => {
32
- const templatePackage = jsFramework === 'vue' ? 'my-fleetbo-vue' : 'my-fleetbo-react';
33
- try {
34
- const tarball = execSync(`npm view ${templatePackage} dist.tarball`, { stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
35
- if (!tarball) throw new Error('Empty response');
36
- return Promise.resolve(tarball);
37
- } catch (e) {
38
- return Promise.reject(new Error(`Could not locate "${templatePackage}" on npm. Is it published?`));
39
- }
33
+ return new Promise((resolve, reject) => {
34
+ const templatePackage = jsFramework === 'vue' ? 'my-fleetbo-vue' : 'my-fleetbo-react';
35
+
36
+ // On interroge directement le registre NPM sans passer par la ligne de commande (Ultra-rapide et silencieux)
37
+ https.get(`https://registry.npmjs.org/${templatePackage}/latest`, (res) => {
38
+ let data = '';
39
+ res.on('data', chunk => { data += chunk; });
40
+ res.on('end', () => {
41
+ if (res.statusCode === 200) {
42
+ try {
43
+ const json = JSON.parse(data);
44
+ if (json.dist && json.dist.tarball) {
45
+ resolve(json.dist.tarball);
46
+ } else {
47
+ reject(new Error('Tarball URL not found.'));
48
+ }
49
+ } catch (e) {
50
+ reject(new Error('Invalid JSON from NPM registry.'));
51
+ }
52
+ } else {
53
+ reject(new Error(`NPM registry returned status ${res.statusCode}`));
54
+ }
55
+ });
56
+ }).on('error', (err) => {
57
+ reject(new Error(`Network error when contacting NPM: ${err.message}`));
58
+ });
59
+ });
40
60
  };
41
61
 
42
62
  const projectName = projectNameArg;
@@ -111,7 +131,12 @@ function downloadEngine(url, dest) {
111
131
  }
112
132
 
113
133
  async function setupProject() {
114
- console.log(`\n Initializing Fleetbo Frontend for "${projectName}"...`);
134
+ // LA SOLUTION ANTI-DOUBLE SAUT DE LIGNE (Windows/Mac)
135
+ const logStep = (text) => {
136
+ process.stdout.write(text + '\n');
137
+ };
138
+
139
+ logStep(`\n ⚡ Initializing Fleetbo Frontend for "${projectName}"...`);
115
140
 
116
141
  try {
117
142
  if (fs.existsSync(projectDir)) {
@@ -120,12 +145,13 @@ async function setupProject() {
120
145
  fs.mkdirSync(projectDir);
121
146
 
122
147
  const frameworkLabel = jsFramework === 'vue' ? 'Vue' : 'React';
123
- console.log(` [1/8] Downloading Fleetbo ${frameworkLabel} Engine...`);
148
+
149
+ logStep(` [1/8] Downloading Fleetbo ${frameworkLabel} Engine...`);
124
150
  const archiveUrl = await getArchiveUrl();
125
151
  const archivePath = path.join(projectDir, 'engine.tar.gz');
126
152
  await downloadEngine(archiveUrl, archivePath);
127
153
 
128
- console.log(' [2/8] Scaffolding project structure...');
154
+ logStep(' [2/8] Scaffolding project structure...');
129
155
  try {
130
156
  execSync(`tar -xf "${archivePath}" -C "${projectDir}" --strip-components=1`, { stdio: 'ignore' });
131
157
  fs.unlinkSync(archivePath);
@@ -135,7 +161,7 @@ async function setupProject() {
135
161
 
136
162
  process.chdir(projectDir);
137
163
 
138
- console.log(' [3/8] Standardizing Architecture (Vite)...');
164
+ logStep(' [3/8] Standardizing Architecture (Vite)...');
139
165
  // Pour Vite, on s'assure juste que l'arborescence de base est correcte.
140
166
  // On retire les vieux renommages CRA (App.js) pour éviter de casser App.jsx
141
167
  const oldPath = path.join(projectDir, 'src/pages');
@@ -144,43 +170,28 @@ async function setupProject() {
144
170
  try { fs.renameSync(oldPath, newPath); } catch (err) {}
145
171
  }
146
172
 
147
- console.log(' [4/8] Authenticating with Fleetbo Cloud...');
173
+ logStep(' [4/8] Authenticating with Fleetbo Cloud...');
148
174
  const keys = await fetchProjectKeys(bootstrapTokenArg);
149
175
  if (!keys.enterpriseId) throw new Error("Invalid keys.");
150
176
 
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`;
177
+ logStep(' [5/8] Configuring environment...');
178
+ const envContent = `VITE_FLEETBO_DB_KEY=${keys.fleetboDBKey}\nVITE_FLEETBO_ENTERPRISE_ID=${keys.enterpriseId}\nVITE_FLEETBO_KEY_APP=${projectName}\nVITE_FLEETBO_TESTER_EMAIL=${userEmailArg}\nDANGEROUSLY_DISABLE_HOST_CHECK=true\nWDS_SOCKET_PORT=0`;
158
179
 
159
180
  fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
160
181
 
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
- `;
182
+ logStep(' [6/8] Securing environment (adding .gitignore)...');
183
+ const gitignoreContent = `# Fleetbo Security\n.env\n.env.local\nnode_modules/\ndist/\nbuild/\n.DS_Store\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n`;
173
184
  fs.writeFileSync(path.join(projectDir, '.gitignore'), gitignoreContent, 'utf8');
174
185
 
175
186
  const npmrcContent = `loglevel=silent\nupdate-notifier=false\n`;
176
187
  fs.writeFileSync(path.join(projectDir, '.npmrc'), npmrcContent, 'utf8');
177
188
 
178
- console.log(' [7/8] Installing dependencies...');
189
+ logStep(' [7/8] Installing dependencies...');
179
190
  execSync('npm install --no-audit --no-fund --silent', { stdio: 'inherit' });
180
191
 
181
192
  execSync('npm install cloudflared --save-dev --no-audit --no-fund --silent', { stdio: 'ignore' });
182
193
 
183
- console.log(' [8/8] Finalizing setup...');
194
+ logStep(' [8/8] Finalizing setup...');
184
195
 
185
196
  // --- 1. CRÉATION DU DOSSIER CACHÉ ET DU SCRIPT RELAI ---
186
197
  const fleetboDir = path.join(projectDir, '.fleetbo');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fleetbo-project",
3
- "version": "1.2.102",
3
+ "version": "1.2.104",
4
4
  "description": "Creates a new Fleetbo project.",
5
5
  "main": "install-react-template.js",
6
6
  "bin": {