Skip to content

Commit 0553778

Browse files
fix: add biome overrides for embed-core to prevent auto-import of node:process (calcom#27387)
* fix: use import.meta.env instead of process.env in embed.ts Using import.meta.env is Vite's native way to handle environment variables in browser bundles. This prevents biome from auto-adding 'import process from node:process' which breaks the embed.js in browsers. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Remove unncessar comment * fix: migrate remaining process.env to import.meta.env in embed.ts Complete the migration started by @hariombalhara by also converting process.env usages at lines 1681, 1682, and 1700 to import.meta.env. Update env.d.ts to include EMBED_PUBLIC_EMBED_FINGER_PRINT, EMBED_PUBLIC_EMBED_VERSION, and INTEGRATION_TEST_MODE types. This ensures no process.env references remain in embed.ts, fully preventing Biome from auto-adding import process from node:process. Co-Authored-By: unknown <> * fix: add biome overrides for embed-core to prevent auto-import of node:process Reverts import.meta.env back to process.env since API V2's tsconfig uses module: commonjs which doesn't support import.meta. Instead, adds biome overrides for embed-core to disable useNodejsImportProtocol, noProcessEnv, and noProcessGlobal rules that were causing biome to auto-add 'import process from node:process' on save. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 3e29904 commit 0553778

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

biome.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,20 @@
177177
}
178178
}
179179
},
180+
{
181+
"includes": ["packages/embeds/embed-core/**/*.{ts,tsx,js,jsx}"],
182+
"linter": {
183+
"rules": {
184+
"style": {
185+
"useNodejsImportProtocol": "off",
186+
"noProcessEnv": "off"
187+
},
188+
"correctness": {
189+
"noProcessGlobal": "off"
190+
}
191+
}
192+
}
193+
},
180194
{
181195
"includes": ["apps/api/v2/**/*.ts", "apps/api/v2/**/*.controller.ts"],
182196
"linter": {

packages/embeds/embed-core/src/embed.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class Cal {
236236
/**
237237
* Commands for which the queue persists across iframe resets
238238
*/
239-
commandsPersistAcrossIframeResets: DoInIframeArg['method'][] = ["ui"];
239+
commandsPersistAcrossIframeResets: DoInIframeArg["method"][] = ["ui"];
240240

241241
isPrerendering?: boolean;
242242

@@ -374,7 +374,7 @@ export class Cal {
374374

375375
// Very Important: Reset iframe ready flag and clear queue, as iframe might load a fresh URL and we need to check correctly when it is ready.
376376
this.iframeReset();
377-
377+
378378
if (iframe.src === urlInstance.toString()) {
379379
// Ensure reload occurs even if the url is same - Though browser normally does it, but would be better to ensure it
380380
// This param has no other purpose except to ensure forced reload.
@@ -414,7 +414,7 @@ export class Cal {
414414

415415
resetQueue() {
416416
// Only keep UI related instructions in the queue, as we want to ensure that newly loaded iframe has the same UI configuration applied automatically
417-
this.iframeDoQueue = this.iframeDoQueue.filter((doInIframeArg) =>
417+
this.iframeDoQueue = this.iframeDoQueue.filter((doInIframeArg) =>
418418
this.commandsPersistAcrossIframeResets.includes(doInIframeArg.method)
419419
);
420420
}
@@ -1500,7 +1500,6 @@ class CalApi {
15001500
},
15011501
});
15021502

1503-
15041503
this.cal.doInIframe({ method: "ui", arg: uiConfig });
15051504
}
15061505
}

0 commit comments

Comments
 (0)