Skip to content

Conversation

@nsrCodes
Copy link
Collaborator

@nsrCodes nsrCodes commented Jan 12, 2026

Summary by CodeRabbit

  • New Features

    • Added support for beta build configurations and preview URL handling.
  • Chores

    • Version bump to 26.1.10.
    • Restructured build scripts for improved efficiency and cleaner workflow.
    • Enhanced URL resolution logic for different build environments.

✏️ Tip: You can customize this high-level summary in your review settings.

@nsrCodes nsrCodes requested a review from wrongsahil January 12, 2026 13:29
@linear
Copy link

linear bot commented Jan 12, 2026

@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

Walkthrough

This pull request introduces a beta build configuration system for the Electron application. It adds two new environment variables (IS_BETA_BUILD and PREVIEW_URL) to the webpack production config, implements new npm scripts (build:beta, build:main:beta, package:beta) to orchestrate beta builds with proper environment variables, and refactors the main build script to use a separate cleanup step. The main.ts file is updated with a DESKTOP_APP_URL constant that conditionally selects the application URL based on the IS_BETA_BUILD flag, supporting development, beta, and production environments. The release app version is bumped from 26.1.6 to 26.1.10.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #207: Both PRs modify the webpack production config's EnvironmentPlugin and package.json build scripts to expose environment-based build flags (IS_BETA_BUILD/PREVIEW_URL) for distinguishing build types.

Suggested reviewers

  • wrongsahil
  • RuntimeTerror10
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: introduction of new npm scripts (cleanup, build:beta, build:main:beta, package:beta) for beta builds, with supporting webpack config and environment variable additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @package.json:
- Line 13: The npm script "build:main:beta" uses Unix-style "$PREVIEW_URL"
expansion which fails on Windows; update that script so PREVIEW_URL is set via
cross-env (e.g., include PREVIEW_URL=%PREVIEW_URL% via cross-env or use
cross-env-shell to allow shell expansion) or remove inline expansion and rely on
the environment/webpack EnvironmentPlugin to read PREVIEW_URL at runtime; modify
the "build:main:beta" entry so both IS_BETA_BUILD and PREVIEW_URL are provided
through cross-env (or switch to cross-env-shell) to ensure consistent behavior
across platforms.
🧹 Nitpick comments (1)
src/main/main.ts (1)

71-75: Consider refactoring nested ternary for improved readability.

The logic is correct, but the nested ternary can be difficult to parse at a glance. A helper function or early-return pattern would make the URL resolution clearer.

♻️ Suggested refactor
-const DESKTOP_APP_URL = isDevelopment ? 'http://localhost:3000' : 
-  process.env.IS_BETA_BUILD == "true" ? 
-    process.env.PREVIEW_URL ? process.env.PREVIEW_URL : "https://beta.requestly.io" :
-    "https://app.requestly.io"
+const getDesktopAppUrl = (): string => {
+  if (isDevelopment) {
+    return 'http://localhost:3000';
+  }
+  if (process.env.IS_BETA_BUILD === 'true') {
+    return process.env.PREVIEW_URL || 'https://beta.requestly.io';
+  }
+  return 'https://app.requestly.io';
+};
+
+const DESKTOP_APP_URL = getDesktopAppUrl();

Also, prefer === over == for string comparison consistency.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56d9654 and f09bca1.

⛔ Files ignored due to path filters (1)
  • release/app/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .erb/configs/webpack.config.main.prod.ts
  • package.json
  • release/app/package.json
  • src/main/main.ts
🔇 Additional comments (4)
release/app/package.json (1)

4-4: LGTM!

Version bump to 26.1.10 aligns with the beta build feature additions.

.erb/configs/webpack.config.main.prod.ts (1)

66-73: LGTM!

The EnvironmentPlugin defaults are correctly configured. The false default for IS_BETA_BUILD ensures production builds target app.requestly.io, while the empty string for PREVIEW_URL correctly falls back to beta.requestly.io when beta builds don't specify a custom URL.

package.json (2)

9-11: LGTM!

Good refactoring to extract cleanup into a dedicated script. This improves maintainability and ensures consistent cleanup behavior across both standard and beta builds.


18-18: LGTM!

The package:beta script correctly chains the beta build with electron-builder using --publish never.

"build": "npm run cleanup && concurrently \"npm run build:main\" \"npm run build:renderer\"",
"build:beta": "npm run cleanup && concurrently \"npm run build:main:beta\" \"npm run build:renderer\"",
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
"build:main:beta": "cross-env IS_BETA_BUILD=true PREVIEW_URL=$PREVIEW_URL npm run build:main",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

$PREVIEW_URL expansion may fail on Windows.

The $PREVIEW_URL shell variable expansion relies on a Unix-like shell. On Windows (cmd.exe), this won't expand correctly—the literal string $PREVIEW_URL will be passed instead.

Consider using cross-env consistently for both variables, or document that this script requires a Unix-like shell (Git Bash, WSL, etc.) on Windows.

🔧 Suggested fix using cross-env-shell
-    "build:main:beta": "cross-env IS_BETA_BUILD=true PREVIEW_URL=$PREVIEW_URL npm run build:main",
+    "build:main:beta": "cross-env-shell IS_BETA_BUILD=true PREVIEW_URL=$PREVIEW_URL npm run build:main",

Alternatively, if PREVIEW_URL is always optional and typically unset:

-    "build:main:beta": "cross-env IS_BETA_BUILD=true PREVIEW_URL=$PREVIEW_URL npm run build:main",
+    "build:main:beta": "cross-env IS_BETA_BUILD=true npm run build:main",

This relies on webpack's EnvironmentPlugin to pick up PREVIEW_URL directly from the environment if set.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build:main:beta": "cross-env IS_BETA_BUILD=true PREVIEW_URL=$PREVIEW_URL npm run build:main",
"build:main:beta": "cross-env-shell IS_BETA_BUILD=true PREVIEW_URL=$PREVIEW_URL npm run build:main",
🤖 Prompt for AI Agents
In @package.json at line 13, The npm script "build:main:beta" uses Unix-style
"$PREVIEW_URL" expansion which fails on Windows; update that script so
PREVIEW_URL is set via cross-env (e.g., include PREVIEW_URL=%PREVIEW_URL% via
cross-env or use cross-env-shell to allow shell expansion) or remove inline
expansion and rely on the environment/webpack EnvironmentPlugin to read
PREVIEW_URL at runtime; modify the "build:main:beta" entry so both IS_BETA_BUILD
and PREVIEW_URL are provided through cross-env (or switch to cross-env-shell) to
ensure consistent behavior across platforms.

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.

2 participants