Skip to content
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

Merged
merged 7 commits into from Sep 8, 2022

Conversation

lramos15
Copy link
Member

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

@lramos15 lramos15 self-assigned this Aug 31, 2022
connor4312
connor4312 previously approved these changes Aug 31, 2022
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";
Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants