Skip to content

Commit ea6d5c0

Browse files
committed
chore: update mongodb-runner
1 parent cc899eb commit ea6d5c0

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

packages/mongodb-downloader/src/index.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type MongoDBDownloaderOptions = {
2626
/** The directory to download the artifacts to. */
2727
directory: string;
2828
/** The semantic version specifier for the target version. */
29-
version: string;
29+
version?: string;
3030
/** Whether to use a lockfile for preventing concurrent downloads of the same version. */
3131
useLockfile: boolean;
3232
/** The options to pass to the download URL lookup. */
@@ -36,7 +36,7 @@ export type MongoDBDownloaderOptions = {
3636
export class MongoDBDownloader {
3737
async downloadMongoDbWithVersionInfo({
3838
downloadOptions = {},
39-
version,
39+
version = '*',
4040
directory,
4141
useLockfile,
4242
}: MongoDBDownloaderOptions): Promise<DownloadResult> {
@@ -199,13 +199,6 @@ export class MongoDBDownloader {
199199
});
200200
}
201201

202-
public async downloadMongoDb(
203-
...args: Parameters<typeof this.downloadMongoDbWithVersionInfo>
204-
): Promise<string> {
205-
return (await this.downloadMongoDbWithVersionInfo(...args))
206-
.downloadedBinDir;
207-
}
208-
209202
private async getCurrentDownloadedFile({
210203
bindir,
211204
artifactInfoFile,
@@ -238,7 +231,7 @@ const downloader = new MongoDBDownloader();
238231
/** Download mongod + mongos with version info and return version info and the path to a directory containing them. */
239232
export async function downloadMongoDbWithVersionInfo({
240233
downloadOptions = {},
241-
version,
234+
version = '*',
242235
directory,
243236
useLockfile,
244237
}: MongoDBDownloaderOptions): Promise<DownloadResult> {
@@ -250,8 +243,18 @@ export async function downloadMongoDbWithVersionInfo({
250243
});
251244
}
252245
/** Download mongod + mongos and return the path to a directory containing them. */
253-
export async function downloadMongoDb(
254-
...args: Parameters<typeof downloadMongoDbWithVersionInfo>
255-
): Promise<string> {
256-
return await downloader.downloadMongoDb(...args);
246+
export async function downloadMongoDb({
247+
downloadOptions = {},
248+
version = '*',
249+
directory,
250+
useLockfile,
251+
}: MongoDBDownloaderOptions): Promise<string> {
252+
return (
253+
await downloader.downloadMongoDbWithVersionInfo({
254+
downloadOptions,
255+
version,
256+
directory,
257+
useLockfile,
258+
})
259+
).downloadedBinDir;
257260
}

packages/mongodb-runner/src/mongocluster.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ export class MongoCluster {
3636
targetVersionSemverSpecifier?: string | undefined,
3737
options?: DownloadOptions | undefined,
3838
): Promise<string> {
39-
return downloadMongoDb(tmpdir, targetVersionSemverSpecifier, options);
39+
return downloadMongoDb({
40+
directory: tmpdir,
41+
version: targetVersionSemverSpecifier,
42+
downloadOptions: options,
43+
useLockfile: true,
44+
});
4045
}
4146

4247
serialize(): unknown /* JSON-serializable */ {

0 commit comments

Comments
 (0)