Skip to content

Commit b9bb515

Browse files
authored
fix(i18n): remove mustache dependency (#1884)
1 parent e99bbbe commit b9bb515

File tree

3 files changed

+5
-41
lines changed

3 files changed

+5
-41
lines changed

package-lock.json

Lines changed: 1 addition & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/i18n/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@
3636
"unitTestsOnly": true
3737
},
3838
"dependencies": {
39-
"@mongosh/errors": "0.0.0-dev.0",
40-
"mustache": "^4.0.0"
39+
"@mongosh/errors": "0.0.0-dev.0"
4140
},
4241
"devDependencies": {
4342
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
4443
"@mongodb-js/prettier-config-devtools": "^1.0.1",
4544
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
46-
"@types/mustache": "^4.0.1",
4745
"depcheck": "^1.4.3",
4846
"eslint": "^7.25.0",
4947
"prettier": "^2.8.8"

packages/i18n/src/translator.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { MongoshInternalError } from '@mongosh/errors';
2-
import Mustache from 'mustache';
32
import type Catalog from './catalog';
43
import de_DE from './locales/de_DE';
54
import en_US from './locales/en_US';
@@ -17,12 +16,6 @@ const MAPPINGS: Record<string, Catalog> = {
1716
de_DE: de_DE,
1817
};
1918

20-
/**
21-
* The help template.
22-
*/
23-
const TEMPLATE =
24-
'{{description}}\n\n' + '{{link}}\n\n' + '{{example}}\n\n' + '{{returns}}';
25-
2619
/**
2720
* The translator class.
2821
*/
@@ -102,7 +95,9 @@ class Translator {
10295
if (typeof value === 'string') {
10396
return value;
10497
}
105-
return Mustache.render(TEMPLATE, value);
98+
99+
const { description = '', link = '', example = '', returns = '' } = value;
100+
return `${description}\n\n${link}\n\n${example}\n\n${returns}`;
106101
}
107102

108103
private find(key: string): string | undefined {

0 commit comments

Comments
 (0)