diff --git a/package-lock.json b/package-lock.json index 8a650953b..dc98581af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10210,12 +10210,6 @@ "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", "dev": true }, - "node_modules/@types/mustache": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@types/mustache/-/mustache-4.2.2.tgz", - "integrity": "sha512-MUSpfpW0yZbTgjekDbH0shMYBUD+X/uJJJMm9LXN1d5yjl5lCY1vN/eWKD6D1tOtjA6206K0zcIPnUaFMurdNA==", - "dev": true - }, "node_modules/@types/node": { "version": "14.18.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", @@ -23078,14 +23072,6 @@ "object-assign": "^4.1.0" } }, - "node_modules/mustache": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", - "bin": { - "mustache": "bin/mustache" - } - }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -31435,14 +31421,12 @@ "version": "0.0.0-dev.0", "license": "Apache-2.0", "dependencies": { - "@mongosh/errors": "0.0.0-dev.0", - "mustache": "^4.0.0" + "@mongosh/errors": "0.0.0-dev.0" }, "devDependencies": { "@mongodb-js/eslint-config-mongosh": "^1.0.0", "@mongodb-js/prettier-config-devtools": "^1.0.1", "@mongodb-js/tsconfig-mongosh": "^1.0.0", - "@types/mustache": "^4.0.1", "depcheck": "^1.4.3", "eslint": "^7.25.0", "prettier": "^2.8.8" @@ -38029,10 +38013,8 @@ "@mongodb-js/prettier-config-devtools": "^1.0.1", "@mongodb-js/tsconfig-mongosh": "^1.0.0", "@mongosh/errors": "0.0.0-dev.0", - "@types/mustache": "^4.0.1", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mustache": "^4.0.0", "prettier": "^2.8.8" } }, @@ -41119,12 +41101,6 @@ "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", "dev": true }, - "@types/mustache": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@types/mustache/-/mustache-4.2.2.tgz", - "integrity": "sha512-MUSpfpW0yZbTgjekDbH0shMYBUD+X/uJJJMm9LXN1d5yjl5lCY1vN/eWKD6D1tOtjA6206K0zcIPnUaFMurdNA==", - "dev": true - }, "@types/node": { "version": "14.18.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", @@ -51067,11 +51043,6 @@ "object-assign": "^4.1.0" } }, - "mustache": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==" - }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 04479d684..548a1b86a 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -36,14 +36,12 @@ "unitTestsOnly": true }, "dependencies": { - "@mongosh/errors": "0.0.0-dev.0", - "mustache": "^4.0.0" + "@mongosh/errors": "0.0.0-dev.0" }, "devDependencies": { "@mongodb-js/eslint-config-mongosh": "^1.0.0", "@mongodb-js/prettier-config-devtools": "^1.0.1", "@mongodb-js/tsconfig-mongosh": "^1.0.0", - "@types/mustache": "^4.0.1", "depcheck": "^1.4.3", "eslint": "^7.25.0", "prettier": "^2.8.8" diff --git a/packages/i18n/src/translator.ts b/packages/i18n/src/translator.ts index 3fa0cf959..1f61cd605 100644 --- a/packages/i18n/src/translator.ts +++ b/packages/i18n/src/translator.ts @@ -1,5 +1,4 @@ import { MongoshInternalError } from '@mongosh/errors'; -import Mustache from 'mustache'; import type Catalog from './catalog'; import de_DE from './locales/de_DE'; import en_US from './locales/en_US'; @@ -17,12 +16,6 @@ const MAPPINGS: Record = { de_DE: de_DE, }; -/** - * The help template. - */ -const TEMPLATE = - '{{description}}\n\n' + '{{link}}\n\n' + '{{example}}\n\n' + '{{returns}}'; - /** * The translator class. */ @@ -102,7 +95,9 @@ class Translator { if (typeof value === 'string') { return value; } - return Mustache.render(TEMPLATE, value); + + const { description = '', link = '', example = '', returns = '' } = value; + return `${description}\n\n${link}\n\n${example}\n\n${returns}`; } private find(key: string): string | undefined {