0

My application uses one npm package (Say x package). I made few changes in one file of x package.

So now i need to manually send that file to other developer's so that they can replace the file of X package. i.e Every time npm install X package get executed on new system, they need to replace that file.

I tried to reach the developer of that npm X package & created pull request but no luck so far.

Query: So do i need to create my one module around the X package or any other workaround. please suggest.

6
  • assuming you are using some sort of source control for your project, you can just include the changed files in your commit? With an appropriate message to inform the team Commented Sep 4, 2017 at 10:24
  • 1
    If x package only depends on JS files then you can copy those JS files from node_modules/x_package folder and copy into your project src code folder, then import components from those files which you have copied, and also you can make changes in those files. Commented Sep 4, 2017 at 10:35
  • 3
    You should create your own module by cloning it on github and changing some files after that link that directly in package.json so that every time npm install is done nothing will be changed. and see this link to install it stackoverflow.com/questions/17509669/… Commented Sep 4, 2017 at 10:38
  • @Paras thank you for your suggestion. Commented Sep 12, 2017 at 12:24
  • @Waqas thank you for your suggestion. I think you should add this an answer. Commented Sep 12, 2017 at 12:25

2 Answers 2

1

In this situation, if you've issued a pull request, you already have a fork of the package's repo, so you have a few options. If you're not sure why your PR isn't being accepted, its probably worth finding out, as that involves the least work for you. Your options:

  1. There are patch managing packages, such as patch-package which are designed to deal with this situation, YMMV depending on your build chain

  2. You could just publish your version to npm, using a name that indicates its a variation of the package, and manage it until your PR is accepted. If you have a private package manager, this might be easiest.

  3. Get your collaborators to use the version of the package you forked (checked out as source), and use something like yalc to install it locally until your PR is accepted. You can use npm link for this, but yarn doesn't handle linking well

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Nick for your solution. This is helpful.
1

You should create your own module by cloning it on github and change files that you want and commit them. After that link that repository directly in package.json so that every time npm install is done nothing will be changed. Follow this to link in package.json How to install an npm package from GitHub directly?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.