Tries to convert a Bower JSON into a virtual Less file.
@param {string} bowerJsonPath
@returns {PromiseConstructor}
341940
function createVirtualLessFileFromBowerJson(bowerJsonPath) {
  return new PromiseConstructor(function(fullfill, reject) {
    bowerJson.read(bowerJsonPath, { validate: false }, function(err, bowerJsonData) {
      if (err) {
        return reject(err);
      }
      if (!bowerJsonData.main) {
        err = bowerJsonPath + ' has no "main" property.';
        return reject(new Error(err));
      }

      // convert bower json into less file
      var virtualLessFile = bowerJsonData.main.filter(function(filename) {
        return path.extname(filename) === '.less';
      }).map(function(filename) {
        return '@import "' + filename + '";';
      }).join('\n');

      if (virtualLessFile) {
        var file = {
          contents: virtualLessFile,
          filename: bowerJsonPath
        };
        return fullfill(file);
      } else {
        err = 'Couldn\'t find a less file in ' + bowerJsonPath + '.';
        return reject(new Error(err));
      }
    });
  });
}
714424
function realpath(dir) {
    return new Promise((resolve, reject) => {
        fs.realpath(dir, (err, path) => err ? reject(err) : resolve(path || dir));
    });
}
1295693
function loadPackageJSONConfigFile(filePath) {
    debug(`Loading package.json config file: ${filePath}`);
    try {
        return loadJSONConfigFile(filePath).eslintConfig || null;
    } catch (e) {
        debug(`Error reading package.json file: ${filePath}`);
        e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`;
        throw e;
    }
}
209656
function getAPIJSONPromise(oChainObject) {
		return new Promise(function(oResolve, oReject) {
			fs.readFile(sInputFile, 'utf8', (oError, sFileData) => {
				if (oError) {
					oReject(oError);
				} else {
					oChainObject.fileData = JSON.parse(sFileData);
					oResolve(oChainObject);
				}
			});
		});
	}
543081
public static JsonPath compile(String jsonPath, Predicate... filters) {
        notEmpty(jsonPath, "json can not be null or empty");

        return new JsonPath(jsonPath, filters);
    }
916216
function importFromBower(relativePath, options) {
    options = options || {};
    app.import(path.join(app.bowerDirectory, relativePath), options);
  }
1113586
function (path) {
        return new Promise((resolve, reject) => {
            fs.access(path, fs.constants.F_OK, (err) => {
                if (err === null) {
                    resolve(true);
                }
                else if (err.code === 'ENOENT') {
                    resolve(false);
                }
                else {
                    reject(err);
                }
            });
        });
    }
668556
function loadFromPath(path, container) {
  if (path && typeof path === 'string' && path.length > 0) {
    return load(path, container)
  }
  return Promise.resolve([])
}
534888
async function getFiles(path) {
  return new Promise((resolve, reject) => {
    glob(path, (error, files) => (error ? reject(error) : resolve(files)));
  });
}
1285370
function requireJSAsync (file) {
	return new Promise(function (resolve, reject) {
		requireJS([ 'rvc!' + requireJSPath(file, '.html') ], resolve, reject);
	});
}
1293684
function writeToFileStream(fileStream, filePath) {
  return new Promise((resolve, reject) => {
    const writerStream = fs.createWriteStream(filePath)
      .on('finish', () => resolve(filePath))
      .on('error', err => reject(err));
    fileStream.pipe(writerStream);
  });
}
858785
public static <T> T withJsonResource(String resourceClasspath,
            TypeReference<T> typeReference) {
        return withJsonInputStream(
                JMResources.getResourceInputStream(resourceClasspath),
                typeReference);
    }
871124
function unlock(isVerbose) {
    if (isVerbose) {
        console.log('Start unlocking ...');
    }

    // Load bower.json and make sure it is a locked bower.json file
    var bowerConfigStr = fs.readFileSync('bower.json', {encoding: 'utf8'});
    var bowerConfig = JSON.parse(bowerConfigStr);
    if (!bowerConfig.bowerLocker) {
        console.warn('The bower.json is already unlocked.\n' +
        "Run 'bower-locker lock' to create a locked file.");
        process.exit(1);
    }

    // Load original bower file
    var originalBowerConfigStr = fs.readFileSync('bower-locker.bower.json', {encoding: 'utf8'});
    // Write it back as bower.json
    fs.writeFileSync('bower.json', originalBowerConfigStr, {encoding: 'utf8'});

    console.log('Unlocking completed.');
}
1119265
function output(sourceCode, filePath) {
    return new Promise(function (resolve, reject) {
        mkdirp(path.dirname(filePath), function (ioErr) {
            if (ioErr) {
                reject(ioErr);
                throw ioErr;
            }
            fs.writeFile(filePath, sourceCode, function (writeErr) {
                if (writeErr) {
                    reject(writeErr);
                    throw writeErr;
                }
                resolve();
            });
        });
    });
}
1307497
function PkgJsonEmbark(filepath, kind) {
  PkgJson.call(this, filepath);
  this.kind = kind || 'invoked';
  this.nodeRange = undefined;
  this.pkg = undefined;
  this.version = undefined;
}
674538
function createScaffold (appname) {
  !fs.existsSync(appname) && fs.mkdirSync(appname)
  var projectPath = path.join(__dirname, appname)
  ;[ 'generated', 'generated/crud', 'generated/agents', 'generated/controllers', 'generated/directives', 'generated/services', 'generated/locale', 'gruntTasks', 'libs', 'libs/vendor', 'styles', 'styles/css', 'generated/partials', 'generated/partials/crud', 'generated/partials/agents', 'client', 'cordova_template' ]
    .forEach(function (directory) {
      var appDirectory = path.join(appname, directory)
      !fs.existsSync(appDirectory) && fs.mkdirSync(appDirectory)
    }, this)
  var customGruntFile = path.join(appname, 'Gruntfile_custom.js')
  !fs.existsSync(customGruntFile) && createTemplate(appname, 'Gruntfile_custom.js')
  // CHANGE BELOW TO MERGE ORIGINAL AND EXISTING TO ENSURE WE HAVE BASE AND
  // EXTENDED COMBINED
  // BE CAREFUL ABOUT VERSIONING AND OTHER MODULE DEPENDENCIES
  var packageJson = path.join(appname, 'package.json')
  createTemplate(appname, 'package.json.req')
  !fs.existsSync(packageJson) && fs.renameSync(packageJson + '.req', packageJson)

  var bowerJson = path.join(appname, 'bower.json')
  createTemplate(appname, 'bower.json.req')
  !fs.existsSync(bowerJson) && fs.renameSync(bowerJson + '.req', bowerJson)
}
25204
function (buildConfig) {
        var src;
        if (buildConfig.nodeProject) {
            src = '<%=buildConfig.libDirectory%>/**/*.js';
        } else if (buildConfig.bowerJSON) {
            src = buildConfig.bowerJSON.main;
        }

        return src;
    }