Code coverage report for lib/util/fileStream.js

Statements: 100% (20 / 20)      Branches: 100% (8 / 8)      Functions: 100% (3 / 3)      Lines: 100% (20 / 20)      Ignored: none     

All files » lib/util/ » fileStream.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33    1 1 1 1   1 5 5   5 300 300   208 204 204 204 204     4   92 78 78   14        
'use strict';
 
var through = require('through2');
var path = require('path');
var isModulable = require('./isModulable');
var copyAddonFile = require('./copyAddonFile');
 
module.exports = function(options) {
  var nodeFolder = path.resolve('node_modules');
  var fullBase = path.resolve(options.rootPath);
 
  return through.obj(function(chunk, _, next) {
    var relativePath = path.relative(fullBase, chunk);
    if (chunk.indexOf(nodeFolder) !== -1) {
      // we don't want blueprints
      if (!/\/blueprints\//i.test(chunk) && !/\/styles\//i.test(chunk)) {
        var self = this;
        copyAddonFile(chunk, options, function(newPath) {
          self.push('ember-addon:'+newPath);
          next();
        });
      } else {
        next();
      }
    } else if (isModulable(relativePath)) {
      this.push(relativePath);
      next();
    } else {
      next();
    }
  });
};