fleetbo-cockpit-cli 1.0.184 → 1.0.185

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.
Files changed (2) hide show
  1. package/cli.js +7 -10
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -142,15 +142,12 @@ const injectRouteIntoAppJs = (moduleName, subPath = '') => {
142
142
  }
143
143
 
144
144
  const cleanSubPath = subPath ? `${subPath}/` : '';
145
- let importLine, routeLine;
146
-
145
+ // 🟢 IMPORT UNIFIÉ — Vite résout l'extension automatiquement (React & Vue)
146
+ const importLine = `import ${moduleName} from './app/${cleanSubPath}${moduleName}';`;
147
+ let routeLine;
147
148
  if (JS_FRAMEWORK === 'vue') {
148
- // 🟢 SYNTAXE VUE
149
- importLine = `import ${moduleName} from './app/${cleanSubPath}${moduleName}.vue';`;
150
149
  routeLine = `{ path: '/${cleanSubPath}${moduleName.toLowerCase()}', component: ${moduleName} },`;
151
150
  } else {
152
- // 🔵 SYNTAXE REACT
153
- importLine = `import ${moduleName} from './app/${cleanSubPath}${moduleName}';`;
154
151
  routeLine = `<Route path="/${cleanSubPath}${moduleName.toLowerCase()}" element={<${moduleName} />} />`;
155
152
  }
156
153
 
@@ -251,12 +248,12 @@ const removeRouteFromAppJs = (moduleName) => {
251
248
 
252
249
  let content = fs.readFileSync(targetFile, 'utf8');
253
250
 
254
- let importLine, routeLine;
251
+ // 🟢 IMPORT UNIFIÉ — Vite résout l'extension automatiquement (React & Vue)
252
+ const importLine = `import ${moduleName} from './app/mocks/${moduleName}';`;
253
+ let routeLine;
255
254
  if (JS_FRAMEWORK === 'vue') {
256
- importLine = `import ${moduleName} from './app/mocks/${moduleName}.vue';`;
257
255
  routeLine = `{ path: '/mocks/${moduleName.toLowerCase()}', component: ${moduleName} },`;
258
256
  } else {
259
- importLine = `import ${moduleName} from './app/mocks/${moduleName}';`;
260
257
  routeLine = `<Route path="/mocks/${moduleName.toLowerCase()}" element={<${moduleName} />} />`;
261
258
  }
262
259
 
@@ -496,7 +493,7 @@ if (command === 'alex') {
496
493
  }
497
494
 
498
495
  if (mockCode && mockFileName) {
499
- const pageName = mockFileName.replace('.jsx', '');
496
+ const pageName = mockFileName.replace(/\.(jsx|vue)$/, '');
500
497
  writeFile('src/app/mocks/', mockFileName, mockCode);
501
498
  const injected = injectRouteIntoAppJs(pageName, 'mocks');
502
499
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.184",
3
+ "version": "1.0.185",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",