Reputation: 181
I have three codebases: web, mobile, and the back-end.
Both the web and mobile codebase will use the same types from the back-end.
The back-end repository is structured as such:
domain/
-- Account.ts
-- Customer.ts
-- Notification.ts
-- Email.ts
-- TextMessage.ts
-- ... etc
...other folders
I need to find a way to get import the types that are inside these files from the mobile and web repositories.
I recently found out about git submodules. It seems to do its job, however, I'd be importing the whole backend to my web and mobile repositories.
Is there a way I can only import the domain
folder, instead of the whole backend repository, which is quite heavy?
Upvotes: 0
Views: 609
Reputation: 6060
No, git submodules only work on whole repositories.
Either externalize the interface ts files into a dedicated shared repo or put everything into one big monorepo. (Or include one in the other)
See also this answer. https://stackoverflow.com/a/5303850/1974021
Upvotes: 1