Skip to content

Patch fs-ext-extra-prebuilt to remove other-platform binaries on install#2615

Merged
wojtekn merged 11 commits into
trunkfrom
fix-fs-ext-extra-prebuilt-cross-platform-binaries
Feb 20, 2026
Merged

Patch fs-ext-extra-prebuilt to remove other-platform binaries on install#2615
wojtekn merged 11 commits into
trunkfrom
fix-fs-ext-extra-prebuilt-cross-platform-binaries

Conversation

@wojtekn
Copy link
Copy Markdown
Contributor

@wojtekn wojtekn commented Feb 19, 2026

Related issues

  • N/A - trying to fix builds broken after recent Playground update.

Proposed Changes

  • Applies upstream fix (adamziel/fs-ext-prebuilt#6) via custom script
  • The script deletes .node binaries for other platforms during postinstall and bundle steps
  • Fixes Performance Metrics broken after monorepo merge
  • Fixes builds, mainly around out/ paths

Testing Instructions

  • Run npm install and verify no errors
  • On Windows: verify code signing doesn't fail on Linux/macOS .node files from fs-ext-extra-prebuilt

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Applies upstream fix (adamziel/fs-ext-prebuilt#6) via patch-package to
remove binaries for other platforms after a successful prebuilt load.
This prevents Windows code-signing tools from encountering
Linux/macOS .node files they cannot process.
Comment thread package.json Outdated
"start": "npm -w studio-app run start",
"start-wayland": "npm -w studio-app run start-wayland",
"postinstall": "patch-package --patch-dir apps/cli/patches && patch-package --patch-dir apps/studio/patches && ts-node ./scripts/download-wp-server-files.ts && node ./scripts/download-available-site-translations.mjs",
"postinstall": "patch-package && patch-package --patch-dir apps/cli/patches && patch-package --patch-dir apps/studio/patches && ts-node ./scripts/download-wp-server-files.ts && node ./scripts/download-available-site-translations.mjs",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fredrikekelund this packages is dependency for @studio/common, benchmark-site-editor and studio-cli. With the monorepo setup, is applying that in the prokject root's node_modules/ a way to go?

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.

Good question. This is probably one of the biggest gotchas with our monorepo setup now.

As part of the packaging flow, we now run the install:bundle npm scripts in apps/cli and apps/studio. They do this:

npm install [--omit=dev] --no-package-lock --no-progress --install-links --no-workspaces 

The goal is to produce self-contained apps/cli/node_modules and apps/studio/node_modules directories, because those are copied into the packaged output.

This goal conflicts with how dependency management typically works with our npm workspaces setup, which is that most (not all) dependencies are hoisted to the root node_modules directory.

So, how does this affect patches? Well, patch-package fails if it finds a patch without a matching dependency. That's why we have separate apps/cli/patches and apps/studio/patches directories, because otherwise the install:bundle npm scripts would fail.

To answer your question directly: just put the patch in apps/cli/patches. fs-ext-extra-prebuilt is a dev dependency of @studio/common, so it won't be included in the self-contained packaged node_modules directories.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the clarification. I moved it, and it works fine.

@wojtekn wojtekn self-assigned this Feb 19, 2026
@wojtekn wojtekn requested a review from a team February 19, 2026 14:19
Copy link
Copy Markdown
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I've triggered a Windows dev build on Buildkite. Let's see how that fares before we land this

@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Feb 19, 2026

📊 Performance Test Results

Comparing cef34dc vs trunk

site-editor

Metric trunk cef34dc Diff Change
load 1481.00 ms 1491.00 ms +10.00 ms ⚪ 0.0%

site-startup

Metric trunk cef34dc Diff Change
siteCreation 7117.00 ms 8104.00 ms +987.00 ms 🔴 13.9%
siteStartup 4944.00 ms 4947.00 ms +3.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

…cript

The patch-package approach patched install.js but that script had already
run before patch-package executes, so no binaries were actually removed.
Instead, run a dedicated script from postinstall that deletes non-current-
platform binaries from fs-ext-extra-prebuilt/binaries directly, preventing
Windows code-signing from encountering darwin/linux .node files.
Comment thread package.json
"start": "npm -w studio-app run start",
"start-wayland": "npm -w studio-app run start-wayland",
"postinstall": "patch-package --patch-dir apps/cli/patches && patch-package --patch-dir apps/studio/patches && ts-node ./scripts/download-wp-server-files.ts && node ./scripts/download-available-site-translations.mjs",
"postinstall": "patch-package --patch-dir apps/cli/patches && patch-package --patch-dir apps/studio/patches && node ./scripts/remove-fs-ext-other-platform-binaries.mjs && ts-node ./scripts/download-wp-server-files.ts && node ./scripts/download-available-site-translations.mjs",
Copy link
Copy Markdown
Contributor Author

@wojtekn wojtekn Feb 19, 2026

Choose a reason for hiding this comment

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

It didn't work with the patch, as the patch was applied after the package was installed. I moved the logic to custom scripts as a hotfix.

We can remove those when the library is fixed.


# Rename NuGet package files with generic name
$artifactsPath = Get-Item ".\out" | Select-Object -ExpandProperty FullName
$artifactsPath = Get-Item ".\apps\studio\out" | Select-Object -ExpandProperty FullName
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We missed that during the monorepo change.

Comment thread .buildkite/pipeline.yml
- apps\studio\out\**\studio-setup.exe
- apps\studio\out\**\studio-update.nupkg
- apps\studio\out\**\RELEASES
- apps\studio\out\**\*.appx
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Those are the remaining changes that follow the monorepo change.

@wojtekn wojtekn merged commit 44012f2 into trunk Feb 20, 2026
12 checks passed
@wojtekn wojtekn deleted the fix-fs-ext-extra-prebuilt-cross-platform-binaries branch February 20, 2026 07:38
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.

3 participants