fix: move patch-package to dependencies for consumer installs#465
fix: move patch-package to dependencies for consumer installs#465jaieds wants to merge 1 commit into
Conversation
The postinstall script (patch-package) runs when consumers install
@bsf/force-ui as a git dependency, but patch-package was only in
devDependencies, so consumer installs failed with:
sh: patch-package: command not found (exit 127)
Moving it to dependencies fixes the install and also ensures the
Lexical Shadow DOM patches get applied to the host project's
node_modules — required at runtime because the build externalizes
lexical, so consumers would otherwise run unpatched lexical and the
Shadow DOM mention fix would silently not work.
| @@ -24,6 +24,7 @@ | |||
| "lexical": "0.38.2", | |||
| "lucide-react": "^0.417.0", | |||
There was a problem hiding this comment.
What: Ensure that patch-package is included in the main dependencies rather than in devDependencies. Moving it is correct, but keep an eye on the consistency of this throughout the project. Sometimes libraries that need to be used at runtime are mistakenly placed in separate sections.
Why: Including patch-package as a dependency is crucial since consumers of the code require it for applying patches at install time. This change aligns with typical library behaviors and ensures that critical patches are applied without requiring consumers to have knowledge of setup.
How: Verify that any existing usage of patch-package in your codebase or documentation reflects this change. Clear documentation will greatly assist consumers, especially those who may refer to the usage guides or setup instructions.
|
Superseded by #466, which targets staging per release flow and includes the complete fix — verification showed moving patch-package to dependencies alone didn't get the Lexical patches applied in consumer projects. |
Problem
Installing
@bsf/force-uiv1.7.12 as a git dependency (e.g. in SureRank) fails:v1.7.12 added
"postinstall": "patch-package"for the Lexical Shadow DOM patches, butpatch-packageis only indevDependencies. npm runs a dependency's ownpostinstallduring consumer installs, and devDependencies aren't installed for consumers — exit 127.Why not just remove the postinstall
The Lexical patches are runtime-critical (Shadow DOM selection/typeahead support patched into lexical core), and the Vite build externalizes all
lexical/@lexical/*packages — consumers install their own lexical 0.38.2 from the registry. Without patch-package running in the host project, consumers get unpatched lexical and the Shadow DOM mention fix from v1.7.12 silently doesn't work.Fix
Move
patch-packagefrom devDependencies to dependencies (the standard pattern for libraries shipping patches). Consumer installs then have the binary available, and patch-package applies thepatches/to the host's hoisted lexical.Release note
The
1.7.12release tag's committedpackage.jsonalso carries the broken combination — after this merges, the tag needs re-creating (or ship1.7.13) so git-dep consumers pick up the fix.