create-fleetbo-project 1.0.42 → 1.0.43

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.
@@ -8,19 +8,19 @@ const https = require('https');
8
8
  // --- Configuration ---
9
9
  const repoOwner = 'FleetFleetbo';
10
10
  const repoName = 'dev.fleetbo.io';
11
- const branchName = 'master'; // Make sure this is the correct branch
11
+ const branchName = 'master'; // Assurez-vous que c'est la bonne branche
12
12
 
13
13
  const repoGitUrl = `https://github.com/${repoOwner}/${repoName}.git`;
14
14
  const bootstrapUrl = 'https://us-central1-myapp-259bf.cloudfunctions.net/bootstrapProject';
15
15
 
16
- // --- Argument Parsing ---
16
+ // --- Analyse des Arguments ---
17
17
  const args = process.argv.slice(2);
18
18
  const projectNameArg = args.find(arg => !arg.startsWith('--'));
19
19
  const tokenArg = args.find(arg => arg.startsWith('--token='));
20
20
 
21
21
  if (!projectNameArg) {
22
22
  console.error('\n Error: Please specify a name for your project.');
23
- console.log(' Usage: npx create-fleetbo-project <project-name> --token=<your-token>');
23
+ console.log(' Usage: npx create-fleetbo-project <nom-du-projet> --token=<votre-token>');
24
24
  process.exit(1);
25
25
  }
26
26
 
@@ -28,13 +28,13 @@ const bootstrapToken = tokenArg ? tokenArg.split('=')[1] : null;
28
28
 
29
29
  if (!bootstrapToken) {
30
30
  console.error('\n Error: The bootstrap token is missing.');
31
- console.log(' Usage: npx create-fleetbo-project <project-name> --token=<your-token>');
31
+ console.log(' Usage: npx create-fleetbo-project <nom-du-projet> --token=<votre-token>');
32
32
  process.exit(1);
33
33
  }
34
34
 
35
35
  const projectName = projectNameArg;
36
36
 
37
- // --- Utility Functions ---
37
+ // --- Fonctions Utilitaires ---
38
38
 
39
39
  function fetchProjectKeys(token) {
40
40
  return new Promise((resolve, reject) => {
@@ -62,55 +62,56 @@ function fetchProjectKeys(token) {
62
62
  });
63
63
  }
64
64
 
65
- // --- Main Function ---
65
+ // --- Fonction Principale ---
66
66
 
67
67
  async function setupProject() {
68
68
  console.log(`\nCreating your Fleetbo project "${projectName}"...`);
69
69
  const projectDir = path.join(process.cwd(), projectName);
70
70
 
71
71
  try {
72
- // Step 1: Download the base project structure
73
- console.log(' [1/5] Initializing project structure...');
74
- // We redirect stderr to null to hide Git's progress messages
72
+ // Étape 1 : Télécharger la structure de base du projet
73
+ console.log(' [1/5] Initializing project structure...');
74
+ // On redirige la sortie d'erreur (stderr) vers null pour masquer les messages de progression de Git
75
75
  execSync(`git clone --depth 1 --branch ${branchName} ${repoGitUrl} "${projectName}" 2> /dev/null`);
76
76
 
77
- // Step 2: Move into the project directory and clean up
77
+ // Étape 2 : Se déplacer dans le dossier du projet et nettoyer
78
78
  console.log(' [2/5] Project structure initialized. Configuring...');
79
79
  process.chdir(projectDir);
80
80
 
81
- // Remove Git history to start with a clean project
81
+ // Supprimer l'historique Git pour commencer avec un projet propre
82
82
  fs.rmSync(path.join(projectDir, '.git'), { recursive: true, force: true });
83
83
 
84
- // Step 3: Fetching project keys
84
+ // Étape 3 : Récupération des clés de projet
85
85
  console.log(' [3/5] Fetching project keys...');
86
86
  const keys = await fetchProjectKeys(bootstrapToken);
87
87
  if (!keys.enterpriseId || !keys.fleetboDBKey) {
88
88
  throw new Error("Received keys from the server are invalid.");
89
89
  }
90
90
 
91
- // Step 4: Configuring the .env file
91
+ // Étape 4 : Configuration du fichier .env
92
92
  console.log(' [4/5] .env file configured successfully.');
93
+ //const envContent = `REACT_APP_FLEETBO_DB_KEY=${keys.fleetboDBKey}\nREACT_APP_ENTERPRISE_ID=${keys.enterpriseId}\n`; //99b426483d543b042209671dd53fb18
93
94
  const envContent = `REACT_APP_FLEETBO_DB_KEY=${keys.fleetboDBKey}\nREACT_APP_ENTERPRISE_ID=99b426483d543b042209671dd53fb18\n`;
94
95
  fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
95
96
 
96
- // Step 5: Installing dependencies
97
+ // Étape 5 : Installation des dépendances
97
98
  console.log(' [5/5] Installing dependencies...');
98
99
  execSync('npm install', { stdio: 'inherit' });
99
100
 
100
- // Customizing package.json
101
+ // Personnalisation du package.json
101
102
  const packageJsonPath = path.join(projectDir, 'package.json');
102
103
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
103
104
  packageJson.name = projectName;
104
105
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8');
105
106
 
106
- console.log('\n Your Fleetbo project is ready!');
107
- console.log(`\nTo get started, run the following commands:`);
107
+ console.log('\n 🚀 Your Fleetbo project is ready !');
108
+ console.log(`\n To get started, run the following commands :`);
108
109
  console.log(` cd ${projectName}`);
109
110
  console.log(` npm start`);
110
111
 
111
112
  } catch (error) {
112
- console.error('\n An error occurred while creating the project:', error.message);
113
- // Cleanup in case of an error
113
+ console.error('\n An error occurred while creating the project :', error.message);
114
+ // Nettoyage en cas d'erreur
114
115
  if (fs.existsSync(projectDir)) {
115
116
  fs.rmSync(projectDir, { recursive: true, force: true });
116
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fleetbo-project",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "Creates a new Fleetbo project.",
5
5
  "main": "install-react-template.js",
6
6
  "bin": {