getDesignEntryPoint = (fs, paths) => {
  if (!paths) {
    return
  }
  const mainPath = toArray(paths)[0]
  let filePath
  const stats = fs.statSync(mainPath)
  if (stats.isFile()) {
    return mainPath
  } else if (stats.isDirectory()) {
    // first try to use package.json to find main
    const packageFile = path.join(mainPath, 'package.json')
    if (fs.existsSync(packageFile)) {
      const rMain = JSON.parse(fs.readFileSync(packageFile)).main
      if (rMain) {
        return path.join(mainPath, rMain)
      }
    }

    // if all else fails try to look for index.js/jscad, main.js/jscad or a file with same name
    // as the folder
    const entries = fs.readdirSync(mainPath)
    const acceptableMainFiles = ['main', 'index', parsePath(path.basename(mainPath)).name]
    const jsMainFiles = acceptableMainFiles.map((x) => x + '.js')
    const jscadMainFiles = acceptableMainFiles.map((x) => x + '.jscad')

    const candidates = entries.filter((entry) => jsMainFiles.concat(jscadMainFiles).includes(entry))
    if (candidates.length > 0) {
      filePath = path.join(mainPath, candidates[0])
    }
    return filePath
  }
  return mainPath
}
get main entry point of a design, given a file system instance and a list of paths
@param  {Object} fs a file-system like object (either node's fs or some other) providing at least
statSync, existSync, readFileSync, readdirSync
@param  {} paths