From 6051b22bec8558461256e7b1713e01177abe7bcc Mon Sep 17 00:00:00 2001 From: Lukas Holzer Date: Thu, 17 Aug 2023 13:24:09 +0200 Subject: [PATCH] feat: let the --cwd option override the monorepo execution directory (#5950) --- src/commands/base-command.mjs | 2 +- src/utils/run-build.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/base-command.mjs b/src/commands/base-command.mjs index 85f7f0890cb..fcf0aaba17a 100644 --- a/src/commands/base-command.mjs +++ b/src/commands/base-command.mjs @@ -574,7 +574,7 @@ export default class BaseCommand extends Command { // configuration file and the API // ================================================== const cachedConfig = await actionCommand.getConfig({ - cwd: this.jsWorkspaceRoot || this.workingDir, + cwd: flags.cwd ? this.workingDir : this.jsWorkspaceRoot || this.workingDir, repositoryRoot: rootDir, packagePath: this.workspacePackage, // The config flag needs to be resolved from the actual process working directory diff --git a/src/utils/run-build.mjs b/src/utils/run-build.mjs index 46acf5f67ca..da80f829105 100644 --- a/src/utils/run-build.mjs +++ b/src/utils/run-build.mjs @@ -80,7 +80,7 @@ export const runNetlifyBuild = async ({ command, env = {}, options, settings, ti const devCommand = async (settingsOverrides = {}) => { let cwd = command.workingDir - if (command.project.workspace?.packages.length) { + if (!options.cwd && command.project.workspace?.packages.length) { cwd = join(command.project.jsWorkspaceRoot, settings.baseDirectory || '') }