mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Check that modules in both the base package.json and remote/ have the same version installed
This commit is contained in:
parent
525f927adc
commit
a726cef3c3
|
@ -78,4 +78,42 @@ const processTreeDts = path.join('node_modules', 'windows-process-tree', 'typing
|
|||
if (fs.existsSync(processTreeDts)) {
|
||||
console.log('Removing windows-process-tree.d.ts');
|
||||
fs.unlinkSync(processTreeDts);
|
||||
}
|
||||
}
|
||||
|
||||
function getInstalledVersion(packageName, cwd) {
|
||||
const opts = {};
|
||||
if (cwd) {
|
||||
opts.cwd = cwd;
|
||||
}
|
||||
|
||||
const result = cp.spawnSync(yarn, ['list', '--pattern', packageName], opts);
|
||||
const stdout = result.stdout.toString();
|
||||
const match = stdout.match(new RegExp(packageName + '@(\\S+)'));
|
||||
if (!match || !match[1]) {
|
||||
throw new Error('Unexpected output from yarn list: ' + stdout);
|
||||
}
|
||||
|
||||
return match[1];
|
||||
}
|
||||
|
||||
function assertSameVersionsBetweenFolders(packageName, otherFolder) {
|
||||
const baseVersion = getInstalledVersion(packageName);
|
||||
const otherVersion = getInstalledVersion(packageName, otherFolder);
|
||||
|
||||
if (baseVersion !== otherVersion) {
|
||||
throw new Error(`Mismatched versions installed for ${packageName}: root has ${baseVersion}, ./${otherFolder} has ${otherVersion}. These should be the same!`);
|
||||
}
|
||||
}
|
||||
|
||||
// Check that modules in both the base package.json and remote/ have the same version installed
|
||||
const requireSameVersionsInRemote = [
|
||||
'xterm',
|
||||
'xterm-addon-search',
|
||||
'xterm-addon-web-links',
|
||||
'node-pty',
|
||||
'vscode-ripgrep'
|
||||
];
|
||||
|
||||
requireSameVersionsInRemote.forEach(packageName => {
|
||||
assertSameVersionsBetweenFolders(packageName, 'remote');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue