<commit_before>#!/usr/bin/env node
"use strict";
var gulp = require('gulp');
var path = require("path");
var removeCode = require('gulp-remove-code');
var removeHtml = require('gulp-html-remove');
var es = require('event-stream');
var ngAnnotate = require('gulp-ng-annotate');
var htmlmin = require('gulp-htmlmin');

var rootdir = process.argv[2];

if (rootdir) {

  // go through each of the platform directories that have been prepared
  var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);

  for(var x=0; x<platforms.length; x++) {

    var platform = platforms[x].trim().toLowerCase();

    var wwwPath;
    if(platform == 'android') {
      wwwPath = path.join(rootdir, 'platforms', platform, 'assets', 'www');
    } else {
      wwwPath = path.join(rootdir, 'platforms', platform, 'www');
    }

    var pluginPath = path.join(wwwPath, 'plugins') + '/es';

    process.stdout.write('Removing unused code for device \n');

    // Compute options {device-<platform>: true}
    var platformDeviceRemoveOptions = {};
    platformDeviceRemoveOptions['device-' + platform] = true;

    // Removing unused code for device...
    es.concat(
      // Remove unused HTML tags
      gulp.src([wwwPath + '/templates/**/*.html', pluginPath + '/templates/**/*.html'])
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true}
        .pipe(removeHtml('.hidden-xs.hidden-sm'))
        .pipe(removeHtml('.hidden-device'))
        .pipe(removeHtml('[remove-if][remove-if="device"]'))
        .pipe(htmlmin())
        .pipe(gulp.dest(".")),

      gulp.src(path.join(wwwPath, 'index.html'))
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true}
        .pipe(removeHtml('.hidden-xs.hidden-sm'))
        .pipe(removeHtml('.hidden-device'))
        .pipe(removeHtml('[remove-if][remove-if="device"]'))
        .pipe(htmlmin())
        .pipe(gulp.dest(wwwPath)),

      // Remove unused JS code + add ng annotations
      gulp.src([wwwPath + '/js/**/*.js'])
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true}
        .pipe(ngAnnotate({single_quotes: true}))
        .pipe(gulp.dest(wwwPath + '/dist/dist_js/app')),

      gulp.src([pluginPath + '/js/**/*.js'])
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true}
        .pipe(ngAnnotate({single_quotes: true}))
        .pipe(gulp.dest(wwwPath + '/dist/dist_js/plugins'))
     );

  }
}
<commit_msg>fix build removeCod(<platform>: true)<commit_after>#!/usr/bin/env node
"use strict";
var gulp = require('gulp');
var path = require("path");
var removeCode = require('gulp-remove-code');
var removeHtml = require('gulp-html-remove');
var es = require('event-stream');
var ngAnnotate = require('gulp-ng-annotate');
var htmlmin = require('gulp-htmlmin');

var rootdir = process.argv[2];

if (rootdir) {

  // go through each of the platform directories that have been prepared
  var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);

  for(var x=0; x<platforms.length; x++) {

    var platform = platforms[x].trim().toLowerCase();

    var wwwPath;
    if(platform == 'android') {
      wwwPath = path.join(rootdir, 'platforms', platform, 'assets', 'www');
    } else {
      wwwPath = path.join(rootdir, 'platforms', platform, 'www');
    }

    var pluginPath = path.join(wwwPath, 'plugins') + '/es';

    process.stdout.write('Removing unused code for device \n');

    // Compute options {device-<platform>: true}
    var platformRemoveCodeOptions = {};
    platformRemoveCodeOptions[platform] = true; // = {<platform>: true}

    // Removing unused code for device...
    es.concat(
      // Remove unused HTML tags
      gulp.src([wwwPath + '/templates/**/*.html', pluginPath + '/templates/**/*.html'])
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformRemoveCodeOptions))
        .pipe(removeHtml('.hidden-xs.hidden-sm'))
        .pipe(removeHtml('.hidden-device'))
        .pipe(removeHtml('[remove-if][remove-if="device"]'))
        .pipe(htmlmin())
        .pipe(gulp.dest(".")),

      gulp.src(path.join(wwwPath, 'index.html'))
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformRemoveCodeOptions))
        .pipe(removeHtml('.hidden-xs.hidden-sm'))
        .pipe(removeHtml('.hidden-device'))
        .pipe(removeHtml('[remove-if][remove-if="device"]'))
        .pipe(htmlmin())
        .pipe(gulp.dest(wwwPath)),

      // Remove unused JS code + add ng annotations
      gulp.src([wwwPath + '/js/**/*.js'])
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformRemoveCodeOptions))
        .pipe(ngAnnotate({single_quotes: true}))
        .pipe(gulp.dest(wwwPath + '/dist/dist_js/app')),

      gulp.src([pluginPath + '/js/**/*.js'])
        .pipe(removeCode({device: true}))
        .pipe(removeCode(platformRemoveCodeOptions))
        .pipe(ngAnnotate({single_quotes: true}))
        .pipe(gulp.dest(wwwPath + '/dist/dist_js/plugins'))
     );

  }
}

{'fraction_non_alphanumeric': 0.18412033511043413, 'fraction_numerical': 0.0007616146230007616, 'mean_word_length': 3.246564268391269, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 24, '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': '235098', 'n_tokens_mistral': 1681, 'n_tokens_neox': 1645, 'n_words': 302}