code: function createCollection(dirPrefix, dirPath, dirConfigs) {
      const dir = dirPath.shift();
      const dirConfig = dirConfigs.shift() || {};
      const absDir = path.join(dirPrefix, dir);
  
      // Create the collection directory
      try {
          if (!fs.statSync(absDir).isDirectory()) {
              throw new Error('1');
          }
      } catch (e) {
          try {
              if (!mkdirp(absDir)) {
                  throw new Error('2');
              }
          } catch (f) {
              return false;
          }
      }
  
      // Configure the collection prefix
      const configPath = path.join(absDir, `${dir.replace(/^\d{2}-/, '')}.config.json`);
      const prefix = path.relative(app.components.get('path'), absDir).split(path.sep).map(p => p.replace(/^\d{2}-/, '')).join('-');
  
      let config;
      try {
          config = require(configPath);
          config.prefix = prefix;
      } catch (e) {
          config = { prefix };
      }
      ['label'].forEach(c => {
          if (c in dirConfig) {
              config[c] = dirConfig[c];
          }
      })
      writeFile(configPath, JSON.stringify(config, null, 4));
  
      // Recurse
      return dirPath.length ? createCollection(absDir, dirPath, dirConfigs) : true;
  }
docs: Create and pre-configure a directory
  
  @param {String} dirPrefix Path prefix
  @param {Array} dirPath Directory path
  @param {Array} dirConfigs Local directory configurations
  @return {boolean} Directory been created and pre-configured