import pkg from '../../../package.json'; import { services } from './services'; const PrimeVue = { version: '^3.38.0', description: 'PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, which has 400+ ready to use UI blocks to build spectacular applications in no time.' }; const app_dependencies = pkg ? pkg.devDependencies : {}; const core_dependencies = { vue: '^3.2.45', 'vue-router': '^4.1.6', '@vitejs/plugin-vue': '^4.0.0', vite: '^4.0.0', primevue: PrimeVue.version || 'latest', primeicons: app_dependencies['primeicons'] || 'latest' }; // create-vue -> https://github.com/vuejs/create-vue const getVueApp = (props = {}, sourceType) => { const path = 'src/'; const { code: sources, title = 'primevue_demo', description = '', service, extPages, dependencies: deps, component, extFiles, embedded } = props; const dependencies = { ...core_dependencies, ...deps }; const fileExtension = '.vue'; const mainFileName = 'App'; const sourceFileName = `${path}${mainFileName}${fileExtension}`; let element = '', imports = '', unstyled = '', pvTheme = '', themeSwitchCode = '', routeFiles = {}; sources.routeFiles && Object.entries(sources.routeFiles).forEach(([key, value]) => { routeFiles[`${path + key}`] = { content: value }; }); let extFilesSource = extFiles ? embedded ? extFiles['composition'] : extFiles[sourceType.language] ? { ...extFiles[sourceType.language] } : Object.keys(extFiles) .filter((k) => !sourceTypes.includes(k)) .reduce((result, current) => (result[current] = extFiles[current]) && result, {}) : {}; if (deps !== null && component !== null) { imports += `import ${component} from 'primevue/${component.toLowerCase()}'; `; element += `app.component('${component}', ${component}); `; } if (embedded) { // main.js unstyled += `, unstyled: true, pt: Tailwind, ptOptions: { mergeProps: true }`; imports += `import Tailwind from 'primevue/passthrough/tailwind'; import ThemeSwitcher from './components/ThemeSwitcher.vue';`; element += `app.component('ThemeSwitcher', ThemeSwitcher);`; // package.json dependencies['tailwindcss'] = '^3.3.2'; dependencies['postcss'] = '^8.4.27'; dependencies['autoprefixer'] = '^10.4.14'; // App.vue themeSwitchCode = ''.concat( `