From a68c403fc4a289fb97ecf7a7c6a357200bec8d35 Mon Sep 17 00:00:00 2001 From: Jikun Date: Fri, 20 Oct 2023 17:16:36 +0800 Subject: [PATCH] retry outputLocation as absolute location --- src/cli/commands/deploy/deploy.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cli/commands/deploy/deploy.ts b/src/cli/commands/deploy/deploy.ts index 1fac32b2..12cd0a92 100644 --- a/src/cli/commands/deploy/deploy.ts +++ b/src/cli/commands/deploy/deploy.ts @@ -63,13 +63,17 @@ export async function deploy(options: SWACLIConfig) { } } - // make sure outputLocation is set - const resolvedOutputLocation = path.resolve(appLocation, outputLocation || process.cwd()); + logger.silly(`Resolving outputLocation=${outputLocation} full path...`); + let resolvedOutputLocation = path.resolve(appLocation, outputLocation as string); // if folder exists, deploy from a specific build folder (outputLocation), relative to appLocation if (!fs.existsSync(resolvedOutputLocation)) { - logger.error(`The folder "${resolvedOutputLocation}" is not found. Exit.`, true); - return; + if (!fs.existsSync(outputLocation as string)) { + logger.error(`The folder "${resolvedOutputLocation}" is not found. Exit.`, true); + return; + } + // otherwise, build folder (outputLocation) is using the absolute location + resolvedOutputLocation = path.resolve(outputLocation as string); } logger.log(`Deploying front-end files from folder:`);