sdk/src/cli.js
function ensureSetup(argv) {
  const root = findPackageRoot();
  const emulatorBin = path.join(root, 'node_modules/silk-sdk-emulator/vendor/bin');

  // Additional paths to search for outside of PATH.
  const additionalPaths = [];

  if (fs.existsSync(emulatorBin)) {
    additionalPaths.push(emulatorBin);
  }

  argv.arguments = argv.arguments || [];
  argv.arguments = [
    [['--device', '-d'], {
      help: 'Specific device to operate under.',
    }],
    ...argv.arguments,
  ];

  const main = argv.main;
  argv.main = function (args) {
    const {device} = args;
    const api = new SDKApi({
      device: device,
      additionalPaths: additionalPaths,
    });

    return main(api, args);
  };

  return argv;
}
function ensureSetup(argv) {
  const root = findPackageRoot();
  const emulatorBin = path.join(root, 'node_modules/silk-sdk-emulator/vendor/bin');

  // Additional paths to search for outside of PATH.
  const additionalPaths = [];

  if (fs.existsSync(emulatorBin)) {
    additionalPaths.push(emulatorBin);
  }

  argv.arguments = argv.arguments || [];
  argv.arguments = [
    [['--device', '-d'], {
      help: 'Specific device to operate under.',
    }],
    ...argv.arguments,
  ];

  const main = argv.main;
  argv.main = function (args) {
    const {device} = args;
    const api = new SDKApi({
      device: device,
      additionalPaths: additionalPaths,
    });

    return main(api, args);
  };

  return argv;
}
function ensureSetup ( argv ) { const root = findPackageRoot ( ) ; const emulatorBin = path . join ( root , 'node_modules/silk-sdk-emulator/vendor/bin' ) ; // Additional paths to search for outside of PATH. const additionalPaths = [ ] ; if ( fs . existsSync ( emulatorBin ) ) { additionalPaths . push ( emulatorBin ) ; } argv . arguments = argv . arguments || [ ] ; argv . arguments = [ [ [ '--device' , '-d' ] , { help : 'Specific device to operate under.' , } ] , ... argv . arguments , ] ; const main = argv . main ; argv . main = function ( args ) { const { device } = args ; const api = new SDKApi ( { device : device , additionalPaths : additionalPaths , } ) ; return main ( api , args ) ; } ; return argv ; }
This function is run from every cli call to ensure the enviornment is
correctly setup.
This function is run from every cli call to ensure the enviornment is correctly setup .