mirror of
https://github.com/Microsoft/vscode
synced 2024-08-26 20:39:37 +00:00
[seti] script to update commitHash in cgmanifest
This commit is contained in:
parent
2f82209adf
commit
6be20f4f76
|
@ -35,16 +35,32 @@ let nonBuiltInLanguages = { // { fileNames, extensions }
|
|||
"todo": { fileNames: ['todo'] }
|
||||
};
|
||||
|
||||
function getCommitSha(repoId, repoPath) {
|
||||
let commitInfo = 'https://api.github.com/repos/' + repoId + '/commits?path=' + repoPath;
|
||||
let FROM_DISK = false; // set to true to take content from a repo checkedout next to the vscode repo
|
||||
|
||||
let font, fontMappingsFile, fileAssociationFile, colorsFile;
|
||||
if (!FROM_DISK) {
|
||||
font = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti/seti.woff';
|
||||
fontMappingsFile = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti.less';
|
||||
fileAssociationFile = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/components/icons/mapping.less';
|
||||
colorsFile = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/ui-variables.less';
|
||||
} else {
|
||||
font = '../../../seti-ui/styles/_fonts/seti/seti.woff';
|
||||
fontMappingsFile = '../../../seti-ui/styles/_fonts/seti.less';
|
||||
fileAssociationFile = '../../../seti-ui/styles/components/icons/mapping.less';
|
||||
colorsFile = '../../../seti-ui/styles/ui-variables.less';
|
||||
}
|
||||
|
||||
function getCommitSha(repoId) {
|
||||
let commitInfo = 'https://api.github.com/repos/' + repoId + '/commits/master';
|
||||
return download(commitInfo).then(function (content) {
|
||||
try {
|
||||
let lastCommit = JSON.parse(content)[0];
|
||||
let lastCommit = JSON.parse(content);
|
||||
return Promise.resolve({
|
||||
commitSha: lastCommit.sha,
|
||||
commitDate: lastCommit.commit.author.date
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('Failed parsing ' + content);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}, function () {
|
||||
|
@ -189,21 +205,10 @@ function getLanguageMappings() {
|
|||
return langMappings;
|
||||
}
|
||||
|
||||
//let font = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti/seti.woff';
|
||||
let font = '../../../seti-ui/styles/_fonts/seti/seti.woff';
|
||||
|
||||
exports.copyFont = function () {
|
||||
return downloadBinary(font, './icons/seti.woff');
|
||||
};
|
||||
|
||||
//let fontMappings = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti.less';
|
||||
//let mappings = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/components/icons/mapping.less';
|
||||
//let colors = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/ui-variables.less';
|
||||
|
||||
let fontMappingsFile = '../../../seti-ui/styles/_fonts/seti.less';
|
||||
let fileAssociationFile = '../../../seti-ui/styles/components/icons/mapping.less';
|
||||
let colorsFile = '../../../seti-ui/styles/ui-variables.less';
|
||||
|
||||
exports.update = function () {
|
||||
|
||||
console.log('Reading from ' + fontMappingsFile);
|
||||
|
@ -358,12 +363,18 @@ exports.update = function () {
|
|||
while ((match = regex3.exec(content)) !== null) {
|
||||
colorId2Value[match[1]] = match[2];
|
||||
}
|
||||
return getCommitSha('jesseweed/seti-ui', 'styles/_fonts/seti.less').then(function (info) {
|
||||
return getCommitSha('jesseweed/seti-ui').then(function (info) {
|
||||
try {
|
||||
writeFileIconContent(info);
|
||||
if (info) {
|
||||
console.log('Updated to jesseweed/seti-ui@' + info.commitSha.substr(0, 7) + ' (' + info.commitDate.substr(0, 10) + ')');
|
||||
}
|
||||
|
||||
let cgmanifestPath = './cgmanifest.json';
|
||||
let cgmanifest = fs.readFileSync(cgmanifestPath).toString();
|
||||
let cgmanifestContent = JSON.parse(cgmanifest);
|
||||
cgmanifestContent['registrations'][0]['component']['git']['commitHash'] = info.commitSha;
|
||||
fs.writeFileSync(cgmanifestPath, JSON.stringify(cgmanifestContent, null, '\t'));
|
||||
console.log('updated ' + cgmanifestPath);
|
||||
|
||||
console.log('Updated to jesseweed/seti-ui@' + info.commitSha.substr(0, 7) + ' (' + info.commitDate.substr(0, 10) + ')');
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
"git": {
|
||||
"name": "seti-ui",
|
||||
"repositoryUrl": "https://github.com/jesseweed/seti-ui",
|
||||
"commitHash": "0b576faae405d3cd8df6ac1a397f287aa6d8b3fe"
|
||||
"commitHash": "89175d7f9e0c70cd325b80a18a3c77fc8eb7c798"
|
||||
}
|
||||
},
|
||||
"version": "0.1.0"
|
||||
}
|
||||
],
|
||||
"version": 1
|
||||
}
|
||||
}
|
|
@ -1820,5 +1820,5 @@
|
|||
"npm-debug.log": "_npm_ignored_light"
|
||||
}
|
||||
},
|
||||
"version": "https://github.com/jesseweed/seti-ui/commit/7714a720646300bb8f6d1690752cd71f50991414"
|
||||
"version": "https://github.com/jesseweed/seti-ui/commit/89175d7f9e0c70cd325b80a18a3c77fc8eb7c798"
|
||||
}
|
Loading…
Reference in a new issue