2023-11-04 01:09:20 +03:00
|
|
|
import { defineConfig } from "tsup";
|
2023-11-10 20:25:14 +03:00
|
|
|
import svgr from 'esbuild-plugin-svgr'
|
2023-11-04 01:09:20 +03:00
|
|
|
|
|
|
|
export default defineConfig([
|
|
|
|
{
|
|
|
|
entry: {"index": './tsup.ui.index.tsx'},
|
|
|
|
treeshake: true,
|
|
|
|
minify: true,
|
|
|
|
verbose: true,
|
|
|
|
dts: true,
|
|
|
|
clean: true,
|
2023-12-13 18:40:31 +03:00
|
|
|
outDir: "../twenty-docs/src/ui/generated",
|
2023-11-10 20:25:14 +03:00
|
|
|
esbuildPlugins: [svgr({ template })],
|
2023-11-04 01:09:20 +03:00
|
|
|
},
|
2023-11-10 20:25:14 +03:00
|
|
|
]);
|
|
|
|
|
|
|
|
function template(variables, { tpl }) {
|
|
|
|
return tpl`
|
|
|
|
${variables.imports};
|
|
|
|
${variables.interfaces};
|
|
|
|
const ${variables.componentName} = (${variables.props}) => (
|
|
|
|
${variables.jsx}
|
|
|
|
);
|
|
|
|
${variables.exports};
|
|
|
|
export const ReactComponent = ${variables.componentName};
|
|
|
|
`;
|
|
|
|
};
|