🗃️Microservices and libs
Since we are in a Node.js multiproject, each lib or microservice has a package.json
file. As in any other Node project, this file contains all the package's informations and scripts.
Microservice configuration
Every microservice's package.json
file is similar and contains the same scripts. The main properties that are different are the name
and dependencies
.
Example:
As you can see there are serveral scripts defined in each microservice:
typecheck: this script runs
tsc
without emitting files (see TypeScript project configuration for more information). This will simply check for type errors.build: this will run a global esbuild configuration file to bundle the entire microservice in a single file (head to Build configuration to learn more)
lint: runs
eslint
on the microservice's source directory. This will use the project root's.eslint.yml
file
Lib configuration
One important thing that is different from microservice is the main
and types
properties. These two points to the TypeScript entrypoint of the lib (usually src/index.ts
) in order to resolve the lib as a dependency for a microservice (in this way esbuild can build and include the lib in the bundle of a microservice that uses that lib).
Thanks to esbuild, libs do not have a build script. This makes not possibile to build a only the single lib by default.
Last updated