<commit_before>"use strict";
var async = require('async');
var fs = require('fs');
var generate = require('./generate');
var npm = require('npm');
var path = require('path');
var rimraf = require('rimraf');
var common = require('./common');

var existingProxies;
var mmsAppPath = '/tasklets/';
var templateRoot = path.join(__dirname,"..","template");
var binaryExtensions = {'.png':true, '.gif':true, '.jpeg':true, '.jpg':true};

exports.global = {};

var _templateDir;
function getTemplateDir(templateName) {
    if(!_templateDir) {
        if(!templateName) {
            templateName = "default";
        }
        _templateDir = path.join(templateRoot,templateName);
        if(!fs.existsSync(_templateDir)) {
            console.log('There is no template: ' + templateName);
            process.exit(1);
        }
    }
    return _templateDir;    
}

exports.add = function add(artifactType,artifactId,targetId,modelInit,templateName,session,callback) {
    common.gotoProjectHome();

    if (!targetId) {
        targetId = artifactId;
    }
    if(!modelInit) {
        modelInit = {name:"addin"};
    }
    if (fs.existsSync("proxy")) {
        existingProxies = fs.readdirSync("proxy");
    }
    else {
        existingProxies = [];
    }

    var partPath = path.join(artifactType,artifactId)
    var targetPath = path.join(artifactType,targetId);
    var templatePath = path.join(getTemplateDir(templateName),partPath);
    if(!fs.existsSync(templatePath)) {
        console.log('There is no "' + partPath + '" in template: ' + templateName);
        // console.log(templatePath + ' and ' + process.cwd());
        process.exit(1);
    }

    var templateFiles = findFiles(templatePath);<commit_msg>Enable npm installs for wsdl-generated proxies<commit_after>"use strict";
var async = require('async');
var fs = require('fs');
var generate = require('./generate');
var npm = require('npm');
var path = require('path');
var rimraf = require('rimraf');
var common = require('./common');

var existingProxies;
var mmsAppPath = '/tasklets/';
var templateRoot = path.join(__dirname,"..","template");
var binaryExtensions = {'.png':true, '.gif':true, '.jpeg':true, '.jpg':true};

exports.global = {};

var _templateDir;
function getTemplateDir(templateName) {
    if(!_templateDir) {
        if(!templateName) {
            templateName = "default";
        }
        _templateDir = path.join(templateRoot,templateName);
        if(!fs.existsSync(_templateDir)) {
            console.log('There is no template: ' + templateName);
            process.exit(1);
        }
    }
    return _templateDir;    
}

exports.add = function add(artifactType,artifactId,targetId,modelInit,templateName,session,callback) {
    common.gotoProjectHome();

    if (!targetId) {
        targetId = artifactId;
    }
    if(!modelInit) {
        modelInit = {name:"addin"};
    }
    if (fs.existsSync("proxy")) {
        existingProxies = fs.readdirSync("proxy");
        if (targetId != artifactId) {
            var tmp = [];
            existingProxies.forEach(function(row) {
                if(row !== targetId) {
                    tmp.push(row);
                }
            });
            existingProxies = tmp;
        }
    }
    else {
        existingProxies = [];
    }

    var partPath = path.join(artifactType,artifactId)
    var targetPath = path.join(artifactType,targetId);
    var templatePath = path.join(getTemplateDir(templateName),partPath);
    if(!fs.existsSync(templatePath)) {
        console.log('There is no "' + partPath + '" in template: ' + templateName);
        // console.log(templatePath + ' and ' + process.cwd());
        process.exit(1);
    }

    var templateFiles = findFiles(templatePath);
{'fraction_non_alphanumeric': 0.15029522275899088, 'fraction_numerical': 0.0010735373054213634, 'mean_word_length': 2.93558606124604, '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': '3251298', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1081, 'n_words': 211}