## Summary This PR fixes the `tsconfig` setup in `twenty-front` so that `tsgo -p tsconfig.json` properly type-checks all files. ### Root Cause The previous setup used TypeScript project references with `files: []` in the main `tsconfig.json`. When running `tsgo -p tsconfig.json`, this checks nothing because `tsgo` requires the `-b` (build) flag for project references, but the configs weren't set up for composite mode. ### Changes **Simplified tsconfig architecture (4 files → 2):** - `tsconfig.json` - All files (dev, tests, stories) for typecheck/IDE/lint - `tsconfig.build.json` - Production files only (excludes tests/stories) **Removed redundant configs:** - `tsconfig.dev.json` - `tsconfig.spec.json` - `tsconfig.storybook.json` **Updated references:** - `jest.config.mjs` → uses `tsconfig.json` - `eslint.config.mjs` → uses `tsconfig.json` - `vite.config.ts` → uses `tsconfig.json` for dev **Type fixes (pre-existing errors revealed by proper typechecking):** - Made `applicationId` optional in `FieldMetadataItem` and `ObjectMetadataItem` - Added missing `navigationMenuItem` translation - Added `objectLabelSingular` to Search GraphQL query - Fixed `sortMorphItems.test.ts` mock data ## Test plan - [ ] Run `npx nx typecheck twenty-front` - should pass - [ ] Run `npx nx lint twenty-front` - should work - [ ] Run `npx nx test twenty-front` - should work - [ ] Run `npx nx build twenty-front` - should work - [ ] Verify IDE type checking works correctly
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import { lingui } from '@lingui/vite-plugin';
|
|
import react from '@vitejs/plugin-react-swc';
|
|
import * as path from 'path';
|
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
|
import { defineConfig } from 'vite';
|
|
import dts from 'vite-plugin-dts';
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
|
|
export default defineConfig({
|
|
root: __dirname,
|
|
cacheDir: '../../node_modules/.vite/packages/twenty-emails',
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@/': path.resolve(__dirname, 'src') + '/',
|
|
'src/': path.resolve(__dirname, 'src') + '/',
|
|
},
|
|
},
|
|
|
|
plugins: [
|
|
react({
|
|
plugins: [['@lingui/swc-plugin', {}]],
|
|
}),
|
|
lingui({
|
|
configPath: path.resolve(__dirname, './lingui.config.ts'),
|
|
}),
|
|
tsconfigPaths({
|
|
root: __dirname
|
|
}),
|
|
dts({
|
|
entryRoot: 'src',
|
|
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
}),
|
|
],
|
|
|
|
// Configuration for building your library.
|
|
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
build: {
|
|
outDir: './dist',
|
|
reportCompressedSize: true,
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
},
|
|
lib: {
|
|
entry: {
|
|
index: 'src/index.ts',
|
|
...Object.values(APP_LOCALES).reduce(
|
|
(acc, locale) => ({
|
|
...acc,
|
|
[`locales/generated/${locale}`]: `src/locales/generated/${locale}.ts`,
|
|
}),
|
|
{},
|
|
),
|
|
},
|
|
name: 'twenty-emails',
|
|
formats: ['es', 'cjs'],
|
|
},
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
},
|
|
},
|
|
});
|