forked from jdalrymple/gitbeaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
87 lines (83 loc) · 1.99 KB
/
rollup.config.js
File metadata and controls
87 lines (83 loc) · 1.99 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import ts from 'rollup-plugin-typescript2';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import json from 'rollup-plugin-json';
import { terser } from 'rollup-plugin-terser';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
import replace from 'rollup-plugin-replace';
import typescript from 'typescript';
import pkg from './package.json';
export default [
// CLI build
{
input: 'src/bin/index.ts',
output: {
banner: '#!/usr/bin/env node',
file: pkg.bin.gitlab,
format: 'cjs',
},
external: [...Object.keys(pkg.dependencies)],
plugins: [
replace({
delimiters: ['', ''],
'#!/usr/bin/env node': '',
}),
globals(),
builtins(),
resolve(),
commonjs(),
json(),
ts({ typescript }),
terser(),
],
},
// Browser-friendly UMD build
{
input: 'src/core/index.ts',
output: {
file: pkg.browser,
name: 'node-gitlab',
format: 'umd',
exports: 'named',
globals: {
li: 'Li',
humps: 'Humps',
'query-string': 'QueryString',
randomstring: 'RandomString',
'ky-universal': 'Ky',
'form-data': 'FormData',
'universal-url': 'universal-url',
},
},
plugins: [
globals(),
builtins(),
resolve({ browser: true }),
commonjs(),
json(),
ts({ typescript }),
terser(),
],
},
// CommonJS (for Node) (for bundlers) build.
{
input: 'src/core/index.ts',
output: {
file: pkg.main,
format: 'cjs',
},
external: [...Object.keys(pkg.dependencies)],
plugins: [globals(), builtins(), ts({ typescript }), terser()],
},
// ES module (for bundlers) build.
{
input: 'src/core/index.ts',
output: {
file: pkg.module,
format: 'es',
},
external: [...Object.keys(pkg.dependencies)],
plugins: [ts({ typescript }), terser()],
},
];