All files / src/scripts deploy.js

90.91% Statements 10/11
50% Branches 2/4
100% Functions 1/1
90.91% Lines 10/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32        1x   1x 1x   1x       1x           1x   1x 1x         1x     1x  
const {
  startInterbit,
  createChains: { createChainsFromManifest },
  configureChains
} = require('../chainManagement')
 
const deploy = async options => {
  const { keyPair, location, manifest, connect } = options
 
  Iif (!location) {
    throw new Error('location option is required for interbit deploy.')
  }
 
  const { cli, hypervisor, cleanup } = await startInterbit(keyPair, options)
 
  // TODO: Refactor deployCovenants to its own function and move options up into here
  // Rename connect to configure and invert it so it makes more sense. ATM this is backwards
  // compatible with other uses of deploy throughout the code
 
  await createChainsFromManifest(location, cli, manifest, options)
 
  Eif (!connect) {
    await configureChains(cli, manifest, options)
  }
 
  // TODO: Once deployed, watch the root chain for manifest updates and reconfigure #267
 
  return { cli, hypervisor, cleanup }
}
 
module.exports = deploy