Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s
164 lines
4.7 KiB
TypeScript
164 lines
4.7 KiB
TypeScript
import react from '@vitejs/plugin-react-swc';
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
import { defineConfig } from 'vite';
|
|
import checker from 'vite-plugin-checker';
|
|
import dts, { type PluginOptions } from 'vite-plugin-dts';
|
|
import sassDts from 'vite-plugin-sass-dts';
|
|
import svgr from 'vite-plugin-svgr';
|
|
|
|
type Checkers = Parameters<typeof checker>[0];
|
|
|
|
import { THEME_CSS_FILE_NAME_BY_SCHEME } from './design-tokens/themeCssFileNameByScheme';
|
|
import packageJson from './package.json';
|
|
import { isDefined } from './src/utilities/utils/isDefined';
|
|
|
|
const isVitest = isDefined(process.env.VITEST);
|
|
|
|
const entries = Object.fromEntries(
|
|
Object.keys(packageJson.exports)
|
|
.filter((subpath) => !subpath.endsWith('.css'))
|
|
.map((subpath) => [
|
|
subpath === '.' ? 'index' : subpath.slice(2),
|
|
`src/${subpath}/index.ts`,
|
|
]),
|
|
);
|
|
|
|
export default defineConfig(({ command }) => {
|
|
const isBuildCommand = command === 'build';
|
|
|
|
const tsConfigPath = isBuildCommand
|
|
? path.resolve(__dirname, './tsconfig.lib.json')
|
|
: path.resolve(__dirname, './tsconfig.json');
|
|
|
|
const checkersConfig: Checkers = {
|
|
typescript: {
|
|
tsconfigPath: tsConfigPath,
|
|
},
|
|
};
|
|
|
|
const dtsConfig: PluginOptions = {
|
|
entryRoot: 'src',
|
|
tsconfigPath: tsConfigPath,
|
|
};
|
|
|
|
const BUNDLED_DEPS: string[] = [];
|
|
|
|
const externalDeps = Object.keys({
|
|
...(packageJson.dependencies || {}),
|
|
...(packageJson.peerDependencies || {}),
|
|
}).filter((dep) => !BUNDLED_DEPS.includes(dep));
|
|
|
|
return {
|
|
resolve: {
|
|
tsconfigPaths: true,
|
|
alias: {
|
|
'@ui/': path.resolve(__dirname, 'src') + '/',
|
|
'@assets/': path.resolve(__dirname, 'src/assets') + '/',
|
|
'@styles/': path.resolve(__dirname, 'src/styles') + '/',
|
|
},
|
|
},
|
|
css: {
|
|
modules: {
|
|
localsConvention: 'camelCaseOnly',
|
|
},
|
|
preprocessorOptions: {
|
|
scss: {
|
|
api: 'modern-compiler',
|
|
loadPaths: [path.resolve(__dirname, 'src/styles')],
|
|
additionalData: [
|
|
`@use 'abstracts/functions' as *;`,
|
|
`@use 'abstracts/mixins' as *;`,
|
|
`@use 'abstracts/breakpoints' as *;`,
|
|
'',
|
|
].join('\n'),
|
|
},
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
// Pre-bundle React and Jotai so Vite's dep optimizer doesn't re-bundle them
|
|
// mid-run during browser-mode Storybook tests — re-bundling rotates the
|
|
// optimized chunk hash and 404s in-flight dynamic imports (vite 8 / rolldown).
|
|
include: [
|
|
'@base-ui/utils/store',
|
|
'react',
|
|
'react-dom',
|
|
'react-dom/client',
|
|
'react/jsx-runtime',
|
|
'react/jsx-dev-runtime',
|
|
],
|
|
},
|
|
root: __dirname,
|
|
cacheDir: 'node_modules/.vite',
|
|
assetsInclude: ['src/**/*.svg'],
|
|
plugins: [
|
|
react(),
|
|
svgr(),
|
|
// Generates typed *.module.scss.d.ts siblings (dev mode only — backed by
|
|
// sass-embedded). CI/build relies on the ambient src/scss-modules.d.ts.
|
|
sassDts({ esmExport: true, legacyFileFormat: true }),
|
|
dts(dtsConfig),
|
|
...(isVitest ? [] : [checker(checkersConfig)]),
|
|
{
|
|
name: 'copy-theme-css',
|
|
apply: 'build',
|
|
closeBundle() {
|
|
const distDir = path.resolve(__dirname, 'dist');
|
|
fs.mkdirSync(distDir, { recursive: true });
|
|
for (const file of Object.values(THEME_CSS_FILE_NAME_BY_SCHEME)) {
|
|
fs.copyFileSync(
|
|
path.resolve(__dirname, `src/theme-constants/${file}`),
|
|
path.resolve(distDir, file),
|
|
);
|
|
}
|
|
},
|
|
},
|
|
],
|
|
build: {
|
|
cssCodeSplit: false,
|
|
minify: 'esbuild',
|
|
sourcemap: false,
|
|
emptyOutDir: false,
|
|
outDir: './dist',
|
|
reportCompressedSize: true,
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
interopDefault: true,
|
|
defaultIsModuleExports: true,
|
|
requireReturnsDefault: 'auto',
|
|
},
|
|
lib: {
|
|
entry: entries,
|
|
name: 'twenty-ui',
|
|
},
|
|
rollupOptions: {
|
|
external: (id: string) =>
|
|
externalDeps.some((dep) => id === dep || id.startsWith(dep + '/')),
|
|
output: [
|
|
{
|
|
assetFileNames: 'style.css',
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
},
|
|
format: 'es',
|
|
entryFileNames: '[name].mjs',
|
|
},
|
|
{
|
|
assetFileNames: 'style.css',
|
|
format: 'cjs',
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
},
|
|
esModule: true,
|
|
exports: 'named',
|
|
entryFileNames: '[name].cjs',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
logLevel: 'error',
|
|
};
|
|
});
|