mirror of
https://github.com/gotson/komga.git
synced 2025-12-08 01:24:31 +01:00
133 lines
3.4 KiB
TypeScript
133 lines
3.4 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
|
|
// Plugins
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import ViteFonts from 'unplugin-fonts/vite'
|
|
import Layouts from 'vite-plugin-vue-layouts-next'
|
|
import Vue from '@vitejs/plugin-vue'
|
|
import VueRouter from 'unplugin-vue-router/vite'
|
|
import { VueRouterAutoImports } from 'unplugin-vue-router'
|
|
import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
|
|
import dir2json from 'vite-plugin-dir2json'
|
|
import UnoCSS from 'unocss/vite'
|
|
|
|
// Utilities
|
|
import { defineConfig } from 'vite'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'
|
|
import * as path from 'path'
|
|
|
|
const dirname =
|
|
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url))
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
VueRouter({
|
|
dts: 'src/typed-router.d.ts',
|
|
}),
|
|
Layouts(),
|
|
AutoImport({
|
|
imports: ['vue', VueRouterAutoImports],
|
|
dts: 'src/auto-imports.d.ts',
|
|
eslintrc: {
|
|
enabled: true,
|
|
},
|
|
vueTemplate: true,
|
|
}),
|
|
Components({
|
|
dts: 'src/components.d.ts',
|
|
dirs: ['src/components', 'src/fragments'],
|
|
globsExclude: ['src/**/*.stories.vue'],
|
|
directoryAsNamespace: true,
|
|
collapseSamePrefixes: true,
|
|
}),
|
|
Vue({
|
|
template: { transformAssetUrls },
|
|
}),
|
|
// https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin#readme
|
|
Vuetify({
|
|
autoImport: true,
|
|
styles: {
|
|
configFile: 'src/styles/settings.scss',
|
|
},
|
|
}),
|
|
ViteFonts({
|
|
fontsource: {
|
|
families: [
|
|
{
|
|
name: 'Roboto',
|
|
weights: [100, 300, 400, 500, 700, 900],
|
|
styles: ['normal', 'italic'],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
dir2json({
|
|
dts: true,
|
|
}),
|
|
UnoCSS(),
|
|
],
|
|
define: { 'process.env': {} },
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
sass: {
|
|
api: 'modern-compiler',
|
|
},
|
|
},
|
|
},
|
|
test: {
|
|
coverage: {
|
|
reporter: ['text', 'json-summary', 'json', 'html'],
|
|
},
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'unit',
|
|
environment: 'happy-dom',
|
|
restoreMocks: true,
|
|
},
|
|
},
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'storybook',
|
|
browser: {
|
|
enabled: true,
|
|
headless: true,
|
|
provider: 'playwright',
|
|
instances: [{ browser: 'chromium' }],
|
|
},
|
|
setupFiles: ['.storybook/vitest.setup.ts'],
|
|
globals: true,
|
|
server: {
|
|
deps: {
|
|
inline: ['vuetify'],
|
|
},
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ['vuetify'],
|
|
},
|
|
plugins: [
|
|
// The plugin will run tests for the stories defined in your Storybook config
|
|
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
storybookTest({
|
|
configDir: path.join(dirname, '.storybook'),
|
|
}),
|
|
],
|
|
},
|
|
],
|
|
},
|
|
})
|