Files
nextcloud-autocurrency/vite.config.ts
Chen Asraf effe1a327d chore: improve CI/CD, testing infrastructure, and development tooling
- Add GitHub Actions workflows for PHPUnit testing (MySQL and
PostgreSQL)
- Add issue templates (bug reports, feature requests) for better issue
management
- Enhance Makefile with Docker test support and improved build targets
- Update lint-staged configuration with better PHP and JSON handling
- Add comprehensive PHPUnit test infrastructure with Docker support
- Update dependencies and add lock files for composer and vendor-bin
tools
- Improve code scaffolding templates (command, component, view
generators)
- Update build configuration (Vite, package.json, pnpm-lock.yaml)
- Refactor Application.php settings initialization
- Update AdminSettings and UserSettings implementations
- Rename test file for consistency (ApiTest → ApiControllerTest)
- Update .gitignore (track composer.lock, ignore stats.html)
2025-11-23 00:52:22 +02:00

110 lines
2.7 KiB
TypeScript

import { createAppConfig } from '@nextcloud/vite-config'
import path from 'path'
import { visualizer } from 'rollup-plugin-visualizer'
import checker from 'vite-plugin-checker'
const manualChunksList = [
'emoji-mart-vue-fast',
'date-fns',
'lodash',
'floating-vue',
'vue-material-design-icons',
]
const manualChunksGroups = {
vue: ['vue-router', 'vue'],
}
const nextcloudSharedList = [
'auth',
'axios',
'browser-storage',
'capabilities',
'event-bus',
'files',
'initial-state',
'l10n',
'logger',
'paths',
'router',
'sharing',
]
// https://vite.dev/config/
export default createAppConfig(
{
admin: path.resolve(path.join('src', 'admin.ts')),
user: path.resolve(path.join('src', 'user.ts')),
},
{
config: {
root: 'src',
resolve: {
alias: {
'@icons': path.resolve(__dirname, 'node_modules/vue-material-design-icons'),
'@': path.resolve(__dirname, 'src'),
},
},
plugins: [
checker({
vueTsc: true,
}),
visualizer({
open: process.env.VITE_BUILD_ANALYZE === 'true',
filename: 'stats.html',
template: 'treemap',
}),
],
build: {
outDir: '../dist',
manifest: true,
cssCodeSplit: false,
rollupOptions: {
output: {
entryFileNames: 'js/[name]-[hash].mjs',
chunkFileNames: 'js/[name]-[hash].mjs',
assetFileNames: '[ext]/[name]-[hash].[ext]',
manualChunks(id) {
if (!id.includes('node_modules')) {
return
}
// Parse package path
const parts = id.split('node_modules/')
const pkgPath = parts[parts.length - 1]
// Check for @nextcloud/xxx or nextcloud-xxx
const ncMatch = pkgPath.match(/^@?nextcloud[/-]([^/]+)/)
// Get the package name (e.g., 'auth', 'vue', 'axios')
const ncPkgName = ncMatch?.[1]
if (ncPkgName) {
if (nextcloudSharedList.includes(ncPkgName)) {
return 'nextcloud-common'
}
return `nextcloud-${ncPkgName}`
}
for (const chunk of manualChunksList) {
if (pkgPath.includes(chunk)) {
return chunk
}
}
for (const [groupName, groupPackages] of Object.entries(manualChunksGroups)) {
if (groupPackages.some((pkg) => pkgPath.includes(pkg))) {
return groupName
}
}
// Fallback
return 'vendor'
},
},
},
},
},
},
)