<commit_before>module.exports = (GULP, PLUGINS, NODE_MODULES, REVISION) => {
    return function (callback) {
        var sources = [
            {
                input: [
                    process.env.SRC + '/resources/pages/**/*.twig'
                ],
                output: process.env.DEST + '/resources/pages'
            },
            {
                input: [
                    process.env.SRC + '/resources/modules/**/*.twig',
                    process.env.MODULES_PATH + '/totem.module.*/**/*.twig',
                    '!**/totem.module.*/**/bower_components/**/*.twig',
                    '!**/modules/*/partials/**/*.twig'
                ],
                output: process.env.DEST + '/resources/modules'
            }
        ];

        var streams = [];

        sources.forEach(function(source) {
            var stream = GULP.src(source.input, {
                nodir: true
            })
            .pipe(PLUGINS.plumber())
            .pipe(PLUGINS.data(function (file) {
                var data = 'data.json';

                var path = NODE_MODULES.path.relative(file.cwd, file.path);
                var extension = NODE_MODULES.path.basename(path);

                var data = path.replace(extension, 'data.json');

                // Check if data.json exists
                if (!NODE_MODULES.fse.existsSync(data)) {
                    return {};
                }
                return JSON.parse(NODE_MODULES.fse.readFileSync(data));
            }))
            .pipe(PLUGINS.twig({
                base: process.env.SRC + '/resources',
                errorLogToConsole: true
            }))
            .pipe(PLUGINS.faker())<commit_msg>Share json file global within twig command<commit_after>module.exports = (GULP, PLUGINS, NODE_MODULES, REVISION) => {
    return function (callback) {
        var sources = [
            {
                input: [
                    process.env.SRC + '/resources/pages/**/*.twig'
                ],
                output: process.env.DEST + '/resources/pages'
            },
            {
                input: [
                    process.env.SRC + '/resources/modules/**/*.twig',
                    process.env.MODULES_PATH + '/totem.module.*/**/*.twig',
                    '!**/totem.module.*/**/bower_components/**/*.twig',
                    '!**/modules/*/partials/**/*.twig'
                ],
                output: process.env.DEST + '/resources/modules'
            }
        ];

        var streams = [];

        // Json file we can use to define global values within the project.
        var global_json = {};
        var data = process.env.SRC + '/data.json';
        if (NODE_MODULES.fse.existsSync(data)) {
            global_json = JSON.parse(NODE_MODULES.fse.readFileSync(data));
        }

        sources.forEach(function(source) {
            var stream = GULP.src(source.input, {
                nodir: true
            })
            .pipe(PLUGINS.plumber())
            .pipe(PLUGINS.data(function (file) {
                var data = 'data.json';

                var path = NODE_MODULES.path.relative(file.cwd, file.path);
                var extension = NODE_MODULES.path.basename(path);

                var f = path.replace(extension, 'data.json');

                // Check if data.json exists
                if (!NODE_MODULES.fse.existsSync(f)) {
                    return {};
                }

                return Object.assign(global_json, JSON.parse(NODE_MODULES.fse.readFileSync(f)));
            }))
            .pipe(PLUGINS.twig({
                base: process.env.SRC + '/resources',
                errorLogToConsole: true
            }))
            .pipe(PLUGINS.faker())
{'fraction_non_alphanumeric': 0.1371597952034492, 'fraction_numerical': 0.0, 'mean_word_length': 1.2927733168622606, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6842605', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1020, 'n_words': 162}