mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 08:10:11 +01:00
Add check that there are samples for each language
This commit is contained in:
parent
f012a2aeee
commit
37f12e39a3
11 changed files with 171 additions and 3 deletions
|
|
@ -13,10 +13,9 @@
|
|||
*/
|
||||
/** @typedef {import('../build/utils').IFile} IFile */
|
||||
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { REPO_ROOT, removeDir, ensureDir, readFiles, writeFiles } = require('../build/utils');
|
||||
const { REPO_ROOT, removeDir, readFiles, writeFiles } = require('../build/utils');
|
||||
const ts = require('typescript');
|
||||
/**@type { IMetadata } */
|
||||
const metadata = require('../metadata.js');
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
/** @typedef {import('../build/utils').IFile} IFile */
|
||||
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const cp = require('child_process');
|
||||
|
|
@ -26,9 +27,51 @@ const MONACO_EDITOR_VERSION = (() => {
|
|||
})();
|
||||
|
||||
removeDir(`../monaco-editor-website`);
|
||||
|
||||
checkSamples();
|
||||
generateWebsite();
|
||||
|
||||
/**
|
||||
* Check that there are samples for all available languages
|
||||
*/
|
||||
function checkSamples() {
|
||||
let languages = glob
|
||||
.sync('src/basic-languages/*/*.contribution.ts', { cwd: REPO_ROOT })
|
||||
.map((f) => path.dirname(f))
|
||||
.map((f) => f.substring('src/basic-languages/'.length));
|
||||
languages.push('css');
|
||||
languages.push('html');
|
||||
languages.push('json');
|
||||
languages.push('typescript');
|
||||
|
||||
// some languages have a different id than their folder
|
||||
languages = languages.map((l) => {
|
||||
switch (l) {
|
||||
case 'coffee':
|
||||
return 'coffeescript';
|
||||
case 'protobuf':
|
||||
return 'proto';
|
||||
case 'solidity':
|
||||
return 'sol';
|
||||
case 'sophia':
|
||||
return 'aes';
|
||||
default:
|
||||
return l;
|
||||
}
|
||||
});
|
||||
|
||||
let fail = false;
|
||||
for (const language of languages) {
|
||||
const expectedSamplePath = path.join(REPO_ROOT, `website/index/samples/sample.${language}.txt`);
|
||||
if (!fs.existsSync(expectedSamplePath)) {
|
||||
console.error(`Missing sample for ${language} at ${expectedSamplePath}`);
|
||||
fail = true;
|
||||
}
|
||||
}
|
||||
if (fail) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} dataPath
|
||||
* @param {string} contents
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue