Skip to content

Instantly share code, notes, and snippets.

@thmsobrmlr
Created May 12, 2022 07:21
Show Gist options
  • Save thmsobrmlr/92cf66a5a490edb58d23ffb4d85f4ad6 to your computer and use it in GitHub Desktop.
Save thmsobrmlr/92cf66a5a490edb58d23ffb4d85f4ad6 to your computer and use it in GitHub Desktop.
How to fork a dependency and use it locally in a project

How to fork a dependency and use it locally in a project

  1. Clone the project

    [email protected]:author/my-dependency.git
  2. Link the local fork into the project

    cd ../my-dependency # in package you want to link
    yarn link
    
    cd ../my-project # current project
    yarn link my-dependency

    This will create a symlink named my-project/node_modules/my-dependency that links to your local copy of the my-dependency project.

    You can see all linked dependencies like this:

    find node_modules/ -type l -ls -maxdepth 1
  3. Make the desire changes and build the project

    git checkout -b fixed-an-issue
    
    vim src/faulty_file.ts
    
    yarn build # or whatever the build command is
  4. Re-build your current project and test the changes

  5. Submit a pull request for the dependency

    git add .
    git commit -m “fix: fixed an issue”
    git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment