create-fleetbo-project 1.2.102 → 1.2.103
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 +17 -26
- package/package.json +1 -1
|
@@ -111,7 +111,12 @@ function downloadEngine(url, dest) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
async function setupProject() {
|
|
114
|
-
|
|
114
|
+
// LA SOLUTION ANTI-DOUBLE SAUT DE LIGNE (Windows/Mac)
|
|
115
|
+
const logStep = (text) => {
|
|
116
|
+
process.stdout.write(text + '\n');
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
logStep(`\n ⚡ Initializing Fleetbo Frontend for "${projectName}"...`);
|
|
115
120
|
|
|
116
121
|
try {
|
|
117
122
|
if (fs.existsSync(projectDir)) {
|
|
@@ -120,12 +125,13 @@ async function setupProject() {
|
|
|
120
125
|
fs.mkdirSync(projectDir);
|
|
121
126
|
|
|
122
127
|
const frameworkLabel = jsFramework === 'vue' ? 'Vue' : 'React';
|
|
123
|
-
|
|
128
|
+
|
|
129
|
+
logStep(` [1/8] Downloading Fleetbo ${frameworkLabel} Engine...`);
|
|
124
130
|
const archiveUrl = await getArchiveUrl();
|
|
125
131
|
const archivePath = path.join(projectDir, 'engine.tar.gz');
|
|
126
132
|
await downloadEngine(archiveUrl, archivePath);
|
|
127
133
|
|
|
128
|
-
|
|
134
|
+
logStep(' [2/8] Scaffolding project structure...');
|
|
129
135
|
try {
|
|
130
136
|
execSync(`tar -xf "${archivePath}" -C "${projectDir}" --strip-components=1`, { stdio: 'ignore' });
|
|
131
137
|
fs.unlinkSync(archivePath);
|
|
@@ -135,7 +141,7 @@ async function setupProject() {
|
|
|
135
141
|
|
|
136
142
|
process.chdir(projectDir);
|
|
137
143
|
|
|
138
|
-
|
|
144
|
+
logStep(' [3/8] Standardizing Architecture (Vite)...');
|
|
139
145
|
// Pour Vite, on s'assure juste que l'arborescence de base est correcte.
|
|
140
146
|
// On retire les vieux renommages CRA (App.js) pour éviter de casser App.jsx
|
|
141
147
|
const oldPath = path.join(projectDir, 'src/pages');
|
|
@@ -144,43 +150,28 @@ async function setupProject() {
|
|
|
144
150
|
try { fs.renameSync(oldPath, newPath); } catch (err) {}
|
|
145
151
|
}
|
|
146
152
|
|
|
147
|
-
|
|
153
|
+
logStep(' [4/8] Authenticating with Fleetbo Cloud...');
|
|
148
154
|
const keys = await fetchProjectKeys(bootstrapTokenArg);
|
|
149
155
|
if (!keys.enterpriseId) throw new Error("Invalid keys.");
|
|
150
156
|
|
|
151
|
-
|
|
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`;
|
|
157
|
+
logStep(' [5/8] Configuring environment...');
|
|
158
|
+
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
159
|
|
|
159
160
|
fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
|
|
160
161
|
|
|
161
|
-
|
|
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
|
-
`;
|
|
162
|
+
logStep(' [6/8] Securing environment (adding .gitignore)...');
|
|
163
|
+
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
164
|
fs.writeFileSync(path.join(projectDir, '.gitignore'), gitignoreContent, 'utf8');
|
|
174
165
|
|
|
175
166
|
const npmrcContent = `loglevel=silent\nupdate-notifier=false\n`;
|
|
176
167
|
fs.writeFileSync(path.join(projectDir, '.npmrc'), npmrcContent, 'utf8');
|
|
177
168
|
|
|
178
|
-
|
|
169
|
+
logStep(' [7/8] Installing dependencies...');
|
|
179
170
|
execSync('npm install --no-audit --no-fund --silent', { stdio: 'inherit' });
|
|
180
171
|
|
|
181
172
|
execSync('npm install cloudflared --save-dev --no-audit --no-fund --silent', { stdio: 'ignore' });
|
|
182
173
|
|
|
183
|
-
|
|
174
|
+
logStep(' [8/8] Finalizing setup...');
|
|
184
175
|
|
|
185
176
|
// --- 1. CRÉATION DU DOSSIER CACHÉ ET DU SCRIPT RELAI ---
|
|
186
177
|
const fleetboDir = path.join(projectDir, '.fleetbo');
|