Skip to content

working build fix#129

Closed
Kitenite wants to merge 3 commits intomainfrom
teal-valley-45
Closed

working build fix#129
Kitenite wants to merge 3 commits intomainfrom
teal-valley-45

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Nov 22, 2025

Summary by CodeRabbit

  • Chores

    • Streamlined desktop build and packaging configuration into a single, simplified setup.
    • Simplified developer build tooling and config for faster local builds and clearer outputs.
    • Updated packaging scripts, dependency adjustments, and npm configuration to support hoisting.
  • New Features

    • Expanded multi-platform packaging targets with improved artifact naming.
    • Added enhanced signing and publish metadata for macOS, Windows, and Linux releases.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 22, 2025

Walkthrough

Centralizes and replaces the Electron Builder config, simplifies the Electron Vite config to a function-driven plugin setup, moves some dependencies into runtime, adds packaging npm scripts, and enables hoisting via .npmrc.

Changes

Cohort / File(s) Summary
Builder config
apps/desktop/electron-builder.ts
Replaced verbose legacy electron-builder options with a condensed top-level config: static appId, asar, directories.output, files, extraResources, per-platform mac/win/linux target arrays and artifact names, nsis placeholder, publish GitHub metadata, and signing/azure options. Default export remains config.
Vite/electron build
apps/desktop/electron.vite.config.ts
Switched from a multi-section static config to defineConfig(({ command }) => {...}) using vite-plugin-electron/simple and React plugin; explicit main/preload build outputs under dist-electron/..., resource copying, path aliases, externalized deps, conditional sourcemaps/minification, and simplified dev-debug override logic. Removed prior env/port auto-detection and earlier per-target structure.
Package manifest & scripts
apps/desktop/package.json
Added package script (electron-builder --config electron-builder.ts), moved open and @superset/ui into dependencies, removed them from devDependencies, and pinned electron devDependency to 39.1.2.
NPM config
apps/desktop/.npmrc
Added shamefully-hoist=true to influence npm hoisting behavior during install/build.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant Vite as Vite (serve/build)
  participant EPlugin as vite-plugin-electron/simple
  participant Builder as electron-builder
  participant Verify as postbuild verify:node-pty

  Dev->>Vite: run dev or build
  Vite->>EPlugin: build main & preload -> emit to dist-electron/...
  EPlugin->>Vite: renderer assets
  Dev->>Builder: run npm script `package` -> electron-builder with config
  Builder->>Builder: package using config (asar, files, extraResources, mac/win/linux targets)
  Builder->>Builder: sign artifacts (if configured)
  Builder->>Verify: run postbuild verification
  Verify-->>Dev: success / failure
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review areas needing extra attention:
    • apps/desktop/electron.vite.config.ts — plugin integration, resource copy error handling, externalization, and conditional flags.
    • apps/desktop/electron-builder.ts — per-platform target configs, artifactName templates, signing and azure sign options.
    • apps/desktop/package.json — dependency moves from devDependencies to dependencies and script correctness.

Possibly related PRs

  • New desktop UI #102 — Overlaps changes to apps/desktop/electron.vite.config.ts and build-output/plugin adjustments.
  • emerald river 7 #127 — Related adjustments to apps/desktop/package.json dependency and script changes.

Poem

🐇 I hopped through configs, small and bright,

I bundled main and preload by moonlight,
I nudged dependencies to join the run,
Signed and checked until the job was done,
A tiny rabbit — release takes flight! 🚀

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete and lacks required sections from the template. It only contains two bullet points without proper structure, missing description details, type of change, testing info, and other sections required by the template. Complete the PR description following the template structure: add clear description of changes, link related issues, select type of change, describe testing performed, and add any additional context.
Title check ❓ Inconclusive The title 'working build fix' is vague and generic, using non-descriptive terms that don't convey meaningful information about the specific changes made to Electron config, package.json, and Vite config. Provide a more specific title that describes the main change, such as 'Refactor Electron Builder configuration and update build setup' or 'Simplify Electron and Vite build configurations'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch teal-valley-45

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e30e841 and 7328223.

📒 Files selected for processing (1)
  • apps/desktop/package.json (3 hunks)
🧰 Additional context used
🪛 GitHub Actions: CI
apps/desktop/package.json

[error] 1-1: sherif: dependencies should be ordered alphabetically. unordered-dependencies

🔇 Additional comments (2)
apps/desktop/package.json (2)

19-19: Script addition looks good.

