diff --git a/.gitignore b/.gitignore index f063e2224f..32c6faf980 100644 --- a/.gitignore +++ b/.gitignore @@ -102,4 +102,6 @@ packages/builder/cypress/reports stats.html # TypeScript cache -*.tsbuildinfo \ No newline at end of file +*.tsbuildinfo +budibase-component +budibase-datasource diff --git a/packages/cli/src/exec.js b/packages/cli/src/exec.js index 8b1134c897..72fd8e00eb 100644 --- a/packages/cli/src/exec.js +++ b/packages/cli/src/exec.js @@ -1,8 +1,8 @@ const util = require("util") const exec = util.promisify(require("child_process").exec) -exports.exec = async command => { - const { stdout } = await exec(command) +exports.exec = async (command, dir = "./") => { + const { stdout } = await exec(command, { cwd: dir }) return stdout } @@ -15,12 +15,13 @@ exports.utilityInstalled = async utilName => { } } -exports.runPkgCommand = async command => { +exports.runPkgCommand = async (command, dir = "./") => { const yarn = await exports.utilityInstalled("yarn") const npm = await exports.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}` - await exports.exec(yarn ? `yarn ${command}` : npmCmd) + const cmd = yarn ? `yarn ${command}` : npmCmd + await exports.exec(cmd, dir) } diff --git a/packages/cli/src/plugins/index.js b/packages/cli/src/plugins/index.js index 6ce2d47e63..e6de624b63 100644 --- a/packages/cli/src/plugins/index.js +++ b/packages/cli/src/plugins/index.js @@ -37,7 +37,7 @@ async function init(opts) { await getSkeleton(type, name) await fleshOutSkeleton(name, desc, version) console.log(info("Installing dependencies...")) - await runPkgCommand("install") + await runPkgCommand("install", join(process.cwd(), name)) console.log(info(`Plugin created in directory "${name}"`)) }