How to use bower-config - 10 common examples

To help you get started, we’ve selected a few bower-config 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 Polymer / web-component-tester / test / integration / setup_test_dir.ts View on Github external
export async function makeProperTestDir(dirname: string) {
  const startingDir = path.join(baseDir, dirname);
  const tempDir = path.join(baseDir, 'temp');
  if (await exists(tempDir)) {
    await new Promise((resolve, reject) => {
      rimraf(tempDir, (err) => err ? reject(err) : resolve());
    });
  }
  fs.mkdirSync(tempDir);

  // copy dir
  const pathToTestDir = await copyDir(startingDir, tempDir);
  const bowerDir = bowerConfig.read(pathToTestDir).directory;

  fs.mkdirSync(path.join(pathToTestDir, 'node_modules'));
  fs.mkdirSync(
      path.join(pathToTestDir, 'node_modules', 'web-component-tester'));

  // set up symlinks into component dirs for browser.js, data/, and wct's
  // dependencies (like mocha, sinon, etc)
  const componentsDirs = new Set([bowerDir]);
  for (const baseFile of fs.readdirSync(startingDir)) {
    if (new RegExp(`${bowerDir}(-|$)`).test(baseFile)) {
      componentsDirs.add(baseFile);
    }
  }

  for (const baseComponentsDir of componentsDirs) {
    const componentsDir = path.join(pathToTestDir, baseComponentsDir);
github joeattardi / tailstreamer / node_modules / grunt-bower-task / node_modules / bower / lib / commands / register.js View on Github external
process.nextTick(function () {
        // Verify name
        // TODO: Verify with the new spec regexp?
        if (!name) {
            return logger.emit('error', createError('Please type a name', 'EINVNAME'));
        }

        // The public registry only allows git:// endpoints
        // As such, we attempt to convert URLs as necessary
        if (config.registry.register === Config.DEFAULT_REGISTRY) {
            url = convertUrl(url, logger);

            if (!mout.string.startsWith(url, 'git://')) {
                return logger.emit('error', createError('The registry only accepts URLs starting with git://', 'EINVFORMAT'));
            }
        }

        // Attempt to resolve the package referenced by the URL to ensure
        // everything is ok before registering
        repository = new PackageRepository(config, logger);
        repository.fetch({ name: name, source: url, target: '*' })
        .spread(function (canonicalDir, pkgMeta) {
            if (pkgMeta.private) {
                throw createError('The package you are trying to register is marked as private', 'EPRIV');
            }
github OrgCurrent / Android / node / bower / lib / commands / register.js View on Github external
process.nextTick(function () {
        // Verify name
        // TODO: Verify with the new spec regexp?
        if (!name) {
            return logger.emit('error', createError('Please type a name', 'EINVNAME'));
        }

        // The public registry only allows git:// endpoints
        // As such, we attempt to convert URLs as necessary
        if (config.registry.register === Config.DEFAULT_REGISTRY) {
            url = convertUrl(url, logger);

            if (!mout.string.startsWith(url, 'git://')) {
                return logger.emit('error', createError('The registry only accepts URLs starting with git://', 'EINVFORMAT'));
            }
        }

        tracker.track('register');

        // Attempt to resolve the package referenced by the URL to ensure
        // everything is ok before registering
        repository = new PackageRepository(config, logger);
        repository.fetch({ name: name, source: url, target: '*' })
        .spread(function (canonicalDir, pkgMeta) {
            if (pkgMeta.private) {
                throw createError('The package you are trying to register is marked as private', 'EPRIV');
github OrgCurrent / Android / node / bower / lib / config.js View on Github external
var tty = require('tty');
var mout = require('mout');
var config = require('bower-config').read();
var cli = require('./util/cli');

// Delete the json attribute because it is no longer supported
// and conflicts with --json
delete config.json;

// If interactive is auto (null), guess its value
if (config.interactive == null) {
    config.interactive = (
        process.bin === 'bower' &&
        tty.isatty(1) &&
        !process.env.CI
    );
}

// If `analytics` hasn't been explicitly set, we disable
github joeattardi / tailstreamer / node_modules / grunt-bower-task / node_modules / bower / lib / config.js View on Github external
var tty = require('tty');
var mout = require('mout');
var config = require('bower-config').read();
var cli = require('./util/cli');

// Delete the json attribute because it is no longer supported
// and conflicts with --json
delete config.json;

// If interactive is auto (null), guess its value
if (config.interactive == null) {
    config.interactive = process.bin === 'bower' && tty.isatty(1);
}

// Merge common CLI options into the config
mout.object.mixIn(config, cli.readOptions({
    force: { type: Boolean, shorthand: 'f' },
    offline: { type: Boolean, shorthand: 'o' },
    verbose: { type: Boolean, shorthand: 'V' },
github dswarm / dswarm-backoffice-web / yo / Gruntfile.js View on Github external
// Time how long tasks take. Can help when optimizing build times
    require('time-grunt')(grunt);

    // Ensure copyright banners
    require('./copyright')(grunt);

    var saveLicense = require('uglify-save-license');

    // Define the configuration for all the tasks
    grunt.initConfig({
        // Project settings
        yeoman: {
            // configurable paths
            app: require('./bower.json').appPath || 'app',
            bower: require('bower-config').read('').directory || 'app/bower_components',
            dist: 'dist',
            target: 'target',
            test: 'test'
        },

        stage: {
            name: process.env.STAGE || 'development'
        },

        dmpProject: {
            backendDir: process.env.DMP_HOME || '../../data-management-platform',
            name: 'd:swarm',
            versions: {
                web: {
                    revision: 'HEAD',
                    date: 'latest'
github bower / bower / lib / config.js View on Github external
function readCachedConfig(cwd) {
    if (cachedConfigs[cwd]) {
        return cachedConfigs[cwd];
    }

    var config = cachedConfigs[cwd] = bowerConfig.read(cwd);
    var configstore = new Configstore('bower-github').all;

    object.mixIn(config, configstore);

    // Delete the json attribute because it is no longer supported
    // and conflicts with --json
    delete config.json;

    // If interactive is auto (null), guess its value
    if (config.interactive == null) {
        config.interactive = (
            process.bin === 'bower' &&
            tty.isatty(1) &&
            !process.env.CI
        );
    }
github broccolijs / broccoli / lib / tree.js View on Github external
function bowerTrees () {
  var bowerDir = require('bower-config').read().directory // note: this relies on cwd
  if (bowerDir == null) throw new Error('Bower did not return a directory')
  var entries = fs.readdirSync(bowerDir)
  var directories = entries.filter(function (f) {
    return fs.statSync(path.join(bowerDir, f)).isDirectory()
  })
  var files = entries.filter(function (f) {
    var stat = fs.statSync(path.join(bowerDir, f))
    return stat.isFile() || stat.isSymbolicLink()
  })
  var trees = []
  for (var i = 0; i < directories.length; i++) {
    trees = trees.concat(Tree._fromDirectory(path.join(bowerDir, directories[i])))
  }
  // Pick up files as well; this is for compatibility with EAK's vendor/loader.js
  for (i = 0; i < files.length; i++) {
    trees.push(new Tree(bowerDir).map('/' + files[i], '/' + files[i]))
github bower / bower / lib / config.js View on Github external
function readCachedConfig(cwd, overwrites) {
    current = bowerConfig.create(cwd).load(overwrites);

    var config = current.toObject();

    var configstore = new Configstore('bower-github').all;

    object.mixIn(config, configstore);

    // If interactive is auto (null), guess its value
    if (config.interactive == null) {
        config.interactive =
            process.bin === 'bower' && tty.isatty(1) && !process.env.CI;
    }

    // Merge common CLI options into the config
    if (process.bin === 'bower') {
        var cli = require('./util/cli');
github mgol / check-dependencies / lib / check-dependencies.js View on Github external
options.packageDir = options.packageDir || findup(packageJsonName);
    if (!options.packageDir) {
        return missingPackageJson();
    }
    options.packageDir = path.resolve(
        options.packageDir.replace(packageJsonRegex, ''),
    );

    packageJson = `${options.packageDir}/${packageJsonName}`;
    if (!fs.existsSync(packageJson)) {
        return missingPackageJson();
    }
    packageJson = require(packageJson);

    if (options.packageManager === 'bower') {
        const bowerConfig = require('bower-config')
            .create(options.packageDir)
            .load();
        depsDirName = bowerConfig._config.directory;
    }

    // Bower uses a different name (with a dot) for package data of dependencies.
    const depsJsonName =
        options.packageManager === 'npm' ? 'package.json' : '.bower.json';

    if (options.packageManager === 'bower') {
        // Allow a local bower.
        pkgManagerPath = findup('node_modules/bower/bin/bower');
    }

    const depsDir = `${options.packageDir}/${depsDirName}`;

bower-config

The Bower config reader and writer.

MIT
Latest version published 5 years ago

Package Health Score

77 / 100
Full package analysis

Similar packages