<commit_before>'use strict';

var lib = require('manifoldjs-lib');

var log = lib.log,
    projectBuilder = lib.projectBuilder;
    
function packageApps(program) {
  
  var platforms = program.platforms.split(/[\s,]+/);  
  var projectDir = program.args.length < 2 ? process.cwd() : program.args[1];  
  return projectBuilder.packageApps(platforms, projectDir, program);
}

module.exports = packageApps;<commit_msg>Updated package command to prevent executing package for  platforms not present in the project<commit_after>'use strict';

var lib = require('manifoldjs-lib');

var log = lib.log,
    projectBuilder = lib.projectBuilder;

function packageApps(program) {
  
  var platforms = program.platforms.split(/[\s,]+/);  
  var projectDir = program.args.length < 2 ? process.cwd() : program.args[1];
  return lib.projectTools.getProjectPlatforms(projectDir).then(function (projectPlatforms) {
    // exclude any platforms not present in the project
    platforms = platforms.filter(function (platform) {
      return projectPlatforms.indexOf(platform) >= 0;
    });
    
    return projectBuilder.packageApps(platforms, projectDir, program); 
  });
}

module.exports = packageApps;
{'fraction_non_alphanumeric': 0.12215669755686605, 'fraction_numerical': 0.004212299915754001, 'mean_word_length': 4.351351351351352, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '4183528', 'n_tokens_mistral': 355, 'n_tokens_neox': 346, 'n_words': 83}