0

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

oh... right! thanks very much. i guess externalizing the types into a private npm package sounds best. do you know if there is a way to create a npm package out of only the domain folder? instead of a npm package will the whole repository
No, sorry I have never published a npm package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.