-
Notifications
You must be signed in to change notification settings - Fork 564
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
Overhaul SDK metrics #5830
Overhaul SDK metrics #5830
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.
Nice!
@@ -25,28 +25,30 @@ import { readFileSync } from "node:fs"; | |||
|
|||
type Fixture = "node" | "react-native" | "electron"; | |||
|
|||
// TODO: Update this to use ESM friendly APIs | |||
describe.skip("Analytics", () => { | |||
describe("Analytics", () => { | |||
function resolvePath(fixture: Fixture) { | |||
return path.resolve(__dirname, "fixtures", fixture); | |||
} | |||
|
|||
function getRealmVersion() { |
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.
Seeing some slight differences in the getRealmVersion()
used here in the test and the implementation in the script. (E.g. readJsonSync()
vs JSON.parse()
and readFileSync()
). Should probably use the same implementation here as in the script.
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 agree, using the same implementation will make it easier to read and understand the code
import commandLineArgs from "command-line-args"; | ||
import fse from "fs-extra"; |
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.
fs-extra
and command-line-args
are both missing as dependencies.
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.
command-line-args
is in the root package.json
and I guess we should move it. And we don't see the issue with fs-extra
in the integration tests as integration-tests/environments/electron/package.json
has it as a dependency. I'll add both to the realm
package's dependencies.
import process from "node:process"; | ||
import https from "node:https"; | ||
import os from "node:os"; | ||
import console from "node:console"; |
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'm surprised this is needed 🤔 Is this due to an eslint rule or something?
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.
Yes, ESLint was loudly complaining.
if (log) { | ||
doLog = (msg) => console.log(msg); | ||
} else { | ||
// eslint-disable-next-line no-unused-vars | ||
doLog = () => { | ||
/* don't log */ | ||
}; | ||
} |
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.
In general, I don't really like this pattern of reassigning a function - as something might capture it in a scoped variable and it won't update as expected.
In general, I would rather that we implement a (const) log
function that does a check on the options.log
before calling console.log
or similar.
Or even better, that we just rely on the "debug" package, which we already have a dependency on - that way we could get rid of the --log
runtime parameter, leaving just --dry-run
which could be replaced with the REALM_DISABLE_ANALYTICS
(which is already essentially doing the same anyway) - and if we did that we could drop the command-line-args
dependency entirely. Just a thought ...
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.
Good point. I'll rewrite it to use the debug
package and see if I can get rid of command-line-args
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.
👍🏼
@@ -64,7 +81,10 @@ describe.skip("Analytics", () => { | |||
expect(data.Version).equals("1.2.3"); | |||
expect(data.Framework).equals("electron"); | |||
expect(data["Framework Version"]).equals("1.0.1"); |
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.
This test seems to be failing. It is expecting ^1.0.0
@@ -73,6 +93,9 @@ describe.skip("Analytics", () => { | |||
expect(data.Version).equals("1.2.3"); | |||
expect(data.Framework).equals("react-native"); | |||
expect(data["Framework Version"]).equals("1.0.1"); |
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.
Same test from above is failing here as well
This reverts commit bf860e4.
What, How & Why?
This closes #5242
Adapting script and tests from #5807
I have reintroduced
dependencies.list
and I am open to other ways to find the version of Realm Core.☑️ 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 necessaryIf this PR adds or changes public API's: