You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+194-3Lines changed: 194 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,214 @@ repository before making a change.
7
7
Please note we have a [code of conduct][code-of-conduct],
8
8
please follow it in all your interactions with the project.
9
9
10
-
## Commit messages
10
+
## Developer Startup Guide
11
+
12
+
### Runtime
13
+
14
+
It's recommended you install Node Version Manager for [unix systems][nvm-unix] or [windows][nvm-windows]. While it isn't required we have a minimum node version requirement (look in package.json under the "engines" key) and we can't accept code that does not work on the minimum specified version.
15
+
16
+
### MongoDB Helpers
17
+
18
+
- To get various MongoDB topologies up and running easily you can use the python based tool [mtools][mtools-install].
19
+
- To get various versions of MongoDB to test against you can use [m](https://github.com/aheckmann/m) an npm tool best installed globally `npm i -g m`.
20
+
21
+
### VSCode Setup
22
+
23
+
If you are developing in VSCode here's some suggestions:
24
+
We have an example of our workspace file: save this as `mongodbNodeDriver.code-workspace` and replace PATH_TO_DRIVER with the path to the driver repository on your computer.
If you use this file you will get our recommended extensions suggested to you.
130
+
If not, we recommend picking up `dbaeumer.vscode-eslint` at least to make sure any additional code is following style recommendations. If you don't want to use this workspace file but still don't want to think about formatting you can have VSCode do the checks and formatting work for you by adding just these settings:
- You can use the script: `test/tools/cluster_setup.sh server`
151
+
- If you are running against more than a standalone make sure your ulimit settings are in accordance with mongo's recommendations
152
+
- Changing the settings on the latest versions of [macos can be tricky read here][macos-ulimt] (unless you know you need it you shouldn't have to do the complicated maxproc steps)
153
+
- Prefix the cluster_setup.sh script with `env MONGODB_VERSION=X.Y` to test against a specific version of the server
- When testing different topologies you may need to remove the existing data folder created.
156
+
- To run a single test, use `npm run test -- -g 'test name'`
157
+
- If it's easier you can also isolate tests by adding .only. Example: `it.only(‘cool test’, {})`
158
+
- To test only the unified topology, use `env MONGODB_UNIFIED_TOPOLOGY=1`
159
+
160
+
### Commit messages
11
161
12
162
Please follow the [Angular commit style][angular-commit-style].
163
+
The format should look something like this (note the blank lines):
164
+
165
+
```txt
166
+
<type>(<scope>): <subject>
167
+
168
+
<body>
169
+
170
+
NODE-XXXX
171
+
```
172
+
173
+
If there is a relevant NODE ticket number it should be in the footer section of the Angular style commit.
174
+
13
175
This helps the team automate [HISTORY.md](HISTORY.md) generation.
176
+
These are the commit types we make use of:
177
+
178
+
-**feat:** A new feature
179
+
-**fix:** A bug fix
180
+
-**docs:** Documentation only changes
181
+
-**style:** Changes that do not affect the meaning of the code (e.g, formatting)
182
+
-**refactor:** A code change that neither fixes a bug nor adds a feature
183
+
-**perf:** A code change that improves performance
184
+
-**test:** Adding missing or correcting existing tests
185
+
-**chore:** Changes to the build process or auxiliary tools and libraries such as documentation generation
186
+
187
+
## Conventions Guide
188
+
189
+
Below are some conventions that aren't enforced by any of our tooling but we nonetheless do our best to adhere to:
190
+
191
+
-**Disallow `async / await` syntax**
192
+
- There is a measurable overhead to Promise usage vs simple callbacks. To support the broadest of driver usage scenarios we maintain an internal callback api while exposing a surface layer Promise API.
193
+
-**Disallow `export default` syntax**
194
+
- For our use case it is best if all imports / exports remain named.
195
+
-**As of 4.0 all code in src is in Typescript**
196
+
- Typescript provides a nice developer experience. As a product of using TS we should be using es6 syntax features whenever possible.
197
+
-**Errors**
198
+
- Error messages should be sentence case, and have no periods at the end.
199
+
- Use built-in error types where possible (not just Error, but TypeError/RangeError), also endeavor to create new Mongo-specific error types (e.g. MongoNetworkError)
14
200
15
201
## Pull Request Process
16
202
17
203
1. Update the README.md or similar documentation with details of changes you
18
204
wish to make, if applicable.
19
205
2. Add any appropriate tests.
20
206
3. Make your code or other changes.
21
-
4. Review guidelines such as
22
-
[How to write the perfect pull request][github-perfect-pr], thanks!
207
+
4. Review guidelines such as [How to write the perfect pull request][github-perfect-pr], thanks!
23
208
209
+
Take a look at [Github Flow][github-flow] for a more detailed explanation of this process.
0 commit comments