kitchentemplate
v0.0.3
Published
Template for a cross plattform react app
Downloads
1
Maintainers
Readme
About
A template for creating npm packages
How to setup your project
- Clone this repo or "use as template" and upload it to GitHub
- Setup GitHub Secrets
- Get your Sonar credentials
- Configure and run the setup script
- Configure Quality Gate in Sonar
2. GitHub Secrets
If not done by your organisation you will need to define the following secrets for your repository or your organisation:
- GITHUB_TOKEN
- NPM_TOKEN
(Note: You will also need to add a secret for Sonar in step 3.)
3. Sonar
Sonar Cloud will be used to analyse our project in terms of code-quality: https://en.wikipedia.org/wiki/Software_quality Therefore we need to get credentials for our project. Create a Sonar-Account if you dont have one (it is free).
- Visit: https://sonarcloud.io/
- Select your profile or organisation.
- Select the GitHub project: https://sonarcloud.io/projects/create
- Configure "With GitHub Actions"
- Follow Step 1: Add the secret to your repository
- "Skip" step 2
- Copy and paste the values of "sonar.projectKey" and "sonar.FireboltCasters" into the setup.json
4. Setup Script
For the correct upload to npm and sonar and keep everything working correctly, the package.json file needs to be setup correctly. This can be tedious, so that you only need to configure the setup.json file to match your project:
{
"package": {
"name": "<kitchentemplate>",
"description": "<packageDescription>",
"keywords": [
"npm-template"
],
"repositoryURL": "https://github.com/FireboltCasters/npm-template.git",
"author": "Steffen Droppelmann",
"contributors": [
{
"name": "Nils Baumgartner",
"email": "[email protected]",
"url": "https://github.com/FireboltCasters"
},
{
"name": "Steffen Droppelmann",
"email": "[email protected]",
"url": "https://github.com/FireboltCasters"
}
],
"license": "MIT"
},
"sonar": {
"projectKey": "ExampleKey",
"FireboltCasters": "ExampleOrganization"
}
}
Then, run the following command: (Note: After running this command, the setup files will be deleted)
npm run setup
5. Configure Quality Gate
Push your current project to GitHub. After that you should see on GitHub under "Actions" that some GitHub-Actions are being executed. The Sonar-Action will firstly fail with:
ERROR: QUALITY GATE STATUS: FAILED
This is because we haven't told Sonarcloud how it should measure the Quality Gate.
- Visit your project at: https://sonarcloud.io/projects/
- Select: "Set New Code definition"
- Select the code definition for your match. We recommend: "Previous version"
- Re-Upload your some minor change in your GitRepo to the master
Contributors
The FireboltCasters