Skip to content

Commit ed9ffa1

Browse files
committed
use a shell-api constant and switch to 2.3.8
1 parent 2b912d9 commit ed9ffa1

File tree

13 files changed

+467
-134
lines changed

13 files changed

+467
-134
lines changed

package-lock.json

+408-105
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -149,24 +149,24 @@
149149
"packages/history",
150150
"packages/java-shell",
151151
"packages/js-multiline-to-singleline",
152-
"packages/types",
153-
"packages/i18n",
154152
"packages/logging",
153+
"packages/node-runtime-worker-thread",
155154
"packages/service-provider-core",
156-
"packages/arg-parser",
155+
"packages/snippet-manager",
156+
"packages/types",
157+
"packages/i18n",
157158
"packages/service-provider-node-driver",
159+
"packages/arg-parser",
158160
"packages/shell-api",
159161
"packages/autocomplete",
160162
"packages/shell-evaluator",
161-
"packages/snippet-manager",
162163
"packages/browser-runtime-core",
163164
"packages/editor",
165+
"packages/browser-repl",
164166
"packages/browser-runtime-electron",
165167
"packages/cli-repl",
166168
"packages/e2e-tests",
167169
"packages/mongosh",
168-
"packages/node-runtime-worker-thread",
169-
"packages/browser-repl",
170170
"packages/connectivity-tests"
171171
],
172172
"overrides": {

packages/browser-runtime-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
4242
"@mongodb-js/prettier-config-devtools": "^1.0.1",
4343
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
44-
"@mongosh/types": "2.3.7",
44+
"@mongosh/types": "2.3.8",
4545
"bson": "^6.10.1",
4646
"depcheck": "^1.4.7",
4747
"eslint": "^7.25.0",

packages/build/src/npm-packages/bump.ts

+30
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,36 @@ export async function bumpMongoshReleasePackages(): Promise<void> {
5555
JSON.stringify(packageJson, null, 2) + '\n'
5656
);
5757
}
58+
59+
await bumpShellApiMongoshVersion(version);
60+
}
61+
62+
/** Sets the shell-api constant to match the mongosh version. */
63+
export async function bumpShellApiMongoshVersion(version: string) {
64+
const shellApiVersionFilePath = path.join(
65+
__dirname,
66+
PROJECT_ROOT,
67+
'packages',
68+
'shell-api',
69+
'src',
70+
'mongosh-version.ts'
71+
);
72+
73+
const versionFileContent = await fs.readFile(
74+
shellApiVersionFilePath,
75+
'utf-8'
76+
);
77+
78+
// Write the updated content back to the mongosh-version file
79+
await fs.writeFile(
80+
shellApiVersionFilePath,
81+
// Replace the version inside MONGOSH_VERSION = '...'
82+
versionFileContent.replace(
83+
/MONGOSH_VERSION = '.*'/,
84+
`MONGOSH_VERSION = '${version}'`
85+
),
86+
'utf-8'
87+
);
5888
}
5989

6090
/** Bumps auxiliary packages without setting a new version of mongosh. */

packages/logging/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
},
1919
"dependencies": {
2020
"@mongodb-js/devtools-connect": "^3.3.4",
21-
"@mongosh/errors": "2.3.7",
22-
"@mongosh/history": "2.3.7",
23-
"@mongosh/types": "2.3.7",
21+
"@mongosh/errors": "2.3.8",
22+
"@mongosh/history": "2.3.8",
23+
"@mongosh/types": "2.3.8",
2424
"mongodb-log-writer": "^1.4.2",
2525
"mongodb-redact": "^1.1.2"
2626
},