The new "package" script correctly delegates to electron-builder with the centralized config. No concerns.


97-97: Verify intent of electron version pinning.

The electron version has been changed from "^39.1.2" (caret, allows minor/patch updates) to "39.1.2" (pinned exact version). Confirm this intentional move toward deterministic builds aligns with project policy, and consider how security updates will be managed under this pinning strategy.


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

Copy link
Copy Markdown
Contributor

@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: 2

🧹 Nitpick comments (1)
apps/desktop/electron-builder.ts (1)

27-31: Refine the asarUnpack pattern to match the actual target path.

The pattern **/node_modules/node-pty/**/* is overly broad. Since the file mapping (line 44) places node-pty at node_modules/node-pty, the asarUnpack pattern should be node_modules/node-pty/**/* to precisely match that location.

Apply this diff:

-	asarUnpack: [
-		"**/node_modules/node-pty/**/*",
-	],
+	asarUnpack: [
+		"node_modules/node-pty/**/*",
+	],
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d530e5d and 93cdadd.

📒 Files selected for processing (2)
  • apps/desktop/electron-builder.ts (2 hunks)
  • apps/desktop/package.json (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: CI
apps/desktop/package.json

[error] sherif: dependencies should be ordered alphabetically. unordered-dependencies

🔇 Additional comments (3)
apps/desktop/electron-builder.ts (2)

41-46: LGTM!

The file copy mapping correctly includes node-pty from the monorepo root, which is necessary for the native module to function properly in the packaged app.


50-50: LGTM!

The updated comment clearly explains why npmRebuild is disabled in this monorepo setup.

apps/desktop/package.json (1)

19-19: LGTM!

The postbuild script appropriately verifies that node-pty was unpacked correctly after the build completes.

Comment thread apps/desktop/package.json Outdated
Comment thread apps/desktop/package.json
Comment on lines +81 to +83
"zustand": "^5.0.8",
"open": "^10.2.0",
"@superset/ui": "workspace:*"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix the alphabetical ordering of dependencies.

The pipeline failure indicates that dependencies must be ordered alphabetically. Currently, open and @superset/ui are placed at the end, but they need to be inserted in alphabetical order.

Apply this diff to fix the ordering:

 		"@types/express": "^5.0.5",
+		"@superset/ui": "workspace:*",
 		"@xterm/addon-clipboard": "^0.1.0",
 		"node-pty": "1.1.0-beta30",
+		"open": "^10.2.0",
 		"react": "^19.1.1",
-		"zustand": "^5.0.8",
-		"open": "^10.2.0",
-		"@superset/ui": "workspace:*"
+		"zustand": "^5.0.8"

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: CI

[error] sherif: dependencies should be ordered alphabetically. unordered-dependencies

🤖 Prompt for AI Agents
In apps/desktop/package.json around lines 81 to 83 the dependencies are not
alphabetically ordered: "open" and "@superset/ui" are at the end but must be
inserted in alphabetical order among the other dependencies; reorder the
dependency entries so keys are sorted lexicographically (e.g., place
"@superset/ui" where entries starting with "@" belong and place "open" in its
correct alphabetical position), update the JSON accordingly and run the
dependency/order linter or package manager check to confirm the pipeline passes.

@Kitenite Kitenite changed the title teal valley 45 working build fix Nov 22, 2025
Copy link
Copy Markdown
Contributor

@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: 2

♻️ Duplicate comments (2)
apps/desktop/package.json (2)

19-21: Make verify:node-pty platform-aware and align it with the new output layout

The inline node -e script:

  • Hardcodes a macOS-only path (release/mac-universal/...), so it will fail on Linux/Windows CI.
  • Ignores the versioned output directory now configured in electron-builder.ts (directories.output: 'release/${version}'), so even mac builds are likely checked at the wrong path.
  • Is hard to maintain in a single long one-liner.

Consider moving this into a small script file that detects the platform and builds the expected unpacked path (including the version) before checking for node-pty, then invoke it from the script:

-    "postbuild": "bun run verify:node-pty",
-    "verify:node-pty": "node -e \"const fs=require('fs');const path=require('path');const unpackedPath=path.join('release','mac-universal','Superset.app','Contents','Resources','app.asar.unpacked','node_modules','node-pty');const exists=fs.existsSync(unpackedPath);console.log(exists?'✅ node-pty unpacked successfully at: '+unpackedPath:'❌ node-pty missing in unpacked! Expected at: '+unpackedPath);process.exit(exists?0:1);\"",
+    "postbuild": "bun run verify:node-pty",
+    "verify:node-pty": "node scripts/verify-node-pty.cjs",

and in scripts/verify-node-pty.cjs (outline only):

const fs = require('fs');
const path = require('path');
const os = require('os');
const pkg = require('../package.json');

const base = path.join('release', pkg.version);
const platform = os.platform();
let unpackedPath;

if (platform === 'darwin') {
  unpackedPath = path.join(base, 'mac-universal', 'Superset.app', 'Contents', 'Resources', 'app.asar.unpacked', 'node_modules', 'node-pty');
} else if (platform === 'linux') {
  unpackedPath = path.join(base, 'linux-unpacked', 'resources', 'app.asar.unpacked', 'node_modules', 'node-pty');
} else if (platform === 'win32') {
  unpackedPath = path.join(base, 'win-unpacked', 'resources', 'app.asar.unpacked', 'node_modules', 'node-pty');
} else {
  console.log(`⚠️  Unknown platform: ${platform}, skipping verification`);
  process.exit(0);
}

const exists = fs.existsSync(unpackedPath);
console.log(
  exists
    ? `✅ node-pty unpacked successfully at: ${unpackedPath}`
    : `❌ node-pty missing in unpacked! Expected at: ${unpackedPath}`,
);
process.exit(exists ? 0 : 1);

This keeps the check readable, works across OSes, and tracks the versioned output directory.


82-84: Fix alphabetical ordering of dependencies to satisfy Sherif

dependencies are still not sorted lexicographically: "open" and "@superset/ui" sit at the end instead of in their proper positions, which matches the Sherif unordered-dependencies failure.

Reorder them like this:

@@
-        "@types/express": "^5.0.5",
-        "@xterm/addon-clipboard": "^0.1.0",
+        "@types/express": "^5.0.5",
+        "@superset/ui": "workspace:*",
+        "@xterm/addon-clipboard": "^0.1.0",
@@
-        "nanoid": "^5.1.6",
-        "node-pty": "1.1.0-beta30",
-        "react": "^19.1.1",
+        "nanoid": "^5.1.6",
+        "node-pty": "1.1.0-beta30",
+        "open": "^10.2.0",
+        "react": "^19.1.1",
@@
-        "tailwind-merge": "^2.6.0",
-        "trpc-electron": "^0.1.2",
-        "zod": "^4.1.12",
-        "zustand": "^5.0.8",
-        "open": "^10.2.0",
-        "@superset/ui": "workspace:*"
+        "tailwind-merge": "^2.6.0",
+        "trpc-electron": "^0.1.2",
+        "zod": "^4.1.12",
+        "zustand": "^5.0.8"

That should clear the CI error.

🧹 Nitpick comments (2)
apps/desktop/electron.vite.config.ts (1)

10-23: Consider limiting destructive/copy operations to build commands

rmSync('dist-electron', { recursive: true, force: true }) and the recursive cpSync('resources', 'dist-electron/main/resources', ...) run on every invocation of the config, including serve.

This is not incorrect, but you might want to wrap these in if (command === 'build') to avoid extra filesystem churn during dev and make the intent clearer:

export default defineConfig(({ command }) => {
  const isServe = command === 'serve';
  const isBuild = command === 'build';

  if (isBuild) {
    rmSync('dist-electron', { recursive: true, force: true });
    try {
      cpSync('resources', 'dist-electron/main/resources', { recursive: true });
      console.log('✓ Resources folder copied to dist-electron');
    } catch (err) {
      console.error('Failed to copy resources folder:', err);
    }
  }

  // ...
});

Purely a maintainability/clarity tweak.

apps/desktop/electron-builder.ts (1)

53-68: Double-check Linux icon format and path

linux.icon is set to 'build/icon.icns', which is typically a macOS icon format. Electron Builder usually expects platform-appropriate icon assets for Linux (often PNGs in various sizes).

If you already have a proper cross-platform icon pipeline, this might be intentional, but otherwise consider pointing linux.icon at a Linux-appropriate asset (e.g., a .png in your build assets) or to a directory containing them.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93cdadd and e30e841.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • apps/desktop/.npmrc (1 hunks)
  • apps/desktop/electron-builder.ts (1 hunks)
  • apps/desktop/electron.vite.config.ts (1 hunks)
  • apps/desktop/package.json (3 hunks)
🧰 Additional context used
🪛 GitHub Actions: CI
apps/desktop/package.json

[error] 1-1: Sherif: dependencies should be ordered alphabetically. unordered-dependencies.

🔇 Additional comments (2)
apps/desktop/.npmrc (1)

1-3: .npmrc hoist setting looks fine

The shamefully-hoist=true flag here is consistent with common electron-builder/pnpm workarounds and is scoped to the desktop app only; no issues from this change alone.

apps/desktop/package.json (1)

99-99: Electron version is now pinned; confirm that’s intentional

Dropping the caret on "electron": "39.1.2" pins builds to exactly that version, which is good for reproducibility but will block automatic minor/patch upgrades.

If that’s the goal (to stay in lockstep with a specific version used by electron-vite/electron-builder), this change is fine; otherwise, consider whether you still want a range.

Comment thread apps/desktop/electron-builder.ts
Comment on lines +90 to +98
server: process.env.VSCODE_DEBUG
? (() => {
const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL);
return {
host: url.hostname,
port: +url.port,
};
})()
: undefined,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Guard access to pkg.debug in the VSCode debug server override

