scripts/code.sh picks up marketplace built-in extensions automatically

This commit is contained in:
Alex Dima
2018-01-23 16:40:41 +01:00
parent 53a2781d80
commit 5bdb90de36
8 changed files with 100 additions and 10 deletions

View File

@@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
const fs = require('fs');
const path = require('path');
const root = path.dirname(path.dirname(__dirname));
function isUpToDate(extension) {
const packagePath = path.join(root, '.build', 'builtInExtensions', extension.name, 'package.json');
if (!fs.existsSync(packagePath)) {
return false;
}
const packageContents = fs.readFileSync(packagePath);
try {
const diskVersion = JSON.parse(packageContents).version;
return (diskVersion === extension.version);
} catch(err) {
return false;
}
}
const builtInExtensions = require('../builtInExtensions');
builtInExtensions.forEach((extension) => {
if (!isUpToDate(extension)) {
process.exit(1);
}
});
process.exit(0);