-
Notifications
You must be signed in to change notification settings - Fork 50
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
Switch to no bundling and let extensions decide how they would like to bundle #119
Conversation
src/common/baseTelemetryReporter.ts
Outdated
private getCommonProperties(): TelemetryEventProperties { | ||
const commonProperties: Record<string, any> = {}; | ||
commonProperties["common.os"] = this.osShim.platform; | ||
commonProperties["common.nodeArch"] = this.osShim.architecture; | ||
commonProperties["common.platformversion"] = (this.osShim.release || "").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/, "$1$2$3"); | ||
commonProperties["common.extname"] = this.extensionId; | ||
commonProperties["common.extversion"] = this.extensionVersion; | ||
// TODO @lramos15, this should be dynamic but loading JSON modules didn't play nicely | ||
commonProperties["common.telemetryclientversion"] = "0.6.3"; |
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.
@connor4312 Any ideas on how to import a JSON
file across node12, node 14, and node16. Seems node 16
gets upset that I don't use import assertions but then node12
and node14
get upset when I do. I don't really want to rely on require because I use no var requires and fs
wouldn't work in a common layer
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.
Prior to Node 16, JSON modules required a flag to be used in an ES6 import, so this is tricky.
Can the version be passed in from a higher level outside of the common layer?
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 could pass it in from the browser layer and node layer respectively. Not sure how that helps especially in the browser case. Normally I would use something like the bundler to compile time inject the value here but the idea is to avoid bundlers
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.
Honestly the easiest way would probably be just having a npm postversion
script that would update the version number in a ts file when the version gets bumped
No longer even bundle source code. Let extensions decide how they would like to bundle everything.
TODO: Can we re-use the common code somehow? Right now I create two spearate directories because node gets compiled as commonjs while browser compiled as esm