6e259d3ded
## Summary - `twenty-shared` is private and never published to npm, so SDK consumers couldn't resolve type imports like `from 'twenty-shared/types'` in the generated `.d.ts` files - Replace `vite.config.sdk.ts` with `rollup-plugin-dts` which compiles `src/sdk/index.ts` directly into a self-contained `dist/sdk/index.d.ts` with all `twenty-shared` types inlined - The JS output from `vite.config.sdk.ts` (`dist/sdk/*.js`) was unused — the main export already maps to `dist/index.mjs` from the node Vite config ## Changes - **Deleted** `vite.config.sdk.ts` — its preserved-module JS output wasn't referenced by any `package.json` export - **Added** `rollup.config.dts.mjs` — uses `rollup-plugin-dts` to compile SDK types from source with `twenty-shared` inlined (~850ms) - **Updated** `project.json` — build/dev/build:sdk targets now use rollup instead of the removed vite config - **Updated** `tsconfig.json` — removed `vite.config.sdk.ts` from include ## Test plan - [ ] Run `npx nx build twenty-sdk` and verify `dist/sdk/index.d.ts` contains no `twenty-shared` references - [ ] Verify `dist/index.mjs` and `dist/index.cjs` are still produced correctly - [ ] Verify CLI (`dist/cli.cjs`) still works - [ ] Verify `npx nx build:sdk twenty-sdk` works standalone Made with [Cursor](https://cursor.com)
27 lines
635 B
JavaScript
27 lines
635 B
JavaScript
import dts from 'rollup-plugin-dts';
|
|
|
|
// Generates a self-contained SDK declaration file directly from source,
|
|
// inlining types from twenty-shared so npm consumers don't need it.
|
|
export default {
|
|
input: 'src/sdk/index.ts',
|
|
output: {
|
|
file: 'dist/sdk/index.d.ts',
|
|
format: 'es',
|
|
},
|
|
external: (id) => {
|
|
if (id === 'twenty-shared' || id.startsWith('twenty-shared/')) {
|
|
return false;
|
|
}
|
|
if (id.startsWith('@/')) {
|
|
return false;
|
|
}
|
|
return !id.startsWith('.') && !id.startsWith('/');
|
|
},
|
|
plugins: [
|
|
dts({
|
|
tsconfig: './tsconfig.lib.json',
|
|
respectExternal: true,
|
|
}),
|
|
],
|
|
};
|