Moving a repo inside a repo!

Hi guys, I have two projects that i want to merge: 1. A nodejs scraper 2. A Next project They both share a single prisma schema... - The node js scraper was a bit legacy but has been rewritten with prisma! - the next project plans to read data from the scraper, so wants to share a single prisma instance I was planing to do this: 1. Merge the prisma schema (done) - db pull from the scraper into the next project, resulting in a schma with both users, and the data they want access to, yay! 2. Merge the files (structure outline below) I managed to do this successfully (the scraper and the next project run) , but it behaves like /scraper is is in the .gitignore of /nextProject - is this the reccomended way to do it? - can i have just one .git, tsconfig, env and package.json or will everything get messed up (dependancies get heavy, etc) Thank you!
/nextProject
.git
.env
.tsconfig
package.json
prisma.schema
/src. - all the usual stuff
/scraper
.git
.env
.tsconfig
.git
package.json
// NO PRISMA SCHEMA
/nextProject
.git
.env
.tsconfig
package.json
prisma.schema
/src. - all the usual stuff
/scraper
.git
.env
.tsconfig
.git
package.json
// NO PRISMA SCHEMA
58 Replies
mac.dev
mac.dev17mo ago
so does the scraper and the next project share a db ?
fotoflo
fotoflo17mo ago
yes
mac.dev
mac.dev17mo ago
is there any auth or something else it shares ?
fotoflo
fotoflo17mo ago
the auth is for next the scraper gets a bunch of data the next will then create charts... both use prisma the scraper data will have a relation to the users in auth
mac.dev
mac.dev17mo ago
you could do something like https://github.com/t3-oss/create-t3-turbo
GitHub
GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo usin...
Clean and simple starter repo using the T3 Stack along with Expo React Native - GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo using the T3 Stack along with Expo React Native
mac.dev
mac.dev17mo ago
ignore the mobile shit but just have your apps
fotoflo
fotoflo17mo ago
fotoflo
fotoflo17mo ago
like this yah ?
mac.dev
mac.dev17mo ago
yea change expo for the scraper
fotoflo
fotoflo17mo ago
thank you! will take a look at how its done here
mac.dev
mac.dev17mo ago
not sure if its right yea I mean , take what I say with a grain of salt, im a junior like I cant even get a dev job lmao
fotoflo
fotoflo17mo ago
each of the apps has a package.json
mac.dev
mac.dev17mo ago
so hopefully someone with a higher status will come along and correct me yea so you'd make a db package and parse it in each app (scraper and nextapp) have you used turbo before ?
fotoflo
fotoflo17mo ago
no, since im not working on mobile apps
mac.dev
mac.dev17mo ago
its not a mobile thing
fotoflo
fotoflo17mo ago
but but will check out how they do the monorepo
mac.dev
mac.dev17mo ago
GitHub
onu/monorepo at master · onugg/onu
Contribute to onugg/onu development by creating an account on GitHub.
mac.dev
mac.dev17mo ago
I've structured my project a similar way it works really well tbh
fotoflo
fotoflo17mo ago
im not fond of the idea of 4 tsconfigs when you make a change to your dashboard, do you commit to the dashboard or to the parent? and where do you keep your schema? Thank you btw
mac.dev
mac.dev17mo ago
either
fotoflo
fotoflo17mo ago
either?
mac.dev
mac.dev17mo ago
in database package yea you can commit in any folder
fotoflo
fotoflo17mo ago
and then you pull the db in as a dep
mac.dev
mac.dev17mo ago
yea
fotoflo
fotoflo17mo ago
which repo does the commit end up getting pushed to? all?
mac.dev
mac.dev17mo ago
just the monorepo folder
fotoflo
fotoflo17mo ago
so only one repo?
mac.dev
mac.dev17mo ago
GitHub
GitHub - onugg/onu
Contribute to onugg/onu development by creating an account on GitHub.
mac.dev
mac.dev17mo ago
? yea its a monorepo
fotoflo
fotoflo17mo ago
so i f you go into /database and make a commit there
mac.dev
mac.dev17mo ago
its a got a monorepo folder and a dev environment
fotoflo
fotoflo17mo ago
and push
mac.dev
mac.dev17mo ago
yea
fotoflo
fotoflo17mo ago
it will commit to /
mac.dev
mac.dev17mo ago
yea like at the latest commit 12 mins ago
fotoflo
fotoflo17mo ago
fotoflo
fotoflo17mo ago
ah right there's no .git in this folder
mac.dev
mac.dev17mo ago
yea its a nice architecture tbh its a bit 'weird' as it kinda decouples next a bit
fotoflo
fotoflo17mo ago
thank you i will explore this today 🙂
mac.dev
mac.dev17mo ago
btw, if you're on the git, drop a star whilst you're there 😉
fotoflo
fotoflo17mo ago
done
mac.dev
mac.dev17mo ago
no worries, if you need any help setting up a turbo repo lmk. Been fucking with em all last night cheers
fotoflo
fotoflo17mo ago
awesome. ill give you a shout after i drop my kid at school 🙂
mac.dev
mac.dev17mo ago
no worries, im coding all day today pepesaxophone
kwargs
kwargs17mo ago
MONOrepo Mono = single
fotoflo
fotoflo17mo ago
@kwargs haha yeah i get that exactly how it works in practice is another story hi @.mac im back 🙂 can i ask you about how this works aka if its not in its own package, how do you reference by package name? it just works? "name": "@onu/database", just this?
fotoflo
fotoflo17mo ago
mac.dev
mac.dev17mo ago
Yea so import like how I’ve imported the packages Import xyz from “@onu/package” Make sure the exported components are in an index file in root dir of the packages
fotoflo
fotoflo17mo ago
ok lets give it a shot 🙂 so @.mac first step was i created a repo and copied /fastmonitor into /fastmonior-monorepo/
fotoflo
fotoflo17mo ago
fotoflo
fotoflo17mo ago
i also changed the name on the fastmonitor package to "name": "@fotoflo/fastmonitor", and i created a package.json for fastmonitor-monorepo
fotoflo
fotoflo17mo ago
fotoflo
fotoflo17mo ago
also doesn't work
mac.dev
mac.dev17mo ago
just copy my tsconfig make sure you're importing the correct package and the package name is correct
mac.dev
mac.dev17mo ago
GitHub
GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo usin...
Clean and simple starter repo using the T3 Stack along with Expo React Native - GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo using the T3 Stack along with Expo React Native
mac.dev
mac.dev17mo ago
just fork this
fotoflo
fotoflo17mo ago
ok started on a different backlog, will try that another day 🙂
mac.dev
mac.dev17mo ago
Ok