mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
refs https://github.com/TryGhost/Product/issues/4105 --- <!-- Leave the line below if you'd like GitHub Copilot to generate a summary from your commit --> <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 2edba98</samp> This pull request introduces a new monorepo package called `admin-x-design`, which contains components, design guidelines and documentation for building apps in Ghost Admin. It also moves some existing components and files from the deprecated `admin-x-settings` package to the new `admin-x-design` package, and updates some styles and rules to use TailwindCSS. The purpose of these changes is to improve the consistency, maintainability and usability of the Ghost Admin UI.
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import react from '@vitejs/plugin-react';
|
|
import glob from 'glob';
|
|
import {resolve} from 'path';
|
|
import svgr from 'vite-plugin-svgr';
|
|
import {defineConfig} from 'vitest/config';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default (function viteConfig() {
|
|
return defineConfig({
|
|
plugins: [
|
|
svgr(),
|
|
react()
|
|
],
|
|
define: {
|
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
'process.env.VITEST_SEGFAULT_RETRY': 3
|
|
},
|
|
preview: {
|
|
port: 4174
|
|
},
|
|
build: {
|
|
minify: false,
|
|
sourcemap: true,
|
|
outDir: 'es',
|
|
lib: {
|
|
formats: ['es'],
|
|
entry: glob.sync(resolve(__dirname, 'src/**/*.{ts,tsx}')).reduce((entries, path) => {
|
|
if (path.includes('.stories.') || path.endsWith('.d.ts')) {
|
|
return entries;
|
|
}
|
|
|
|
const outPath = path.replace(resolve(__dirname, 'src') + '/', '').replace(/\.(ts|tsx)$/, '');
|
|
entries[outPath] = path;
|
|
return entries;
|
|
}, {} as Record<string, string>)
|
|
},
|
|
commonjsOptions: {
|
|
include: [/packages/, /node_modules/]
|
|
},
|
|
rollupOptions: {
|
|
external: (source) => {
|
|
if (source.startsWith('.')) {
|
|
return false;
|
|
}
|
|
|
|
if (source.includes('node_modules')) {
|
|
return true;
|
|
}
|
|
|
|
return !source.includes(__dirname);
|
|
}
|
|
}
|
|
},
|
|
test: {
|
|
globals: true, // required for @testing-library/jest-dom extensions
|
|
environment: 'jsdom',
|
|
include: ['./test/unit/**/*'],
|
|
testTimeout: process.env.TIMEOUT ? parseInt(process.env.TIMEOUT) : 10000,
|
|
...(process.env.CI && { // https://github.com/vitest-dev/vitest/issues/1674
|
|
minThreads: 1,
|
|
maxThreads: 2
|
|
})
|
|
}
|
|
});
|
|
});
|