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.

Revisions

  1. thmsobrmlr created this gist May 12, 2022.
    44 changes: 44 additions & 0 deletions HOTFIX_DEPENDENCY.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    # How to fork a dependency and use it locally in a project

    1. Clone the project

    ```sh
    [email protected]:author/my-dependency.git
    ```

    2. [Link the local fork into the project](https://classic.yarnpkg.com/en/docs/cli/link/)

    ```sh
    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:

    ```sh
    find node_modules/ -type l -ls -maxdepth 1
    ```

    3. Make the desire changes and build the project

    ```sh
    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

    ```sh
    git add .
    git commit -m “fix: fixed an issue”
    git push
    ```