@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
38 lines • 1.6 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const schema_1 = require("@sprucelabs/schema");
const namedTemplateItem_builder_1 = __importDefault(require("../../../schemas/v2020_07_22/namedTemplateItem.builder"));
const AbstractAction_1 = __importDefault(require("../../AbstractAction"));
const optionsSchema = (0, schema_1.buildSchema)({
id: 'createLogTransportOptions',
description: 'Send logs wherever you want based on their severity. We like to send console.error to a Slack channel the team uses.',
fields: {
nameReadable: {
type: 'text',
label: 'What is the name of your transport?',
isRequired: true,
hint: 'E.g. Slack or Email',
},
nameCamel: namedTemplateItem_builder_1.default.fields.nameCamel,
},
});
class CreateLogTransportAction extends AbstractAction_1.default {
optionsSchema = optionsSchema;
invocationMessage = 'Creating a new log transport... ✍️';
commandAliases = ['create.log.transport'];
async execute(options) {
const { nameCamel, nameReadable } = this.validateAndNormalizeOptions(options);
const file = await this.Writer('log').writeTransportPlugin(this.cwd, {
nameCamel,
nameReadable,
});
return {
files: [file],
};
}
}
exports.default = CreateLogTransportAction;
//# sourceMappingURL=CreateTransportAction.js.map