-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
51 lines (49 loc) · 1.41 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
// rollup.config.js
import json from '@rollup/plugin-json';
import copy from 'rollup-plugin-copy';
// directory where a completed build of the extension should go
const outputDir = '_build';
// format which javascript files should be in in the extension
const outputJSFormat = 'cjs';
// output zip file name for chrome
const outputZip = 'li-profile-filter.zip'
// directory where root files are stored
const cmdDir = 'cmd';
// root files to build for the extension
const jsFiles = [
'background.js',
'li-profile-page.js',
'li-recruiter-profile-page.js',
'li-recruiter-search-page.js',
'options.js'
];
// directory where additional files that should be copied are stored
const extrasDir = 'assets';
const extraFiles = [
'options.html',
'pure-min.css',
];
// declare actions to perform
const buildActions = [];
// handle javascript files
buildActions.push(...jsFiles.map(cmdFile => ({
input: `${cmdDir}/${cmdFile}`,
output: {
file: `${outputDir}/dist/${cmdFile}`,
format: outputJSFormat,
},
plugins: [json()]
})));
// handle asset files
buildActions[0].plugins.push(copy({
targets: extraFiles.map(extraFile => ({
src: `${extrasDir}/${extraFile}`,
dest: `${outputDir}/dist`
})),
}));
// handle manifest file
buildActions[0].plugins.push(copy({
targets: [{ src: 'manifest.json', dest: outputDir }]
}));
// export build actions
export default buildActions;