Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate lerna #3

Merged
merged 31 commits into from
Aug 2, 2021
Merged

Integrate lerna #3

merged 31 commits into from
Aug 2, 2021

Conversation

setaman
Copy link
Contributor

@setaman setaman commented Jul 27, 2021

@DaTebe, @anatoliynovo

This PR brings massive refactoring to our core services and introduces lerna as a management tool for the dependencies. I'll give a brief introduction here. The details will be captured in the docs.

  • You have to use lerna for dependency management and linking to local common packages.
    Install lerna globally with npm i -g lerna or use it through npx lerna ...

  • lerna manages packages in a sub directory (/packages by default), core/services/ in our case. Therefore, lerna config file and package.json are located in core/. ⚠️So the working directory for lerna commands is core ⚠️

  • To install all dependencies run lerna bootstrap --hoist. This command installs deps for all services and hoists common packages in core/node_modules.
    For specific service run lerna bootstrap --hoist --scope=<service-name>

  • To add a dependency: lerna add <package-name> [--scope=<service-name>]

  • To remove node_modules: lerna clean [--scope=<service-name>]

  • ⚠️ npm commands like install will fail as @diva/common package is not in any registry now

  • To run the service you can use lerna or just normally execute the npm scripts

So what has changed:

  • Repeatedly written code has been moved to @diva/common. These includes express server setup, JSON schema validation, Kafka messages validation and messaging in general, connections with Mongo and Elasticsearch, CRUD operations on entities and other frequently used utilities. These modules were rewritten to be flexible and generalized as possible.
  • ESLint configuration has been moved to @diva/eslint-config. All service use this config
  • Code base of the services reduced by 40-60%
  • Dockerfile's now have 2 stages: bootstrap the app with lerna and build executable binary, copy and execute binary.
  • Docker images size reduced 145 -> 85 MB

We need a strong testing and debugging on this as many things have changed and i have not tested every single endpoint yet.

@setaman setaman marked this pull request as ready for review July 29, 2021 14:48
@setaman setaman added type: enhancement minor incremental enhancement INTERNAL labels Jul 29, 2021
@setaman setaman self-assigned this Jul 29, 2021
@setaman setaman merged commit 362a8ea into dev Aug 2, 2021
@setaman setaman deleted the integrate-lerna branch August 2, 2021 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement minor incremental enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant