message: Wait for hub ready message before fetching generated code
diff: @@ -8,14 +8,18 @@ const quickTemp = require('quick-temp');
  const Plugin = require('broccoli-plugin');
  const {WatchedDir} = require('broccoli-source');
  +const {connect} = require('./hub-connection');
  +
  class CodeWriter extends Plugin {
  - constructor(branch, trigger) {
  + constructor(branch, trigger, ready) {
  super([trigger], { name: '@cardstack/hub', needsCache: false });
  this.branch = branch;
  + this.ready = ready;
  }
  async build() {
  + await this.ready;
  let filePath = path.join(this.outputPath, 'cardstack-generated.js');
  let request = superagent.get('http://localhost:3000/codegen/master');
  let writeStream = fs.createWriteStream(filePath);
  @@ -30,9 +34,10 @@ class CodeWriter extends Plugin {
  module.exports = class BroccoliConnector {
  constructor(branch) {
  + let hubReady = connect().then((c) => c.ready);
  quickTemp.makeOrRemake(this, '_triggerDir', 'cardstack-hub');
  this._trigger = new WatchedDir(this._triggerDir, { annotation: '@cardstack/hub' });
  - this.tree = new CodeWriter(branch, this._trigger);
  + this.tree = new CodeWriter(branch, this._trigger, hubReady);
  this._buildCounter = 0;
  }
  triggerRebuild() {
  