sfdx-hardis
Version:
Swiss-army-knife Toolbox for Salesforce. Allows you to define a complete CD/CD Pipeline. Orchestrate base commands and assist users with interactive wizards
30 lines • 1.47 kB
JavaScript
import { ActionsProvider } from './actionsProvider.js';
import { execCommand, uxLog } from '../utils/index.js';
import c from 'chalk';
export class PublishCommunityAction extends ActionsProvider {
getLabel() {
return 'PublishCommunityAction';
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async checkParameters(cmd) {
const communityName = cmd.parameters?.communityName || '';
if (!communityName) {
uxLog('error', this, c.red(`[DeploymentActions] No communityName parameter provided for action [${cmd.id}]: ${cmd.label}`));
return { statusCode: 'failed', skippedReason: 'No communityName parameter provided' };
}
return null;
}
async run(cmd) {
const validity = await this.checkValidityIssues(cmd);
if (validity)
return validity;
const communityName = cmd.parameters?.communityName || '';
const publishCmd = `sf community publish -n "${communityName}"` + (this.customUsernameToUse ? ` --target-org ${this.customUsernameToUse}` : '');
const res = await execCommand(publishCmd, null, { fail: false, output: true });
if (res.status === 0) {
return { statusCode: 'success', output: (res.stdout || '') + '\n' + (res.stderr || '') };
}
return { statusCode: 'failed', output: (res.stdout || '') + '\n' + (res.stderr || '') };
}
}
//# sourceMappingURL=publishCommunityAction.js.map