-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.js
94 lines (79 loc) · 2.24 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
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
88
89
90
91
92
93
94
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import json from '@rollup/plugin-json';
import run from '@rollup/plugin-run';
import execute from 'rollup-plugin-execute';
import del from 'rollup-plugin-delete';
import keysTransformer from 'ts-transformer-keys/transformer';
const production = !process.env.ROLLUP_WATCH;
const onwarn = (message, warn) => {
const ignored = {
EVAL: ['node_modules'],
// CIRCULAR_DEPENDENCY: [''],
};
const ignoredKeys = Object.keys(ignored);
const ignoredValues = Object.values(ignored);
for (let i = 0, l = ignoredKeys.length; i < l; ++i) {
const ignoredKey = ignoredKeys[i];
const ignoredValue = ignoredValues[i];
for (const ignoredValuePart of ignoredValue) {
if (message.code !== ignoredKey
|| !message.toString().includes(ignoredValuePart)) {
continue;
}
return;
}
}
warn(message);
};
const watch = {
clearScreen: false,
};
const plugins = [
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
preferBuiltins: true,
}),
commonjs({
ignoreDynamicRequires: true,
}),
production && del({ targets: 'dist/*' }),
execute([
'pushd "src/lib/SS" && dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release && popd',
'xcopy "node_modules/edge-js/lib/native" "dist/native" /E/H/C/I/Y >nul',
'xcopy "node_modules/edge-js/lib/bootstrap" "dist/bootstrap" /E/H/C/I/Y >nul',
'xcopy "src/lib" "dist/lib" /E/H/C/I/Y >nul',
]),
json(),
typescript({
include: ['src/**/*.ts'],
declaration: production,
transformers: {
before: [{
type: 'program',
factory: keysTransformer,
}],
},
}),
!production && run(),
];
export default [{
input: 'src/index.ts',
output: {
sourcemap: !production,
format: 'cjs',
name: 'index',
dir: 'dist',
entryFileNames: 'index.js',
},
onwarn,
watch,
plugins,
}];