From 6d5c29d61d50f75e84ff8299f8f6d91089248266 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah <36107+shazron@users.noreply.github.com> Date: Mon, 3 Oct 2022 14:34:39 +0800 Subject: [PATCH] fix: ACNA-1817 - error when trying to deploy an app created with `aio app init --no-login` (#588) --- src/commands/app/deploy.js | 2 +- test/commands/app/deploy.test.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/commands/app/deploy.js b/src/commands/app/deploy.js index 67550cac..8d4c2646 100644 --- a/src/commands/app/deploy.js +++ b/src/commands/app/deploy.js @@ -82,7 +82,7 @@ class Deploy extends BuildCommand { } // 2. Bail if workspace is production and application status is PUBLISHED, honor force-deploy - if (aioConfig.project.workspace.name === 'Production' && !flags['force-deploy']) { + if (aioConfig?.project?.workspace?.name === 'Production' && !flags['force-deploy']) { const extension = await this.getApplicationExtension(libConsoleCLI, aioConfig) spinner.info(chalk.dim(JSON.stringify(extension))) if (extension && extension.status === 'PUBLISHED') { diff --git a/test/commands/app/deploy.test.js b/test/commands/app/deploy.test.js index 6de567b9..3c0970ba 100644 --- a/test/commands/app/deploy.test.js +++ b/test/commands/app/deploy.test.js @@ -753,6 +753,26 @@ describe('run', () => { expect(command.error).toHaveBeenCalledWith(expect.stringMatching(/Nothing to be done/)) }) + test('deploy for standalone app --no-publish (no login)', async () => { + command.getAppExtConfigs.mockReturnValueOnce(createAppConfig(command.appConfig, 'exc')) + mockGetExtensionPointsPublishedApp() + mockGetProject() + command.getFullConfig.mockReturnValue({ + aio: { + } + }) + mockExtRegExcShellPayload() + command.argv = ['--no-publish'] + await command.run() + + expect(mockLibConsoleCLI.getProject).toHaveBeenCalledTimes(0) + expect(mockLibConsoleCLI.getApplicationExtensions).toHaveBeenCalledTimes(0) + expect(mockWebLib.deployWeb).toHaveBeenCalledTimes(1) + expect(mockRuntimeLib.deployActions).toHaveBeenCalledTimes(1) + expect(mockLibConsoleCLI.updateExtensionPoints).toHaveBeenCalledTimes(0) + expect(mockLibConsoleCLI.updateExtensionPointsWithoutOverwrites).toHaveBeenCalledTimes(0) + }) + test('deploy for PUBLISHED Production extension - no publish', async () => { command.getAppExtConfigs.mockReturnValueOnce(createAppConfig(command.appConfig, 'exc')) mockGetExtensionPointsPublishedApp()