broccolijs / broccoli-persistent-filter

MIT License
12 stars 33 forks source link

Allow array of trees #188

Open SparshithNR opened 4 years ago

SparshithNR commented 4 years ago
const Filter = require('broccoli-persistent-filter');
//BrocFile.js

class Awk extends Filter {
  constructor(inputNode, search, replace, options) {
    options = options || {};
    super(inputNode, {
      annotation: options.annotation
    });
    this.search = search;
    this.replace = replace;
    this.extensions = ['txt'];
    this.targetExtension = 'txt';
  }
  processString(content, relativePath) {
    return content.replace(this.search, this.replace);
  };
}
//before current change we use to run a mergeTree and then run Awk filter
// i.e. let mergedTree = new MergeTree(['fixture','fixture_2']);
// module.exports = new Awk(mergedTree, 'test', 'real');
// now we can pass whole array of inputTrees 
module.exports = new Awk(['fixture','fixture_2'], 'test', 'real');
SparshithNR commented 4 years ago

This PR is the next step to #187 .

SparshithNR commented 4 years ago

@chriseppstein @stefanpenner Please have a look at this change.

chriseppstein commented 4 years ago

@SparshithNR @stefanpenner Is there anything remaining to do in order to land this? It would be good if we could realize the gains of all the underlying changes.