text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
  
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
  
  _Object$defineProperty(exports, "__esModule", {
    value: true
  });
  
  exports.handler = exports.builder = exports.command = exports.description = exports.files = void 0;
  
  var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/reduce"));
  
  var _lib = require("../../../lib");
  
  var _helpers = require("../helpers");
  
  const REDWOOD_WEB_PATH_NAME = 'components';
  
  const files = ({
    name,
    ...options
  }) => {
    var _context;
  
    const isJavascript = options.javascript && !options.typescript;
    const componentFile = (0, _helpers.templateForComponentFile)({
      name,
      webPathSection: REDWOOD_WEB_PATH_NAME,
      extension: isJavascript ? '.js' : '.tsx',
      generator: 'component',
      templatePath: 'component.tsx.template'
    });
    const testFile = (0, _helpers.templateForComponentFile)({
      name,
      extension: `.test.${isJavascript ? 'js' : 'tsx'}`,
      webPathSection: REDWOOD_WEB_PATH_NAME,
      generator: 'component',
      templatePath: 'test.tsx.template'
    });
    const storiesFile = (0, _helpers.templateForComponentFile)({
      name,
      extension: `.stories.${isJavascript ? 'js' : 'tsx'}`,
      webPathSection: REDWOOD_WEB_PATH_NAME,
      generator: 'component',
      templatePath: 'stories.tsx.template'
    }); // Returns
    // {
    //    "path/to/fileA": "<<<template>>>",
    //    "path/to/fileB": "<<<template>>>",
    // }
  
    return (0, _reduce.default)(_context = [componentFile, testFile, storiesFile]).call(_context, (acc, [outputPath, content]) => {
      const template = isJavascript ? (0, _lib.transformTSToJS)(outputPath, content) : content;
      return {
        [outputPath]: template,
        ...acc
      };
    }, {});
  };
  
  exports.files = files;
  const description = 'Generate a component';
  exports.description = description;
  const {
    command,
    builder,
    handler
  } = (0, _helpers.createYargsForComponentGeneration)({
    componentName: 'component',
    filesFn: files
  });
  exports.handler = handler;
  exports.builder = builder;
  exports.command = command;