Generating and Running Patches for Gesso
This guide provides instructions for applying a temporary patch to the Gesso monorepo in your project, useful when you've submitted a merge request (MR) but need to implement the changes before the official release.
Prerequisites
Ensure you have pnpm
or yarn
installed and are familiar with the basic operations in the Gesso monorepo. For details on pnpm patch
refer to the official pnpm documentation.
Instructions
For PNPM Users
-
Run PNPM Patch: In your project directory, execute
pnpm patch
. This prepares your project for the incoming patch. -
Modify the Gesso Monorepo: Navigate to the Gesso monorepo and make the necessary changes.
-
Compile the Package: Compile the
/dist
folder of the specific package you modified in the monorepo. -
Copy the Compiled Package: Transfer the compiled
/dist
folder from the monorepo to your project directory. -
Commit the Patch: Run
pnpm patch-commit package path
(replacepackage path
with the relevant path to your package). This creates a patch file in your project and updates yourpackage.json
.
For Yarn Users
-
Install patch-package: If not already installed, add
patch-package
to your project by runningyarn add patch-package postinstall-postinstall
. -
Modify the Gesso Monorepo: Similar to the PNPM process, make your changes in the Gesso monorepo.
-
Compile the Package: Compile the
/dist
folder of the modified package. -
Copy the Compiled Package: Copy the compiled
/dist
folder to your project directory. -
Create and Apply the Patch: Run
yarn patch-package package-name
(replacepackage-name
with the name of the package you modified). This command creates a patch file and applies it to your project.
Troubleshooting
- If you encounter issues with
pnpm patch-commit
oryarn patch-package
, ensure that the package path or name is correct. - For other common issues, consult the pnpm documentation or the
patch-package
GitHub repository for solutions.
By following these steps, you can implement and use changes in the Gesso monorepo immediately in your project with either PNPM or Yarn, without waiting for the official merge and release.