Skip to content

Commit 747489c

Browse files
committed
feat: more reliable watch mode
Only output build folder once so `web-ext` only executed once, rather than after each react build.
1 parent be6de94 commit 747489c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const watch = require("@cnakazawa/watch");
66
const { execSync } = require("child_process");
77

88
class WebExtReact {
9+
constructor() {
10+
this.buildNum = 0;
11+
}
12+
913
get buildPath() {
1014
return path.join(process.cwd(), "build", "static");
1115
}
@@ -66,6 +70,7 @@ class WebExtReact {
6670
this.addContentScript();
6771
await this.bundleExt();
6872
this.addHtml();
73+
this.buildNum++;
6974
return this.tmp;
7075
}
7176
}
@@ -185,7 +190,9 @@ class WebExtReact {
185190
},
186191
async () => {
187192
const sourceDir = await this.buildExt();
188-
process.stdout.write(`${sourceDir}\n`);
193+
if (this.buildNum === 1) {
194+
process.stdout.write(`${sourceDir}\n`);
195+
}
189196
}
190197
);
191198
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-ext-react",
3-
"version": "1.0.2",
3+
"version": "1.1.2",
44
"description": "Command line tool to help build, run and test ReactJS based WebExtensions",
55
"main": "index.js",
66
"bin": {

0 commit comments

Comments
 (0)