R
Reactiflux

snowberb – 09-42 Jul 3

snowberb – 09-42 Jul 3

S⛄Snowberb⛄7/3/2023
I have multiple repositories for multiple APIs. Each of these apis has a custom fetch function which is duplicated code. There are times where I have to update the code of that fetch to adapt to back changes, and right now I have to make the change on all the different repos. Should I create a new repo that contains this fetch file and import that in all other repos? Would that be the best way to do this?
UUUnknown User7/3/2023
2 Messages Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
no, I mean multiple APIs I made a script to autogenerate the TS code for every endpoint in every api, but everytime I make a new change, I have to manually update it in each one of the repos
UUUnknown User7/4/2023
Message Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
would you say having a mono repo with subfolders for each api would be better?
UUUnknown User7/4/2023
Message Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
yes, but what would be better?
UUUnknown User7/4/2023
Message Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
if I have a mono repo I could have the custom fetch and the script in the root and just import it to every folder yes
UUUnknown User7/4/2023
Message Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
if I give you some more context could you share your opinion?
UUUnknown User7/4/2023
4 Messages Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
- Backend uses yaml files to type each endpoint of an API using schemas - For every API, there is a gitlab repo which I use as an npm package in the main app - I have a script that reads that yaml and generates react-query hooks + type definitions using zod. The script and the custom fetch is duplicated code that every single API repo needs, and everytime I make a change in the script so I can adapt better to the yaml as there are still not controlled cases, I have to update every single repo (there are like +10 different APIs). The bad thing about this is that it's a bit hard to maintain consistency between all the repos and in a close future, I wanted to make another project which would automatically update every yaml of every repo by just hitting a button
UUUnknown User7/4/2023
2 Messages Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
the product im working is being built, and there are frequent backend changes that force the yaml to update and I need the yaml update so the main project can compile
UUUnknown User7/4/2023
Message Not Public
Sign In & Join Server To View
S⛄Snowberb⛄7/4/2023
no
UUUnknown User7/6/2023
2 Messages Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

snowberb – 09-42 Jul 3

Join Server