Code for solution-spark-on-aws is written in TypeScript. It is highly recommended you configure your IDE to render TypeScript errors and warnings. To make sure your IDE displays TS properly, see this guide to help
This repository uses Rush as the monorepo manager and pnpm as it's package manager. Please go through the Developer tutorial for Rush usage details
- Clone the repo:
git clone https://github.com/awslabs/solution-spark-on-aws.git
- Move to the correct directory:
cd solution-spark-on-aws
- Install rush:
npm install -g @microsoft/rush
- Run
rush update
- This ensures rush is set-up and ready to go, which includes installing NPM packages as defined in package.json files
- Set up your repo (Follow Prerequisites for development) on your local machine
- Create a feature branch from
develop
:git pull; git checkout develop; git checkout -b feature/<feature>
- Run:
rush check
- Checks each project's package.json files and ensures that all dependencies are of the same version throughout the repository. - Run either of the two:
rush build
- performs incremental build. Seerush build -h
for more optionsrush rebuild
- performs a full clean build. Seerush rebuild -h
for more options
rush test
- runs test and updates code coverage summary in README file for each package. Seerush test -h
for more options- Alternatively you can use:
rush build:test
- single command to performrush build && rush test
for each package. Seerush build:test -h
for more options
rush common-coverage-report
- updates root README file with code coverage summaryrush lint:fix
- automatically fixes eslint problems
NOTE: to install new packages or dependencies: DO NOT USE npm install
. Refer to the documentation for more details. Packages can be added/updated in 2 ways:
rush add -p <PACKAGE_NAME> --caret
. Always use the--caret
or version with caret sign(example-lib@^1.2.3), not doing so by default installs tilde versions(e.g. ~1.2.3). Seerush add -h
for more options.- Update the package.json in your package and run
rush update
.
- Make changes locally (Follow Local Development Flow)
- Ensure you are on a feature branch; from
develop
branch:git pull; git checkout develop; git checkout -b feature/<feature>
- If you are happy with your code and they are passing tests, you can push your changes to your feature branch:
git add -A; git commit
- Note: the commit must be in conventional commits format
git commit
will trigger commitizen and you'll be prompted to fill out any required commit fields at commit time.- We have pre-commit git-hooks. These are used to inspect the snapshot that's about to be committed, to see if you've forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code. We currently support:
- git-secrets prevents you from committing passwords and other sensitive information to a git repository
- prettier is configured to automatically format your code on commit. If you want to format your code manually you can just do:
git add -A; rush prettier
- generate code coverage summary in the root README file
- We have commit-msg git-hook configured:
- A check has been added for commit messages to ensure they are in conventional commits format.
git push
- Further checks are triggered on a Pull Request. Please refer the Pull Requests Process section
Please refer to Contributing via Pull Requests
rush update
- This ensures rush is set-up and ready to go, which includes installing NPM packages as defined in package.json filesrush update --purge
- The--purge
option is used to delete temporary files created by Rush. This is useful if you are having problems and suspect that cache files may be corrupt.
rush install
- Therush install
command installs package dependencies for all your projects, based on the pnpm-lock.yaml file that is created/updated usingrush update
rush add
- Adds a specified package as a dependency of the current project (as determined by the current working directory) and then runsrush update
. Always use the--caret
or version with caret sign(example-lib@^1.2.3), not doing so by default installs tilde versions(e.g. ~1.2.3)rush add -p example-lib --dev --caret
- Adds package to the devDependencies only for the current project (cd /path-to-your-project first)rush add -p example-lib --all --dev --caret
orrush add -p example-lib@^1.2.3 --all --dev
- Caret specifier for SemVer dependenciesrush add -p example-lib --all --dev --caret --make-consistent
- Make all devDependency for a package consistent across all projectsrush add -p [email protected] --all --dev
orrush add -p example-lib --exact --all --dev
- Adds package to all the projects as devDependencies (installs the exact version, use this if there is a need for exact version or else always install dependencies and devDependencies with--caret
option)
rush check
- Checks each project's package.json files and ensures that all dependencies are of the same version throughout the repository.- Triggering commands using
rush
as mentioned above triggers them for all the projects in the monorepo, but if you want to trigger a command just for a specific package then (for example trigger commands just for workbench-core/audit package):- Go to projects root folder -
cd ./workbench-core/audit
- Instead of running commands using
rush
userushx
, example:- run build -
rushx build
- run test -
rushx test
- run lint:fix -
rushx lint:fix
- run build -
- Go to projects root folder -
git checkout develop
git checkout -b < your new branch >
rush install --bypass-policy
(This will install thecinstall
andcupdate
commands)- Start using
rush cinstall
orrush cupdate
instead ofrush install
orrush update
.