Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .erb/configs/webpack.config.main.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export default merge(baseConfig, {
DEBUG_PROD: false,
START_MINIMIZED: false,
IS_SETAPP_BUILD: false,
IS_BETA_BUILD: false,
PREVIEW_URL: ''
}),
],

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
"private": true,
"description": "Intercept & Modify HTTP Requests",
"scripts": {
"build": "ts-node ./.erb/scripts/clean.js dist && concurrently \"npm run build:main\" \"npm run build:renderer\"",
"cleanup": "ts-node ./.erb/scripts/clean.js dist",
"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.

"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir src",
"lint": "cross-env NODE_ENV=development eslint . --cache --ext .js,.jsx,.ts,.tsx",
"package": "npm run build && electron-builder build --publish never",
"package:beta": "npm run build:beta && electron-builder build --publish never",
"package:setapp": "cross-env IS_SETAPP_BUILD=true npm run build && electron-builder build --config electron-builder-setapp.json --mac --universal --publish never",
"deploy": "npm run build && electron-builder build --publish always",
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
Expand Down
6 changes: 4 additions & 2 deletions release/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "requestly",
"productName": "Requestly",
"version": "26.1.6",
"version": "26.1.10",
"private": true,
"description": "Intercept & Modify HTTP Requests",
"main": "./dist/main/main.js",
Expand Down
9 changes: 5 additions & 4 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ const getAssetPath = (...paths: string[]): string => {
const isDevelopment =
process.env.NODE_ENV === "development" || process.env.DEBUG_PROD === "true";

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"

if (isDevelopment) {
const sourceMapSupport = require("source-map-support");
sourceMapSupport.install();
Expand Down Expand Up @@ -232,10 +237,6 @@ const createWindow = async () => {
new AutoUpdate(webAppWindow);
remote.enable(webAppWindow.webContents);

// TODO @sahil: Prod and Local Urls should be supplied by @requestly/requestly-core-npm package.
const DESKTOP_APP_URL = isDevelopment
? "http://localhost:3000"
: "https://app.requestly.io";
webAppWindow.loadURL(DESKTOP_APP_URL, {
extraHeaders: "pragma: no-cache\n",
});
Expand Down