代码拉取完成,页面将自动刷新
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.")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。