forked from arcanis/clipanion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
45 lines (43 loc) · 1.06 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import ts from '@rollup/plugin-typescript';
import path from 'path';
import copy from 'rollup-plugin-copy';
import multiInput from 'rollup-plugin-multi-input';
// Since we're using `multiInput`, the entries output path are already set.
// We only need to define the extension we want to give to the file.
const entryFileNames = ext => ({name}) => `${path.basename(name)}${ext}`;
// eslint-disable-next-line arca/no-default-export
export default {
input: [`sources/**/*.ts`],
output: [
{
dir: `lib`,
entryFileNames: entryFileNames(`.mjs`),
format: `es`,
},
{
dir: `lib`,
entryFileNames: entryFileNames(`.js`),
format: `cjs`,
},
],
preserveModules: true,
external: [
`tty`,
`typanion`,
`../platform`,
],
plugins: [
multiInput({
relative: `sources/`,
}),
ts({
tsconfig: `tsconfig.dist.json`,
include: `./sources/**/*`,
}),
copy({
targets: [
{src: `./sources/platform/package.json`, dest: `./lib/platform/`},
],
}),
],
};