Skip to content

Commit 3cdc7b7

Browse files
committed
update all grammars script
1 parent 175cece commit 3cdc7b7

3 files changed

Lines changed: 77 additions & 2 deletions

File tree

build/npm/update-all-grammars.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
const cp = require('child_process');
7+
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
8+
const integrationTests = process.platform === 'win32' ? '.\test-integration.bat' : './test-integration.sh';
9+
10+
function updateGrammar(location) {
11+
const result = cp.spawnSync(npm, ['run', 'update-grammar'], {
12+
cwd: location,
13+
stdio: 'inherit'
14+
});
15+
16+
if (result.error || result.status !== 0) {
17+
process.exit(1);
18+
}
19+
}
20+
21+
const extensions = [
22+
// 'bat' Grammar no longer available
23+
'clojure',
24+
'coffeescript',
25+
'cpp',
26+
'csharp',
27+
'css',
28+
'diff',
29+
'docker',
30+
'fsharp',
31+
'gitsyntax',
32+
'go',
33+
'groovy',
34+
'handlebars',
35+
'hlsl',
36+
'html',
37+
'ini',
38+
'java',
39+
// 'javascript', updated through JavaScript
40+
// 'json', customized
41+
'less',
42+
'lua',
43+
'make',
44+
'markdown',
45+
'objective-c',
46+
'perl',
47+
'php',
48+
// 'powershell', grammar not ready yet, @daviwil will ping when ready
49+
'pug',
50+
'python',
51+
'r',
52+
'razor',
53+
'ruby',
54+
'rust',
55+
'scss',
56+
'shaderlab',
57+
'shellscript',
58+
// 'sql', customized, PRs pending
59+
'swift',
60+
'typescript',
61+
'vb',
62+
'xml',
63+
'yaml'
64+
];
65+
66+
extensions.forEach(extension => updateGrammar(`extensions/${extension}`));
67+
68+
// run integration tests
69+
70+
if (process.platform === 'win32') {
71+
cp.spawn('.\scripts\test-integration.bat', [], { env: process.env, stdio: 'inherit' });
72+
} else {
73+
cp.spawn('/bin/bash', ['./scripts/test-integration.sh'], { env: process.env, stdio: 'inherit' });
74+
}

extensions/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"scripts": {
2323
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:typescript ./tsconfig.json",
24-
"update-grammars": "node ./build/update-grammars.js"
24+
"update-grammar": "node ./build/update-grammars.js"
2525
},
2626
"activationEvents": [
2727
"onLanguage:javascript",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"monaco-editor-test": "mocha --only-monaco-editor",
1919
"precommit": "node build/gulpfile.hygiene.js",
2020
"gulp": "gulp --max_old_space_size=4096",
21-
"7z": "7z"
21+
"7z": "7z",
22+
"update-grammars": "node build/npm/update-all-grammars.js"
2223
},
2324
"dependencies": {
2425
"applicationinsights": "0.17.1",

0 commit comments

Comments
 (0)