1 Star 0 Fork 0

jcleng/oni2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
install-node-deps.js 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
const cp = require("child_process")
const fs = require("fs")
const path = require("path")
const rootDir = __dirname
const vendorDir = path.join(rootDir, "vendor")
const nodeVendorDir = path.join(vendorDir, "node-v12.17.0")
const yarnScript = path.join(vendorDir, "yarn-v1.14.0", "yarn-1.14.0.js")
let nodeBinaryPath
if (process.platform === "win32") {
nodeBinaryPath = path.join(nodeVendorDir, "win-x64", "node.exe")
} else if (process.platform === "darwin") {
nodeBinaryPath = path.join(nodeVendorDir, "osx", "node")
} else {
nodeBinaryPath = path.join(nodeVendorDir, "linux-x64", "node")
}
let useProductionDeps = process.argv.filter((i) => i.indexOf("-prod") >= 0).length > 0
console.log(`-- Production: ${useProductionDeps}`)
let args = [yarnScript, "install", "--flat", "--production=true"]
const packagesToInstall = ["node", "extensions"]
packagesToInstall.forEach((pkg) => {
const fullPath = path.join(rootDir, pkg)
console.log("Installing packages at: " + fullPath)
console.log("Running: " + nodeBinaryPath + " | " + JSON.stringify(args))
const result = cp.spawnSync(nodeBinaryPath, args, { stdio: "inherit", cwd: fullPath })
if (result.status != 0) {
console.error(`Process exited with code ${result.status}`)
console.error(`stderr: ${result.stderr}`)
throw result.error
}
})
console.log("Node dependencies successfully installed.")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jcleng/oni2.git
[email protected]:jcleng/oni2.git
jcleng
oni2
oni2
master

搜索帮助