How to use the broccoli-source.WatchedDir function in broccoli-source

To help you get started, we’ve selected a few broccoli-source 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 broccolijs / broccoli / test / watcher_test_suite.js View on Github external
it('is rejected when a watched source directory does not exist', function() {
        setUpBuilderAndWatcher(new WatchedDir('doesnotexist'))
        return expect(watchPromise).to.be.rejected
      })
    })
github ember-shell / ember-shell / index.js View on Github external
packages.forEach(pkg => {
      const pkgLib = path.join(this.packagesPath, pkg.name, 'lib');
      const pkgTemplates = path.join(pkgLib, 'templates');

      if (!existsSync(pkgLib)) {
        return;
      }

      addonJS.push(new WatchedDir(pkgLib));

      if(pkg.hasTemplates){
        addonHbs.push(new Funnel(pkgTemplates, {
          include: [
            '*.hbs',
            '**/*.hbs'
          ],
          exclude: ['*.gitkeep'],
          srcDir: '/',
          destDir: 'modules/ember-shell/templates/'+ pkg.module
        }));
      }
    });
github chrmod / spanan / Brocfile.js View on Github external
function package(tree, options) {
  options = options || {};
  options.configPath = options.configPath || 'system.config.js';
  options.inputFileName = options.inputFileName || 'index.js';
  options.outputFileName = options.outputFileName || 'index.js';
  options.format = options.format || 'global';

  return new SystemBuilder(tree, '/', options.configPath, function (builder) {
    return builder.buildStatic(options.inputFileName, options.outputFileName, {
      format: options.format,
      runtime: false,
    });
  });
}

var src = new WatchedTree('src');

var transpiledSrc = babel(src);

var transpiledLib = new Funnel(transpiledSrc, {
  exclude: ['**/*-test.js'],
});

var outputNodes = [
  package(transpiledLib, {
    format: 'global',
    inputFileName: 'index.js',
    outputFileName: 'spanan.global.js'
  }),
  package(transpiledLib, {
    format: 'esm',
    inputFileName: 'index.js',
github reactcli / react-cli / lib / broccoli / react-app.js View on Github external
'use strict';

let broccoliSource              = require('broccoli-source'),
    mergeTrees                  = require('broccoli-merge-trees'),
    concat                      = require('broccoli-concat'),
    funnel                      = require('broccoli-funnel'),
    browserify                  = require('broccoli-fast-browserify'),
    sassCompiler                = require('broccoli-sass-source-maps'),
    extractSourceMaps           = require('broccoli-source-map').extract,
    babelify                    = require('babelify'),
    omit                        = require('lodash.omit'),
    merge                       = require('lodash.merge'),
    findup                      = require('findup'),
    path                        = require('path'),
    appDir                      = broccoliSource.WatchedDir('app'),
    babelOptions                = {
      filterExtensions: ['js', 'jsx', 'es6'],
      browserPolyfill: true
    };

class ReactApp {
  constructor(options) {
    this.options = options;
    this.otherJavascriptFiles = [];
    this.otherCssFiles = [];
  }

  index() {
    return funnel('app/static', {
      files: ['index.html'],
      annotation: 'Funnel: index.html'
github cardstack / portfolio / portfolio / ember-cli-build.js View on Github external
let packageTrees = packageDirs.map(dir => {
    let testsDir = join(dir, 'tests');
    if (existsSync(testsDir)) {
      return new Funnel(new WatchedDir(testsDir), {
        exclude: ['dummy', 'index.html'],
        destDir: basename(dir)
      });
    }
  }).filter(Boolean);
github glimmerjs / glimmer-application-pipeline / lib / broccoli / glimmer-app.ts View on Github external
buildTrees(): Trees {
    const srcPath = this.resolveLocal('src');
    const srcTree = existsSync(srcPath) ? new WatchedDir(srcPath) : null;

    const nodeModulesPath = this.resolveLocal('node_modules');
    const nodeModulesTree = existsSync(srcPath) ? new UnwatchedDir(nodeModulesPath) : null;

    return {
      srcTree,
      nodeModulesTree
    }
  }
github ember-cli / ember-cli / lib / broccoli / ember-app.js View on Github external
let buildTreeFor = (defaultPath, specified, shouldWatch) => {
      if (specified !== null && specified !== undefined && typeof specified !== 'string') {
        return specified;
      }

      let tree = null;
      let resolvedPath = resolvePathFor(defaultPath, specified);
      if (fs.existsSync(resolvedPath)) {
        if (shouldWatch !== false) {
          tree = new WatchedDir(resolvedPath);
        } else {
          tree = new UnwatchedDir(resolvedPath);
        }
      }

      return tree;
    };
    let trees = (options && options.trees) || {};
github cardstack / cardstack / packages / hub / docker-host / broccoli-connector.js View on Github external
constructor(codeGenUrl) {
    quickTemp.makeOrRemake(this, '_triggerDir', 'cardstack-hub');
    this._trigger = new WatchedDir(this._triggerDir, {
      annotation: '@cardstack/hub',
    });
    this.tree = new CodeWriter(codeGenUrl, this._trigger);
    this._buildCounter = 0;
  }
  triggerRebuild() {
github embroider-build / embroider / packages / compat / src / v1-app.ts View on Github external
get indexTree() {
    let indexFilePath = this.app.options.outputPaths.app.html;

    let index: Tree = new Funnel(this.app.trees.app, {
      allowEmpty: true,
      include: [`index.html`],
      getDestinationPath: () => indexFilePath,
      annotation: 'app/index.html',
    });

    if (this.isModuleUnification) {
      let srcIndex = new Funnel(new WatchedDir(join(this.root, 'src')), {
        files: ['ui/index.html'],
        getDestinationPath: () => indexFilePath,
        annotation: 'src/ui/index.html',
      });

      index = mergeTrees([index, srcIndex], {
        overwrite: true,
        annotation: 'merge classic and MU index.html',
      });
    }

    let patterns = this.configReplacePatterns;

    return new this.configReplace(index, this.configTree, {
      configPath: join('environments', `${this.app.env}.json`),
      files: [indexFilePath],

broccoli-source

Broccoli plugin for referring to source directories on the file system

MIT
Latest version published 4 years ago

Package Health Score

66 / 100
Full package analysis