-
Notifications
You must be signed in to change notification settings - Fork 0
/
postbuild.ts
39 lines (36 loc) · 1.17 KB
/
postbuild.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
import {execSync} from 'child_process';
const browsers = ['firefox', 'chrome'];
// copy css file to dist folder
const commands = [
'ls -lah',
...browsers.map(browser => {
return [
`echo "copying css and js files to dist/${browser}"`,
// making browser directory
`mkdir -p dist/${browser}`,
// copying main css and js files
`cp src/main.css dist/${browser}`,
`cp dist/index.js dist/${browser}`,
// popup
`cp -R dist/popup dist/${browser}/popup`,
`cp -R src/popup/*.html dist/${browser}/popup/`,
`cp -R src/popup/*.css dist/${browser}/popup/`,
// background
`cp -R dist/background dist/${browser}/background`,
// manifest
`cp src/manifest-${browser}.json dist/${browser}/manifest.json`,
// icons
`mkdir -p dist/${browser}/icons`,
`cp icons/* dist/${browser}/icons`,
// copy browser polyfill for chrome
`cp node_modules/webextension-polyfill/dist/browser-polyfill.js dist/${browser}/browser-polyfill.js`,
// zip
`cd dist/${browser}`,
`zip -r ${browser}.zip *`,
`cd ../..`,
];
}),
].flat();
execSync(commands.join(' && '), {
stdio: 'inherit',
});