In the server block you do:

const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL);

but apps/desktop/package.json does not define a debug field. If VSCODE_DEBUG is set, this will throw at config evaluation time (Cannot read properties of undefined (reading 'env')), breaking your debug workflow.

Either add the expected debug.env.VITE_DEV_SERVER_URL structure to package.json, or guard this access and/or read from an environment variable instead, for example:

server: process.env.VSCODE_DEBUG
  ? (() => {
        const devUrl =
          process.env.VITE_DEV_SERVER_URL ?? pkg.debug?.env?.VITE_DEV_SERVER_URL;
        if (!devUrl) {
          throw new Error('VITE_DEV_SERVER_URL is not configured for VSCode debug');
        }
        const url = new URL(devUrl);
        return { host: url.hostname, port: Number(url.port) };
    })()
  : undefined,

This keeps the debug override robust even if pkg.debug is missing.


🏁 Script executed:

#!/bin/bash
# Check if debug field exists in package.json
if [ -f "apps/desktop/package.json" ]; then
  echo "=== apps/desktop/package.json exists ==="
  jq '.debug' "apps/desktop/package.json" 2>/dev/null || echo "No debug field or jq failed"
else
  echo "apps/desktop/package.json not found"
fi

Length of output: 45


🏁 Script executed:

#!/bin/bash
# Get the full context around lines 90-98 in electron.vite.config.ts
if [ -f "apps/desktop/electron.vite.config.ts" ]; then
  echo "=== Full electron.vite.config.ts context (lines 1-110) ==="
  head -110 "apps/desktop/electron.vite.config.ts" | tail -50
  echo ""
  echo "=== Checking for 'pkg' import/declaration ==="
  grep -n "import.*pkg\|const pkg\|let pkg" "apps/desktop/electron.vite.config.ts" | head -5
