Skip to content

Commit 946d790

Browse files
authored
fix: make install-local script work, update react to 17 VSCODE-310 (#471)
1 parent 7b6222f commit 946d790

26 files changed

+1566
-1117
lines changed

.depcheckrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
ignores:
22
- "@babel/core"
3-
- "@leafygreen-ui/palette"
43
- "@mongodb-js/prettier-config-compass"
54
- "@types/jest"
65
- "buffer"
76
- "eslint-config-mongodb-js"
87
- "keytar"
8+
- "electron"
99
- "mocha-junit-reporter"
1010
- "mocha-multi"
1111
- "mongodb-client-encryption"

package-lock.json

Lines changed: 1327 additions & 872 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,6 @@
10021002
"@iconify-icons/codicon": "^1.2.16",
10031003
"@iconify/react": "^1.1.4",
10041004
"@leafygreen-ui/logo": "^6.1.3",
1005-
"@leafygreen-ui/palette": "^3.4.2",
10061005
"@leafygreen-ui/toggle": "^7.0.5",
10071006
"@mongodb-js/mongodb-constants": "^0.2.1",
10081007
"@mongosh/browser-runtime-electron": "^1.6.2",
@@ -1020,13 +1019,13 @@
10201019
"mongodb-build-info": "^1.5.0",
10211020
"mongodb-cloud-info": "^1.1.3",
10221021
"mongodb-connection-string-url": "^2.5.3",
1023-
"mongodb-data-service": "^22.1.1",
1022+
"mongodb-data-service": "^22.4.1",
10241023
"mongodb-query-parser": "^2.4.6",
10251024
"mongodb-schema": "^10.0.0",
10261025
"numeral": "^2.0.6",
1027-
"react": "^16.14.0",
1028-
"react-dom": "^16.14.0",
1029-
"react-redux": "^7.2.8",
1026+
"react": "^17.0.2",
1027+
"react-dom": "^17.0.2",
1028+
"react-redux": "^8.0.5",
10301029
"redux": "^4.2.0",
10311030
"ts-log": "^2.2.5",
10321031
"uuid": "^8.3.2",
@@ -1056,6 +1055,7 @@
10561055
"@typescript-eslint/eslint-plugin": "^5.38.0",
10571056
"@typescript-eslint/parser": "^5.38.0",
10581057
"@vscode/test-electron": "^2.1.5",
1058+
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
10591059
"autoprefixer": "^9.8.8",
10601060
"buffer": "^6.0.3",
10611061
"chai": "^4.3.6",
@@ -1069,8 +1069,8 @@
10691069
"css-loader": "^3.6.0",
10701070
"depcheck": "^1.4.3",
10711071
"download": "^8.0.0",
1072+
"electron": "^23.0.0",
10721073
"enzyme": "^3.11.0",
1073-
"enzyme-adapter-react-16": "^1.15.6",
10741074
"eslint": "^8.23.1",
10751075
"eslint-config-mongodb-js": "^5.0.3",
10761076
"eslint-plugin-mocha": "^10.1.0",
@@ -1086,7 +1086,7 @@
10861086
"mocha": "^8.4.0",
10871087
"mocha-junit-reporter": "^2.0.2",
10881088
"mocha-multi": "^1.1.6",
1089-
"mongodb-client-encryption": "^2.2.1",
1089+
"mongodb-client-encryption": "^2.4.0",
10901090
"mongodb-runner": "^4.9.0",
10911091
"node-loader": "^0.6.0",
10921092
"npm-run-all": "^4.1.5",

scripts/no-npm-list-fail.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
// Monkey-patch child_process so that the `npm list` command run by
3-
// `vsce package` does not fail because of `mongodb` being a 4.x prerelease
4-
// rather than a "proper" version number.
3+
// `vsce package` does not fail.
54
const child_process = require('child_process');
65
const origExec = child_process.exec;
76
child_process.exec = (cmd, options, cb) => {

src/editors/collectionDocumentsProvider.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as vscode from 'vscode';
2-
import * as util from 'util';
32
import { URLSearchParams } from 'url';
43

54
import CollectionDocumentsOperationsStore from './collectionDocumentsOperationsStore';
@@ -85,8 +84,7 @@ export default class CollectionViewProvider
8584
}
8685

8786
try {
88-
const find = util.promisify(dataservice.find.bind(dataservice));
89-
const documents = await find(
87+
const documents = await dataservice.find(
9088
namespace,
9189
{}, // No filter.
9290
{ limit: documentLimit }

src/editors/mongoDBDocumentService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ export default class MongoDBDocumentService {
133133
this._statusView.showMessage('Fetching document...');
134134

135135
try {
136-
const find = util.promisify(dataservice.find.bind(dataservice));
137-
const documents = await find(
136+
const documents = await dataservice.find(
138137
namespace,
139138
{ _id: documentId },
140139
{ limit: 1 }

src/explorer/collectionTreeItem.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as util from 'util';
22
import * as vscode from 'vscode';
33
import path from 'path';
4+
import type { DataService } from 'mongodb-data-service';
45

56
import DocumentListTreeItem, {
67
CollectionTypes,
@@ -72,7 +73,7 @@ export default class CollectionTreeItem
7273
databaseName: string;
7374
namespace: string;
7475

75-
private _dataService: any;
76+
private _dataService: DataService;
7677
private _type: CollectionTypes;
7778
documentCount: number | null = null;
7879

@@ -320,16 +321,13 @@ export default class CollectionTreeItem
320321
try {
321322
// We fetch the document when we expand in order to show
322323
// the document count in the document list tree item `description`.
323-
const estimatedCount = util.promisify(
324-
this._dataService.estimatedCount.bind(this._dataService)
325-
);
326-
327-
this.documentCount = await estimatedCount(
324+
this.documentCount = await this._dataService.estimatedCount(
328325
this.namespace,
329-
{} // No options.
326+
{}, // No options.
327+
undefined
330328
);
331329

332-
return this.documentCount as number;
330+
return this.documentCount;
333331
} catch (err) {
334332
this.documentCount = null;
335333
return 0;

src/explorer/documentListTreeItem.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as util from 'util';
21
import * as vscode from 'vscode';
32
import numeral from 'numeral';
43

@@ -202,10 +201,7 @@ export default class DocumentListTreeItem
202201
let documents;
203202

204203
try {
205-
const find = util.promisify(
206-
this._dataService.find.bind(this._dataService)
207-
);
208-
documents = await find(
204+
documents = await this._dataService.find(
209205
this.namespace,
210206
{}, // No filter.
211207
{ limit: this._maxDocumentsToShow }

src/explorer/documentTreeItem.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ export default class DocumentTreeItem
5959
}
6060

6161
async getDocumentContents(): Promise<Document> {
62-
const find = promisify(this.dataService.find.bind(this.dataService));
63-
const documents = await find(
62+
const documents = await this.dataService.find(
6463
this.namespace,
6564
{ _id: this.documentId },
6665
{ limit: 1 }

src/explorer/schemaTreeItem.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as util from 'util';
21
import * as vscode from 'vscode';
32
import parseSchema from 'mongodb-schema';
43
import path from 'path';
@@ -9,6 +8,7 @@ import formatError from '../utils/formatError';
98
import { getImagesPath } from '../extensionConstants';
109
import TreeItemParent from './treeItemParentInterface';
1110
import { MAX_DOCUMENTS_VISIBLE } from './documentListTreeItem';
11+
import { DataService } from 'mongodb-data-service';
1212

1313
const log = createLogger('tree view document list');
1414

@@ -52,7 +52,7 @@ export default class SchemaTreeItem
5252
collectionName: string;
5353
databaseName: string;
5454

55-
private _dataService: any;
55+
private _dataService: DataService;
5656

5757
isExpanded: boolean;
5858

@@ -62,7 +62,7 @@ export default class SchemaTreeItem
6262
constructor(
6363
collectionName: string,
6464
databaseName: string,
65-
dataService: any,
65+
dataService: DataService,
6666
isExpanded: boolean,
6767
hasClickedShowMoreFields: boolean,
6868
hasMoreFieldsToShow: boolean,
@@ -100,10 +100,7 @@ export default class SchemaTreeItem
100100
const namespace = `${this.databaseName}.${this.collectionName}`;
101101
let documents;
102102
try {
103-
const find = util.promisify(
104-
this._dataService.find.bind(this._dataService)
105-
);
106-
documents = await find(
103+
documents = await this._dataService.find(
107104
namespace,
108105
{}, // No filter.
109106
{ limit: MAX_DOCUMENTS_VISIBLE }

0 commit comments

Comments
 (0)