packages/node-runtime-worker-thread/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
3838
"@mongodb-js/prettier-config-devtools": "^1.0.1",
3939
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
40-
"@mongosh/browser-runtime-core": "2.3.7",
41-
"@mongosh/browser-runtime-electron": "2.3.7",
42-
"@mongosh/service-provider-core": "2.3.7",
43-
"@mongosh/service-provider-node-driver": "2.3.7",
44-
"@mongosh/types": "2.3.7",
40+
"@mongosh/browser-runtime-core": "2.3.8",
41+
"@mongosh/browser-runtime-electron": "2.3.8",
42+
"@mongosh/service-provider-core": "2.3.8",
43+
"@mongosh/service-provider-node-driver": "2.3.8",
44+
"@mongosh/types": "2.3.8",
4545
"bson": "^6.10.1",
4646
"depcheck": "^1.4.7",
4747
"eslint": "^7.25.0",

packages/node-runtime-worker-thread/src/worker-thread-evaluation-listener.ts

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export class WorkerThreadEvaluationListener {
5959
(Promise.resolve() as Promise<never>)
6060
);
6161
},
62-
version: workerRuntime.evaluationListener?.version,
6362
},
6463
worker
6564
);

packages/service-provider-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"dependencies": {
4646
"@aws-sdk/credential-providers": "^3.525.0",
47-
"@mongosh/errors": "2.3.7",
47+
"@mongosh/errors": "2.3.8",
4848
"bson": "^6.10.1",
4949
"mongodb": "^6.12.0",
5050
"mongodb-build-info": "^1.7.2",

packages/shell-api/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
5252
"@mongodb-js/prettier-config-devtools": "^1.0.1",
5353
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
54-
"@mongosh/types": "2.3.7",
54+
"@mongosh/types": "2.3.8",
5555
"bson": "^6.10.1",
5656
"depcheck": "^1.4.7",
5757
"eslint": "^7.25.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* NOTE: Do not manually modify this file.
3+
* The MONGOSH_VERSION gets re-generated automatically with scripts/set-mongosh-version.ts
4+
**/
5+
6+
/** Current mongosh cli-repl version. */
7+
export const MONGOSH_VERSION = '2.3.8';

packages/shell-api/src/shell-api.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import type { ClientSideFieldLevelEncryptionOptions } from './field-level-encryp
3535
import { dirname } from 'path';
3636
import { ShellUserConfig } from '@mongosh/types';
3737
import i18n from '@mongosh/i18n';
38+
import { MONGOSH_VERSION } from './mongosh-version';
3839

3940
const instanceStateSymbol = Symbol.for('@@mongosh.instanceState');
4041
const loadCallNestingLevelSymbol = Symbol.for('@@mongosh.loadCallNestingLevel');
@@ -289,11 +290,7 @@ export default class ShellApi extends ShellApiClass {
289290
}
290291

291292
version(): string {
292-
const version = this._instanceState.evaluationListener.version;
293-
if (!version) {
294-
throw new MongoshInternalError('mongosh version not known');
295-
}
296-
return version;
293+
return MONGOSH_VERSION;
297294
}
298295

299296
@returnsPromise

packages/shell-api/src/shell-instance-state.ts

-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ export interface EvaluationListener
116116
* options used to access it.
117117
*/
118118
getCryptLibraryOptions?: () => Promise<AutoEncryptionOptions['extraOptions']>;
119-
120-
/** References the mongosh version used by the EvaluationListener */
121-
version?: string;
122119
}
123120

124121
/**

packages/snippet-manager/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
},
3737
"dependencies": {
3838
"@mongodb-js/devtools-proxy-support": "^0.4.2",
39-
"@mongosh/errors": "2.3.7",
40-
"@mongosh/shell-api": "2.3.7",
41-
"@mongosh/types": "2.3.7",
39+
"@mongosh/errors": "2.3.8",
40+
"@mongosh/shell-api": "2.3.8",
41+
"@mongosh/types": "2.3.8",
4242
"bson": "^6.10.1",
4343
"cross-spawn": "^7.0.5",
4444
"escape-string-regexp": "^4.0.0",

0 commit comments

Comments
 (0)