How to use bower-json - 10 common examples

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
TestRunner.prototype._makeBowerSandbox = function _makeBowerSandbox(next) {
  if (this._cancelled) return next('cancelled');
  // check bower.json, component.json, and .bower.json
  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));
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 OrgCurrent / Android / node / bower / lib / util / readJson.js View on Github external
}, function (err) {
        // No json file was found, assume one
        if (err.code === 'ENOENT' && options.assume) {
            return [bowerJson.parse(options.assume, options), false, true];
        }

        err.details = err.message;

        if (err.file) {
            err.message = 'Failed to read ' + err.file;
            err.data = { filename: err.file };
        } else {
            err.message = 'Failed to read json from ' + file;
        }

        throw err;
    });
}
github bower / bower / lib / util / readJson.js View on Github external
function(err) {
            // No json file was found, assume one
            if (err.code === 'ENOENT' && options.assume) {
                return [bowerJson.parse(options.assume, options), false, true];
            }

            err.details = err.message;

            if (err.file) {
                err.message = 'Failed to read ' + err.file;
                err.data = { filename: err.file };
            } else {
                err.message = 'Failed to read json from ' + file;
            }

            throw err;
        }
    );
github erobwen / causality / test / bower.js View on Github external
it('validate', function(){
        
        const data = fs.readFileSync(__dirname+'/../bower.json');
        const json = JSON.parse(data);
        const bj = require('bower-json');
        const norm = bj.parse(json);
        
        assert.equal(json.main, "causality.js");
    });
});
github Silk-GUI / Silk / core / fork_framework / app_loader.js View on Github external
async.eachSeries(Object.keys(d), function (dep, next) {
      bowerJSON.find(__root + '/bower_components/' + dep, function (err, file) {
        if (file) {
          return next();
        }
        console.log('installing ' + dep);
        bower.commands
          .install([dep + '#' + d[dep]], {
            save: false,
            force: true,
            forceLatest: true
          })
          .on('error', function (err) {
            console.log('error installing bower dependency ' + dep + ' for ' + self.name);
            console.log(err);
            next();
          })
          .on('end', function () {
github AceMetrix / bower-license / lib / index.js View on Github external
packages.forEach(function(package){
        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;
github pauldijou / outdated / lib / bower.js View on Github external
return new Promise(function (resolve, reject) {
      bowerJson.find('.', function (err, filename) {
        if (err) {
          reject(err);
        } else {
          resolve(filename);
        }
      });
    }).then(function (filename) {
      return fs.readFileAsync(filename, 'utf8').then(function (content) {
github robotichead / NearBeach / NearBeach / static / NearBeach / widgets / jQuery-File-Upload / bower-version-update.js View on Github external
#!/usr/bin/env node

'use strict';

var path = require('path');
var packageJSON = require(path.join(__dirname, 'package.json'));
var bowerFile = path.join(__dirname, 'bower.json');
var bowerJSON = require('bower-json').parse(
  require(bowerFile),
  {normalize: true}
);
bowerJSON.version = packageJSON.version;
require('fs').writeFileSync(
  bowerFile,
  JSON.stringify(bowerJSON, null, 2) + '\n'
);

bower-json

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

MIT
Latest version published 5 years ago

Package Health Score

70 / 100
Full package analysis