From 81c726a0407e00c10e4cca1ab53cbd49f58fac31 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Sat, 26 Aug 2023 10:27:16 +0000 Subject: [PATCH] intialize evite on `post-install` --- .gitmodules | 3 +++ package.json | 1 + packages/app/package.json | 3 +-- scripts/post-install.js | 37 +++++++++++++++++++++++++++++++++++-- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..7c71543c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "evite"] + path = evite + url = https://github.com/ragestudio/evite diff --git a/package.json b/package.json index 60954ca9..0b918eb3 100755 --- a/package.json +++ b/package.json @@ -32,5 +32,6 @@ "form-data": "^4.0.0", "pm2": "5.3.0" }, + "_web_app_path": "packages/app", "version": "0.57.5" } \ No newline at end of file diff --git a/packages/app/package.json b/packages/app/package.json index 7472a8d0..a57b25b4 100755 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -145,8 +145,7 @@ "electron-log": "^4.4.8", "electron-squirrel-startup": "^1.0.0", "express": "^4.17.1", - "typescript": "^4.3.5", - "vite": "3.2.5" + "typescript": "^4.3.5" }, "config": { "forge": { diff --git a/scripts/post-install.js b/scripts/post-install.js index e30a9467..a3ec767c 100644 --- a/scripts/post-install.js +++ b/scripts/post-install.js @@ -1,13 +1,16 @@ const fs = require("node:fs") const path = require("node:path") - -const sharedRootPath = path.resolve(process.cwd(), "shared") +const child_process = require("node:child_process") const rootPath = process.cwd() + +const sharedRootPath = path.resolve(rootPath, "shared") const packagesPath = path.resolve(rootPath, "packages") const getPackages = require("./utils/getPackages") +const pkgjson = require("../package.json") + async function linkSharedResources(pkgJSON, packagePath) { if (typeof pkgJSON !== "object") { throw new Error("Package must be an object") @@ -53,9 +56,39 @@ async function linkSharedResources(pkgJSON, packagePath) { } } +async function initializeEvite() { + const appPath = path.resolve(rootPath, pkgjson._web_app_path) + const evitePath = path.resolve(rootPath, "evite") + + console.log("📦 Initializing Evite...") + + console.log(`Intalling Evite dependencies...`) + await child_process.execSync("yarn install", { + cwd: evitePath, + stdio: "inherit", + }) + + console.log(`Linking Evite to app...`) + await child_process.execSync("yarn link", { + cwd: evitePath, + stdio: "inherit", + }) + + await child_process.execSync(`yarn link "evite"`, { + cwd: appPath, + stdio: "inherit", + }) + + console.log(`✅ Evite dependencies installed`) + + return true +} + async function main() { console.time("✅ post-install tooks:") + await initializeEvite() + // read dir with absolute paths let packages = await getPackages()