forked from fiatjaf/nos2x
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.js
executable file
·56 lines (54 loc) · 1.22 KB
/
build.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
52
53
54
55
56
#!/usr/bin/env node
import esbuild from "esbuild";
import copy from "esbuild-copy-plugin";
const isProd = process.argv.indexOf("prod") !== -1;
const isFirefox = process.argv.indexOf("firefox") !== -1;
esbuild
.build({
bundle: true,
entryPoints: {
"popup.build": "./extension/popup.tsx",
"prompt.build": "./extension/prompt.tsx",
"options.build": "./extension/options.jsx",
"background.build": "./extension/background.js",
"content-script.build": "./extension/content-script.js",
},
outdir: "./extension/output",
sourcemap: isProd ? false : "inline",
define: {
window: "self",
global: "self",
},
plugins: [
copy({
assets: [
{
from: [
isFirefox
? "./extension/firefox/manifest.json"
: "./extension/chrome/manifest.json",
],
to: ["./"],
},
{
from: ["./extension/*.html"],
to: ["./"],
},
{
from: ["./extension/common.js"],
to: ["./"],
},
{
from: ["./extension/nostr-provider.js"],
to: ["./"],
},
{
from: ["./extension/icons/*"],
to: ["./icons"],
},
],
}),
],
})
.then(() => console.log("Build success."))
.catch((err) => console.error("Build error.", err));