create-fleetbo-project 1.0.40 → 1.0.42
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 +10 -9
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ const projectNameArg = args.find(arg => !arg.startsWith('--'));
|
|
|
19
19
|
const tokenArg = args.find(arg => arg.startsWith('--token='));
|
|
20
20
|
|
|
21
21
|
if (!projectNameArg) {
|
|
22
|
-
console.error('\n
|
|
22
|
+
console.error('\n Error: Please specify a name for your project.');
|
|
23
23
|
console.log(' Usage: npx create-fleetbo-project <project-name> --token=<your-token>');
|
|
24
24
|
process.exit(1);
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ if (!projectNameArg) {
|
|
|
27
27
|
const bootstrapToken = tokenArg ? tokenArg.split('=')[1] : null;
|
|
28
28
|
|
|
29
29
|
if (!bootstrapToken) {
|
|
30
|
-
console.error('\n
|
|
30
|
+
console.error('\n Error: The bootstrap token is missing.');
|
|
31
31
|
console.log(' Usage: npx create-fleetbo-project <project-name> --token=<your-token>');
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
@@ -70,31 +70,31 @@ async function setupProject() {
|
|
|
70
70
|
|
|
71
71
|
try {
|
|
72
72
|
// Step 1: Download the base project structure
|
|
73
|
-
console.log(' [1/5]
|
|
73
|
+
console.log(' [1/5] Initializing project structure...');
|
|
74
74
|
// We redirect stderr to null to hide Git's progress messages
|
|
75
75
|
execSync(`git clone --depth 1 --branch ${branchName} ${repoGitUrl} "${projectName}" 2> /dev/null`);
|
|
76
76
|
|
|
77
77
|
// Step 2: Move into the project directory and clean up
|
|
78
|
-
console.log(' [2/5]
|
|
78
|
+
console.log(' [2/5] Project structure initialized. Configuring...');
|
|
79
79
|
process.chdir(projectDir);
|
|
80
80
|
|
|
81
81
|
// Remove Git history to start with a clean project
|
|
82
82
|
fs.rmSync(path.join(projectDir, '.git'), { recursive: true, force: true });
|
|
83
83
|
|
|
84
84
|
// Step 3: Fetching project keys
|
|
85
|
-
console.log(' [3/5]
|
|
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
91
|
// Step 4: Configuring the .env file
|
|
92
|
-
console.log(' [4/5]
|
|
92
|
+
console.log(' [4/5] .env file configured successfully.');
|
|
93
93
|
const envContent = `REACT_APP_FLEETBO_DB_KEY=${keys.fleetboDBKey}\nREACT_APP_ENTERPRISE_ID=99b426483d543b042209671dd53fb18\n`;
|
|
94
94
|
fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
|
|
95
95
|
|
|
96
96
|
// Step 5: Installing dependencies
|
|
97
|
-
console.log(' [5/5]
|
|
97
|
+
console.log(' [5/5] Installing dependencies...');
|
|
98
98
|
execSync('npm install', { stdio: 'inherit' });
|
|
99
99
|
|
|
100
100
|
// Customizing package.json
|
|
@@ -103,13 +103,13 @@ async function setupProject() {
|
|
|
103
103
|
packageJson.name = projectName;
|
|
104
104
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8');
|
|
105
105
|
|
|
106
|
-
console.log('\n
|
|
106
|
+
console.log('\n Your Fleetbo project is ready!');
|
|
107
107
|
console.log(`\nTo get started, run the following commands:`);
|
|
108
108
|
console.log(` cd ${projectName}`);
|
|
109
109
|
console.log(` npm start`);
|
|
110
110
|
|
|
111
111
|
} catch (error) {
|
|
112
|
-
console.error('\n
|
|
112
|
+
console.error('\n An error occurred while creating the project:', error.message);
|
|
113
113
|
// Cleanup in case of an error
|
|
114
114
|
if (fs.existsSync(projectDir)) {
|
|
115
115
|
fs.rmSync(projectDir, { recursive: true, force: true });
|
|
@@ -118,3 +118,4 @@ async function setupProject() {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
setupProject();
|
|
121
|
+
|