else
  echo "File not found"
fi

Length of output: 2279


Guard access to pkg.debug in the VSCode debug server override

In the server block (lines 90–98) you access:

const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL);

but apps/desktop/package.json does not define a debug field. When VSCODE_DEBUG is set, this will throw Cannot read properties of null (reading 'env') at config evaluation time, breaking your debug workflow.

Either add the expected debug.env.VITE_DEV_SERVER_URL structure to package.json, or guard this access and/or read from an environment variable instead, for example:

server: process.env.VSCODE_DEBUG
  ? (() => {
        const devUrl =
          process.env.VITE_DEV_SERVER_URL ?? pkg.debug?.env?.VITE_DEV_SERVER_URL;
        if (!devUrl) {
          throw new Error('VITE_DEV_SERVER_URL is not configured for VSCode debug');
        }
        const url = new URL(devUrl);
        return { host: url.hostname, port: Number(url.port) };
    })()
  : undefined,

This keeps the debug override robust even if pkg.debug is missing.

🤖 Prompt for AI Agents
In apps/desktop/electron.vite.config.ts around lines 90–98, the current VSCode
debug server override directly accesses pkg.debug.env.VITE_DEV_SERVER_URL which
can be undefined and will throw; change it to first read
process.env.VITE_DEV_SERVER_URL and fall back to
pkg.debug?.env?.VITE_DEV_SERVER_URL, validate the resulting URL string exists
(throw a clear error if not), then construct a URL from it and return host and
Number(port) to ensure safe parsing and avoid runtime throws when pkg.debug is
absent.

@Kitenite Kitenite closed this Nov 22, 2025
@Kitenite Kitenite deleted the teal-valley-45 branch November 23, 2025 20:57
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.

1 participant