mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-10 12:47:49 +00:00
fix: ignore case when inferring file extension from codeSample lang prop (#991)
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
writeYaml,
|
||||
exitWithError,
|
||||
escapeLanguageName,
|
||||
langToExt,
|
||||
} from '../../utils';
|
||||
import { isString, isObject, isEmptyObject } from '../../js-utils';
|
||||
import {
|
||||
@@ -106,20 +107,6 @@ function validateDefinitionFileName(fileName: string) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function langToExt(lang: string) {
|
||||
const langObj: any = {
|
||||
php: '.php',
|
||||
'c#': '.cs',
|
||||
shell: '.sh',
|
||||
curl: '.sh',
|
||||
bash: '.sh',
|
||||
javascript: '.js',
|
||||
js: '.js',
|
||||
python: '.py',
|
||||
};
|
||||
return langObj[lang];
|
||||
}
|
||||
|
||||
function traverseDirectoryDeep(directory: string, callback: any, componentsFiles: object) {
|
||||
if (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory()) return;
|
||||
const files = fs.readdirSync(directory);
|
||||
|
||||
Reference in New Issue
Block a user