<commit_before>var api = require('../../api');

exports.build = function (app, config, cb) {

  // find the build module
  var buildModule;
  var modules = app.getModules();
  Object.keys(modules).forEach(function (moduleName) {
    if (!buildModule) {
      var module = modules[moduleName];
      buildModule = module.loadBuildTarget(config.target);
    }
  });

  if (!buildModule) {
    throw new Error("Build target `" + config.target + "` not found");
  }

  api.apps.get(app, function (err, appJSON) {
    if (err) { throw err; }

    // execute the build module
    buildModule.build(api, appJSON, config, cb);
  });
};
<commit_msg>better error reporting for when no modules are present<commit_after>var api = require('../../api');

exports.build = function (app, config, cb) {

  // find the build module
  var buildModule;
  var modules = app.getModules();
  var moduleKeys = Object.keys(modules);

  if (!moduleKeys.length) {
    throw new Error("Your project has no modules!  Have you tried running 'devkit install'?");
  }

  moduleKeys.forEach(function (moduleName) {
    console.log(moduleName)
    if (!buildModule) {
      var module = modules[moduleName];
      buildModule = module.loadBuildTarget(config.target);
    }
  });

  if (!buildModule) {
    throw new Error("Build target `" + config.target + "` not found");
  }

  api.apps.get(app, function (err, appJSON) {
    if (err) { throw err; }

    // execute the build module
    buildModule.build(api, appJSON, config, cb);
  });
};

{'fraction_non_alphanumeric': 0.145791915175613, 'fraction_numerical': 0.0, 'mean_word_length': 3.241573033707865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5434584', 'n_tokens_mistral': 471, 'n_tokens_neox': 458, 'n_words': 129}