How to use the bower-json.read function in bower-json

To help you get started, we’ve selected a few bower-json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlearchive / ci-runner / lib / testrunner.js View on Github external
BowerJson.find(this._root, function(error, file) {
    if (error) return next(['No bower json file found', error]);

    BowerJson.read(file, function(error, info) {
      if (error) return next(['Invalid bower.json', error]);
      if (!(typeof info.name === 'string')) return next('package name is required');

      // Make sure the name doesn't break out of our sandbox
      var packageRoot = path.resolve(this._sandbox, info.name);
      if (packageRoot.indexOf(this._sandbox) !== 0) {
        return next('Inavlid package name: ' + info.name);
      }

      shelljs.mv(this._root, packageRoot);
      this._root = packageRoot;
      next();
    }.bind(this));
  }.bind(this));
};
github AceMetrix / bower-license / lib / index.js View on Github external
bowerJson.find(path.resolve(options.directory, package), function(err, filename){
            if (!filename){
                output[package] = {licenses: 'UNKNOWN'};
                completed.push(package);
                return;
            }
            bowerJson.read(filename, function(err, bowerData){

                if (!!err) {
                    callback(null, err);
                    return;
                }

                var moduleInfo = {licenses: []};
                if (bowerData.license) moduleInfo.licenses = moduleInfo.licenses.concat(bowerData.license);
                if (bowerData.repository) moduleInfo.repository = bowerData.repository;
                if (bowerData.homepage) moduleInfo.homepage = bowerData.homepage;

                // enhance with npm-license
                npmLicense.init({start: path.resolve(options.directory, package)}, function(npmData){
                    var npmVersion;
                    if (Object.keys(npmData).length > 0)
                        npmVersion = Object.keys(npmData)[0].split('@')[1];
github Polymer / tools / packages / cli / src / install / install.ts View on Github external
const bowerJson = await new Promise((resolve, reject) => {
    const config = defaultBowerConfig({
      save: false,
    });
    const cwd = config.cwd || process.cwd();
    readBowerJson(cwd, {}, (err: {}, json: {}) => {
      err ? reject(err) : resolve(json);
    });
  });

bower-json

Read bower.json files with semantics, normalisation, defaults and validation

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis