Medentee backend packages
This is monorepo packages repo, managed by Lerna.
All instructions provided for
npm
package manager. Feel free to useyarn
, if preferred.
Install
Install dependencies
npm run boot
Add new repo dependency
Read Lerna add command.
lerna add <package>[@version] [--dev] [--exact] [--peer]
Add Package dependency
By adding new dependency to the Package, please consider to user peer
dependency with *
version. It will be useful in the target projects, where your Package will be used.
lerna add package-1 --scope=package-2 --peer
If it's needed to add one package as dependency of another one, add appropriate reference
in the tsconfig.json
file of a target package
"references": [
{
"path": "../enums"
}
]
New Package
In order to create a new Package you can use generate
script. Follow provided instructions then:
npm run generate
Scrip generate
uses SAO to scaffold new package based on template
. See template folder for initial data.
Commands
This repo contains a set of predefined scripts, designed to help developers in the development of packages.
Command: Commit
Use the following script to commit changes into GIT repo:
npm run cm
This command uses git-cz
to help organize and support change-logs in the GIT repo.
Command: Format
Quick format of only changed files
npm run format
Command: Format All
Format of all the files in the repo
npm run format:all
Command: Scripts
In order to simplify management of multiple packages this repo uses NPS
utility files are
package-scrips*.js
View list of packages
npm run scripts:list
Build all packages
npm run scripts:build
Clean all packages
npm run scripts:clean
Rebuild all packages
npm run scripts:rebuild
To perform specific script on particular package, use the following structure:
npm run scripts <command>.<package>
For example:
npm run scripts build.models
Command: Publish
npm run pub
Command performs publishing of all changed packages into NPM registry.
First of all, create personal .npmrc
file in the root folder with a private token. The target NPM registry and auth token will be used from this file.
.npmrc
file added to.gitignore
, but make sure that your personal token not commited into the repo.
Command: Pack .tar.gz package for local usage
cd packages/{{package-name}} && yarn pack