diff --git a/build/npm/update-all-grammars.js b/build/npm/update-all-grammars.js new file mode 100644 index 00000000000..252b0f4edcb --- /dev/null +++ b/build/npm/update-all-grammars.js @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const cp = require('child_process'); +const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; +const integrationTests = process.platform === 'win32' ? '.\test-integration.bat' : './test-integration.sh'; + +function updateGrammar(location) { + const result = cp.spawnSync(npm, ['run', 'update-grammar'], { + cwd: location, + stdio: 'inherit' + }); + + if (result.error || result.status !== 0) { + process.exit(1); + } +} + +const extensions = [ + // 'bat' Grammar no longer available + 'clojure', + 'coffeescript', + 'cpp', + 'csharp', + 'css', + 'diff', + 'docker', + 'fsharp', + 'gitsyntax', + 'go', + 'groovy', + 'handlebars', + 'hlsl', + 'html', + 'ini', + 'java', + // 'javascript', updated through JavaScript + // 'json', customized + 'less', + 'lua', + 'make', + 'markdown', + 'objective-c', + 'perl', + 'php', + // 'powershell', grammar not ready yet, @daviwil will ping when ready + 'pug', + 'python', + 'r', + 'razor', + 'ruby', + 'rust', + 'scss', + 'shaderlab', + 'shellscript', + // 'sql', customized, PRs pending + 'swift', + 'typescript', + 'vb', + 'xml', + 'yaml' +]; + +extensions.forEach(extension => updateGrammar(`extensions/${extension}`)); + +// run integration tests + +if (process.platform === 'win32') { + cp.spawn('.\scripts\test-integration.bat', [], { env: process.env, stdio: 'inherit' }); +} else { + cp.spawn('/bin/bash', ['./scripts/test-integration.sh'], { env: process.env, stdio: 'inherit' }); +} \ No newline at end of file diff --git a/extensions/typescript/package.json b/extensions/typescript/package.json index a24c0c10519..461cb773a4d 100644 --- a/extensions/typescript/package.json +++ b/extensions/typescript/package.json @@ -21,7 +21,7 @@ }, "scripts": { "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:typescript ./tsconfig.json", - "update-grammars": "node ./build/update-grammars.js" + "update-grammar": "node ./build/update-grammars.js" }, "activationEvents": [ "onLanguage:javascript", diff --git a/package.json b/package.json index 236e9d787e5..c31f58f40c9 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "monaco-editor-test": "mocha --only-monaco-editor", "precommit": "node build/gulpfile.hygiene.js", "gulp": "gulp --max_old_space_size=4096", - "7z": "7z" + "7z": "7z", + "update-grammars": "node build/npm/update-all-grammars.js" }, "dependencies": { "applicationinsights": "0.17.1",