intialize evite on post-install

This commit is contained in:
SrGooglo 2023-08-26 10:27:16 +00:00
parent b9972935b3
commit fcb7f1cdf0
4 changed files with 40 additions and 4 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "evite"]
path = evite
url = https://github.com/ragestudio/evite

View File

@ -32,5 +32,6 @@
"form-data": "^4.0.0",
"pm2": "5.3.0"
},
"_web_app_path": "packages/app",
"version": "0.57.5"
}

View File

@ -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": {

View File

@ -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()