2023-07-28 00:51:07 -07:00
|
|
|
import vue from '@vitejs/plugin-vue';
|
2022-04-29 06:23:41 -07:00
|
|
|
import { resolve } from 'path';
|
2022-10-25 04:46:25 -07:00
|
|
|
import { defineConfig, mergeConfig } from 'vite';
|
2023-11-07 05:19:39 -08:00
|
|
|
import { type UserConfig } from 'vitest';
|
2022-10-25 04:46:25 -07:00
|
|
|
import { defineConfig as defineVitestConfig } from 'vitest/config';
|
2024-07-23 03:30:29 -07:00
|
|
|
import components from 'unplugin-vue-components/vite';
|
|
|
|
import icons from 'unplugin-icons/vite';
|
|
|
|
import iconsResolver from 'unplugin-icons/resolver';
|
2022-04-29 06:23:41 -07:00
|
|
|
|
2023-11-07 05:19:39 -08:00
|
|
|
export const vitestConfig = defineVitestConfig({
|
|
|
|
test: {
|
2023-11-28 03:15:08 -08:00
|
|
|
silent: true,
|
2023-11-07 05:19:39 -08:00
|
|
|
globals: true,
|
|
|
|
environment: 'jsdom',
|
|
|
|
setupFiles: ['./src/__tests__/setup.ts'],
|
|
|
|
...(process.env.COVERAGE_ENABLED === 'true'
|
|
|
|
? {
|
|
|
|
coverage: {
|
2023-11-07 06:59:25 -08:00
|
|
|
enabled: true,
|
2023-11-07 05:19:39 -08:00
|
|
|
provider: 'v8',
|
2024-01-09 07:18:20 -08:00
|
|
|
reporter: process.env.CI === 'true' ? 'cobertura' : 'text-summary',
|
2023-11-07 05:19:39 -08:00
|
|
|
all: true,
|
|
|
|
},
|
2024-06-13 07:46:25 -07:00
|
|
|
}
|
2023-11-07 05:19:39 -08:00
|
|
|
: {}),
|
|
|
|
css: {
|
|
|
|
modules: {
|
|
|
|
classNameStrategy: 'non-scoped',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}) as UserConfig;
|
2023-03-14 05:13:21 -07:00
|
|
|
|
2022-10-25 04:46:25 -07:00
|
|
|
export default mergeConfig(
|
|
|
|
defineConfig({
|
2024-07-23 03:30:29 -07:00
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
icons({
|
|
|
|
compiler: 'vue3',
|
|
|
|
autoInstall: true,
|
|
|
|
}),
|
|
|
|
components({
|
|
|
|
dirs: [],
|
|
|
|
dts: false,
|
|
|
|
resolvers: [
|
|
|
|
iconsResolver({
|
|
|
|
prefix: 'icon'
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
],
|
2022-10-25 04:46:25 -07:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': resolve(__dirname, 'src'),
|
2023-07-28 00:51:07 -07:00
|
|
|
'n8n-design-system': resolve(__dirname, 'src'),
|
2024-03-13 08:52:29 -07:00
|
|
|
lodash: 'lodash-es',
|
2022-10-25 04:46:25 -07:00
|
|
|
},
|
2022-04-29 06:23:41 -07:00
|
|
|
},
|
2022-10-25 04:46:25 -07:00
|
|
|
build: {
|
|
|
|
lib: {
|
2023-04-06 06:32:45 -07:00
|
|
|
entry: resolve(__dirname, 'src', 'main.ts'),
|
2022-10-25 04:46:25 -07:00
|
|
|
name: 'N8nDesignSystem',
|
|
|
|
fileName: (format) => `n8n-design-system.${format}.js`,
|
|
|
|
},
|
|
|
|
rollupOptions: {
|
|
|
|
// make sure to externalize deps that shouldn't be bundled
|
|
|
|
// into your library
|
|
|
|
external: ['vue'],
|
|
|
|
output: {
|
|
|
|
exports: 'named',
|
|
|
|
// Provide global variables to use in the UMD build
|
|
|
|
// for externalized deps
|
|
|
|
globals: {
|
|
|
|
vue: 'Vue',
|
|
|
|
},
|
2022-04-29 06:23:41 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-10-25 04:46:25 -07:00
|
|
|
}),
|
2023-11-07 05:19:39 -08:00
|
|
|
vitestConfig,
|
2022-10-25 04:46:25 -07:00
|
|
|
);
|