<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

const cp = require('child_process');
const path = require('path');
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';

function npmInstall(location, opts) {
	opts = opts || {};
	opts.cwd = location;
	opts.stdio = 'inherit';

	const result = cp.spawnSync(npm, ['install'], opts);

	if (result.error || result.status !== 0) {
		process.exit(1);
	}
}

npmInstall('extensions'); // node modules shared by all extensions

const extensions = [
	'vscode-api-tests',
	'vscode-colorize-tests',
	'json',
	'configuration-editing',
	'extension-editing',
	'markdown',
	'typescript',
	'php',
	'javascript',
	'css',
	'html',
	'git',
	'gulp',
	'grunt',
	'jake',
	'merge-conflict',
	'emmet',
	'npm',
	'jake'
];

extensions.forEach(extension => npmInstall(`extensions/${extension}`));

function npmInstallBuildDependencies() {
	// make sure we install gulp watch for the system installed
	// node, since that is the driver of gulp
	const env = Object.assign({}, process.env);

	delete env['npm_config_disturl'];
	delete env['npm_config_target'];
	delete env['npm_config_runtime'];

	npmInstall(path.join(path.dirname(__dirname), 'lib', 'watch'), { env });
}

npmInstall(`build`); // node modules required for build
npmInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron<commit_msg>run smoketest npm install as postinstall step<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

const cp = require('child_process');
const path = require('path');
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';

function npmInstall(location, opts) {
	opts = opts || {};
	opts.cwd = location;
	opts.stdio = 'inherit';

	const result = cp.spawnSync(npm, ['install'], opts);

	if (result.error || result.status !== 0) {
		process.exit(1);
	}
}

npmInstall('extensions'); // node modules shared by all extensions

const extensions = [
	'vscode-api-tests',
	'vscode-colorize-tests',
	'json',
	'configuration-editing',
	'extension-editing',
	'markdown',
	'typescript',
	'php',
	'javascript',
	'css',
	'html',
	'git',
	'gulp',
	'grunt',
	'jake',
	'merge-conflict',
	'emmet',
	'npm',
	'jake'
];

extensions.forEach(extension => npmInstall(`extensions/${extension}`));

function npmInstallBuildDependencies() {
	// make sure we install gulp watch for the system installed
	// node, since that is the driver of gulp
	const env = Object.assign({}, process.env);

	delete env['npm_config_disturl'];
	delete env['npm_config_target'];
	delete env['npm_config_runtime'];

	npmInstall(path.join(path.dirname(__dirname), 'lib', 'watch'), { env });
}

npmInstall(`build`); // node modules required for build
npmInstall('test/smoke'); // node modules required for smoketest
npmInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
{'fraction_non_alphanumeric': 0.24762999138178685, 'fraction_numerical': 0.002298190175237001, 'mean_word_length': 2.8645948945615984, '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': '6166486', 'n_tokens_mistral': 1035, 'n_tokens_neox': 992, 'n_words': 281}