Skip to content

Instantly share code, notes, and snippets.

@tuanngominh
Last active October 18, 2019 08:35
Show Gist options
  • Save tuanngominh/3dc4df463518e362e48f0bc31baccafd to your computer and use it in GitHub Desktop.
Save tuanngominh/3dc4df463518e362e48f0bc31baccafd to your computer and use it in GitHub Desktop.
Migrate out of NX workspace study

monorepo for multiple languages apps

Goal:

  • Every apps work with each other in a single commit.
  • No need to manage versions between different apps in different repos.
  • Each language has its own advantages in one area like python is good for data crunching, typescript is working well with nosql db and only good option in angular.

Challenge:

Development flow for apps in different languages.

Each language like js has npm for running command like lint, code format, test, install dependency; nx, lerna for monorepo.

One option can be using best tool for specific language: npm for node app, pipenv for python app. Then use another tool to manage all the apps. It can be shell, or a tool (node, pipenv) which can call shell script.

Move applications out of nx workspace ( https://nx.dev/ )

Each app will need its owned package.json.

Each app's tsconfig.json should still inherit from single root tsconfig.json so the typescript version and other config are the same and in a single place. Same with:

  • jest.config.js
  • tslint.json

All cloud functions will be in one app.

Issues:

Share typing between cloud function and web.

Option 1 As CF only allow to reference running code inside its own app folder so we make sure no implementation reference.

  • Using lerna or something similar which symlinks the type package.
  • Using interface instead of class.
  • Not use enum.

Is this easy or possible to not use lerna if multiple apps depend on each others?

Option 2 Or have a build step to copy code inside CF app. This will make typescript code hint doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment