forked from webgptorg/promptbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
31 lines (29 loc) · 992 Bytes
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import typescript from '@rollup/plugin-typescript';
import { readdirSync } from 'fs';
import { join } from 'path';
export const packageNames = readdirSync(join(__dirname, 'src/_packages'), { recursive: false, withFileTypes: true })
.filter((dirent) => dirent.isFile())
.filter((dirent) => dirent.name.endsWith('.index.ts'))
.map((dirent) => dirent.name.split('.').shift());
export default packageNames.map((name) => ({
input: `./src/_packages/${name}.index.ts`,
output: [
{
file: `./packages/${name}/umd/index.umd.js`,
name: `promptbook-${name}`,
format: 'umd',
sourcemap: true,
},
{
file: `./packages/${name}/esm/index.es.js`,
format: 'es',
sourcemap: true,
},
],
plugins: [
typescript({
tsconfig: './tsconfig.json',
// <- Note: This is essential propper type declaration generation
}),
],
}));