jan/joi/rollup.config.mjs
hiento09 bd0e525d66
chore: upgrade to turbo v2 and reduce ci quality gate runtime (#4324)
* chore: upgrade to turbo v2 and reduce ci quality gate runtime

* chore: upgrade to yarn v4 and deprecate turborepo

* chore: reconfigure modules and fix tests

* chore: switch to github-hosted runner

* fix: dependency resolving

* chore: clean redundant step

* chore: headless test

* chore: remove headed param

* fix: resolve dependency version

* fix: ubuntu no-sandbox test

---------

Co-authored-by: Hien To <tominhhien97@gmail.com>
Co-authored-by: Louis <louis@jan.ai>
2024-12-29 17:46:15 +07:00

81 lines
2.0 KiB
JavaScript

import { readFileSync } from 'fs'
import dts from 'rollup-plugin-dts'
import terser from '@rollup/plugin-terser'
import autoprefixer from 'autoprefixer'
import commonjs from 'rollup-plugin-commonjs'
import bundleSize from 'rollup-plugin-bundle-size'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'
import typescript from 'rollup-plugin-typescript2'
import tailwindcss from 'tailwindcss'
import typescriptEngine from 'typescript'
import resolve from '@rollup/plugin-node-resolve'
import copy from 'rollup-plugin-copy'
import sass from 'rollup-plugin-sass'
const packageJson = JSON.parse(readFileSync('./package.json'))
import tailwindConfig from './tailwind.config.js'
export default [
{
input: `./src/index.ts`,
output: [
{
file: packageJson.main,
format: 'es',
exports: 'named',
sourcemap: false,
},
],
external: ['react', 'typescript', 'class-variance-authority'],
plugins: [
postcss({
plugins: [autoprefixer(), tailwindcss(tailwindConfig)],
sourceMap: true,
use: {
sass: {
silenceDeprecations: ['legacy-js-api'],
},
},
minimize: true,
extract: 'main.css',
}),
peerDepsExternal({ includeDependencies: true }),
commonjs(),
resolve(),
typescript({
tsconfig: './tsconfig.json',
typescript: typescriptEngine,
sourceMap: false,
exclude: [
'docs',
'dist',
'node_modules/**',
'**/*.test.ts',
'**/*.test.tsx',
],
}),
terser(),
sass(),
],
watch: {
clearScreen: false,
},
},
{
input: 'dist/esm/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
external: [/\.(sc|sa|c)ss$/],
plugins: [
dts(),
peerDepsExternal({ includeDependencies: true }),
copy({
targets: [{ src: 'dist/esm/main.css', dest: 'dist' }],
}),
bundleSize(),
],
},
]