1
0
Fork 0
mirror of synced 2024-07-04 05:50:57 +12:00

Fixing issue with CLI build, removing some old cjs exports that shouldn't be there.

This commit is contained in:
Michael Drury 2023-08-07 21:31:55 +01:00
parent 2e4e55e2cf
commit f6c992964e

View file

@ -1,5 +1,6 @@
import util from "util"
const runCommand = util.promisify(require("child_process").exec)
import childProcess from "child_process"
const runCommand = util.promisify(childProcess.exec)
export async function exec(command: string, dir = "./") {
const { stdout } = await runCommand(command, { cwd: dir })
@ -16,12 +17,12 @@ export async function utilityInstalled(utilName: string) {
}
export async function runPkgCommand(command: string, dir = "./") {
const yarn = await exports.utilityInstalled("yarn")
const npm = await exports.utilityInstalled("npm")
const yarn = await utilityInstalled("yarn")
const npm = await utilityInstalled("npm")
if (!yarn && !npm) {
throw new Error("Must have yarn or npm installed to run build.")
}
const npmCmd = command === "install" ? `npm ${command}` : `npm run ${command}`
const cmd = yarn ? `yarn ${command} --ignore-engines` : npmCmd
await exports.exec(cmd, dir)
await exec(cmd, dir)
}