From d071833d0d67c3991c02fec3200242b9cea7846b Mon Sep 17 00:00:00 2001 From: gagik Date: Tue, 9 Dec 2025 12:04:21 +0100 Subject: [PATCH 1/7] chore: filter with evergreen install --- .evergreen.yml | 28 ++++++++++++++++++++++++++++ .evergreen/evergreen.yml.in | 2 ++ .evergreen/install-npm-deps.sh | 20 ++++++++++++++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/.evergreen.yml b/.evergreen.yml index 159d59360d..ef0f7b0771 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -163,6 +163,7 @@ functions: DISTRO_ID: ${distro_id} MONOGDB_DRIVER_VERSION_OVERRIDE: ${mongodb_driver_version_override} PUPPETEER_SKIP_DOWNLOAD: ${puppeteer_skip_download|true} + MONGOSH_INSTALL_WORKSPACE: ${mongosh_install_workspace|} script: | set -e set -x @@ -6206,6 +6207,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/arg-parser" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6225,6 +6227,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/async-rewriter2" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6244,6 +6247,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/autocomplete" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6263,6 +6267,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "false" + mongosh_install_workspace: "@mongosh/browser-repl" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6282,6 +6287,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/browser-runtime-core" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6301,6 +6307,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/browser-runtime-electron" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6320,6 +6327,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/build" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6339,6 +6347,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/cli-repl" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6358,6 +6367,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/connectivity-tests" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6377,6 +6387,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/e2e-tests" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6396,6 +6407,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/editor" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6415,6 +6427,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/errors" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6434,6 +6447,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/history" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6453,6 +6467,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/i18n" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6472,6 +6487,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/java-shell" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6491,6 +6507,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/js-multiline-to-singleline" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6510,6 +6527,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/logging" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6529,6 +6547,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/mongosh" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6548,6 +6567,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/node-runtime-worker-thread" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6567,6 +6587,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/service-provider-core" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6586,6 +6607,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/service-provider-node-driver" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6605,6 +6627,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/shell-api" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6624,6 +6647,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/shell-bson" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6643,6 +6667,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/shell-evaluator" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6662,6 +6687,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/snippet-manager" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6681,6 +6707,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/testing" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} @@ -6700,6 +6727,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "true" + mongosh_install_workspace: "@mongosh/types" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} diff --git a/.evergreen/evergreen.yml.in b/.evergreen/evergreen.yml.in index 37aa6caa74..134ef65111 100644 --- a/.evergreen/evergreen.yml.in +++ b/.evergreen/evergreen.yml.in @@ -172,6 +172,7 @@ functions: DISTRO_ID: ${distro_id} MONOGDB_DRIVER_VERSION_OVERRIDE: ${mongodb_driver_version_override} PUPPETEER_SKIP_DOWNLOAD: ${puppeteer_skip_download|true} + MONGOSH_INSTALL_WORKSPACE: ${mongosh_install_workspace|} script: | set -e set -x @@ -1167,6 +1168,7 @@ tasks: vars: node_js_version: ${node_js_version} puppeteer_skip_download: "<% out(usePuppeteer ? "false" : "true") %>" + mongosh_install_workspace: "@mongosh/<% out(packageName) %>" - func: test vars: mongosh_server_test_version: ${mongosh_server_test_version} diff --git a/.evergreen/install-npm-deps.sh b/.evergreen/install-npm-deps.sh index 1752a52b4f..928edc84b7 100755 --- a/.evergreen/install-npm-deps.sh +++ b/.evergreen/install-npm-deps.sh @@ -5,7 +5,13 @@ export BASEDIR="$PWD/.evergreen" . "$BASEDIR/setup-env.sh" -npm ci --verbose +# If MONGOSH_INSTALL_WORKSPACE is set, install only that workspace +if [[ -n "$MONGOSH_INSTALL_WORKSPACE" ]]; then + echo "Installing workspace: $MONGOSH_INSTALL_WORKSPACE" + npm ci -w "$MONGOSH_INSTALL_WORKSPACE" --include-workspace-root --verbose +else + npm ci --verbose +fi echo "MONOGDB_DRIVER_VERSION_OVERRIDE:$MONOGDB_DRIVER_VERSION_OVERRIDE" # if MONOGDB_DRIVER_VERSION_OVERRIDE is set, then we want to replace the package version @@ -28,7 +34,17 @@ npm run mark-ci-required-optional-dependencies # mongodb-client-encryption failed to install (it can't install on some # platforms), then install again ignoring scripts so that the package installs # along with its types, but npm wouldn't try and compile the addon -(npm ci && test -e node_modules/mongodb-client-encryption) || npm ci --ignore-scripts +if [[ -n "$MONGOSH_INSTALL_WORKSPACE" ]]; then + # Check if the workspace or root actually depends on mongodb-client-encryption + if npm ls --workspace "$MONGOSH_INSTALL_WORKSPACE" --depth=1 mongodb-client-encryption > /dev/null 2>&1; then + echo "Workspace or root depends on mongodb-client-encryption, retrying install with optional deps..." + (npm ci -w "$MONGOSH_INSTALL_WORKSPACE" --include-workspace-root && test -e node_modules/mongodb-client-encryption) || npm ci -w "$MONGOSH_INSTALL_WORKSPACE" --include-workspace-root --ignore-scripts + else + echo "Workspace does not depend on mongodb-client-encryption, skipping optional deps reinstall" + fi +else + (npm ci && test -e node_modules/mongodb-client-encryption) || npm ci --ignore-scripts +fi echo "npm packages after installation" npm ls || true From caaf3eb439b5742ef763edc20e329ee3568e800b Mon Sep 17 00:00:00 2001 From: gagik Date: Thu, 13 Nov 2025 19:26:23 +0100 Subject: [PATCH 2/7] chore: fix shell-api, worker-thread tests --- package-lock.json | 8 ++++++- .../node-runtime-worker-thread/package.json | 21 +++++++++++++++++++ .../src/deep-inspect/custom-inspect.ts | 1 + .../shell-api/src/shell-instance-state.ts | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 14ad2515e5..d253c92f57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38692,7 +38692,8 @@ "license": "Apache-2.0", "dependencies": { "interruptor": "^1.0.1", - "system-ca": "^2.0.1" + "system-ca": "^2.0.1", + "web-worker": "^1.3.0" }, "devDependencies": { "@mongodb-js/eslint-config-mongosh": "^1.0.0", @@ -38715,6 +38716,11 @@ }, "engines": { "node": ">=14.15.1" + }, + "optionalDependencies": { + "glibc-version": "^1.0.0", + "macos-export-certificate-and-key": "^1.2.4", + "win-export-certificate-and-key": "^2.1.0" } }, "packages/service-provider-core": { diff --git a/packages/node-runtime-worker-thread/package.json b/packages/node-runtime-worker-thread/package.json index 1385da8d26..b43ceab5b3 100644 --- a/packages/node-runtime-worker-thread/package.json +++ b/packages/node-runtime-worker-thread/package.json @@ -56,5 +56,26 @@ "dependencies": { "interruptor": "^1.0.1", "system-ca": "^2.0.1" + }, + "optionalDependencies": { + "glibc-version": "^1.0.0", + "macos-export-certificate-and-key": "^1.2.4", + "win-export-certificate-and-key": "^2.1.0" + }, + "mongosh": { + "ciRequiredOptionalDependencies": { + "macos-export-certificate-and-key": [ + "darwin" + ], + "win-export-certificate-and-key": [ + "win32" + ], + "get-console-process-list": [ + "win32" + ], + "glibc-version": [ + "linux" + ] + } } } diff --git a/packages/shell-api/src/deep-inspect/custom-inspect.ts b/packages/shell-api/src/deep-inspect/custom-inspect.ts index 4282e946d0..467809db5c 100644 --- a/packages/shell-api/src/deep-inspect/custom-inspect.ts +++ b/packages/shell-api/src/deep-inspect/custom-inspect.ts @@ -1,4 +1,5 @@ import type { InspectOptions, inspect as _inspect } from 'util'; +import type { Document } from '@mongosh/service-provider-core'; const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom'); diff --git a/packages/shell-api/src/shell-instance-state.ts b/packages/shell-api/src/shell-instance-state.ts index 4aae05f865..d20dbfb8e2 100644 --- a/packages/shell-api/src/shell-instance-state.ts +++ b/packages/shell-api/src/shell-instance-state.ts @@ -3,6 +3,7 @@ import type { AutoEncryptionOptions, ConnectionExtraInfo, ConnectionInfo, + Document, ServerApi, ServiceProvider, ServiceProviderBaseCursor, From 7e5017adca82451638593f428cba5432871641bc Mon Sep 17 00:00:00 2001 From: gagik Date: Wed, 10 Dec 2025 13:17:27 +0100 Subject: [PATCH 3/7] chore: issues with some packages --- package-lock.json | 14 +++++++------- packages/async-rewriter2/package.json | 2 +- packages/js-multiline-to-singleline/package.json | 2 +- packages/node-runtime-worker-thread/package.json | 3 --- packages/shell-api/package.json | 3 ++- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index d253c92f57..d57e2d55b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12719,9 +12719,9 @@ "license": "MIT" }, "node_modules/@types/babel__core": { - "version": "7.20.1", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", - "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "dev": true, "license": "MIT", "dependencies": { @@ -37136,7 +37136,7 @@ "@mongodb-js/eslint-config-mongosh": "^1.0.0", "@mongodb-js/prettier-config-devtools": "^1.0.1", "@mongodb-js/tsconfig-mongosh": "^1.0.0", - "@types/babel__core": "^7.20.1", + "@types/babel__core": "^7.20.5", "eslint": "^7.25.0", "prettier": "^2.8.8" }, @@ -38639,7 +38639,7 @@ "@mongodb-js/eslint-config-mongosh": "^1.0.0", "@mongodb-js/prettier-config-devtools": "^1.0.1", "@mongodb-js/tsconfig-mongosh": "^1.0.0", - "@types/babel__core": "^7.1.18", + "@types/babel__core": "^7.20.5", "eslint": "^7.25.0", "prettier": "^2.8.8" }, @@ -38692,8 +38692,7 @@ "license": "Apache-2.0", "dependencies": { "interruptor": "^1.0.1", - "system-ca": "^2.0.1", - "web-worker": "^1.3.0" + "system-ca": "^2.0.1" }, "devDependencies": { "@mongodb-js/eslint-config-mongosh": "^1.0.0", @@ -38802,6 +38801,7 @@ "@mongodb-js/tsconfig-mongosh": "^1.0.0", "@mongosh/testing": "0.0.0-dev.0", "@mongosh/types": "^3.14.1", + "@types/babel__core": "^7.20.5", "bson": "^6.10.4", "eslint": "^7.25.0", "mongodb": "^6.19.0", diff --git a/packages/async-rewriter2/package.json b/packages/async-rewriter2/package.json index 7c99bc8c5c..e766810ac4 100644 --- a/packages/async-rewriter2/package.json +++ b/packages/async-rewriter2/package.json @@ -49,7 +49,7 @@ "@mongodb-js/eslint-config-mongosh": "^1.0.0", "@mongodb-js/prettier-config-devtools": "^1.0.1", "@mongodb-js/tsconfig-mongosh": "^1.0.0", - "@types/babel__core": "^7.20.1", + "@types/babel__core": "^7.20.5", "eslint": "^7.25.0", "prettier": "^2.8.8" } diff --git a/packages/js-multiline-to-singleline/package.json b/packages/js-multiline-to-singleline/package.json index a184318063..287fb86c0d 100644 --- a/packages/js-multiline-to-singleline/package.json +++ b/packages/js-multiline-to-singleline/package.json @@ -41,7 +41,7 @@ "@mongodb-js/eslint-config-mongosh": "^1.0.0", "@mongodb-js/prettier-config-devtools": "^1.0.1", "@mongodb-js/tsconfig-mongosh": "^1.0.0", - "@types/babel__core": "^7.1.18", + "@types/babel__core": "^7.20.5", "eslint": "^7.25.0", "prettier": "^2.8.8" } diff --git a/packages/node-runtime-worker-thread/package.json b/packages/node-runtime-worker-thread/package.json index b43ceab5b3..c16b5b1b4d 100644 --- a/packages/node-runtime-worker-thread/package.json +++ b/packages/node-runtime-worker-thread/package.json @@ -70,9 +70,6 @@ "win-export-certificate-and-key": [ "win32" ], - "get-console-process-list": [ - "win32" - ], "glibc-version": [ "linux" ] diff --git a/packages/shell-api/package.json b/packages/shell-api/package.json index a0e3025eba..12c40fc664 100644 --- a/packages/shell-api/package.json +++ b/packages/shell-api/package.json @@ -72,6 +72,7 @@ "prettier": "^2.8.8", "semver": "^7.5.3", "@babel/core": "^7.26.10", - "@babel/types": "^7.26.10" + "@babel/types": "^7.26.10", + "@types/babel__core": "^7.20.5" } } From 9631747a0814c12ca7f81d48a8d92805ebee1b0a Mon Sep 17 00:00:00 2001 From: gagik Date: Tue, 16 Dec 2025 14:06:55 +0100 Subject: [PATCH 4/7] chore: fix i18n --- packages/i18n/package.json | 10 +++++ packages/i18n/src/catalog.ts | 4 +- packages/i18n/src/locales/de_DE.ts | 3 +- packages/i18n/src/locales/en_US.ts | 2 +- packages/i18n/src/locales/index.ts | 5 +++ packages/i18n/src/translator.ts | 2 +- .../src/missing-help.spec.ts | 40 +++++++------------ 7 files changed, 35 insertions(+), 31 deletions(-) create mode 100644 packages/i18n/src/locales/index.ts rename packages/{i18n => shell-api}/src/missing-help.spec.ts (66%) diff --git a/packages/i18n/package.json b/packages/i18n/package.json index b5c3fc68c1..d32a98ca3f 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -4,6 +4,16 @@ "description": "MongoDB Shell i18n Project", "main": "lib/index.js", "types": "lib/index.d.ts", + "exports": { + ".": { + "default": "./lib/index.js", + "types": "./lib/index.d.ts" + }, + "./locales": { + "default": "./src/locales/index.ts", + "types": "./src/locales/index.d.ts" + } + }, "repository": { "type": "git", "url": "git://github.com/mongodb-js/mongosh.git" diff --git a/packages/i18n/src/catalog.ts b/packages/i18n/src/catalog.ts index 657d87cc4c..170539b9c7 100644 --- a/packages/i18n/src/catalog.ts +++ b/packages/i18n/src/catalog.ts @@ -15,10 +15,10 @@ type NestedRecord = [key: string]: NestedRecord; }; -export default interface Catalog { +export type Catalog = { [packageName: string]: | { classes: Record; } | NestedRecord; -} +}; diff --git a/packages/i18n/src/locales/de_DE.ts b/packages/i18n/src/locales/de_DE.ts index b78792bb54..2e288d1813 100644 --- a/packages/i18n/src/locales/de_DE.ts +++ b/packages/i18n/src/locales/de_DE.ts @@ -1,4 +1,5 @@ -import type Catalog from '../catalog'; +// eslint-disable-next-line filename-rules/match +import type { Catalog } from '../catalog'; import enUs from './en_US'; /** diff --git a/packages/i18n/src/locales/en_US.ts b/packages/i18n/src/locales/en_US.ts index 50100f189a..5a1a932dc9 100644 --- a/packages/i18n/src/locales/en_US.ts +++ b/packages/i18n/src/locales/en_US.ts @@ -1,5 +1,5 @@ /* eslint-disable filename-rules/match */ -import type Catalog from '../catalog'; +import type { Catalog } from '../catalog'; /** * US english translations. diff --git a/packages/i18n/src/locales/index.ts b/packages/i18n/src/locales/index.ts new file mode 100644 index 0000000000..88dfca6204 --- /dev/null +++ b/packages/i18n/src/locales/index.ts @@ -0,0 +1,5 @@ +import en_US from './en_US'; +import de_DE from './de_DE'; + +export { type Catalog } from '../catalog'; +export { en_US, de_DE }; diff --git a/packages/i18n/src/translator.ts b/packages/i18n/src/translator.ts index 1f61cd6051..f44865dadf 100644 --- a/packages/i18n/src/translator.ts +++ b/packages/i18n/src/translator.ts @@ -1,5 +1,5 @@ import { MongoshInternalError } from '@mongosh/errors'; -import type Catalog from './catalog'; +import type { Catalog } from './catalog'; import de_DE from './locales/de_DE'; import en_US from './locales/en_US'; diff --git a/packages/i18n/src/missing-help.spec.ts b/packages/shell-api/src/missing-help.spec.ts similarity index 66% rename from packages/i18n/src/missing-help.spec.ts rename to packages/shell-api/src/missing-help.spec.ts index 7606a18727..d525f56b35 100644 --- a/packages/i18n/src/missing-help.spec.ts +++ b/packages/shell-api/src/missing-help.spec.ts @@ -1,6 +1,5 @@ -import fs from 'fs'; -import path from 'path'; -import { signatures } from '../../shell-api/src/index'; +import { signatures } from './index'; +import { en_US, type Catalog } from '@mongosh/i18n/locales'; const IGNORED_TYPES = [ 'unknown', @@ -19,29 +18,18 @@ const IGNORED_ATTRIBUTES = [ 'ChangeStreamCursor.pretty', ]; -const localesDir = path.resolve(__dirname, 'locales'); - -const localeFiles = fs - .readdirSync(localesDir) - .filter((filename) => { - return /^[a-z]{2,3}_[A-Z]{2,3}\.ts$/.exec(filename); - }) - .filter((filename) => { - // skip german for now - return filename.includes('en'); - }); - const typeNames = Object.keys(signatures).filter( (typeName) => !IGNORED_TYPES.includes(typeName) ); -localeFiles.forEach((localeFile) => { - const locale = require(path.join(localesDir, localeFile)).default; - const localeName = localeFile.replace('.ts', ''); - - describe(`${localeName}`, function () { - typeNames.forEach((typeName) => { - const typeHelp = locale['shell-api'].classes[typeName]; +for (const [localeName, locale] of [ + ['en_US', en_US], + // Skip German for now + // ['de_DE', de_DE], +] as [string, Catalog][]) { + describe(`i18n with ${localeName} locale`, function () { + for (const typeName of typeNames) { + const typeHelp = (locale['shell-api'] as any).classes[typeName]; it(`has translations for ${typeName} type`, function () { if (!typeHelp) { @@ -60,7 +48,7 @@ localeFiles.forEach((localeFile) => { !IGNORED_ATTRIBUTES.includes(`${typeName}.${attributeName}`) ); - attributeNames.forEach((attributeName) => { + for (const attributeName of attributeNames) { it(`has translations for ${typeName}.${attributeName} attribute`, function () { const attributeHelp = typeHelp.help.attributes && typeHelp.help.attributes[attributeName]; @@ -74,7 +62,7 @@ localeFiles.forEach((localeFile) => { ); } }); - }); - }); + } + } }); -}); +} From 81e73ca215e03773a6479734571b366b2742fbd4 Mon Sep 17 00:00:00 2001 From: gagik Date: Thu, 18 Dec 2025 10:51:56 +0100 Subject: [PATCH 5/7] fix: shell-bson, only npm ci once --- .evergreen/install-npm-deps.sh | 12 +----- package-lock.json | 2 +- package.json | 2 +- packages/shell-bson/src/shell-bson.ts | 1 + ...mark-ci-required-optional-dependencies.mts | 41 +++++++++++++++++++ .../mark-ci-required-optional-dependencies.ts | 27 ------------ 6 files changed, 46 insertions(+), 39 deletions(-) create mode 100644 scripts/mark-ci-required-optional-dependencies.mts delete mode 100644 scripts/mark-ci-required-optional-dependencies.ts diff --git a/.evergreen/install-npm-deps.sh b/.evergreen/install-npm-deps.sh index 928edc84b7..10460d4227 100755 --- a/.evergreen/install-npm-deps.sh +++ b/.evergreen/install-npm-deps.sh @@ -5,13 +5,8 @@ export BASEDIR="$PWD/.evergreen" . "$BASEDIR/setup-env.sh" -# If MONGOSH_INSTALL_WORKSPACE is set, install only that workspace -if [[ -n "$MONGOSH_INSTALL_WORKSPACE" ]]; then - echo "Installing workspace: $MONGOSH_INSTALL_WORKSPACE" - npm ci -w "$MONGOSH_INSTALL_WORKSPACE" --include-workspace-root --verbose -else - npm ci --verbose -fi +npm run mark-ci-required-optional-dependencies + echo "MONOGDB_DRIVER_VERSION_OVERRIDE:$MONOGDB_DRIVER_VERSION_OVERRIDE" # if MONOGDB_DRIVER_VERSION_OVERRIDE is set, then we want to replace the package version @@ -27,9 +22,6 @@ if [[ -n "$MONOGDB_DRIVER_VERSION_OVERRIDE" ]]; then npm i --verbose --force fi -# if we rewrote this script in javascript using just builtin node modules we could skip the npm ci above -npm run mark-ci-required-optional-dependencies - # install again, this time with all the optional deps. If # mongodb-client-encryption failed to install (it can't install on some # platforms), then install again ignoring scripts so that the package installs diff --git a/package-lock.json b/package-lock.json index d57e2d55b8..1f69649c34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,11 +19,11 @@ "packages/types", "packages/i18n", "packages/logging", - "packages/shell-bson", "packages/testing", "packages/arg-parser", "packages/java-shell", "packages/service-provider-core", + "packages/shell-bson", "packages/service-provider-node-driver", "packages/shell-api", "packages/autocomplete", diff --git a/package.json b/package.json index b3b558c5d0..071b83322d 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "update-evergreen-config": "npm run test-evergreen-expansions && node .evergreen/generate-evergreen-yml.js .evergreen/evergreen.yml.in > .evergreen.yml", "update-cli-usage-text": "node scripts/update-cli-usage-text.js", "update-security-test-summary": "ts-node scripts/generate-security-test-summary.ts > docs/security-test-summary.md", - "mark-ci-required-optional-dependencies": "ts-node scripts/mark-ci-required-optional-dependencies.ts", + "mark-ci-required-optional-dependencies": "node scripts/mark-ci-required-optional-dependencies.mts", "write-node-js-dep": "node scripts/write-nodejs-dep > .sbom/node-js-dep.json", "scan-node-js": "mongodb-sbom-tools scan-node-js --version=$NODE_JS_VERSION > .sbom/node-js-vuln.json", "snyk-test": "node scripts/snyk-test.js", diff --git a/packages/shell-bson/src/shell-bson.ts b/packages/shell-bson/src/shell-bson.ts index b4a162f9b7..fac5a6c0d1 100644 --- a/packages/shell-bson/src/shell-bson.ts +++ b/packages/shell-bson/src/shell-bson.ts @@ -10,6 +10,7 @@ import { assignAll, pickWithExactKeyMatch, } from './helpers'; +import type { Document } from 'bson'; type LongWithoutAccidentallyExposedMethods = Omit< typeof Long, diff --git a/scripts/mark-ci-required-optional-dependencies.mts b/scripts/mark-ci-required-optional-dependencies.mts new file mode 100644 index 0000000000..7ddbec201a --- /dev/null +++ b/scripts/mark-ci-required-optional-dependencies.mts @@ -0,0 +1,41 @@ +import { promises as fs } from "fs"; +import assert from "assert"; +import path from "path"; +import { getPackagesInTopologicalOrder } from "@mongodb-js/monorepo-tools"; + +// esm __dirname +import { fileURLToPath } from "url"; +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +(async () => { + const monorepoRootPath = path.resolve(__dirname, ".."); + // not really relevant that it is in topological order, but it is a convenient + // way to get all the packages' paths + const packages = await getPackagesInTopologicalOrder(monorepoRootPath); + + for (const { location } of packages) { + const packageJsonPath = path.join(location, "package.json"); + const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8")); + const { ciRequiredOptionalDependencies } = packageJson.mongosh ?? {}; + for (const [pkg, platforms] of Object.entries( + ciRequiredOptionalDependencies ?? {} + ) as any[]) { + if (platforms.includes(process.platform)) { + packageJson.dependencies ??= {}; + + console.log(`Marking ${pkg} as non-optional in ${packageJson.name}`); + assert(packageJson.optionalDependencies[pkg]); + packageJson.dependencies[pkg] = packageJson.optionalDependencies[pkg]; + } + } + await fs.writeFile( + packageJsonPath, + JSON.stringify(packageJson, null, 2) + "\n" + ); + } +})().catch((err) => + process.nextTick(() => { + throw err; + }) +); diff --git a/scripts/mark-ci-required-optional-dependencies.ts b/scripts/mark-ci-required-optional-dependencies.ts deleted file mode 100644 index f050ea5cde..0000000000 --- a/scripts/mark-ci-required-optional-dependencies.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { promises as fs } from 'fs'; -import assert from 'assert'; -import path from 'path'; -import { getPackagesInTopologicalOrder } from '@mongodb-js/monorepo-tools'; - -(async () => { - const monorepoRootPath = path.resolve(__dirname, '..'); - // not really relevant that it is in topological order, but it is a convenient - // way to get all the packages' paths - const packages = await getPackagesInTopologicalOrder(monorepoRootPath); - - for (const { location } of packages) { - const packageJsonPath = path.join(location, 'package.json'); - const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')); - const { ciRequiredOptionalDependencies } = packageJson.mongosh ?? {}; - for (const [pkg, platforms] of Object.entries(ciRequiredOptionalDependencies ?? {}) as any[]) { - if (platforms.includes(process.platform)) { - packageJson.dependencies ??= {}; - - console.log(`Marking ${pkg} as non-optional in ${packageJson.name}`); - assert(packageJson.optionalDependencies[pkg]); - packageJson.dependencies[pkg] = packageJson.optionalDependencies[pkg]; - } - } - await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n'); - } -})().catch(err => process.nextTick(() => { throw err; })); From 6d0f058ca301628924fc45d9f8d7101556f6fc3e Mon Sep 17 00:00:00 2001 From: gagik Date: Thu, 18 Dec 2025 10:58:20 +0100 Subject: [PATCH 6/7] chore: use temporary ts-node --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 071b83322d..6bb2182d07 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "update-evergreen-config": "npm run test-evergreen-expansions && node .evergreen/generate-evergreen-yml.js .evergreen/evergreen.yml.in > .evergreen.yml", "update-cli-usage-text": "node scripts/update-cli-usage-text.js", "update-security-test-summary": "ts-node scripts/generate-security-test-summary.ts > docs/security-test-summary.md", - "mark-ci-required-optional-dependencies": "node scripts/mark-ci-required-optional-dependencies.mts", + "mark-ci-required-optional-dependencies": "npx -y ts-node@10.9.2 scripts/mark-ci-required-optional-dependencies.mts", "write-node-js-dep": "node scripts/write-nodejs-dep > .sbom/node-js-dep.json", "scan-node-js": "mongodb-sbom-tools scan-node-js --version=$NODE_JS_VERSION > .sbom/node-js-vuln.json", "snyk-test": "node scripts/snyk-test.js", From ab80baedd24c52d2f4653053d6b50ed5d70ebb5c Mon Sep 17 00:00:00 2001 From: gagik Date: Thu, 18 Dec 2025 11:02:02 +0100 Subject: [PATCH 7/7] chore: remove .mjs --- package.json | 2 +- ...dencies.mts => mark-ci-required-optional-dependencies.ts} | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) rename scripts/{mark-ci-required-optional-dependencies.mts => mark-ci-required-optional-dependencies.ts} (89%) diff --git a/package.json b/package.json index 6bb2182d07..c987f4a749 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "update-evergreen-config": "npm run test-evergreen-expansions && node .evergreen/generate-evergreen-yml.js .evergreen/evergreen.yml.in > .evergreen.yml", "update-cli-usage-text": "node scripts/update-cli-usage-text.js", "update-security-test-summary": "ts-node scripts/generate-security-test-summary.ts > docs/security-test-summary.md", - "mark-ci-required-optional-dependencies": "npx -y ts-node@10.9.2 scripts/mark-ci-required-optional-dependencies.mts", + "mark-ci-required-optional-dependencies": "npx -y ts-node@10.9.2 scripts/mark-ci-required-optional-dependencies.ts", "write-node-js-dep": "node scripts/write-nodejs-dep > .sbom/node-js-dep.json", "scan-node-js": "mongodb-sbom-tools scan-node-js --version=$NODE_JS_VERSION > .sbom/node-js-vuln.json", "snyk-test": "node scripts/snyk-test.js", diff --git a/scripts/mark-ci-required-optional-dependencies.mts b/scripts/mark-ci-required-optional-dependencies.ts similarity index 89% rename from scripts/mark-ci-required-optional-dependencies.mts rename to scripts/mark-ci-required-optional-dependencies.ts index 7ddbec201a..a2aa439856 100644 --- a/scripts/mark-ci-required-optional-dependencies.mts +++ b/scripts/mark-ci-required-optional-dependencies.ts @@ -3,11 +3,6 @@ import assert from "assert"; import path from "path"; import { getPackagesInTopologicalOrder } from "@mongodb-js/monorepo-tools"; -// esm __dirname -import { fileURLToPath } from "url"; -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - (async () => { const monorepoRootPath = path.resolve(__dirname, ".."); // not really relevant that it is in topological order, but it is a convenient