-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[telemetry example] initial import #6116
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@kneth one comment - having an exported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few considerations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here comes the first batch of comments (only got the README left to review). Looks good!
P.S. could we remove the example-
prefix from the directory? (So that it aligns with the updated examples discussed on Slack.) So instead of examples/example-node-telemetry
we could go with examples/node-telemetry
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the remainder of the review. Provided some updates and suggestions for the README 🙂
## How to build and run | ||
|
||
You need to clone Realm JavaScript's git repository: | ||
|
||
```sh | ||
git clone https://github.com/realm/realm-js | ||
cd realm-js | ||
git submodule update --init --recursive | ||
``` | ||
|
||
Moreover, you need to install the dependencies for this app: | ||
|
||
```sh | ||
cd examples/example-node-telemetry | ||
npm install | ||
``` | ||
|
||
Before building the app, you need to add your app id to `src/config.ts`. After that, you can build and run the app: | ||
|
||
```sh | ||
npm run build | ||
node dist/app.js | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One improvement I think we could do here to provide a better DX is to let the example be independent of our repo. So e.g. having the README speak from the perspective of this example directory as the root. (Since realm
is defined in the package.json
, they shouldn't need our repo.)
I think the lines I marked here could be replaced with the following if you agree (ps. temporarily placing \
in front of code blocks otherwise I can't show it in one code block here):
### Install Dependencies
\```sh
npm install
\```
### Run the App
1. [Copy your Atlas App ID](https://www.mongodb.com/docs/atlas/app-services/reference/find-your-project-or-app-id/#std-label-find-your-app-id) from the App Services UI.
2. Paste the copied ID as the value of the existing variable `ATLAS_APP_ID` in [src/atlas-app-services/config.ts](./src/atlas-app-services/config.ts):
\```ts
export const ATLAS_APP_ID = "YOUR_APP_ID";
\```
3. Start the app
\```sh
npm run build
npm start
\```
Notes:
- The mention of
ATLAS_APP_ID
assumes a refactor of the code, but you can always change it along with the link if you decide not to refactor 👍 - The code shown under
Start the app
assumes that astart
script has been added inpackage.json
(I left a previous alternative where thestart
script also calls thebuild
script. If so, you could just shownpm start
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is related to https://github.com/realm/realm-js/pull/6116/files#r1321373935
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah seems related 🙂 I believe the example runs fine without the git submodule update
. Also if you e.g. copy the example directory to outside the js repo, it should run fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. And as @takameyer is saying, we should find a way to make the example easily accessible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we just don't add this to the workspaces, then it will treat itself like a separate project within realm-js
. Currently it is not in workspaces, so I guess the git submodule update
isn't even a necessary step here. It would just download the realm
package into the local node_modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should know as a team that if we want to test these examples against the local version of realm
, this could be done by adding the example to the workspaces. The only issue would be with the React Native projects, as these require a bit of configuration changes to work within the mono-repo.
Co-authored-by: Andrew Meyer <[email protected]> Co-authored-by: LJ <[email protected]>
dfc0684
to
10c390a
Compare
│ │ ├── machine_info.ts | ||
│ │ └── sensor_reading.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
│ │ ├── machine_info.ts | |
│ │ └── sensor_reading.ts | |
│ │ ├── MachineInfo.ts | |
│ │ └── SensorReading.ts |
What, How & Why?
This closes #5823
☑️ ToDos
Compatibility
label is updated or copied from previous entryCOMPATIBILITY.md
package.json
s (if updating internal packages)Breaking
label has been applied or is not necessary