Bamieh/reflow

View on GitHub
packages/reflow-cli/bin/parse-caps.js

Summary

Maintainability
A
0 mins
Test Coverage
const path = require('path');
let ROOTPATH;
module.exports = function(capsPath) {
  ROOTPATH = ROOTPATH || process.cwd();
  try {
    const completePath = path.resolve(ROOTPATH, capsPath);
    return require(completePath);
  } catch(err) {
    console.error('Error parsing Caps: ', err)
    console.log('Using default Caps.');
    return {
      connection: {},
      devices: [],
    };
  }
}