Sniberb
Sniberb13mo ago

snowberb – 09-42 Jul 3

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?
18 Replies
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
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
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
would you say having a mono repo with subfolders for each api would be better?
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
yes, but what would be better?
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
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
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
if I give you some more context could you share your opinion?
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
- 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
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
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
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Sniberb
Sniberb13mo ago
no
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
reactibot
reactibot13mo ago
This thread hasn’t had any activity in 36 hours, so it’s now locked. Threads are closed automatically after 36 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1125360948312539267