create-fleetbo-project 1.2.96 → 1.2.98

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.
@@ -9,24 +9,37 @@ const fs = require('fs');
9
9
  const path = require('path');
10
10
  const https = require('https');
11
11
 
12
- const repoOwner = 'FleetFleetbo';
13
- const repoName = 'dev.fleetbo.io';
14
- const branchName = 'master';
15
- const archiveUrl = `https://github.com/${repoOwner}/${repoName}/archive/refs/heads/${branchName}.tar.gz`;
16
12
  const bootstrapUrl = 'https://us-central1-myapp-259bf.cloudfunctions.net/bootstrapProject';
17
13
 
18
14
  const args = process.argv.slice(2);
19
15
  const projectNameArg = args.find(arg => !arg.startsWith('--'));
20
16
  const tokenArg = args.find(arg => arg.startsWith('--token='));
21
17
  const emailArg = args.find(arg => arg.startsWith('--email='));
18
+ const frameworkArg = args.find(arg => arg.startsWith('--framework='));
22
19
  const bootstrapTokenArg = tokenArg ? tokenArg.split('=')[1] : null;
23
20
  const userEmailArg = emailArg ? emailArg.split('=')[1] : null;
21
+ const jsFramework = frameworkArg ? frameworkArg.split('=')[1] : 'react';
24
22
 
25
23
  if (!projectNameArg || !bootstrapTokenArg || !userEmailArg) {
26
- console.error('\n Usage: npx create-fleetbo-project <name> --token=<token> --email=<email>');
24
+ console.error('\n Usage: npx create-fleetbo-project <n> --token=<token> --email=<email> [--framework=vue]');
27
25
  process.exit(1);
28
26
  }
29
27
 
28
+ // 🌐 RÉSOLUTION UNIFIÉE DEPUIS NPM
29
+ // React : my-fleetbo-react | Vue : my-fleetbo-vue
30
+ // NPM = CDN industriel, SemVer, zéro rate limit GitHub
31
+ const getArchiveUrl = () => {
32
+ const templatePackage = jsFramework === 'vue' ? 'my-fleetbo-vue' : 'my-fleetbo-react';
33
+ console.log(` 🔍 Resolving latest ${jsFramework.toUpperCase()} template from npm registry...`);
34
+ try {
35
+ const tarball = execSync(`npm view ${templatePackage} dist.tarball`, { stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
36
+ if (!tarball) throw new Error('Empty response');
37
+ return Promise.resolve(tarball);
38
+ } catch (e) {
39
+ return Promise.reject(new Error(`Could not locate "${templatePackage}" on npm. Is it published?`));
40
+ }
41
+ };
42
+
30
43
  const projectName = projectNameArg;
31
44
  const projectDir = path.join(process.cwd(), projectName);
32
45
 
@@ -107,7 +120,9 @@ async function setupProject() {
107
120
  }
108
121
  fs.mkdirSync(projectDir);
109
122
 
110
- console.log(' [1/8] Downloading Fleetbo Core Engine...');
123
+ const frameworkLabel = jsFramework === 'vue' ? 'Vue' : 'React';
124
+ console.log(` [1/8] Downloading Fleetbo ${frameworkLabel} Engine...`);
125
+ const archiveUrl = await getArchiveUrl();
111
126
  const archivePath = path.join(projectDir, 'engine.tar.gz');
112
127
  await downloadEngine(archiveUrl, archivePath);
113
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fleetbo-project",
3
- "version": "1.2.96",
3
+ "version": "1.2.98",
4
4
  "description": "Creates a new Fleetbo project.",
5
5
  "main": "install-react-template.js",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  "fullstack",
23
23
  "OS",
24
24
  "Cloud",
25
- "fleetbo"
25
+ "Mobile"
26
26
  ],
27
27
  "author": "Jean Aubain NOUCTI",
28
28
  "license": "ISC"