How to use the broccoli.Builder function in broccoli

To help you get started, we’ve selected a few broccoli 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 sir-dunxalot / ember-cli-modernizr / tests / helpers / ember-cli-modernizr.js View on Github external
if (typeof modernizrConfig.shouldParseFiles !== 'boolean') {
      modernizrConfig.shouldParseFiles = true;
    }

    this.setOptions(modernizrConfig, environment);

    /* By default, we want all the fixtures */

    if (modernizrConfig && modernizrConfig.tree) {
      this.currentFixturesTree = modernizrConfig.tree;
    } else {
      this.currentFixturesTree = 'tests/fixtures';
    }

    this.builder = new broccoli.Builder(this.parseTree());

    return this.builder.build();
  },
github ember-cli / broccoli-lint-eslint / test / helpers / run-eslint.js View on Github external
module.exports = function runEslint(path, _options) {
  const options = _options || {};
  const buildLog = [];

  // default options
  // eslint-disable-next-line global-require, newline-after-var
  const formatter = require(options.format || 'eslint/lib/cli-engine/formatters/compact');
  options.format = function spyFormatter(results) {
    buildLog.push(formatter(results));
    // prevent console spew
    return '';
  };
  options.options = options.options || {};

  const node = eslintValidationFilter.create(path, options);
  const builder = new broccoli.Builder(node);
  const promise = builder.build().then(() => ({
    buildLog: buildLog.join('\n'),
    outputPath: node.outputPath,
  }));

  pFinally(promise, () => builder.cleanup());

  return promise;
};
github ericf / grunt-broccoli-build / tasks / broccoli_build.js View on Github external
// cwd into the Brocfile's dir so its deps are loaded correctly.
            process.chdir(path.dirname(brocfile));
            return require(brocfile);
        }

        if (typeof dest !== 'string') {
            grunt.fatal('Target must be configured with a `dest` dir path.');
        }

        if (grunt.file.isDir(dest)) {
            grunt.warn('Directory "' + dest + '" already exists.');
        }

        var tree    = loadBrocfile(this.data.brocfile);
        var builder = new broccoli.Builder(tree);

        grunt.log.writeln('Broccoli building to "' + dest + '"');

        builder.build().then(function (results) {
            // Deal with differences in Broccoli versions.
            var dir = typeof results === 'string' ? results : results.directory;

            var buildTime = results.totalTime;

            ncp(dir, dest, {dereference: true}, function (err) {
                if (err) { throw err; }

                if (buildTime) {
                    grunt.log.ok('built (' + Math.floor(buildTime / 1e6) + 'ms)');
                } else {
                    grunt.log.ok('built');
github ramybenaroya / ember-index / mocha-tests / addon-tree-test-node.js View on Github external
it('creates a simple clone of index.html', function () {
            appTree = new EmberAddon({
                'ember-index': {
                    output: 'index.jsp'
                }
            }).toTree();

            builder = new broccoli.Builder(appTree);
            return builder.build()
                .then(function (results) {
                    var indexHtml, indexJsp,
                        outputPath = results.directory,
                        indexJspPath = path.join(outputPath, 'index.jsp'),
                        indexHtmlPath = path.join(outputPath, 'index.html');

                    expect(fs.existsSync(indexJspPath)).to.be.equal(true);

                    indexJsp = fs.readFileSync(indexJspPath).toString();
                    indexHtml = fs.readFileSync(indexHtmlPath).toString();

                    dummyVar = expect(indexJsp).not.to.be.empty;

                    expect(indexHtml).to.be.equal(indexJsp);
                });
github kratiahuja / broccoli-tslinter / tests / index.js View on Github external
it('should not throw an error when failBuild option is passed for correct files', function() {
    var node = new TSLint('./tests/fixtures/lintedFiles', {
      logError: function(message) {
        loggerOutput.push(message);
      },
      failBuild: true
    });
    builder = new broccoli.Builder(node);
    return builder.build().then(function() {
      assert.equal(loggerOutput.length, 0);
    }, function(error) {
    });
  });
});
github rickharrison / broccoli-asset-rev / tests / filter-tests.js View on Github external
it("accepts an array of globs as exclude parameter", function() {
    var sourcePath = 'tests/fixtures/exclude';

    var node = new AssetRev(sourcePath + '/input', {
      extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'ttf'],
      exclude: ['assets/fonts/**/*'],
      replaceExtensions: ['html', 'js', 'css']
    });

    builder = new broccoli.Builder(node);
    return builder.build().then(function(graph) {
      confirmOutput(graph.directory, sourcePath + '/output');
    });
  });
github ember-cli / broccoli-caching-writer / tests / index.js View on Github external
function setupCachingWriter(inputNodes, options, buildCallback) {
  if (!buildCallback) buildCallback = function() { };
  buildCount = 0;
  cachingWriter = new CachingWriter(inputNodes, options);
  cachingWriter.build = function() {
    buildCount++;
    return buildCallback.call(this);
  };
  builder = new broccoli.Builder(cachingWriter);
}
github sivakumar-kailasam / broccoli-leasot / ember-addon-main.js View on Github external
var optionsThatCanBeOverridden = ['enabled', 'kinds', 'extensions', 'groupBy', 'console'];

		if (typeof(app.options.markers) !== 'undefined') {
			forOwnFn(app.options.markers, function(value, key) {
				if (optionsThatCanBeOverridden.indexOf(key) !== -1) {
					optionsForLeasot[key] = value;
				} else {
					console.log('\n' + chalk.bgRed(key + ' is an unknown option for broccoli-leasot'));
				}
			});
		}

		console.log('\n');

		new BroccoliBuilder(
			new BroccoliLeasotFilter(
				appFolder,
				optionsForLeasot,
				'app'
			)
		).build();
		new BroccoliBuilder(
			new BroccoliLeasotFilter(
				testsFolder,
				optionsForLeasot,
				'tests'
			)
		).build()

	}
github cliqz-oss / browser-core / fern / common.js View on Github external
function getBroccoliBuilder(outputDir) {
  const brocfile = broccoli.loadBrocfile();
  return new broccoli.Builder(brocfile({}), {
    outputDir,
  });
}
github reactcli / react-cli / lib / models / builder.js View on Github external
configureBroccoliBuilder() {
    let buildFile = this.getBuildFile(),
        tree = buildFile();

    this.builder = new broccoli.Builder(tree);
  }