summaryrefslogtreecommitdiff
path: root/extension/scripts/prepackage.js
diff options
context:
space:
mode:
Diffstat (limited to 'extension/scripts/prepackage.js')
-rw-r--r--extension/scripts/prepackage.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/extension/scripts/prepackage.js b/extension/scripts/prepackage.js
new file mode 100644
index 00000000..c55df802
--- /dev/null
+++ b/extension/scripts/prepackage.js
@@ -0,0 +1,31 @@
+const { exec } = require("child_process");
+const fs = require("fs");
+const path = require("path");
+
+exec("npm install", (error) => {
+ if (error) throw error;
+ console.log("npm install completed");
+
+ exec("npm run typegen", (error) => {
+ if (error) throw error;
+ console.log("npm run typegen completed");
+
+ process.chdir("react-app");
+
+ exec("npm install", (error) => {
+ if (error) throw error;
+ console.log("npm install in react-app completed");
+
+ exec("npm run build", (error) => {
+ if (error) throw error;
+ if (!fs.existsSync(path.join("dist", "assets", "index.js"))) {
+ throw new Error("react-app build did not produce index.js");
+ }
+ if (!fs.existsSync(path.join("dist", "assets", "index.css"))) {
+ throw new Error("react-app build did not produce index.css");
+ }
+ console.log("npm run build in react-app completed");
+ });
+ });
+ });
+});