From b0b6dc6c2eea0f587cb060af074b91af89ad7e11 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 6 Feb 2019 15:16:49 +0100 Subject: [PATCH] Update grammars to pick up make changes and fix hashes. --- build/npm/update-grammar.js | 39 +++++++++++-------- extensions/cpp/cgmanifest.json | 4 +- extensions/git/cgmanifest.json | 2 +- extensions/html/cgmanifest.json | 2 +- extensions/make/cgmanifest.json | 2 +- extensions/make/syntaxes/make.tmLanguage.json | 9 ++++- extensions/php/cgmanifest.json | 4 +- extensions/scss/cgmanifest.json | 2 +- extensions/sql/cgmanifest.json | 2 +- extensions/sql/syntaxes/sql.tmLanguage.json | 4 +- 10 files changed, 41 insertions(+), 29 deletions(-) diff --git a/build/npm/update-grammar.js b/build/npm/update-grammar.js index b4f94044419..522b2941218 100644 --- a/build/npm/update-grammar.js +++ b/build/npm/update-grammar.js @@ -12,6 +12,8 @@ var cson = require('cson-parser'); var https = require('https'); var url = require('url'); +let commitDate = '0000-00-00'; + /** * @param {string} urlString */ @@ -120,30 +122,35 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas try { fs.writeFileSync(dest, JSON.stringify(result, null, '\t').replace(/\n/g, '\r\n')); - // Add commit sha to cgmanifest let cgmanifestRead = JSON.parse(fs.readFileSync('./cgmanifest.json').toString()); let promises = new Array(); - let packageJsonPath = 'https://raw.githubusercontent.com/' + repoId + `/${info.commitSha}/package.json`; - for (let i = 0; i < cgmanifestRead.registrations.length; i++) { - if (cgmanifestRead.registrations[i].component.git.repositoryUrl.substr(cgmanifestRead.registrations[i].component.git.repositoryUrl.length - repoId.length, repoId.length) === repoId) { - cgmanifestRead.registrations[i].component.git.commitHash = info.commitSha; - promises.push(download(packageJsonPath).then(function (packageJson) { - if (packageJson) { - try { - cgmanifestRead.registrations[i].version = JSON.parse(packageJson).version; - } catch (e) { - console.log('File does not exist at' + packageJsonPath); - } - } - })); - break; + const currentCommitDate = info.commitDate.substr(0, 10); + + // Add commit sha to cgmanifest. + if (currentCommitDate > commitDate) { + let packageJsonPath = 'https://raw.githubusercontent.com/' + repoId + `/${info.commitSha}/package.json`; + for (let i = 0; i < cgmanifestRead.registrations.length; i++) { + if (cgmanifestRead.registrations[i].component.git.repositoryUrl.substr(cgmanifestRead.registrations[i].component.git.repositoryUrl.length - repoId.length, repoId.length) === repoId) { + cgmanifestRead.registrations[i].component.git.commitHash = info.commitSha; + commitDate = currentCommitDate; + promises.push(download(packageJsonPath).then(function (packageJson) { + if (packageJson) { + try { + cgmanifestRead.registrations[i].version = JSON.parse(packageJson).version; + } catch (e) { + console.log('Cannot get version. File does not exist at ' + packageJsonPath); + } + } + })); + break; + } } } Promise.all(promises).then(function (allResult) { fs.writeFileSync('./cgmanifest.json', JSON.stringify(cgmanifestRead, null, '\t').replace(/\n/g, '\r\n')); }); if (info) { - console.log('Updated ' + path.basename(dest) + ' to ' + repoId + '@' + info.commitSha.substr(0, 7) + ' (' + info.commitDate.substr(0, 10) + ')'); + console.log('Updated ' + path.basename(dest) + ' to ' + repoId + '@' + info.commitSha.substr(0, 7) + ' (' + currentCommitDate + ')'); } else { console.log('Updated ' + path.basename(dest)); } diff --git a/extensions/cpp/cgmanifest.json b/extensions/cpp/cgmanifest.json index 7bab26bfa11..e6666933f61 100644 --- a/extensions/cpp/cgmanifest.json +++ b/extensions/cpp/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "atom/language-c", "repositoryUrl": "https://github.com/atom/language-c", - "commitHash": "3a269f88b12e512fb9495dc006a1dabf325d3d7f" + "commitHash": "9c0c5f202741a5647025db8d5df5fefba47b036c" } }, "license": "MIT", - "version": "0.58.0", + "version": "0.58.1", "description": "The files syntaxes/c.json and syntaxes/c++.json were derived from the Atom package https://atom.io/packages/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle." }, { diff --git a/extensions/git/cgmanifest.json b/extensions/git/cgmanifest.json index 8b62f6fbb0c..d0bdb9ac443 100644 --- a/extensions/git/cgmanifest.json +++ b/extensions/git/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "textmate/git.tmbundle", "repositoryUrl": "https://github.com/textmate/git.tmbundle", - "commitHash": "93897a78c6e52bef13dadc0d4091d203c5facb40" + "commitHash": "3f6ad2138200db14b57a090ecb2d2e733275ca3e" } }, "licenseDetail": [ diff --git a/extensions/html/cgmanifest.json b/extensions/html/cgmanifest.json index fb7007ddb31..78125476f1e 100644 --- a/extensions/html/cgmanifest.json +++ b/extensions/html/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "textmate/html.tmbundle", "repositoryUrl": "https://github.com/textmate/html.tmbundle", - "commitHash": "390c8870273a2ae80244dae6db6ba064a802f407" + "commitHash": "0c3d5ee54de3a993f747f54186b73a4d2d3c44a2" } }, "licenseDetail": [ diff --git a/extensions/make/cgmanifest.json b/extensions/make/cgmanifest.json index e575c65097b..6f4432b66da 100644 --- a/extensions/make/cgmanifest.json +++ b/extensions/make/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "fadeevab/make.tmbundle", "repositoryUrl": "https://github.com/fadeevab/make.tmbundle", - "commitHash": "d01ce3404f9e2eed0fd4d07b5e24094c03599241" + "commitHash": "21e9108e9dce13b798667806bb105d852ac0a58c" } }, "licenseDetail": [ diff --git a/extensions/make/syntaxes/make.tmLanguage.json b/extensions/make/syntaxes/make.tmLanguage.json index 79a3082a0bb..878e78767e8 100644 --- a/extensions/make/syntaxes/make.tmLanguage.json +++ b/extensions/make/syntaxes/make.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/fadeevab/make.tmbundle/commit/d01ce3404f9e2eed0fd4d07b5e24094c03599241", + "version": "https://github.com/fadeevab/make.tmbundle/commit/21e9108e9dce13b798667806bb105d852ac0a58c", "name": "Makefile", "scopeName": "source.makefile", "patterns": [ @@ -342,7 +342,12 @@ "begin": "(^[ ]*|\\G\\s*)([^\\s]+)\\s*((?