<commit_before>/* jshint node: true */
'use strict';

var path = require('path');

var funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');

var TransformComponents = require('./broccoli-transform-components');
var ImportThemeComponents = require('./broccoli-import-theme-components');
var ProvideAppImports = require('./broccoli-provide-app-imports');

var stew = require('broccoli-stew');

module.exports = function(tree, options) {
  var themes = options.themes || [];
  var componentsNamespace = options.componentsNamespace;
  var scssMainFilePath = 'app/styles/app.scss';

  var themeTrees = themes.reduce(function(trees, theme) {
    var themeTree = theme.toScssTree();
    themeTree = funnel(themeTree, {
      destDir: path.join(theme.name)
    });
    themeTree = new TransformComponents(themeTree, {
      componentsNamespace: componentsNamespace
    });

    var themeMain = path.join(theme.name, theme.name + '.scss');
    themeTree = new ImportThemeComponents(themeTree, {
      main: themeMain,
      include: [path.join(theme.name, componentsNamespace, '*.scss')]
    });

    var appImport = new ProvideAppImports(themeTree, {
      importPath: themeMain.replace('.scss', ''),
      dest: path.dirname(scssMainFilePath),
      themeName: theme.name
    });

    trees.push(themeTree);
    trees.push(appImport);

    return trees;
  }, []);

  var scssTree = funnel(tree, { include: ['**/*.scss'] });
  scssTree = mergeTrees([scssTree].concat(themeTrees), { overwrite: true });

  var loggedTree = stew.log(scssTree, { output: 'tree', label: 'my-app-name tree' });

  return loggedTree;
};<commit_msg>Remove broccoli-stew log of scss tree<commit_after>/* jshint node: true */
'use strict';

var path = require('path');

var funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');

var TransformComponents = require('./broccoli-transform-components');
var ImportThemeComponents = require('./broccoli-import-theme-components');
var ProvideAppImports = require('./broccoli-provide-app-imports');

module.exports = function(tree, options) {
  var themes = options.themes || [];
  var componentsNamespace = options.componentsNamespace;
  var scssMainFilePath = 'app/styles/app.scss';

  var themeTrees = themes.reduce(function(trees, theme) {
    var themeTree = theme.toScssTree();
    themeTree = funnel(themeTree, {
      destDir: path.join(theme.name)
    });
    themeTree = new TransformComponents(themeTree, {
      componentsNamespace: componentsNamespace
    });

    var themeMain = path.join(theme.name, theme.name + '.scss');
    themeTree = new ImportThemeComponents(themeTree, {
      main: themeMain,
      include: [path.join(theme.name, componentsNamespace, '*.scss')]
    });

    var appImport = new ProvideAppImports(themeTree, {
      importPath: themeMain.replace('.scss', ''),
      dest: path.dirname(scssMainFilePath),
      themeName: theme.name
    });

    trees.push(themeTree);
    trees.push(appImport);

    return trees;
  }, []);

  var scssTree = funnel(tree, { include: ['**/*.scss'] });
  scssTree = mergeTrees([scssTree].concat(themeTrees), { overwrite: true });

  return scssTree;
};
{'fraction_non_alphanumeric': 0.1491090965926852, 'fraction_numerical': 0.0, 'mean_word_length': 4.128205128205129, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2861342', 'n_tokens_mistral': 1005, 'n_tokens_neox': 955, 'n_words': 198}