generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.ts
39 lines (35 loc) · 1.65 KB
/
publish.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as os from 'os';
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import { CommunityPublishResource } from '../../../shared/community/connect/CommunityPublishResource';
import { ConnectExecutor } from '../../../shared/connect/services/ConnectExecutor';
import { CommunityPublishResponse } from '../../../shared/community/defs/CommunityPublishResponse';
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-community', 'publish');
/**
* A command to publish a community. This is just an sfdx wrapper around
* the community publish connect endpoint
*/
export class CommunityPublishCommand extends SfdxCommand {
public static readonly requiresUsername = true;
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessage('examples').split(os.EOL);
public static readonly flagsConfig: FlagsConfig = {
name: flags.string({
char: 'n',
description: messages.getMessage('flags.name.description'),
longDescription: messages.getMessage('flags.name.longDescription'),
required: true,
}),
};
public async run(): Promise<CommunityPublishResponse | Error> {
const publishCommand = new CommunityPublishResource(this.flags, this.org, this.ux);
return new ConnectExecutor(publishCommand, this.org).callConnectApi();
}
}