Ejemplo n.º 1
0
/**
 * Return JSON contents of file name from root
 * @param {String} fileName - name of file to read
 * @returns {Promise<Object>} - file contents
 */
/* eslint-disable space-before-function-paren */
async function getFileFromRoot(fileName) {
  /* eslint-enable space-before-function-paren */
  return require(path.join(await getYoRcPath.dir(), fileName));
}
Ejemplo n.º 2
0
    if (routesFile.indexOf('-routes') === -1) {
      console.log(chalk.red('Routes file names without a `-routes` prefix are deprecated. Official support will be ' +
        'dropped in v0.12.0. Add a `-routes` prefix to be officially supported.'));
    }

    return routesFile;
  },

  /**
   * Gets the app's name from the main module in the appDir
   * @return {Promise<String>} - app name
   */
  async getAppName() {
    const filePath = path.join(
      await getYoRcPath.dir(),
      await appUtils.getAppDir(),
      'app'
    );

    const moduleFile = await this.findModuleFile(filePath);

    return ngModGetNames((await pify(fs.readFile)(moduleFile)).toString())[0];
  },

  /**
   * Returns list of modules when given a list of files
   * @param {String[]} files - list of files to filter
   * @return {Promise<Object[]>} - list of modules
   */
  moduleFilter(files) {