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
84c84a42f8
commit
e8e421274d
@ -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 appPath = path.resolve(rootPath, pkgjson._web_app_path)
|
||||||
|
|
||||||
const evitePath = path.resolve(rootPath, "evite")
|
const evitePath = path.resolve(rootPath, "evite")
|
||||||
|
const linebridePath = path.resolve(rootPath, "linebridge")
|
||||||
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...`)
|
console.log(`Linking Evite to app...`)
|
||||||
await child_process.execSync("yarn link", {
|
await child_process.execSync("yarn link", {
|
||||||
@ -79,6 +73,30 @@ async function initializeEvite() {
|
|||||||
stdio: "inherit",
|
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`)
|
console.log(`✅ Evite dependencies installed`)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -87,18 +105,18 @@ async function initializeEvite() {
|
|||||||
async function main() {
|
async function main() {
|
||||||
console.time("✅ post-install tooks:")
|
console.time("✅ post-install tooks:")
|
||||||
|
|
||||||
await initializeEvite()
|
// read dir with absolute paths
|
||||||
|
let packages = await getPackages()
|
||||||
|
|
||||||
|
await linkInternalSubmodules(packages)
|
||||||
|
|
||||||
console.log("Rebuilding TFJS...")
|
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,
|
cwd: rootPath,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
})
|
})
|
||||||
|
|
||||||
// read dir with absolute paths
|
|
||||||
let packages = await getPackages()
|
|
||||||
|
|
||||||
for (const packageName of packages) {
|
for (const packageName of packages) {
|
||||||
const packagePath = path.resolve(packagesPath, packageName)
|
const packagePath = path.resolve(packagesPath, packageName)
|
||||||
|
|
||||||
|
@ -4,9 +4,13 @@ const path = require("path")
|
|||||||
const rootPath = process.cwd()
|
const rootPath = process.cwd()
|
||||||
const packagesPath = path.resolve(rootPath, "packages")
|
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")
|
const gitIgnore = fs.readFileSync(path.resolve(rootPath, ".gitignore"), "utf-8")
|
||||||
|
|
||||||
// create a regex to match all packages that are in the gitignore file
|
// 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
|
// filter packages that are in the gitignore file
|
||||||
packages = packages.filter((packageName) => {
|
packages = packages.filter((packageName) => {
|
||||||
// filter excluded packages
|
|
||||||
if (excludedPackages.includes(packageName)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// filter ignored packages
|
// filter ignored packages
|
||||||
if (ignore.includes(packageName)) {
|
if (ignore.includes(packageName)) {
|
||||||
return false
|
return false
|
||||||
@ -46,7 +45,12 @@ function filterPackages(packages, ignore = []) {
|
|||||||
async function getPackages({ ignore = [] } = {}) {
|
async function getPackages({ ignore = [] } = {}) {
|
||||||
let packages = await fs.promises.readdir(packagesPath)
|
let packages = await fs.promises.readdir(packagesPath)
|
||||||
|
|
||||||
packages = filterPackages(packages, ignore)
|
const ignoredPackages = await readIgnoredPackages()
|
||||||
|
|
||||||
|
packages = filterPackages(packages, [
|
||||||
|
...ignore,
|
||||||
|
...ignoredPackages,
|
||||||
|
])
|
||||||
|
|
||||||
return packages
|
return packages
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user