create-fleetbo-project 1.2.103 → 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.
- package/install-react-template.js +28 -8
- package/package.json +1 -1
|
@@ -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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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;
|