mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
improve installations scripts
This commit is contained in:
parent
29f2336467
commit
f7f37c5606
@ -56,17 +56,11 @@ async function linkSharedResources(pkgJSON, packagePath) {
|
||||
}
|
||||
}
|
||||
|
||||
async function initializeEvite() {
|
||||
async function linkInternalSubmodules(packages) {
|
||||
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",
|
||||
// })
|
||||
const linebridePath = path.resolve(rootPath, "linebridge")
|
||||
|
||||
console.log(`Linking Evite to app...`)
|
||||
await child_process.execSync("yarn link", {
|
||||
@ -79,6 +73,30 @@ async function initializeEvite() {
|
||||
stdio: "inherit",
|
||||
})
|
||||
|
||||
console.log(`Linking Linebride to servers...`)
|
||||
|
||||
await child_process.execSync(`yarn link`, {
|
||||
cwd: linebridePath,
|
||||
stdio: "inherit",
|
||||
})
|
||||
|
||||
for await (const packageName of packages) {
|
||||
const packagePath = path.resolve(packagesPath, packageName)
|
||||
|
||||
const packageJsonPath = path.resolve(packagePath, "package.json")
|
||||
|
||||
if (!fs.existsSync(packageJsonPath)) {
|
||||
continue
|
||||
}
|
||||
|
||||
await child_process.execSync(`yarn link "linebridge"`, {
|
||||
cwd: packagePath,
|
||||
stdio: "inherit",
|
||||
})
|
||||
|
||||
console.log(`Linking Linebride to package [${packageName}]...`)
|
||||
}
|
||||
|
||||
console.log(`✅ Evite dependencies installed`)
|
||||
|
||||
return true
|
||||
@ -87,18 +105,18 @@ async function initializeEvite() {
|
||||
async function main() {
|
||||
console.time("✅ post-install tooks:")
|
||||
|
||||
await initializeEvite()
|
||||
// read dir with absolute paths
|
||||
let packages = await getPackages()
|
||||
|
||||
await linkInternalSubmodules(packages)
|
||||
|
||||
console.log("Rebuilding TFJS...")
|
||||
|
||||
await child_process.execSync("npm rebuild @tensorflow/tfjs-node --build-from-source &&", {
|
||||
await child_process.execSync("npm rebuild @tensorflow/tfjs-node --build-from-source", {
|
||||
cwd: rootPath,
|
||||
stdio: "inherit",
|
||||
})
|
||||
|
||||
// read dir with absolute paths
|
||||
let packages = await getPackages()
|
||||
|
||||
for (const packageName of packages) {
|
||||
const packagePath = path.resolve(packagesPath, packageName)
|
||||
|
||||
|
@ -4,9 +4,13 @@ const path = require("path")
|
||||
const rootPath = process.cwd()
|
||||
const packagesPath = path.resolve(rootPath, "packages")
|
||||
|
||||
const excludedPackages = ["comty.js"]
|
||||
async function readIgnoredPackages() {
|
||||
const packages = await fs.promises.readFile(path.resolve(rootPath, ".ignorepackages"), "utf-8").catch(() => "")
|
||||
|
||||
function filterPackages(packages, ignore = []) {
|
||||
return packages.split("\n")
|
||||
}
|
||||
|
||||
async function filterPackages(packages, ignore = []) {
|
||||
const gitIgnore = fs.readFileSync(path.resolve(rootPath, ".gitignore"), "utf-8")
|
||||
|
||||
// create a regex to match all packages that are in the gitignore file
|
||||
@ -19,11 +23,6 @@ function filterPackages(packages, ignore = []) {
|
||||
|
||||
// filter packages that are in the gitignore file
|
||||
packages = packages.filter((packageName) => {
|
||||
// filter excluded packages
|
||||
if (excludedPackages.includes(packageName)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// filter ignored packages
|
||||
if (ignore.includes(packageName)) {
|
||||
return false
|
||||
@ -46,7 +45,12 @@ function filterPackages(packages, ignore = []) {
|
||||
async function getPackages({ ignore = [] } = {}) {
|
||||
let packages = await fs.promises.readdir(packagesPath)
|
||||
|
||||
packages = filterPackages(packages, ignore)
|
||||
const ignoredPackages = await readIgnoredPackages()
|
||||
|
||||
packages = filterPackages(packages, [
|
||||
...ignore,
|
||||
...ignoredPackages,
|
||||
])
|
||||
|
||||
return packages
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user