forked from facebookincubator/meta-code-verify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.ts
121 lines (116 loc) · 3.48 KB
/
rollup.config.ts
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { Plugin, RollupOptions } from 'rollup';
import cleanOnce from './build/rollup-plugin-clean-once';
import eslintPlugin from '@rollup/plugin-eslint';
import typescript from '@rollup/plugin-typescript';
import prettierBuildStart from './build/rollup-plugin-prettier-build-start';
import staticFiles from './build/rollup-plugin-static-files';
import watch from './build/rollup-plugin-watch-additional';
function eslint(): Plugin {
return eslintPlugin({throwOnError: true});
}
function prettierSrc(): Plugin {
return prettierBuildStart('"src/**/*.(js|ts)"');
}
const config: Array<RollupOptions> = [
{
input: 'src/js/detectWAMeta.ts',
output: [{
file: 'dist/chrome/contentWA.js',
format: 'iife'
}, {
file: 'dist/edge/contentWA.js',
format: 'iife'
}, {
file: 'dist/firefox/contentWA.js',
format: 'iife'
}],
plugins: [cleanOnce(), typescript(), prettierSrc(), eslint()],
},
{
input: 'src/js/detectMSGRMeta.ts',
output: [{
file: 'dist/chrome/contentMSGR.js',
format: 'iife'
}, {
file: 'dist/edge/contentMSGR.js',
format: 'iife'
}, {
file: 'dist/firefox/contentMSGR.js',
format: 'iife'
}],
plugins: [typescript(), prettierSrc(), eslint()],
},
{
input: 'src/js/detectFBMeta.ts',
output: [{
file: 'dist/chrome/contentFB.js',
format: 'iife'
}, {
file: 'dist/edge/contentFB.js',
format: 'iife'
}, {
file: 'dist/firefox/contentFB.js',
format: 'iife'
}],
plugins: [typescript(), prettierSrc(), eslint()],
},
{
input: 'src/js/detectIGMeta.ts',
output: [{
file: 'dist/chrome/contentIG.js',
format: 'iife'
}, {
file: 'dist/edge/contentIG.js',
format: 'iife'
}, {
file: 'dist/firefox/contentIG.js',
format: 'iife'
}],
plugins: [typescript(), prettierSrc(), eslint()],
},
{
input: 'src/js/background.ts',
output: [{
file: 'dist/chrome/background.js',
format: 'iife'
}, {
file: 'dist/edge/background.js',
format: 'iife'
}, {
file: 'dist/firefox/background.js',
format: 'iife'
}],
plugins: [typescript(), prettierSrc(), eslint()],
},
{
input: 'src/js/popup.ts',
output: [{
file: 'dist/chrome/popup.js',
format: 'iife',
plugins: [staticFiles('config/v3/')],
}, {
file: 'dist/edge/popup.js',
format: 'iife',
plugins: [staticFiles('config/v3/')],
}, {
file: 'dist/firefox/popup.js',
format: 'iife',
plugins: [staticFiles('config/v2/')],
}],
plugins: [
typescript(),
prettierSrc(),
eslint(),
staticFiles(['images/', 'src/css/', 'src/html/']),
staticFiles('_locales/', {keepDir: true}),
watch(['images/', 'src/css/', 'src/html/', '_locales/', 'config/']),
],
}
];
export default config;