Skip to content

Commit 0ba7450

Browse files
author
Kamil Sobol
authored
add possibility to specify output format in pipeline-deploy command (#1686)
1 parent d52c833 commit 0ba7450

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/backend-cli': minor
3+
---
4+
5+
add possibility to specify output format in pipeline-deploy command

packages/cli/src/commands/pipeline-deploy/pipeline_deploy_command.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
} from '@aws-amplify/cli-core';
2121
import { ClientConfigGeneratorAdapter } from '../../client-config/client_config_generator_adapter.js';
2222
import {
23+
ClientConfigFormat,
2324
ClientConfigVersionOption,
2425
DEFAULT_CLIENT_CONFIG_VERSION,
2526
} from '@aws-amplify/client-config';
@@ -156,6 +157,7 @@ void describe('deploy command', () => {
156157
},
157158
DEFAULT_CLIENT_CONFIG_VERSION,
158159
'src',
160+
undefined,
159161
]);
160162
});
161163

@@ -192,6 +194,44 @@ void describe('deploy command', () => {
192194
},
193195
ClientConfigVersionOption.V0,
194196
undefined,
197+
undefined,
198+
]);
199+
});
200+
201+
void it('allows --outputs-format argument', async () => {
202+
const backendDeployerFactory = new BackendDeployerFactory(
203+
packageManagerControllerFactory.getPackageManagerController(),
204+
formatterStub
205+
);
206+
const mockDeploy = mock.method(
207+
backendDeployerFactory.getInstance(),
208+
'deploy',
209+
() => Promise.resolve()
210+
);
211+
await getCommandRunner(true).runCommand(
212+
'pipeline-deploy --app-id abc --branch test-branch --outputs-format dart'
213+
);
214+
assert.strictEqual(mockDeploy.mock.callCount(), 1);
215+
assert.deepStrictEqual(mockDeploy.mock.calls[0].arguments, [
216+
{
217+
name: 'test-branch',
218+
namespace: 'abc',
219+
type: 'branch',
220+
},
221+
{
222+
validateAppSources: true,
223+
},
224+
]);
225+
assert.equal(generateClientConfigMock.mock.callCount(), 1);
226+
assert.deepStrictEqual(generateClientConfigMock.mock.calls[0].arguments, [
227+
{
228+
name: 'test-branch',
229+
namespace: 'abc',
230+
type: 'branch',
231+
},
232+
DEFAULT_CLIENT_CONFIG_VERSION,
233+
undefined,
234+
ClientConfigFormat.DART,
195235
]);
196236
});
197237
});

packages/cli/src/commands/pipeline-deploy/pipeline_deploy_command.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ClientConfigGeneratorAdapter } from '../../client-config/client_config_
55
import { ArgumentsKebabCase } from '../../kebab_case.js';
66
import { BackendIdentifier } from '@aws-amplify/plugin-types';
77
import {
8+
ClientConfigFormat,
89
ClientConfigVersion,
910
ClientConfigVersionOption,
1011
DEFAULT_CLIENT_CONFIG_VERSION,
@@ -16,6 +17,7 @@ export type PipelineDeployCommandOptions =
1617
type PipelineDeployCommandOptionsCamelCase = {
1718
branch: string;
1819
appId: string;
20+
outputsFormat: ClientConfigFormat | undefined;
1921
outputsVersion: string;
2022
outputsOutDir?: string;
2123
};
@@ -72,7 +74,8 @@ export class PipelineDeployCommand
7274
await this.clientConfigGenerator.generateClientConfigToFile(
7375
backendId,
7476
args.outputsVersion as ClientConfigVersion,
75-
args.outputsOutDir
77+
args.outputsOutDir,
78+
args.outputsFormat
7679
);
7780
};
7881

@@ -104,6 +107,12 @@ export class PipelineDeployCommand
104107
array: false,
105108
choices: Object.values(ClientConfigVersionOption),
106109
default: DEFAULT_CLIENT_CONFIG_VERSION,
110+
})
111+
.option('outputs-format', {
112+
describe: 'amplify_outputs file format',
113+
type: 'string',
114+
array: false,
115+
choices: Object.values(ClientConfigFormat),
107116
});
108117
};
109118
}

0 commit comments

Comments
 (0)