How to do a flow of work automaticlly each time after yarn?

A project required A dependence which required B. And I want to change some code in B. But each time I rerun yarn (add new dependence), these changes all rolled back.

For example: in my react-native project I required "react-navigation": "^2.0.1", and in react-navigation's package.json also required "react-native-safe-area-view": "^0.8.0". I change some code in react-native-safe-area-view/index.js because it's hard to upgrade react-navigation.

Another example: same project I change some code in RNCamere.m(Objective-C) which in node_modules/react-native-camera/ios/RN/RNCamera.m. It's hard to upgrade react-native-camera.

But each time I add new dependence (yarn add) these changes were all rolled back. So I have to do the same thing again. And my partners also have to do the same thing again and again.

Is there any good solutions for optimizing this workflow? I really don't want to do the same work.

I think using sed to change these files each time after yarn is a good way, but I have to write long long script to fix it. Any other suggestions?

728x90

2 Answers How to do a flow of work automaticlly each time after yarn?

You should make a fork of the react-native-safe-area-view project, in one of your repo. Then in your package.json add something like this in your dependencies:

"react-native-android-action-sheet": "git+ssh://[email protected]_of_your_fork/react-native-safe-area-view.git#v0.0.1",

5 months ago

My situation was: project relies on A, A relies on B, A also relies on C, and C also relies on B.

node_modules:
  [email protected]     -> [email protected]
  [email protected]                -> A
  [email protected]           -> C
    node_modules:
      [email protected] -> [email protected]

My solution was:

  1. fork these three projects on github
  2. git revert to the tag version
  3. change the code where needs to be modified
  4. modify A's package.json to git+https://github.com/MYNAME/C.git/#mytag
  5. modify B's package.json to git+https://github.com/MYNAME/C.git/#mytag
  6. modify A's package.json to git+https://github.com/MYNAME/B.git/#mytag
  7. modify project's package.json to git+https://github.com/MYNAME/A.git/#mytag

So the problem solved. It's a hard(bad) try.

Here's the github issue detail: https://github.com/react-navigation/react-navigation/issues/5205

4 months ago