adding theming registry

This commit is contained in:
Martin Aeschlimann
2017-03-07 12:03:23 +01:00
parent 777cc89e3d
commit 0049138c96
10 changed files with 558 additions and 422 deletions

40
build/npm/update-theme.js Normal file
View File

@@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
var path = require('path');
var fs = require('fs');
var plist = require('fast-plist');
exports.update = function (srcName, destName) {
try {
console.log('reading ', srcName);
let result = {};
let plistContent = fs.readFileSync(srcName).toString();
let theme = plist.parse(plistContent);
let settings = theme.settings;
if (Array.isArray(settings)) {
for (let entry of settings) {
let scope = entry.scope;
if (scope) {
let parts = scope.split(',').map(p => p.trim());
if (parts.length > 1) {
entry.scope = parts;
}
}
}
result.syntaxTokens = settings;
result.colors = {};
}
fs.writeFileSync(destName, JSON.stringify(result, null, '\t'));
} catch (e) {
console.log(e);
}
}
if (path.basename(process.argv[1]) === 'update-theme.js') {
exports.update(process.argv[2], process.argv[3]);
}