forked from opening-hours/opening_hours.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
46 lines (42 loc) · 1.11 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
import {readFileSync} from 'fs';
import common from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import yaml from 'rollup-plugin-yaml';
var banner = readFileSync('./banner.js', 'utf-8');
var dependencies = process.env.DEPS === 'YES';
function recursivelyDeleteNominatimUrl(data) {
if (typeof data === 'object') {
Object.values(data).forEach(recursivelyDeleteNominatimUrl);
}
delete data._nominatim_url;
return data;
}
var yamlPlugin = yaml({
transform(data) {
return recursivelyDeleteNominatimUrl(data);
}
})
export default {
input: './index',
plugins: dependencies ? [
nodeResolve(),
common(),
yamlPlugin,
] : [
yamlPlugin,
],
external: dependencies ? [] : [
'i18next-client',
'suncalc'
],
output: {
name: 'opening_hours',
banner: banner,
globals: dependencies ? {} : {
'i18next-client': 'i18n',
'suncalc': 'SunCalc'
},
format: 'umd',
file: dependencies ? 'opening_hours+deps.js' : 'opening_hours.js'
}
};