Remove vue-router from stackblitz

pull/5880/head
tugcekucukoglu 2024-06-13 12:12:07 +03:00
parent c26a00303c
commit 011e329f3d
1 changed files with 3 additions and 47 deletions

View File

@ -11,7 +11,6 @@ const app_dependencies = pkg ? pkg.devDependencies : {};
const core_dependencies = { const core_dependencies = {
vue: '^3.2.45', vue: '^3.2.45',
'vue-router': '^4.1.6',
'@vitejs/plugin-vue': '^4.0.0', '@vitejs/plugin-vue': '^4.0.0',
vite: '^4.0.0', vite: '^4.0.0',
primevue: PrimeVue.version || 'latest', primevue: PrimeVue.version || 'latest',
@ -31,17 +30,10 @@ const getVueApp = (props = {}, sourceType) => {
const fileExtension = '.vue'; const fileExtension = '.vue';
const mainFileName = 'App'; const mainFileName = 'App';
const sourceFileName = `${path}${mainFileName}${fileExtension}`; const sourceFileName = `${path}${mainFileName}${fileExtension}`;
let extFilesSource = extFiles ? extFiles[sourceType.language] : {};
let element = '', let element = '',
imports = '', imports = '',
themeSwitchCode = '', themeSwitchCode = '';
routeFiles = {};
sources.routeFiles &&
Object.entries(sources.routeFiles).forEach(([key, value]) => {
routeFiles[`${path + key}`] = {
content: value
};
});
if (deps !== null && component !== null) { if (deps !== null && component !== null) {
imports += `import ${component} from 'primevue/${component.toLowerCase()}'; imports += `import ${component} from 'primevue/${component.toLowerCase()}';
@ -136,7 +128,6 @@ import PrimeVue from "primevue/config";
import AppState from './plugins/appState.js'; import AppState from './plugins/appState.js';
import Noir from './presets/Noir.js'; import Noir from './presets/Noir.js';
import ThemeSwitcher from './components/ThemeSwitcher.vue'; import ThemeSwitcher from './components/ThemeSwitcher.vue';
import { router } from "./router";
import AutoComplete from 'primevue/autocomplete'; import AutoComplete from 'primevue/autocomplete';
import Accordion from 'primevue/accordion'; import Accordion from 'primevue/accordion';
import AccordionPanel from 'primevue/accordionpanel'; import AccordionPanel from 'primevue/accordionpanel';
@ -274,7 +265,6 @@ app.use(AppState);
app.use(ConfirmationService); app.use(ConfirmationService);
app.use(ToastService); app.use(ToastService);
app.use(DialogService); app.use(DialogService);
app.use(router);
app.directive('tooltip', Tooltip); app.directive('tooltip', Tooltip);
app.directive('badge', BadgeDirective); app.directive('badge', BadgeDirective);
@ -1133,15 +1123,6 @@ export default {
[`${path}flags.css`]: { [`${path}flags.css`]: {
content: staticStyles.flags content: staticStyles.flags
}, },
[`${path}router.js`]: {
content: `import { createRouter, createWebHistory } from "vue-router";
import ${mainFileName} from "./${mainFileName}${fileExtension}";
export const router = createRouter({
history: createWebHistory(),
routes: [{ path: "/", component: ${mainFileName} }]
});`
},
[`${sourceFileName}`]: { [`${sourceFileName}`]: {
content: themeSwitchCode content: themeSwitchCode
}, },
@ -1173,34 +1154,9 @@ export const router = createRouter({
</g> </g>
</svg>` </svg>`
}, },
...routeFiles, ...extFilesSource
...extFiles
}; };
if (extPages && extPages.length >= 1) {
let routePaths = '';
let viewImports = '';
extPages.forEach((page, index) => {
let compPath = page.tabName.replace('Demo', '').toLowerCase();
routePaths += `{ path: "/${index === 0 ? '' : compPath}", component: ${page.tabName} },\n`;
viewImports += `import ${page.tabName} from "./components/${page.tabName}${fileExtension}";\n`;
files[`${path}components/${page.tabName}${fileExtension}`] = {
content: page.content
};
});
files[`${path}router.js`] = {
content: `import { createRouter, createWebHistory } from "vue-router";
${viewImports}
export const router = createRouter({
history: createWebHistory(),
routes: [ ${routePaths}]
});`
};
}
if (service) { if (service) {
service.forEach((name) => { service.forEach((name) => {
files[`${path}service/${name}.js`] = { files[`${path}service/${name}.js`] = {