|
1 | | -import { Args } from '@oclif/core' |
2 | | -import { uploadCartridges } from '@salesforce/b2c-tooling' |
3 | | -import { InstanceCommand } from '@salesforce/b2c-tooling/cli' |
4 | | -import { t } from '../../i18n/index.js' |
| 1 | +import {Args} from '@oclif/core'; |
| 2 | +import {uploadCartridges} from '@salesforce/b2c-tooling'; |
| 3 | +import {InstanceCommand} from '@salesforce/b2c-tooling/cli'; |
| 4 | +import {t} from '../../i18n/index.js'; |
5 | 5 |
|
6 | 6 | export default class Deploy extends InstanceCommand<typeof Deploy> { |
7 | 7 | static args = { |
8 | 8 | cartridgePath: Args.string({ |
9 | 9 | description: 'Path to cartridges directory', |
10 | 10 | default: './cartridges', |
11 | 11 | }), |
12 | | - } |
| 12 | + }; |
13 | 13 |
|
14 | | - static description = t('commands.code.deploy.description', 'Deploy cartridges to a B2C Commerce instance') |
| 14 | + static description = t('commands.code.deploy.description', 'Deploy cartridges to a B2C Commerce instance'); |
15 | 15 |
|
16 | 16 | static examples = [ |
17 | 17 | '<%= config.bin %> <%= command.id %>', |
18 | 18 | '<%= config.bin %> <%= command.id %> ./my-cartridges', |
19 | 19 | '<%= config.bin %> <%= command.id %> --server my-sandbox.demandware.net --code-version v1', |
20 | | - ] |
| 20 | + ]; |
21 | 21 |
|
22 | 22 | async run(): Promise<void> { |
23 | | - this.requireServer() |
24 | | - this.requireCodeVersion() |
25 | | - this.requireWebDavCredentials() |
| 23 | + this.requireServer(); |
| 24 | + this.requireCodeVersion(); |
| 25 | + this.requireWebDavCredentials(); |
26 | 26 |
|
27 | | - const instance = this.createWebDavInstance() |
28 | | - const path = this.args.cartridgePath |
29 | | - const hostname = this.resolvedConfig.hostname! |
30 | | - const version = this.resolvedConfig.codeVersion! |
| 27 | + const instance = this.createWebDavInstance(); |
| 28 | + const path = this.args.cartridgePath; |
| 29 | + const hostname = this.resolvedConfig.hostname!; |
| 30 | + const version = this.resolvedConfig.codeVersion!; |
31 | 31 |
|
32 | | - this.log(t('commands.code.deploy.deploying', 'Deploying cartridges from {{path}}...', { path })) |
33 | | - this.log(t('commands.code.deploy.target', 'Target: {{hostname}}', { hostname })) |
34 | | - this.log(t('commands.code.deploy.codeVersion', 'Code Version: {{version}}', { version })) |
| 32 | + this.log(t('commands.code.deploy.deploying', 'Deploying cartridges from {{path}}...', {path})); |
| 33 | + this.log(t('commands.code.deploy.target', 'Target: {{hostname}}', {hostname})); |
| 34 | + this.log(t('commands.code.deploy.codeVersion', 'Code Version: {{version}}', {version})); |
35 | 35 |
|
36 | 36 | try { |
37 | | - await uploadCartridges(instance, path) |
38 | | - this.log(t('commands.code.deploy.complete', 'Deployment complete')) |
| 37 | + await uploadCartridges(instance, path); |
| 38 | + this.log(t('commands.code.deploy.complete', 'Deployment complete')); |
39 | 39 | } catch (error) { |
40 | 40 | if (error instanceof Error) { |
41 | | - this.error(t('commands.code.deploy.failed', 'Deployment failed: {{message}}', { message: error.message })) |
| 41 | + this.error(t('commands.code.deploy.failed', 'Deployment failed: {{message}}', {message: error.message})); |
42 | 42 | } |
43 | | - throw error |
| 43 | + throw error; |
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
0 commit comments