fleetbo-cockpit-cli 1.0.185 → 1.0.186
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/cli.js +5 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -248,8 +248,6 @@ const removeRouteFromAppJs = (moduleName) => {
|
|
|
248
248
|
|
|
249
249
|
let content = fs.readFileSync(targetFile, 'utf8');
|
|
250
250
|
|
|
251
|
-
// 🟢 IMPORT UNIFIÉ — Vite résout l'extension automatiquement (React & Vue)
|
|
252
|
-
const importLine = `import ${moduleName} from './app/mocks/${moduleName}';`;
|
|
253
251
|
let routeLine;
|
|
254
252
|
if (JS_FRAMEWORK === 'vue') {
|
|
255
253
|
routeLine = `{ path: '/mocks/${moduleName.toLowerCase()}', component: ${moduleName} },`;
|
|
@@ -259,7 +257,11 @@ const removeRouteFromAppJs = (moduleName) => {
|
|
|
259
257
|
|
|
260
258
|
const originalContent = content;
|
|
261
259
|
|
|
262
|
-
|
|
260
|
+
// 🟢 REGEX INTELLIGENTE — supprime l'import peu importe l'extension (.vue, .jsx, ou aucune)
|
|
261
|
+
const importRegex = new RegExp(
|
|
262
|
+
`import\\s+${moduleName}\\s+from\\s+['"]\\./app/mocks/${moduleName}(?:\\.jsx|\\.vue)?['"];?\\n?`,
|
|
263
|
+
'g'
|
|
264
|
+
);
|
|
263
265
|
content = content.replace(importRegex, '');
|
|
264
266
|
|
|
265
267
|
const routeRegex = new RegExp(`\\n?\\s*${routeLine.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`, 'g');
|