Tuesday, 31 July 2018

I have ten individual node packages (microservices) in ten separate repos. I would like to merge them into one, unified package. Each individual package would also depend on the unified package. Possible?

Ten microservices, some of which depend on each other (eg. User, TodoItem, ...). Currently, each microservice has its own repo and npm package. I would like to merge them into one npm package while maintaining individual repos (open to opinions on that choice, though)Each microservice will provide interface code so that other microservices can call it//Code owned by the TodoItem microservice. Can be called from other microservices // TodoItem/index.ts const addTodo = (someDescription: string) => {...} const removeTodo = (todoId: string) => {...} export { addTodo, removeTodo } Currently, I can import the TodoItem code from my private npm package:import TodoItem from '@user/TodoItem' However, I would like to use the "aws-sdk" approach, where all of my packages are bundled:import { TodoItem } from '@user/my-app-sdk'; The "my-app-sdk" node package would really just import the various microservices and then export them. Something like://my-app-sdk/index.ts import TodoItem from '@user/TodoItem' import User from '@user/User' export { TodoItem, User } Is this possible and practical? Bad design? Am I in for circular dependency hellscape?

Submitted July 31, 2018 at 09:10PM by 8solutions

No comments:

Post a Comment