- (Optional) Install
nvm
for your operating system: https://github.com/nvm-sh/nvm - Install
node
(Use version number you need)nvm node --lts
- Install
pnpm
from: https://pnpm.io/installation
E.g.curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
- Install
@microsoft/rush
: https://rushjs.io/pages/developer/new_developer/ E.g. npm install -g @microsoft/rush - Create empty git repository and clone it on local machine, and cd into it.
E.g.git clone https://github.com/<user>/<repo>.git
Run the following commands to create backend package:
mkdir -p pkgs/api
cd pkgs/api
Follow instructions from Heft guide to setup backend project: https://rushstack.io/pages/heft_tutorials/getting_started/
E.g. copy package.json
, start.ts
, tsconfig.json
as shown to api directory.
Run the following commands:
pnpm install --save-dev @rushstack/heft
pnpm install --save-dev typescript
pnpm install --save-dev --save-exact @types/node
pnpm install --global @rushstack/heft
Add following lines to the "scripts" section in package.json
"build": "heft build --clean",
"start": "node lib/start.js"
Now you can build and run the project using following commands:
pnpm run build
pnpm run start
Install Rush: https://rushjs.io/pages/maintainer/setup_new_repo/
npm install -g @microsoft/rush
rush init
Edit rush.json
and add an entry like this under the "projects" section:
"projects": [
{
"packageName": "pkgs",
"projectFolder": "pkgs/api"
}
]
Change name
field in package.json
"name": "pkgs"
Run the following commands to build and run the project using rush
cd <repo-root>
rush update
cd pkgs/api
rushx build
rushx start