-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - GitHub issue and PR templates, and contribution guidelines (#59)
* docs(github templates): added first draft of bug and feature issue templates * docs(bug-report): added a field asking if the bug has been reported before * docs(pull request): added a template for pull requests * refactor(github templates): moved md templates to .github/ISSUE_TEMPLATES and changed to snake_case this is the expected location and casing of these files * docs(style_guide.md): first draft of style guide, could be less subjective and not as strict * docs(*): added style guideline and contribution guideline * fix(pull_request.md): fixed name, pull_request_template was expected instead of pull_request * docs(*): made changes to the new markdown files based on feedback * docs(contributing.md): added branchlint, npm script for branchlint, and updated contributing.md contributing.md now includes info about branchlint and the step to run it
- Loading branch information
Showing
8 changed files
with
314 additions
and
4 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,2 @@ | ||
/** @type {import("@branchlint/cli").TBranchlintConfig} */ | ||
module.exports = require('@branchlint/default-config'); |
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 @@ | ||
### Subject | ||
Bug - subject of the issue | ||
|
||
### Description | ||
Elaborate on the subject, motivation, and context. | ||
|
||
### Has the bug been reported before | ||
(Y/N) - Provide a link to the issue. | ||
|
||
### Expected Behaviour | ||
What should happen? | ||
|
||
### Actual Behaviour | ||
What happens instead? | ||
|
||
### Environment | ||
* Node version: | ||
* Device, operating system and its version: | ||
* | ||
* Browser and its version: | ||
* | ||
* Version of the affected apps and packages: | ||
* | ||
|
||
### Steps to Reproduce | ||
1. Use a list format to describe which commands to run, and which actions to take. | ||
|
||
### Any possible solutions | ||
Describe the possible solutions you've considered, refer to files and lines of code when possible. | ||
|
||
### If the bug is confirmed, would you be willing to submit a PR | ||
(Y/N) | ||
|
||
### Examples and references | ||
Links, logs, screenshots, and other resources to help us understand the issue. |
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,17 @@ | ||
### Subject | ||
Feature - subject of the issue | ||
|
||
### Description | ||
Elaborate on the subject, motivation, and context. | ||
|
||
### Alternatives | ||
Can you achieve the same result doing it in an alternative way? Is the alternative considerable? | ||
|
||
### Does the feature have an issue or an open Canny ticket | ||
(Y/N) - Provide a link to the issue and Canny ticket. | ||
|
||
### If the feature request is approved, would you be willing to submit a PR | ||
(Y/N) | ||
|
||
### Examples and references | ||
Links, screenshots, and other resources to help us understand the issue. |
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 @@ | ||
### Description | ||
Elaborate on the subject, motivation, and context. | ||
|
||
### Related issues | ||
* Provide a link to each related issue. | ||
|
||
### Breaking changes | ||
* Describe the breaking changes that this pull request introduces. | ||
|
||
### How these changes were tested | ||
* Describe the tests that you ran to verify your changes, including devices, operating systems, browsers and versions. | ||
|
||
### Examples and references | ||
* Links, screenshots, and other resources related to this change. | ||
|
||
### Checklist | ||
- [] I have read the [contribution guidelines](CONTRIBUTING.md) of this project | ||
- [] I have read the [style guidelines](STYLE_GUIDE.md) of this project | ||
- [] I have performed a self-review of my own code | ||
- [] I have commented my code, particularly in hard-to-understand areas | ||
- [] I have made corresponding changes to the documentation | ||
- [] My changes generate no new warnings and errors | ||
- [] New and existing tests pass locally with my changes |
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,94 @@ | ||
# Contributing to Ballerine | ||
|
||
Thank you for investing your time in contributing to our project! | ||
|
||
Before moving forward please read our [code of conduct](CODE_OF_CONDUCT.md), and our [style guide](STYLE_GUIDE.md). | ||
|
||
## What to contribute | ||
|
||
We accept contributions in different sizes and varied difficulty, from documentation and typos, to features and bug fixes. To see what you could help with, report an issue, or suggest a feature see [issues](https://github.com/ballerine-io/ballerine/issues) and [discussions](https://github.com/ballerine-io/ballerine/discussions). | ||
|
||
## Need help? | ||
|
||
- Join our [Discord](https://discord.gg/e2rQE4YygA) or [Slack](https://join.slack.com/t/ballerine-oss/shared_invite/zt-1iu6otkok-OqBF3TrcpUmFd9oUjNs2iw) | ||
- Head to our [documentation](README.md) | ||
- Contact us at [[email protected]](mailto:[email protected]) | ||
|
||
## Prerequisites | ||
|
||
```bash | ||
node: ">=16.15.1" | ||
pnpm: ">=7.11.0" | ||
``` | ||
|
||
## Setup | ||
1. Clone Ballerine's repository | ||
```bash | ||
git clone [email protected]:ballerine-io/ballerine.git | ||
``` | ||
2. Navigate to the directory and install dependencies | ||
```bash | ||
cd ballerine && pnpm install | ||
``` | ||
3. Start the dev server | ||
```bash | ||
pnpm dev | ||
``` | ||
4. Open the page in your [browser](http://localhost:3000/) | ||
|
||
## Project structure | ||
|
||
``` | ||
├── apps # end user facing, interacts with packages and services | ||
├── community # ui packs, ui components, and vendor integrations made by the community | ||
├── packages # shared logic between apps, community, sdks, and services | ||
├── sdks # dev kits for developers to create experiences and applications, interacts with apps | ||
(can load an app into a certain platform such as web or native) | ||
└── services # backend microservices, services communicate through a communication layer | ||
(i.e REST/HTTP requests), and may communicate with a database | ||
``` | ||
|
||
## First commit | ||
|
||
### Branch name | ||
This project makes use of [branchlint](https://github.com/Omri-Levy/branchlint) to ensure that all branch names follow a consistent format with a CLI to help with the process of creating a new branch, setting upstream, and checking out to the new branch. | ||
|
||
### Commit message | ||
This project makes use of tools like [commitizen](https://github.com/commitizen/cz-cli) and [commitlint](https://github.com/conventional-changelog/commitlint) to ensure that all commits follow a consistent commit message format with a CLI to help with the process of pushing a commit. | ||
|
||
1. Create a new branch, set upstream, and checkout to the new branch | ||
|
||
Make sure to run this NPM script in the root of the monorepo and follow the CLI prompts. | ||
|
||
```bash | ||
pnpm branchlint | ||
``` | ||
|
||
2. Make your changes | ||
|
||
```bash | ||
pnpm changeset | ||
``` | ||
|
||
3. Push a formatted commit | ||
|
||
Make sure to run this NPM script in the root of the monorepo and follow the CLI prompts. | ||
|
||
```bash | ||
pnpm commit | ||
``` | ||
|
||
4. Push the commit | ||
```bash | ||
git push | ||
``` | ||
|
||
5. GitHub Actions | ||
|
||
Now that the changes are pushed to the remote branch, GitHub Actions will run workflows for building, testing, linting, and formatting. Before creating a pull request, make sure that all workflows have passed. | ||
|
||
6. Create a pull request | ||
|
||
When creating a pull request, make sure to follow the pull request template. | ||
|
||
|
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,64 @@ | ||
# Style Guide | ||
|
||
## Tools | ||
|
||
This repository makes use of EditorConfig, ESLint, and Prettier to enforce a consistent coding style. These tools are configured under `.editorconfig`, `packages/config/eslintrc.base.cjs`, and `packages/config/prettierrc.base.cjs` respectively. Linting can be done locally by running `pnpm lint:fix` and formatting by running `pnpm format` from the root of the monorepo. | ||
|
||
## General guidelines | ||
|
||
- Code indentation of 2 spaces. | ||
- Maximum line length of 100 characters. | ||
- Use single quotes for strings. | ||
- Functional programming first - avoid side effects and mutations. | ||
- Clarity and readability in mind, descriptive names and comments. | ||
|
||
## TypeScript & JavaScript | ||
- Use TypeScript over JavaScript. | ||
- TypeScript interfaces, enums, and types should live in a types.ts, enums.ts, or interfaces.ts file respectively (src level or co-located to usage). | ||
- Use modern ES6+ syntax. | ||
- Use inline named exports over default exports i.e `export const isExported = true;`. | ||
- Use `const` over `let` where possible. | ||
- Use arrow functions over function expressions. | ||
- Avoid over 2 levels of nesting, utilize early returns. | ||
- Avoid `for` loops, use `Array.prototype.forEach` or `Array.prototype.map` instead. | ||
|
||
## Naming conventions | ||
|
||
- kebab-case for file and directory names. | ||
- PascalCase for class names, TypeScript enums, interfaces, types, and UI components (Svelte, JSX, etc.) file and directory names. | ||
- camelCase for variables, functions, and methods. | ||
- Prefix interfaces with `I`, enums with `E`, and types with `T`. i.e `interface IMyInterface`, `enum EMyEnum`, `type TMyType`. | ||
- Prefix private variables, properties, and methods with `__`. | ||
- Prefix unused variables and parameters with `_`. | ||
- A function that returns a value should be prefixed with `get` i.e `getUser`. | ||
- A function that sets a value should be prefixed with `set` i.e `setUser`. | ||
- A function that makes an HTTP request should be prefixed with `fetch` i.e `fetchUser`. | ||
- A function that preforms a mutation should be prefixed with `create`, `update`, or `delete` i.e `createUser`, `updateUser`, `deleteUser`. | ||
- A function that returns a boolean should be prefixed with `checkIs` i.e `checkIsMobile`. | ||
- A variable that holds a boolean should be prefixed with `is` i.e `isMobile`. | ||
|
||
## Project structure | ||
|
||
### UI components (Svelte, JSX, etc.) | ||
|
||
This repository uses the [Atomic Design](https://bradfrost.com/blog/post/atomic-web-design/) methodology to organize UI components and strives for co-location of files a component owns such as its styling and tests. | ||
|
||
``` | ||
├── atoms/ | ||
└───── Button/ | ||
├── Button.svelte | ||
├── Button.test.svelte (an implementation Button.svelte to be imported | ||
by Button.test.ts) | ||
├── Button.test.ts | ||
└── types.ts | ||
``` | ||
|
||
### Non-UI | ||
|
||
``` | ||
├── utils/ | ||
└───── get-user/ | ||
├── get-user.ts | ||
├── get-user.test.ts | ||
└── types.ts | ||
``` |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.