<commit_before>'use strict';

var debug     = require('debug-ext')('setup')
  , writeFile = require('fs2/write-file')

  , stringify = JSON.stringify
  , writeOpts = { intermediate: true };

module.exports = function (env, path) {
	var content, clientEnv;
	debug('generate-client-env');
	clientEnv = {
		static: { host: (env.static && env.static.host) || '/' },
		url: env.url,
		i18n: (env.i18n !== false)
	};
	if (env.googleAnalytics) clientEnv.googleAnalytics = env.googleAnalytics;
	content = '\'use strict\';\n\nmodule.exports = require(\'mano\').env = ' +
		stringify(clientEnv, null, '\t') + ';\n';
	return writeFile(path, content, writeOpts);
};<commit_msg>Take root instead of exact path<commit_after>'use strict';

var ensureObject = require('es5-ext/object/valid-object')
  , ensureString = require('es5-ext/object/validate-stringifiable-value')
  , debug        = require('debug-ext')('setup')
  , resolve      = require('path').resolve
  , writeFile    = require('fs2/write-file')

  , stringify = JSON.stringify
  , writeOpts = { intermediate: true };

module.exports = function (env, root) {
	var content, clientEnv;
	ensureObject(env);
	root = ensureString(root);
	debug('generate-client-env');
	clientEnv = {
		static: { host: (env.static && env.static.host) || '/' },
		url: env.url,
		i18n: (env.i18n !== false)
	};
	if (env.googleAnalytics) clientEnv.googleAnalytics = env.googleAnalytics;
	content = '\'use strict\';\n\nmodule.exports = require(\'mano\').env = ' +
		stringify(clientEnv, null, '\t') + ';\n';
	return writeFile(resolve(root, 'apps-common/client/env.js'), content, writeOpts);
};
{'fraction_non_alphanumeric': 0.1845201238390093, 'fraction_numerical': 0.007430340557275541, 'mean_word_length': 4.212903225806452, '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': '3688611', 'n_tokens_mistral': 562, 'n_tokens_neox': 549, 'n_words': 107}