diff --git a/src/commands/app/deploy.js b/src/commands/app/deploy.js index 8d4c2646..9f46ea18 100644 --- a/src/commands/app/deploy.js +++ b/src/commands/app/deploy.js @@ -33,9 +33,10 @@ class Deploy extends BuildCommand { const deployConfigs = this.getAppExtConfigs(flags) const keys = Object.keys(deployConfigs) const values = Object.values(deployConfigs) + const isStandaloneApp = (keys.length === 1 && keys[0] === 'application') // if there are no extensions, then set publish to false - flags.publish = flags.publish && !(keys.length === 1 && keys[0] === 'application') + flags.publish = flags.publish && !isStandaloneApp let libConsoleCLI if (flags.publish) { // force login at beginning (if required) @@ -82,7 +83,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 (!isStandaloneApp && 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 3c0970ba..967ee4ea 100644 --- a/test/commands/app/deploy.test.js +++ b/test/commands/app/deploy.test.js @@ -828,6 +828,31 @@ describe('run', () => { expect(mockLibConsoleCLI.updateExtensionPointsWithoutOverwrites).toHaveBeenCalledTimes(1) }) + test('deploy for Production legacy app', async () => { + command.getAppExtConfigs.mockReturnValueOnce(createAppConfig(command.appConfig)) + command.getFullConfig.mockReturnValue({ + aio: { + project: { + workspace: { + name: 'Production' + }, + org: { + id: '1111' + } + } + } + }) + command.argv = [] + 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 RETRACTED Production extension - publish', async () => { mockLibConsoleCLI.getApplicationExtensions.mockReset()