{"version":3,"file":"frack","sources":["../src/scripts/build.js","../src/hotdev/util.js","../src/hotdev/HotServerManager.js","../src/hotdev/ListenerManager.js","../src/hotdev/HotClientManager.js","../src/hotdev/clearConsole.js","../src/hotdev/formatWebpackMessages.js","../src/hotdev/getProcessForPort.js","../src/hotdev/DevServerUtils.js","../src/hotdev/HotController.js","../src/scripts/start.js","../src/scripts/init.js","../src/scripts/new/prompts.js","../src/scripts/new/utils.js","../src/scripts/new/index.js","../src/utils/logger.js","../src/scripts/dupe/prompts.js","../src/scripts/dupe/utils.js","../src/scripts/dupe/index.js","../src/script.js"],"sourcesContent":["import { resolve } from 'path'\nimport rimraf from 'rimraf'\nimport webpack from 'webpack'\nimport { series } from 'async'\nimport chalk from 'chalk'\nimport { frackSettings } from 'frack-settings'\n\nimport { configFactory } from 'frack-build-config-factory'\n\nfunction niceStattrace (error) {\n  const [file, message, ...stack] = error.split('\\n')\n\n  return [\n    '',\n    '',\n    `${chalk.cyan(file)}: ${chalk.red(message)}`,\n    '',\n    ...stack.map(row => chalk.white(`\\t${row}`)),\n    '',\n    '',\n  ].join('\\n')\n}\n\n/* eslint-disable no-process-exit, no-console */\nexport default function build () {\n  const buildFolderClient = resolve(process.cwd(), 'build', 'client')\n  const buildFolderServer = resolve(process.cwd(), 'build', 'server')\n\n  series([\n      (callback) => {\n        // Remove all content but keep the directory so that\n        // if you're in it, you don't end up in Trash\n        rimraf(`${buildFolderClient}/*.css`, callback)\n        rimraf(`${buildFolderClient}/*.css.map`, () => true)\n      },\n      (callback) => {\n        // Remove all content but keep the directory so that\n        // if you're in it, you don't end up in Trash\n        rimraf(`${buildFolderServer}/*`, callback)\n      },\n    callback => {\n      console.log('Creating a production build for client...')\n      const clientWebpackConfig = configFactory({\n        target: 'web',\n        mode: 'production',\n        settings: frackSettings(),\n      })\n      webpack({ ...clientWebpackConfig, context: process.cwd() }).run(\n        (error, stats) => {\n          if (error || stats.hasErrors()) {\n            console.error('Failed to create a production build for client:')\n            error && 'message' in error && console.error(error.message)\n            stats.toJson('errors-only').errors.forEach(statError => {\n              console.error(niceStattrace(statError))\n            })\n            process.exit(1)\n          }\n\n          callback()\n        }\n      )\n    },\n    callback => {\n      console.log('Creating a production build for server...')\n      const nodeWebpackConfig = configFactory({\n        target: 'node',\n        mode: 'production',\n        settings: frackSettings(),\n      })\n      webpack({ ...nodeWebpackConfig, context: process.cwd() }).run(\n        (error, stats) => {\n          if (error || stats.hasErrors()) {\n            console.error('Failed to create a production build for server:')\n            error && 'message' in error && console.error(error.message)\n            stats.toJson('errors-only').errors.forEach(statError => {\n              console.error(niceStattrace(statError))\n            })\n            process.exit(1)\n          }\n\n          callback()\n        }\n      )\n    },\n  ])\n}\n","import notifier from 'node-notifier'\nimport chalk from 'chalk'\n\nexport function createNotification (options) {\n  const title = `${options.title}`\n\n  if (options.notify) {\n    notifier.notify({\n      title,\n      message: options.message,\n    })\n  }\n\n  const level = options.level || 'info'\n  const message = `${chalk.bold(title)}: ${options.message}`\n\n  switch (level) {\n    case 'warn':\n      console.log(chalk.yellow(message))\n      break\n\n    case 'error':\n      console.log(chalk.bgRed.white(message))\n      break\n\n    case 'info':\n    default:\n      console.log(message)\n  }\n}\n","import { createNotification } from './util'\n\nexport default class HotServerManager {\n  constructor (compiler) {\n    compiler.plugin('done', (stats) => {\n      if (stats.hasErrors() && stats.toString() !== '') {\n        createNotification({\n          title: 'Hot Server Manager',\n          level: 'error',\n          message: 'Build failed, check the console for more information.',\n          notify: true,\n        })\n\n        console.log(stats.toString('minimal'))\n      }\n    })\n\n    // Lets start the compiler.\n    this.watcher = compiler.watch(null, () => undefined)\n  }\n\n  dispose () {\n    this.disposing = true\n    this.watcher.close()\n  }\n}\n","/* eslint-disable promise/avoid-new */\nimport { createNotification } from './util'\n\nexport default class ListenerManager {\n  constructor (listener, name) {\n    this.name = name || 'listener'\n    this.lastConnectionKey = 0\n    this.connectionMap = {}\n    this.listener = listener\n\n    // Track all connections to our server so that we can close them when needed.\n    this.listener.on('connection', (connection) => {\n      // Increment the connection key.\n      this.lastConnectionKey += 1\n\n      // Generate a new key to represent the connection\n      const connectionKey = this.lastConnectionKey\n\n      // Add the connection to our map.\n      this.connectionMap[connectionKey] = connection\n\n      // Remove the connection from our map when it closes.\n      connection.on('close', () => {\n        delete this.connectionMap[connectionKey]\n      })\n    })\n  }\n\n  killAllConnections () {\n    Object.keys(this.connectionMap).forEach((connectionKey) => {\n      this.connectionMap[connectionKey].destroy()\n    })\n  }\n\n  dispose () {\n    return new Promise((resolve) => {\n      if (this.listener) {\n        this.killAllConnections()\n\n        createNotification({\n          title: this.name,\n          level: 'info',\n          message: 'Destroyed all existing connections.',\n        })\n\n        this.listener.close(() => {\n          createNotification({\n            title: this.name,\n            level: 'info',\n            message: 'Closed listener.',\n          })\n\n          resolve()\n        })\n      } else {\n        resolve()\n      }\n    })\n  }\n}\n","import express from 'express'\nimport createDevMiddleware from 'webpack-dev-middleware'\nimport createHotMiddleware from 'webpack-hot-middleware'\n\nimport ListenerManager from './ListenerManager'\nimport { createNotification } from './util'\n\nexport default class HotClientManager {\n  constructor (compiler) {\n    const httpServer = express()\n\n    const httpPathRegex = /^https?:\\/\\/(.*):([\\d]{1,5})/i\n    const httpPath = compiler.options.output.publicPath\n\n    if (!httpPath.startsWith('http') && !httpPathRegex.test(httpPath)) {\n      throw new Error(\n        'You must supply an absolute public path to a development build of a web target bundle ' +\n          'as it will be hosted on a seperate development server to any node target bundles.'\n      )\n    }\n\n    // eslint-disable-next-line no-unused-vars\n    const [_, host, port] = httpPathRegex.exec(httpPath)\n\n    this.devMiddleware = createDevMiddleware(compiler, {\n      quiet: false,\n      noInfo: true,\n      stats: {\n        colors: true,\n      },\n      headers: {\n        'Access-Control-Allow-Origin': '*',\n      },\n\n      // Ensure that the public path is taken from the compiler webpack config\n      // as it will have been created as an absolute path to avoid conflicts\n      // with an node servers.\n      publicPath: compiler.options.output.publicPath,\n    })\n\n    this.hotMiddleware = createHotMiddleware(compiler)\n\n    httpServer.use(this.devMiddleware)\n    httpServer.use(this.hotMiddleware)\n\n    const listener = httpServer.listen(port, host)\n\n    this.listenerManager = new ListenerManager(listener, 'client')\n\n    compiler.plugin('done', stats => {\n      if (stats.hasErrors()) {\n        createNotification({\n          title: 'Hot Client Manager',\n          level: 'error',\n          message: 'Build failed, please check the console for more information.',\n          notify: true,\n        })\n\n        console.error(stats.toString())\n      }\n    })\n  }\n\n  dispose () {\n    this.devMiddleware.close()\n\n    return this.listenerManager ? this.listenerManager.dispose() : Promise.resolve()\n  }\n}\n","export default function clearConsole () {\n  process.stdout.write(process.platform === 'win32' ? '\\x1Bc' : '\\x1B[2J\\x1B[3J\\x1B[H')\n}\n","var chalk = require('chalk')\nvar friendlySyntaxErrorLabel = 'Syntax error:'\n\nfunction isLikelyASyntaxError (message) {\n  return message.indexOf(friendlySyntaxErrorLabel) !== -1\n}\n\n// Cleans up webpack error messages.\n// eslint-disable-next-line no-unused-vars\nfunction formatMessage (message, isError) {\n  var lines = message.split('\\n')\n\n  if (lines.length > 2 && lines[1] === '') {\n    // Remove extra newline.\n    lines.splice(1, 1)\n  }\n\n  // Remove webpack-specific loader notation from filename.\n  // Before:\n  // ./~/css-loader!./~/postcss-loader!./src/App.css\n  // After:\n  // ./src/App.css\n  if (lines[0].lastIndexOf('!') !== -1) {\n    lines[0] = lines[0].substr(lines[0].lastIndexOf('!') + 1)\n  }\n\n  lines = lines.filter(function (line) {\n    // Webpack adds a list of entry points to warning messages:\n    //  @ ./src/index.js\n    //  @ multi react-scripts/~/react-dev-utils/webpackHotDevClient.js ...\n    // It is misleading (and unrelated to the warnings) so we clean it up.\n    // It is only useful for syntax errors but we have beautiful frames for them.\n    return line.indexOf(' @ ') !== 0\n  })\n\n  // line #0 is filename\n  // line #1 is the main error message\n  if (!lines[0] || !lines[1]) {\n    return lines.join('\\n')\n  }\n\n  // Cleans up verbose \"module not found\" messages for files and packages.\n  if (lines[1].indexOf('Module not found: ') === 0) {\n    lines = [\n      lines[0],\n      // Clean up message because \"Module not found: \" is descriptive enough.\n      lines[1]\n        .replace(\"Cannot resolve 'file' or 'directory' \", '')\n        .replace('Cannot resolve module ', '')\n        .replace('Error: ', '')\n        .replace('[CaseSensitivePathsPlugin] ', ''),\n    ]\n  }\n\n  // Cleans up syntax error messages.\n  if (lines[1].indexOf('Module build failed: ') === 0) {\n    lines[1] = lines[1].replace('Module build failed: SyntaxError:', friendlySyntaxErrorLabel)\n  }\n\n  // Clean up export errors.\n  // TODO: we should really send a PR to Webpack for this.\n  var exportError = /\\s*(.+?)\\s*(\")?export '(.+?)' was not found in '(.+?)'/\n  if (lines[1].match(exportError)) {\n    lines[1] = lines[1].replace(exportError, \"$1 '$4' does not contain an export named '$3'.\")\n  }\n\n  lines[0] = chalk.inverse(lines[0])\n\n  // Reassemble the message.\n  message = lines.join('\\n')\n  // Internal stacks are generally useless so we strip them... with the\n  // exception of stacks containing `webpack:` because they're normally\n  // from user code generated by WebPack. For more information see\n  // https://github.com/facebookincubator/create-react-app/pull/1050\n  message = message.replace(/^\\s*at\\s((?!webpack:).)*:\\d+:\\d+[\\s)]*(\\n|$)/gm, '') // at ... ...:x:y\n\n  return message.trim()\n}\n\nexport default function formatWebpackMessages (json) {\n  var formattedErrors = json.errors.map(function (message) {\n    return formatMessage(message, true)\n  })\n  var formattedWarnings = json.warnings.map(function (message) {\n    return formatMessage(message, false)\n  })\n  var result = {\n    errors: formattedErrors,\n    warnings: formattedWarnings,\n  }\n  if (result.errors.some(isLikelyASyntaxError)) {\n    // If there are any syntax errors, show just them.\n    // This prevents a confusing ESLint parsing error\n    // preceding a much more useful Babel syntax error.\n    result.errors = result.errors.filter(isLikelyASyntaxError)\n  }\n  return result\n}\n","var chalk = require('chalk')\nvar execSync = require('child_process').execSync\nvar path = require('path')\n\nvar execOptions = {\n  encoding: 'utf8',\n  stdio: [\n    'pipe', // stdin (default)\n    'pipe', // stdout (default)\n    'ignore', // stderr\n  ],\n}\n\nfunction isProcessAReactApp (processCommand) {\n  return /^node .*react-scripts\\/scripts\\/start\\.js\\s?$/.test(processCommand)\n}\n\nfunction getProcessIdOnPort (port) {\n  return execSync('lsof -i:' + port + ' -P -t -sTCP:LISTEN', execOptions).split('\\n')[0].trim()\n}\n\nfunction getPackageNameInDirectory (directory) {\n  var packagePath = path.join(directory.trim(), 'package.json')\n\n  try {\n    return require(packagePath).name\n  } catch (e) {\n    return null\n  }\n}\n\nfunction getProcessCommand (processId, processDirectory) {\n  var command = execSync('ps -o command -p ' + processId + ' | sed -n 2p', execOptions)\n\n  command = command.replace(/\\n$/, '')\n\n  if (isProcessAReactApp(command)) {\n    const packageName = getPackageNameInDirectory(processDirectory)\n    return packageName || command\n  } else {\n    return command\n  }\n}\n\nfunction getDirectoryOfProcessById (processId) {\n  return execSync('lsof -p ' + processId + ' | awk \\'$4==\"cwd\" {print $9}\\'', execOptions).trim()\n}\n\nexport default function getProcessForPort (port) {\n  try {\n    var processId = getProcessIdOnPort(port)\n    var directory = getDirectoryOfProcessById(processId)\n    var command = getProcessCommand(processId, directory)\n    return chalk.cyan(command) + chalk.grey(' (pid ' + processId + ')\\n') + chalk.blue('  in ') + chalk.cyan(directory)\n  } catch (e) {\n    return null\n  }\n}\n","/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict'\n\nimport address from 'address'\n// import fs from 'fs'\nimport path from 'path'\nimport url from 'url'\nimport chalk from 'chalk'\n// import detect from 'detect-port-alt'\n// import isRoot from 'is-root'\nimport inquirer from 'inquirer'\nimport clearConsole from './clearConsole'\nimport formatWebpackMessages from './formatWebpackMessages'\nimport getProcessForPort from './getProcessForPort'\n\nconst isInteractive = process.stdout.isTTY\nlet handleCompile\n\n// You can safely remove this after ejecting.\n// We only use this block for testing of Create React App itself:\nconst isSmokeTest = process.argv.some((arg) => arg.indexOf('--smoke-test') > -1)\nif (isSmokeTest) {\n  handleCompile = (err, stats) => {\n    if (err || stats.hasErrors() || stats.hasWarnings()) {\n      process.exit(1)\n    } else {\n      process.exit(0)\n    }\n  }\n}\n\nfunction prepareUrls (protocol, host, port) {\n  const formatUrl = (hostname) =>\n    url.format({\n      protocol,\n      hostname,\n      port,\n      pathname: '/',\n    })\n  const prettyPrintUrl = (hostname) =>\n    url.format({\n      protocol,\n      hostname,\n      port: chalk.bold(port),\n      pathname: '/',\n    })\n\n  const isUnspecifiedHost = host === '0.0.0.0' || host === '::'\n  let prettyHost, lanUrlForConfig, lanUrlForTerminal\n  if (isUnspecifiedHost) {\n    prettyHost = 'localhost'\n    try {\n      // This can only return an IPv4 address\n      lanUrlForConfig = address.ip()\n      if (lanUrlForConfig) {\n        // Check if the address is a private ip\n        // https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces\n        if (/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(lanUrlForConfig)) {\n          // Address is private, format it for later use\n          lanUrlForTerminal = prettyPrintUrl(lanUrlForConfig)\n        } else {\n          // Address is not private, so we will discard it\n          lanUrlForConfig = undefined\n        }\n      }\n    } catch (_e) {\n      // ignored\n    }\n  } else {\n    prettyHost = host\n  }\n  const localUrlForTerminal = prettyPrintUrl(prettyHost)\n  const localUrlForBrowser = formatUrl(prettyHost)\n  return {\n    lanUrlForConfig,\n    lanUrlForTerminal,\n    localUrlForTerminal,\n    localUrlForBrowser,\n  }\n}\n\nfunction printInstructions (appName, urls, useYarn) {\n  console.log()\n  console.log(`You can now view ${chalk.bold(appName)} in the browser.`)\n  console.log()\n\n  if (urls.lanUrlForTerminal) {\n    console.log(`  ${chalk.bold('Local:')}            ${urls.localUrlForTerminal}`)\n    console.log(`  ${chalk.bold('On Your Network:')}  ${urls.lanUrlForTerminal}`)\n  } else {\n    console.log(`  ${urls.localUrlForTerminal}`)\n  }\n\n  console.log()\n  console.log('Note that the development build is not optimized.')\n  console.log(`To create a production build, use ` + `${chalk.cyan(`${useYarn ? 'yarn' : 'npm run'} build`)}.`)\n  console.log()\n}\n\nfunction createCompiler (webpack, config, appName, urls, useYarn) {\n  // \"Compiler\" is a low-level interface to Webpack.\n  // It lets us listen to some events and provide our own custom messages.\n  let compiler\n  try {\n    compiler = webpack(config, handleCompile)\n  } catch (err) {\n    console.log(chalk.red('Failed to compile.'))\n    console.log()\n    console.log(err.message || err)\n    console.log()\n    process.exit(1)\n  }\n\n  // \"invalid\" event fires when you have changed a file, and Webpack is\n  // recompiling a bundle. WebpackDevServer takes care to pause serving the\n  // bundle, so if you refresh, it'll wait instead of serving the old one.\n  // \"invalid\" is short for \"bundle invalidated\", it doesn't imply any errors.\n  compiler.plugin('invalid', () => {\n    if (isInteractive) {\n      clearConsole()\n    }\n    console.log('Compiling...')\n  })\n\n  let isFirstCompile = true\n\n  // \"done\" event fires when Webpack has finished recompiling the bundle.\n  // Whether or not you have warnings or errors, you will get this event.\n  compiler.plugin('done', (stats) => {\n    if (isInteractive) {\n      clearConsole()\n    }\n\n    // We have switched off the default Webpack output in WebpackDevServer\n    // options so we are going to \"massage\" the warnings and errors and present\n    // them in a readable focused way.\n    const messages = formatWebpackMessages(stats.toJson({}, true))\n    const isSuccessful = !messages.errors.length && !messages.warnings.length\n    if (isSuccessful) {\n      console.log(chalk.green('Compiled successfully!'))\n    }\n    if (isSuccessful && (isInteractive || isFirstCompile)) {\n      printInstructions(appName, urls, useYarn)\n    }\n    isFirstCompile = false\n\n    // If errors exist, only show errors.\n    if (messages.errors.length) {\n      // Only keep the first error. Others are often indicative\n      // of the same problem, but confuse the reader with noise.\n      if (messages.errors.length > 1) {\n        messages.errors.length = 1\n      }\n      console.log(chalk.red('Failed to compile.\\n'))\n      console.log(messages.errors.join('\\n\\n'))\n      return\n    }\n\n    // Show warnings if no errors were found.\n    if (messages.warnings.length) {\n      console.log(chalk.yellow('Compiled with warnings.\\n'))\n      console.log(messages.warnings.join('\\n\\n'))\n\n      // Teach some ESLint tricks.\n      console.log(\n        '\\nSearch for the ' + chalk.underline(chalk.yellow('keywords')) + ' to learn more about each warning.'\n      )\n      console.log('To ignore, add ' + chalk.cyan('// eslint-disable-next-line') + ' to the line before.\\n')\n    }\n  })\n  return compiler\n}\n\nfunction resolveLoopback (proxy) {\n  const o = url.parse(proxy)\n  o.host = undefined\n  if (o.hostname !== 'localhost') {\n    return proxy\n  }\n  // Unfortunately, many languages (unlike node) do not yet support IPv6.\n  // This means even though localhost resolves to ::1, the application\n  // must fall back to IPv4 (on 127.0.0.1).\n  // We can re-enable this in a few years.\n  /* try {\n    o.hostname = address.ipv6() ? '::1' : '127.0.0.1';\n  } catch (_ignored) {\n    o.hostname = '127.0.0.1';\n  } */\n\n  try {\n    // Check if we're on a network; if we are, chances are we can resolve\n    // localhost. Otherwise, we can just be safe and assume localhost is\n    // IPv4 for maximum compatibility.\n    if (!address.ip()) {\n      o.hostname = '127.0.0.1'\n    }\n  } catch (_ignored) {\n    o.hostname = '127.0.0.1'\n  }\n  return url.format(o)\n}\n\n// We need to provide a custom onError function for httpProxyMiddleware.\n// It allows us to log custom error messages on the console.\nfunction onProxyError (proxy) {\n  return (err, req, res) => {\n    const host = req.headers && req.headers.host\n    console.log(\n      chalk.red('Proxy error:') +\n        ' Could not proxy request ' +\n        chalk.cyan(req.url) +\n        ' from ' +\n        chalk.cyan(host) +\n        ' to ' +\n        chalk.cyan(proxy) +\n        '.'\n    )\n    console.log(\n      'See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (' +\n        chalk.cyan(err.code) +\n        ').'\n    )\n    console.log()\n\n    // And immediately send the proper error response to the client.\n    // Otherwise, the request will eventually timeout with ERR_EMPTY_RESPONSE on the client side.\n    if (res.writeHead && !res.headersSent) {\n      res.writeHead(500)\n    }\n    res.end(\n      'Proxy error: Could not proxy request ' + req.url + ' from ' + host + ' to ' + proxy + ' (' + err.code + ').'\n    )\n  }\n}\n\nfunction prepareProxy (proxy, appPublicFolder) {\n  // `proxy` lets you specify alternate servers for specific requests.\n  // It can either be a string or an object conforming to the Webpack dev server proxy configuration\n  // https://webpack.github.io/docs/webpack-dev-server.html\n  if (!proxy) {\n    return undefined\n  }\n  if (typeof proxy !== 'object' && typeof proxy !== 'string') {\n    console.log(chalk.red('When specified, \"proxy\" in package.json must be a string or an object.'))\n    console.log(chalk.red('Instead, the type of \"proxy\" was \"' + typeof proxy + '\".'))\n    console.log(chalk.red('Either remove \"proxy\" from package.json, or make it an object.'))\n    process.exit(1)\n  }\n\n  // Otherwise, if proxy is specified, we will let it handle any request except for files in the public folder.\n  function mayProxy (pathname) {\n    const maybePublicPath = path.resolve(appPublicFolder, pathname.slice(1))\n    return !fs.existsSync(maybePublicPath)\n  }\n\n  // Support proxy as a string for those who are using the simple proxy option\n  if (typeof proxy === 'string') {\n    if (!/^http(s)?:\\/\\//.test(proxy)) {\n      console.log(chalk.red('When \"proxy\" is specified in package.json it must start with either http:// or https://'))\n      process.exit(1)\n    }\n\n    let target\n    if (process.platform === 'win32') {\n      target = resolveLoopback(proxy)\n    } else {\n      target = proxy\n    }\n    return [\n      {\n        target,\n        logLevel: 'silent',\n        // For single page apps, we generally want to fallback to /index.html.\n        // However we also want to respect `proxy` for API calls.\n        // So if `proxy` is specified as a string, we need to decide which fallback to use.\n        // We use a heuristic: if request `accept`s text/html, we pick /index.html.\n        // Modern browsers include text/html into `accept` header when navigating.\n        // However API calls like `fetch()` won’t generally accept text/html.\n        // If this heuristic doesn’t work well for you, use a custom `proxy` object.\n        context: function (pathname, req) {\n          return mayProxy(pathname) && req.headers.accept && req.headers.accept.indexOf('text/html') === -1\n        },\n        onProxyReq: (proxyReq) => {\n          // Browers may send Origin headers even with same-origin\n          // requests. To prevent CORS issues, we have to change\n          // the Origin to match the target URL.\n          if (proxyReq.getHeader('origin')) {\n            proxyReq.setHeader('origin', target)\n          }\n        },\n        onError: onProxyError(target),\n        secure: false,\n        changeOrigin: true,\n        ws: true,\n        xfwd: true,\n      },\n    ]\n  }\n\n  // Otherwise, proxy is an object so create an array of proxies to pass to webpackDevServer\n  return Object.keys(proxy).map(function (context) {\n    if (!proxy[context].hasOwnProperty('target')) {\n      console.log(\n        chalk.red(\n          'When `proxy` in package.json is as an object, each `context` object must have a ' +\n            '`target` property specified as a url string'\n        )\n      )\n      process.exit(1)\n    }\n    let target\n    if (process.platform === 'win32') {\n      target = resolveLoopback(proxy[context].target)\n    } else {\n      target = proxy[context].target\n    }\n    return Object.assign({}, proxy[context], {\n      context: function (pathname) {\n        return mayProxy(pathname) && pathname.match(context)\n      },\n      onProxyReq: (proxyReq) => {\n        // Browers may send Origin headers even with same-origin\n        // requests. To prevent CORS issues, we have to change\n        // the Origin to match the target URL.\n        if (proxyReq.getHeader('origin')) {\n          proxyReq.setHeader('origin', target)\n        }\n      },\n      target,\n      onError: onProxyError(target),\n    })\n  })\n}\n\nfunction choosePort (host, defaultPort) {\n  return detect(defaultPort, host).then(\n    (port) =>\n      new Promise((resolve) => {\n        if (port === defaultPort) {\n          return resolve(port)\n        }\n        const message =\n          process.platform !== 'win32' && defaultPort < 1024 && !isRoot()\n            ? `Admin permissions are required to run a server on a port below 1024.`\n            : `Something is already running on port ${defaultPort}.`\n        if (isInteractive) {\n          clearConsole()\n          const existingProcess = getProcessForPort(defaultPort)\n          const question = {\n            type: 'confirm',\n            name: 'shouldChangePort',\n            message:\n              chalk.yellow(message + `${existingProcess ? ` Probably:\\n  ${existingProcess}` : ''}`) +\n              '\\n\\nWould you like to run the app on another port instead?',\n            default: true,\n          }\n          inquirer\n            .prompt(question)\n            .then((answer) => {\n              if (answer.shouldChangePort) {\n                return resolve(port)\n              } else {\n                return resolve(null)\n              }\n            })\n            .catch((e) => console.error(e))\n        } else {\n          console.log(chalk.red(message))\n          resolve(null)\n        }\n      }),\n    (err) => {\n      throw new Error(\n        chalk.red(`Could not find an open port at ${chalk.bold(host)}.`) +\n          '\\n' +\n          ('Network error message: ' + err.message || err) +\n          '\\n'\n      )\n    }\n  )\n}\n\nexport { choosePort, createCompiler, prepareProxy, prepareUrls }\n","/* eslint-disable promise/avoid-new */\n/* eslint-disable import/first */\nimport webpack from 'webpack'\nimport { frackSettings } from 'frack-settings'\nimport { spawn } from 'child_process'\nimport appRootDir from 'app-root-dir'\nimport path from 'path'\nimport { createNotification } from './util'\nimport HotServerManager from './HotServerManager'\nimport HotClientManager from './HotClientManager'\nimport { configFactory, StatusPlugin } from 'frack-build-config-factory'\nimport { createCompiler as ruCreateCompiler, prepareUrls } from './DevServerUtils'\n\nfunction safeDisposer (manager) {\n  return manager ? manager.dispose() : Promise.resolve()\n}\n\n/* eslint-disable arrow-body-style, no-console */\n\nfunction createCompiler ({ name, start, done }) {\n  try {\n    const settings = frackSettings()\n    const webpackConfig = configFactory({\n      target: name === 'server' ? 'node' : 'web',\n      mode: 'development',\n      settings,\n    })\n\n    // Offering a special status handling until Webpack offers a proper `done()` callback\n    // See also: https://github.com/webpack/webpack/issues/4243\n    webpackConfig.plugins.push(new StatusPlugin({ name, start, done }))\n    const urls = prepareUrls('http', 'localhost', settings.serverPort)\n    return ruCreateCompiler(webpack, webpackConfig, name, urls, settings.useYarn || false)\n  } catch (error) {\n    createNotification({\n      title: 'development',\n      level: 'error',\n      message: 'Webpack config is invalid, please check the console for more information.',\n      notify: true,\n    })\n\n    console.error(error)\n    throw error\n  }\n}\n\nexport default class HotController {\n  constructor () {\n    this.hotClientManager = null\n    this.hotServerManager = null\n\n    this.clientIsBuilding = false\n    this.serverIsBuilding = false\n\n    this.timeout = 0\n\n    const createClientManager = () => {\n      return new Promise((resolve) => {\n        const compiler = createCompiler({\n          name: 'client',\n          start: () => {\n            this.clientIsBuilding = true\n            createNotification({\n              title: 'Hot Client',\n              level: 'info',\n              message: 'Building new bundle...',\n            })\n          },\n          done: () => {\n            this.clientIsBuilding = false\n            createNotification({\n              title: 'Hot Client',\n              level: 'info',\n              message: 'Bundle is ready.',\n              notify: true,\n            })\n            resolve(compiler)\n          },\n        })\n\n        this.hotClientCompiler = compiler\n        this.hotClientManager = new HotClientManager(compiler)\n      })\n    }\n\n    const createServerManager = () => {\n      return new Promise((resolve) => {\n        const compiler = createCompiler({\n          name: 'server',\n          start: () => {\n            this.serverIsBuilding = true\n            createNotification({\n              title: 'Hot Server',\n              level: 'info',\n              message: 'Building new bundle...',\n            })\n          },\n          done: () => {\n            this.serverIsBuilding = false\n            createNotification({\n              title: 'Hot Server',\n              level: 'info',\n              message: 'Bundle is ready.',\n              notify: true,\n            })\n\n            this.tryStartServer()\n            resolve(compiler)\n          },\n        })\n\n        this.compiledServer = path.resolve(\n          appRootDir.get(),\n          compiler.options.output.path,\n          `${Object.keys(compiler.options.entry)[0]}.js`\n        )\n\n        this.hotServerCompiler = compiler\n        this.hotServerManager = new HotServerManager(compiler, this.hotClientCompiler)\n      })\n    }\n\n    createClientManager().then(createServerManager).catch((error) => {\n      console.error('Error during build:', error)\n    })\n  }\n\n  tryStartServer = () => {\n    if (this.clientIsBuilding) {\n      if (this.serverTryTimeout) {\n        clearTimeout(this.serverTryTimeout)\n      }\n      this.serverTryTimeout = setTimeout(this.tryStartServer, this.timeout)\n      this.timeout += 100\n      return\n    }\n\n    this.startServer()\n    this.timeout = 0\n  }\n  startServer = () => {\n    if (this.server) {\n      this.server.kill()\n      this.server = null\n      createNotification({\n        title: 'Hot Server',\n        level: 'info',\n        message: 'Restarting server...',\n      })\n    }\n\n    const newServer = spawn('node', [ this.compiledServer, '--colors' ], {\n      stdio: [ process.stdin, process.stdout, 'pipe' ],\n    })\n\n    createNotification({\n      title: 'Hot Server',\n      level: 'info',\n      message: 'Server running with latest changes.',\n      notify: true,\n    })\n\n    newServer.stderr.on('data', (data) => {\n      createNotification({\n        title: 'Hot Server',\n        level: 'error',\n        message: 'Error in server execution, check the console for more info.',\n      })\n      process.stderr.write('\\n')\n      process.stderr.write(data)\n      process.stderr.write('\\n')\n    })\n\n    this.server = newServer\n  }\n  dispose () {\n    // First the hot client server. Then dispose the hot node server.\n    return safeDisposer(this.hotClientManager).then(() => safeDisposer(this.hotServerManager)).catch((error) => {\n      console.error(error)\n    })\n  }\n}\n","import HotController from '../hotdev/HotController'\n\nexport default function start () {\n  /* eslint-disable no-new */\n  new HotController()\n}\n","import pacote from 'pacote'\nimport ora from 'ora'\nimport { existsSync } from 'fs'\nimport { resolve } from 'path'\nimport { writeJsonSync, readJsonSync } from 'fs-extra'\nimport shelljs from 'shelljs'\n\nconst ROOT = process.cwd()\n\nfunction mergePackages () {\n  let progress = ora('Creating extended package.json').start()\n  let projectPackage = readJsonSync(resolve(ROOT, 'package.json'))\n  let kitPackage = readJsonSync(resolve(ROOT, '.tmp', 'package.json'))\n  projectPackage = {\n    ...projectPackage,\n    scripts: { ...projectPackage.scripts, ...kitPackage.scripts },\n    dependencies: { ...projectPackage.dependencies, ...kitPackage.dependencies },\n    devDependencies: { ...projectPackage.devDependencies, ...kitPackage.devDependencies },\n  }\n\n  try {\n    writeJsonSync(resolve(ROOT, 'package.json'), projectPackage)\n  } catch (e) {\n    progress.fail(e.message)\n    process.exit(1)\n  }\n\n  progress.succeed('Package successfully extended')\n}\n\nfunction copySources () {\n  let progress = ora('Copying kit sources to project folder').start()\n  const from = resolve(ROOT, './.tmp/*')\n  const fromDot = resolve(ROOT, './.tmp/.*')\n  shelljs.cp('-r', [ from, fromDot ], ROOT)\n  progress.succeed('Files copied successfully')\n  return Promise.resolve()\n}\n\nfunction installPackages () {\n  let progress = ora('Installing dependencies').start()\n  return new Promise((resolve, reject) =>\n    shelljs\n      .exec(`yarn`, function (err) {\n        if (err) {\n          progress.fail(err.message)\n          reject(err)\n        }\n\n        progress.succeed('Dependencies installed successfully')\n        resolve()\n      })\n      .catch(console.error)\n  )\n}\n\nfunction downloadProjectKit () {\n  let progress = ora('Downloading project kit').start()\n  const packagePath = resolve(ROOT, 'package.json')\n\n  if (!existsSync(packagePath)) {\n    progress.fail(\"You doesn't seem to be in Frack based project\")\n    process.exit(1)\n  }\n\n  shelljs.exec(`mkdir -p ${resolve(ROOT, '.tmp')}`)\n\n  return pacote\n    .extract('frack-kit-universal@latest', resolve(ROOT, '.tmp/'))\n    .catch((err) => {\n      progress.fail(err.message)\n      return process.exit(1)\n    })\n    .then(() => {\n      progress.succeed(`Files downloaded`)\n      return true\n    })\n}\n\nfunction copyEnvFile () {\n  shelljs.cp(resolve(ROOT, '.env-development'), resolve(ROOT, '.env'))\n}\n\nexport default () => {\n  let progress = ora('Initializing new project').start()\n  downloadProjectKit()\n    .then(mergePackages)\n    .then(copySources)\n    .then(installPackages)\n    .then(copyEnvFile)\n    .then(() => progress.succeed('Project initialized'))\n    .catch(() => progress.fail('Error during project initialization'))\n}\n","// @flow\n\nconst loc = (): Object => ({\n  type: 'input',\n  name: 'module',\n  message: `How do you want to name it?`,\n  default: '',\n  validate: (name: string) => name !== '',\n})\n\nconst mod = (): Object => ({\n  type: 'list',\n  name: 'location',\n  message: (answers: any) => `Which type of module do you want to create?`,\n  default: 'both',\n  choices: ['application', 'server', 'both'],\n})\n\nexport { loc, mod }\n","const shell = require('shelljs')\nconst fs = require('fs')\nconst path = require('path')\n\nconst toCamelCase = function (str) {\n  return str.replace(/^([A-Z])|\\s(\\w)/g, function (match, p1, p2) {\n    if (p2) return p2.toUpperCase()\n    return p1.toLowerCase()\n  })\n}\n\nconst capitalize = function (str) {\n  return str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nfunction copyFiles (logger, templatePath, module, location) {\n  const destinationPath = path.resolve(process.cwd(), `./src/${location}/modules/${module}`)\n  // create new module directory\n  const mkdir = shell.mkdir('-p', destinationPath)\n\n  logger.info(`Copying ${location} files into ${destinationPath}`)\n\n  // continue only if directory does not jet exist\n  if (mkdir.code === 0) {\n    shell.cp('-R', `${templatePath}/${location}/*`, destinationPath)\n    logger.info(`✔ The ${location} files have been copied!`)\n    // change to destination directory\n    // rename files\n    shell.ls('-Rl', destinationPath).forEach(entry => {\n      if (entry.isFile()) {\n        const moduleFile = entry.name.replace(/module/gi, capitalize(module))\n        shell.mv(path.resolve(destinationPath, entry.name), path.resolve(destinationPath, moduleFile))\n      }\n    })\n    // replace module names\n    shell.ls('-Rl', destinationPath).forEach(entry => {\n      if (entry.isFile()) {\n        shell.sed('-i', /\\[module\\]/g, module, path.resolve(destinationPath, entry.name))\n        shell.sed('-i', /\\[Module\\]/g, capitalize(toCamelCase(module)), path.resolve(destinationPath, entry.name))\n      }\n    })\n\n    // get module input data\n    const inputDataPath = path.resolve(destinationPath, `../index.js`)\n    let data = fs.readFileSync(inputDataPath)\n    // extract Feature modules\n    const re = /Feature\\(([^()]+)\\)/g\n    const match = re.exec(data)\n    // prepend import module\n    const prepend = `import ${capitalize(module)} from './${module}';\\n`\n    fs.writeFileSync(inputDataPath, prepend + data)\n    // add module to Feature function\n    shell.sed('-i', re, `Feature(${capitalize(module)}, ${match[1]})`, inputDataPath)\n    logger.info(`✔Module for ${location} successfully created!`)\n  }\n}\nfunction deleteFiles (logger, templatePath, module, location) {\n  logger.info(`Deleting ${location} files…`)\n  const modulePath = path.resolve(process.cwd(), `../src/${location}/modules/${module}`)\n  if (fs.existsSync(modulePath)) {\n    // create new module directory\n    shell.rm('-rf', modulePath)\n    // add module to Feature function \n    // let ok = shell.sed('-i', `import ${module} from '.\\/${module}';`, '', 'index.js'); \n    // get module input data\n    const inputDataPath = path.resolve(process.cwd(), `./src/${location}/modules/index.js`)\n    let data = fs.readFileSync(inputDataPath)\n    // extract Feature modules\n    const re = /Feature\\(([^()]+)\\)/g\n    const match = re.exec(data)\n    const modules = match[1].split(',').filter(featureModule => featureModule.trim() !== module)\n    // remove import module line\n    const lines = data\n      .toString()\n      .split('\\n')\n      .filter(line => line.match(`import ${module} from './${module}';`) === null)\n    fs.writeFileSync(inputDataPath, lines.join('\\n'))\n    // remove module from Feature function\n    shell.sed('-i', re, `Feature(${modules.toString().trim()})`, 'index.js')\n    // continue only if directory does not jet exist\n    logger.info(`✔Module for ${location} successfully deleted!`)\n  } else {\n    logger.info(`✔Module ${location} location for ${modulePath} wasn't found!`)\n  }\n}\nexport default (action, args, options, logger) => {\n  const templatePath = path.resolve(__dirname, '../src/templates/module')\n  logger.info(action, templatePath, args, options)\n  if (!fs.existsSync(templatePath)) {\n    logger.error(`The requested location for ${args.location} wasn't found.`)\n    process.exit(1)\n  }\n  // application\n  if (args.location === 'application' || args.location === 'both') {\n    if (action === 'addmodule') {\n      copyFiles(logger, templatePath, args.module, 'application')\n    } else if (action === 'deletemodule') {\n      deleteFiles(logger, templatePath, args.module, 'application')\n    }\n  }\n\n  // server\n  if (args.location === 'server' || args.location === 'both') {\n    if (action === 'addmodule') {\n      copyFiles(logger, templatePath, args.module, 'server')\n    } else if (action === 'deletemodule') {\n      deleteFiles(logger, templatePath, args.module, 'server')\n    }\n  }\n}\n","/* eslint-disable no-console */\nimport inquirer from 'inquirer'\nimport { mod, loc } from './prompts'\nimport moduleCmd from './utils'\n\nconst createModule = (answers, logger) => {\n  logger.info(answers)\n  moduleCmd('addmodule', answers, { cwd: process.cwd() }, logger)\n}\n\nconst newModule = async logger => {\n  const answers = await inquirer.prompt([mod(['module']), loc()])\n  return answers\n}\n\nexport { newModule, createModule }\n","import minilog from 'minilog'\n\nminilog.enable()\n\nconst logger = minilog('😝 frack-cli')\n\nlet consoleLog = global.console.log\nglobal.console.log = function () {\n  if (\n    arguments.length === 1 &&\n    typeof arguments[0] === 'string' &&\n    arguments[0].match(/^\\[(HMR|WDS)\\]/)\n  ) {\n    consoleLog('😝 frack-cli ' + arguments[0])\n  } else {\n    consoleLog.apply(consoleLog, arguments)\n  }\n}\n\nexport default logger\n","// @flow\nimport { isAbsolute, relative } from 'path'\nimport type { InquirerFile } from './types'\n\nexport const component = (files: InquirerFile[]): {} => ({\n  type: 'autocomplete',\n  name: 'component',\n  message: 'Which component do you want to replicate?',\n  source: (_, input) =>\n    Promise.resolve(\n      files.filter(file => !input || file.value.toLowerCase().indexOf(input.toLowerCase()) >= 0)\n    ),\n})\n\nexport const name = (originalName: string): {} => ({\n  type: 'input',\n  name: 'name',\n  message: `How do you want to name ${originalName} component?`,\n  default: originalName,\n})\n\nexport const folder = (originalFolder: string): {} => ({\n  type: 'input',\n  name: 'folder',\n  message: answers => `In which folder do you want to put ${answers.name} component?`,\n  default: originalFolder,\n  filter: input => (isAbsolute(input) ? relative(process.cwd(), input) : input),\n})\n","// @flow\nimport { dirname, join, relative } from 'path'\nimport { camelCase, upperFirst } from 'lodash'\nimport { gray } from 'chalk'\nimport glob from 'glob'\nimport listReactFiles from 'list-react-files'\nimport type { InquirerFile } from './types'\n\nconst removeExt = path => path.replace(/\\.[^.]+$/, '')\n\nexport const getComponentName = (path: string): string => (\n  path.split('/').reduce((name, part) => {\n    if (/^[A-Z]/.test(part)) {\n      return removeExt(part)\n    } else if (/^((?!index).+)\\.[^.]+$/.test(part)) {\n      return upperFirst(camelCase(removeExt(part)))\n    }\n    return name\n  }, '')\n)\n\nexport const getComponentFolder = (path: string): string => {\n  const name = getComponentName(path)\n  return dirname(path).split('/').reduce((folder, part) => {\n    if (removeExt(part) === name) {\n      return folder\n    }\n    return join(folder, part)\n  }, './')\n}\n\nexport const isSingleFile = (path: string): boolean => {\n  const name = getComponentName(path)\n  const [dir] = dirname(path).split('/').reverse()\n\n  return dir !== name\n}\n\nexport const getFiles = (cwd: string, componentName?: string): string[] => {\n  const extensions = '{js,ts,jsx,tsx,css,less,scss}'\n  const pattern = componentName ? `**/${componentName}{.,.*.}${extensions}` : `**/*.${extensions}`\n  return glob.sync(pattern, { cwd, absolute: true, nodir: true })\n}\n\nexport const getComponentFiles = (root: string): Promise<InquirerFile[]> => (\n  listReactFiles(root).then((files: string[]) =>\n    files.map((path: string): InquirerFile => {\n      const name = getComponentName(path)\n      const absolutePath = join(root, path)\n      const relativePath = relative(process.cwd(), absolutePath)\n      return {\n        name: `${name} ${gray(relativePath)}`,\n        short: name,\n        value: absolutePath,\n      }\n    })\n  )\n)\n\nexport const replaceContents = (\n  contents: string,\n  oldName: string,\n  newName: string\n): string => contents.replace(\n  new RegExp(`([^a-zA-Z0-9_$])${oldName}([^a-zA-Z0-9_$]|Container)`, 'g'),\n  `$1${newName}$2`\n)\n","/* eslint-disable no-console */\nimport { join, relative, isAbsolute, dirname, basename } from 'path'\nimport { copy, move, readFileSync, writeFileSync } from 'fs-extra'\nimport { cyan, green, red } from 'chalk'\nimport inquirer from 'inquirer'\nimport autocomplete from 'inquirer-autocomplete-prompt'\nimport ora from 'ora'\nimport { component, name, folder } from './prompts'\nimport {\n  getComponentName,\n  getComponentFolder,\n  isSingleFile,\n  getFiles,\n  getComponentFiles,\n  replaceContents,\n} from './utils'\n\nconst replicate = async path => {\n  const originalName = getComponentName(path)\n  const absolutePath = isAbsolute(path) ? path : join(process.cwd(), path)\n  const relativePath = relative(process.cwd(), absolutePath)\n  const originalFolder = getComponentFolder(relativePath)\n  const promises = []\n\n  const answers = await inquirer.prompt([name(originalName), folder(originalFolder)])\n\n  if (isSingleFile(path)) {\n    const files = getFiles(dirname(absolutePath), originalName)\n\n    files.forEach(async file => {\n      const filename = basename(file).replace(originalName, answers.name)\n      const destinationPath = join(process.cwd(), answers.folder, filename)\n      const promise = copy(file, destinationPath)\n        .then(() => {\n          const contents = readFileSync(destinationPath).toString()\n          return writeFileSync(destinationPath, replaceContents(contents, originalName, answers.name))\n        })\n        .catch(e => {\n          console.error(e)\n          process.exit(1)\n        })\n      promises.push(promise)\n    })\n  } else {\n    const destinationPath = join(process.cwd(), answers.folder, answers.name)\n    await copy(dirname(absolutePath), destinationPath)\n    const files = getFiles(destinationPath)\n\n    files.forEach(file => {\n      const contents = readFileSync(file).toString()\n      const renamedPath = join(dirname(file), basename(file).replace(originalName, answers.name))\n      writeFileSync(file, replaceContents(contents, originalName, answers.name))\n      const promise = move(file, renamedPath)\n      promises.push(promise)\n    })\n  }\n  await Promise.all(promises)\n}\n\nconst scan = async (root = process.cwd()) => {\n  const absoluteRoot = isAbsolute(root) ? root : join(process.cwd(), root)\n  const spinner = ora(`Scanning ${green(absoluteRoot)} for React component files...`).start()\n  const files = await getComponentFiles(absoluteRoot)\n  spinner.stop()\n\n  if (!files.length) {\n    console.log(red.bold('No components found! :(\\n'))\n    console.log(\n      `Make sure you are running ${cyan('frack gen')} inside a React-like project directory or using ${green('root')} option:\\n`\n    )\n    console.log(\n      `    ${cyan('$ frack gen')} ${green('--root relative/or/absolute/path/to/any/react/project')}\\n`\n    )\n    console.log(\n      `If you are already doing that, it means that ${cyan('frack gen')} could not find your React component files automagically.`\n    )\n    console.log('In this case, you can explicitly pass the component path to replicate:\\n')\n    console.log(\n      `    ${cyan('$ frack gen')} ${green('relative/or/absolute/path/to/my/react/component.js')}\\n`\n    )\n    return process.exit(1)\n  }\n\n  inquirer.registerPrompt('autocomplete', autocomplete)\n  const answers = await inquirer.prompt([component(files)])\n  return answers.component\n}\n\nexport { scan, replicate }\n","/* eslint-disable no-console */\nimport chalk from 'chalk'\nimport { r } from 'ansi-rainbow'\nimport build from './scripts/build'\nimport start from './scripts/start'\nimport init from './scripts/init'\nimport { newModule, createModule } from './scripts/new/index'\nimport logger from './utils/logger'\nimport { scan, replicate } from './scripts/dupe/index'\nimport packageConfig from '../package.json'\nimport meow from 'meow'\n\nprocess.on('uncaughtException', ex => {\n  logger.error(ex)\n  process.exit(1)\n})\n\nprocess.on('unhandledRejection', reason => {\n  logger.error(reason)\n})\n\nconst cli = meow(\n  `\\n\\n\nVersion ${packageConfig.version}\n\n${chalk.yellow('Usage')}\n  $ frack [command]\n\n${chalk.yellow('Commands')}\n  init      Initializes a new Frack project\n  start     Starts application in development mode with hot reloading\n  build     Compiles a production build\n  new       Create a new Module\n  dupe      Replicates an existing component\n            Options\n              --root Sets the root path to scan for component files\n`\n)\n\nconst ARGSPOS_SCRIPT = 2\nconst ARGSPOS_ARGUMENTS = 3\n\nvar script = process.argv[ARGSPOS_SCRIPT]\nvar args = process.argv.slice(ARGSPOS_ARGUMENTS)\n\nfunction clearConsole () {\n  process.stdout.write(process.platform === 'win32' ? '\\x1Bc' : '\\x1B[2J\\x1B[3J\\x1B[H')\n}\n\nfunction header () {\n  clearConsole()\n\n  console.log(\n    r(\n      `\n    _                    _     \n  /| |                  | |  \\\\ \n / | |  ,_    __,   __  | |   \\\\\n \\\\ |/  /  |  /  |  /    |/_)  /\n  \\\\|__/   |_/\\\\_/|_/\\\\___/| \\\\_// \n   |\\\\                          \n   |/`\n    ) +\n      `   ${chalk.yellow.bold(packageConfig.name)}${chalk.gray('@')}${chalk.white.bold(packageConfig.version)}\\n\\n`\n  )\n}\n\nheader()\n\nswitch (script) {\n  case 'build':\n    build(args)\n    break\n\n  case 'start':\n    start(args)\n    break\n\n  case 'gen':\n    if (cli.input.length > 1) {\n      replicate(cli.input[1]).then(() => logger.info('component replicated')).catch(logger.error)\n    } else {\n      scan(cli.flags.root).then(replicate).catch(logger.error)\n    }\n    break\n\n  case 'init':\n    init()\n    break\n\n  case 'new':\n    newModule(logger).then(answers => createModule(answers, logger)).catch(logger.error)\n    break\n  // case 'del':\n  //   moduleCmd('deletemodule', {module: args[0], location: args[1]}, {cwd: process.cwd()}, logger)\n  //   break\n\n  case null:\n  case undefined:\n  default:\n    console.log(`  ❌️  ${chalk.red('No script name given!')}`)\n    console.log(`  💡  Run ${chalk.cyan('frack --help')} to display CLI docs`)\n    break\n}\n"],"names":["niceStattrace","error","file","message","stack","split","chalk","cyan","red","map","row","white","join","build","buildFolderClient","resolve","process","cwd","buildFolderServer","callback","log","clientWebpackConfig","configFactory","frackSettings","context","run","stats","hasErrors","console","toJson","errors","forEach","statError","exit","nodeWebpackConfig","createNotification","options","title","notify","level","bold","yellow","bgRed","HotServerManager","compiler","plugin","toString","watcher","watch","undefined","disposing","close","ListenerManager","listener","name","lastConnectionKey","connectionMap","on","connection","connectionKey","keys","destroy","Promise","killAllConnections","HotClientManager","httpServer","express","httpPathRegex","httpPath","output","publicPath","startsWith","test","Error","_","host","port","exec","devMiddleware","createDevMiddleware","hotMiddleware","createHotMiddleware","use","listen","listenerManager","dispose","clearConsole","stdout","write","platform","require","friendlySyntaxErrorLabel","isLikelyASyntaxError","indexOf","formatMessage","lines","length","splice","lastIndexOf","substr","filter","line","replace","exportError","match","inverse","trim","formatWebpackMessages","json","formattedErrors","formattedWarnings","warnings","result","some","execSync","path","isInteractive","isTTY","handleCompile","isSmokeTest","argv","arg","err","hasWarnings","prepareUrls","protocol","prettyPrintUrl","hostname","url","format","prettyHost","lanUrlForConfig","lanUrlForTerminal","address","ip","_e","localUrlForTerminal","localUrlForBrowser","printInstructions","appName","urls","useYarn","createCompiler","webpack","config","isFirstCompile","messages","isSuccessful","green","underline","safeDisposer","manager","start","done","settings","webpackConfig","plugins","push","StatusPlugin","serverPort","ruCreateCompiler","HotController","tryStartServer","clientIsBuilding","serverTryTimeout","setTimeout","timeout","startServer","server","kill","newServer","spawn","compiledServer","stdin","stderr","data","hotClientManager","hotServerManager","serverIsBuilding","hotClientCompiler","then","appRootDir","get","Object","entry","hotServerCompiler","ROOT","mergePackages","progress","ora","projectPackage","readJsonSync","kitPackage","scripts","dependencies","devDependencies","e","fail","succeed","copySources","from","fromDot","cp","installPackages","reject","shelljs","downloadProjectKit","packagePath","existsSync","pacote","extract","copyEnvFile","loc","mod","shell","fs","toCamelCase","str","p1","p2","toUpperCase","toLowerCase","capitalize","charAt","slice","copyFiles","logger","templatePath","module","location","destinationPath","mkdir","info","code","ls","isFile","moduleFile","mv","sed","inputDataPath","readFileSync","re","prepend","writeFileSync","deleteFiles","modulePath","rm","modules","featureModule","action","args","__dirname","createModule","answers","newModule","inquirer","prompt","minilog","enable","consoleLog","global","arguments","apply","component","files","input","value","originalName","folder","originalFolder","isAbsolute","relative","removeExt","getComponentName","reduce","part","getComponentFolder","dirname","isSingleFile","dir","reverse","getFiles","componentName","extensions","pattern","glob","sync","absolute","nodir","getComponentFiles","root","listReactFiles","absolutePath","relativePath","gray","replaceContents","contents","oldName","newName","RegExp","replicate","filename","basename","promise","copy","renamedPath","move","all","promises","scan","absoluteRoot","stop","registerPrompt","autocomplete","ex","reason","cli","meow","packageConfig","version","ARGSPOS_SCRIPT","ARGSPOS_ARGUMENTS","script","header","r","flags"],"mappings":";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