A boilerplate with some sane defaults for building TypeScript libraries to be consumed by both browsers and Node.js projects.
- What's Included
- Setting Up Your Development Environment
- Setting Up CircleCI
- Setting Up Travis CI
- Setting Up GitLab CI
- Setting Up Codecov
- Setting Up SonarQube
- License
This project includes tooling for
- TypeScript to add static typing to JavaScript
- Jest for automated testing
- EditorConfig for consistent coding styles
- Prettier for code formatting
- TSLint for linting per prettier rules
- rollup.js for module bundling and tree-shaking
With easy integrations for
- CircleCI for continuous integration
- Travis CI for continuous integration
- GitLab CI for continuous integration
- Codecov for code coverage reports
- SonarQube to ensure code quality
It is recommended that you install the following extensions for your editor:
If you're using VSCode all the recommended extensions are included in this extension pack.
Login to CircleCI and select "Add Projects" in the left-hand sidebar.
Scroll down until you find your project and click "Set Up Project".
For Operating System choose Linux and then click the "Start Building" button located at the bottom of the page.
If you aren't using SonarQube you'll want to remove && ./sonarqube.sh
from the run command in .circleci/config.yml.
If you would like to use SonarQube make sure you setup SonarQube following the instructions below.
If you don't setup or disable SonarQube then CircleCI will fail with the message
You're only authorized to execute a local (preview) SonarQube
analysis without pushing the results to the SonarQube server.
Please contact your SonarQube administrator.
Login to https://travis-ci.org/ and click the "+" next to "My Repositories".
Click the toggle next to your project.
And that's it! Your project will build next time you push to your repository.
If your code is hosted on GitLab:
- From within your GitLab repository, click on "CI/CD" in the left-hand sidebar and click "Run Pipeline" then "Create Pipeline".
If your code is hosted on GitHub:
- From https://gitlab.com/ click "New project" and select "CI/CD for external repo".
Click "GitHub" and then click "Connect" next to your project.
Login to https://codecov.io/gh and give them access to your git hosting account.
Copy your Upload Token and add it with the key CODECOV_TOKEN
as an environment variable to the CI service of your choice.
Here are some links to docs for setting up environment variables with the CI services this project supports:
- CircleCI - Setting an Environment Variable in a Project
- Travis CI - Defining Variables in Repository Settings
- GitLab CI - Variables
Congrats! After your next CI run you will see coverage reports.
Reminder: Don't forget to update the badge in README.md to point to your project in codecov
Login to https://sonarcloud.io/ and click "Create new project".
Select your repository and click "Create".
Enter a name for your token and click "Generate".
Copy the token that was generated and add it as an environment variable with the key SONAR_LOGIN
to your CI project.
If you're not using CircleCI then update your CI run script to call ./sonarqube.sh
after build.
After your next CI run you will see code quality analysis in SonarQube.
MIT