-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add package.json and license * chore: add lint, husky and prettier * docs: add contributing guide * feat: add pull request template * chore: setup hello world with react, redux toolkit and react router * docs: add readme * ci: add relase and deploy workflows * chore: squash
- Loading branch information
1 parent
981e3ca
commit 64ad1a3
Showing
95 changed files
with
11,167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
# Matches the exact files either package.json or .travis.yml | ||
[*.{json,yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
coverage/ | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
jest: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint', 'react'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
'prettier', | ||
], | ||
rules: { | ||
'@typescript-eslint/no-inferrable-types': 'off', | ||
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }], | ||
'prefer-const': 'off', | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: "Use Dependencies" | ||
|
||
description: "Checks if the dependencies have been cached with the hash of the yarn.lock file." | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "🔧 Setup" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 'lts/*' | ||
cache: 'yarn' | ||
- name: "💾 Cache dependencies" | ||
uses: actions/cache@v3 | ||
id: cache-dependencies | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }} | ||
- name: "📦 Install" | ||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | ||
run: yarn install --ignore-scripts | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- | ||
The title should summarise what the purpose of this change, | ||
⚠️**NOTE:** The title must conform to the conventional commit message format outlined in CONTRIBUTING.md document, at the root of the project. This is to ensure the merge commit to the main branch is picked up by the CI and creates an entry in the CHANGELOG.md. | ||
--> | ||
|
||
# Description | ||
<!-- Describe your changes in detail --> | ||
|
||
# Type of change | ||
<!-- What type of change does this change introduce? Put an 'x' in all the boxes that apply. --> | ||
|
||
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] 🏗️ Build configuration (CI configuration, scaffolding etc.) | ||
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue) | ||
- [ ] 📝 Documentation update(s) | ||
- [ ] 📦 Dependency update(s) | ||
- [ ] 👩🏽💻 Improve developer experience | ||
- [ ] ⚡ Improve performance | ||
- [ ] ✨ New feature (non-breaking change which adds functionality) | ||
- [ ] ♻ Refactor | ||
- [ ] ⏪ Revert changes | ||
- [ ] 🧪 New tests or updates to existing tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: "Deploy" | ||
|
||
on: | ||
release: | ||
types: [released] # triggered on main branch releases | ||
|
||
jobs: | ||
install: | ||
name: "Install" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
|
||
deploy: | ||
name: "Deploy" | ||
needs: install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
- name: "🏗️ Build" | ||
run: yarn build | ||
- name: "🚀 Deploy" | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
personal_token: ${{ secrets.WRITE_REPOS_TOKEN }} | ||
publish_branch: gh-pages | ||
publish_dir: ./dist | ||
user_name: agoralabs-bot | ||
user_email: tech@agoralabs.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: "Pull Request Checks" | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
## | ||
# install | ||
## | ||
|
||
install: | ||
name: "Install" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
|
||
## | ||
# lint, build and test | ||
## | ||
|
||
lint: | ||
name: "Lint" | ||
needs: install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
- name: "👕 Lint" | ||
run: yarn lint | ||
|
||
build: | ||
name: "Build" | ||
needs: install | ||
runs-on: ubuntu-latest | ||
environment: development | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
- name: "🏗️ Build" | ||
run: yarn build | ||
|
||
test: | ||
name: "Test" | ||
needs: install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
- name: "🧪 Test" | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: "Release" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: "Release" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.9.0' | ||
cache: yarn | ||
- name: "📦 Install" | ||
run: yarn global add semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/npm @semantic-release/github @semantic-release/git @semantic-release/changelog | ||
- name: "🔖 Release" | ||
env: | ||
# appears on the release commits | ||
GIT_AUTHOR_NAME: agoralabs-bot | ||
GIT_AUTHOR_EMAIL: tech@agoralabs.sh | ||
GIT_COMMITTER_NAME: agoralabs-bot | ||
GIT_COMMITTER_EMAIL: tech@agoralabs.sh | ||
# used to push the release commit and create the tags | ||
GITHUB_TOKEN: ${{ secrets.WRITE_REPOS_TOKEN }} | ||
run: semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS", | ||
"pre-commit": "lint-staged" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
'**/*.{js,json,ts,tsx}': (filenames) => | ||
`prettier --write ${filenames.join(' ')}`, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
coverage/ | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"endOfLine": "lf", | ||
"arrowParens": "always", | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"branches": "main", | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": ["package.json", "CHANGELOG.md"], | ||
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"releasedLabels": ["🚀 released"] | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Contributing guide | ||
|
||
### Table of contents | ||
|
||
* [1. Commit messages](#1-commit-messages) | ||
* [1.1. Type](#11-type) | ||
* [1.2. Scope](#12-scope) | ||
* [1.3. Subject](#13-subject) | ||
* [2. Pull requests](#2-pull-requests) | ||
* [2.1 Branching strategy](#21-branching-strategy) | ||
* [2.2 Merge to main](#22-merge-to-main) | ||
|
||
## 1. Commit messages | ||
|
||
Commit messages lean heavily towards the convention set out by [conventional commits][conventional-commits]. | ||
|
||
Each commit message must be in the format that includes a **type**, an optional **scope** and a **subject**: | ||
``` | ||
type(scope?): subject #scope is optional | ||
``` | ||
|
||
Limit the whole message to 72 characters or less! | ||
|
||
Example: | ||
|
||
``` | ||
build(terraform): burn it all down | ||
``` | ||
|
||
### 1.1. Type | ||
|
||
Must be one of the following: | ||
|
||
* **build**: Changes that affect the build system or external dependencies (example scopes: npm) | ||
* **chore**: Changes that don't really fall under any other type | ||
* **ci**: Changes to the CI configuration files and scripts | ||
* **docs**: Documentation only changes | ||
* **feat**: A new feature | ||
* **fix**: A bug fix | ||
* **perf**: A code change that improves performance | ||
* **refactor**: A code change that neither fixes a bug nor adds a feature | ||
* **revert**: Revert a previous commit | ||
* **test**: Adding missing tests or correcting existing tests | ||
|
||
### 1.2. Scope | ||
|
||
A scope may be provided to a commit’s type, to provide additional contextual information and is contained within a parenthesis | ||
|
||
### 1.3. Subject | ||
|
||
The subject contains a succinct description of the change: | ||
|
||
* use the present tense ("Add feature" not "Added feature") | ||
* use the imperative mood ("Move cursor to..." not "Moves cursor to...") | ||
* don't capitalise the first letter | ||
* don't use a fullstop (.) at the end. <- Not this | ||
|
||
<sup>[Back to top ^](#table-of-contents)</sup> | ||
|
||
## 2. Pull requests | ||
|
||
### 2.1 Branching strategy | ||
|
||
This repo uses a [trunk-based][trunk-based] development workflow. There is one permanent branch, the `main` branch, which contains stable code and all releases are based off of any commits to this branch. | ||
|
||
In order to make updates, a feature branch is made from the `main` branch and when it is ready to be merged, it can be brought back into the `main` branch which trigger a release (if necessary). | ||
|
||
<sup>[Back to top ^](#table-of-contents)</sup> | ||
|
||
### 2.2 Merge to main | ||
|
||
1. Create a branch from the `main` branch and use the convention: `<feat|fix|ci>/name-of-issue`. | ||
2. Once the code is ready to be merged into `main`, open a pull request. | ||
> ⚠️**NOTE:** The title must conform to the conventional commit message format outlined above. This is to ensure the merge commit to the main branch is picked up by the CI and creates a release (if necessary). | ||
3. To merge the PR, use the "Squash and merge" option. This is to keep the commit history clean and keep the commits on `main` with a 1:1 ratio with previous PRs. | ||
|
||
<sup>[Back to top ^](#table-of-contents)</sup> | ||
|
||
[conventional-commits]: https://www.conventionalcommits.org | ||
[trunk-based]: https://www.atlassian.com/continuous-delivery/continuous-integration/trunk-based-development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Agora Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Oops, something went wrong.