forked from opening-hours/opening_hours.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
63 lines (59 loc) · 1.67 KB
/
rollup.config.mjs
File metadata and controls
63 lines (59 loc) · 1.67 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
import common from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import yaml from '@rollup/plugin-yaml';
const dependencies = process.env.DEPS === 'YES';
function recursivelyDeleteNominatimUrl(data) {
if (typeof data === 'object') {
Object.values(data).forEach(recursivelyDeleteNominatimUrl);
}
delete data._nominatim_url;
return data;
}
const yamlPlugin = yaml({
transform(data) {
return recursivelyDeleteNominatimUrl(data);
}
});
export default {
input: './src/index',
plugins: dependencies ? [
nodeResolve(),
common(),
yamlPlugin,
] : [
yamlPlugin,
],
external: dependencies ? [] : [
'i18next',
'suncalc'
],
output: [
{
name: 'opening_hours',
file: 'build/' + (dependencies ? 'opening_hours+deps.js' : 'opening_hours.js'),
globals: dependencies ? {} : {
'i18next': 'i18next',
'suncalc': 'SunCalc'
},
format: 'umd',
},
{
name: 'opening_hours',
file: 'build/' + (dependencies ? 'opening_hours+deps.min.js' : 'opening_hours.min.js'),
globals: dependencies ? {} : {
'i18next': 'i18next',
'suncalc': 'SunCalc'
},
format: 'umd',
plugins: [
terser({
format: {
comments: /@preserve|@license|@cc_on|SPDX-FileCopyrightText|©|\(c\)/i,
},
}),
],
sourcemap: true,
}
]
};