Skip to content

Commit

Permalink
feat: v1 ready with events structures, listening, and component struc…
Browse files Browse the repository at this point in the history
…tures
  • Loading branch information
sarthakjdev authored Jun 1, 2024
2 parents 3d66259 + 064b39f commit aedd569
Show file tree
Hide file tree
Showing 80 changed files with 3,286 additions and 141 deletions.
98 changes: 98 additions & 0 deletions .github/COMMIT_CONVENTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 📘 Commit and Branch Conventions

At `wapi.go`, we follow a strict set of conventions for commit messages and branch names to ensure that our repository stays organized, and our commit history remains crystal clear. Here's a guide on our conventions:

---

## 🚀 Conventional Commits

Conventional commits ensure our commit messages are clear and useful.

📋 **Benefits**:

- 📜 Automatic changelog generation
- 🔢 Simplified versioning
- 🧐 Improved readability of commit messages

### 📄 Commit Message Format

Each commit message should follow this format:

```
<type>(<scope>): <short summary>
<BLANK LINE>
<optional body>
<BLANK LINE>
<optional footer>
```

- **`<type>`**: Describes the purpose of the commit:
- 🆕 `feat`: Introduces a new feature
- 🐞 `fix`: Addresses a bug
- 📚 `docs`: Updates documentation
- 🎨 `style`: Code that relates to styling, not affecting logic
- 🔧 `refactor`: Refactoring existing code
- 🚀 `perf`: Improving performance
- 🧪 `test`: All about tests
- 🧽 `chore`: Maintenance tasks
- **`<scope>`**: (Optional) Specifies which part of the codebase is affected.

- **`<short summary>`**: A concise summary of the changes made.

### 📝 Examples:

1. Introducing a new feature:

```
feat(auth): implement social login
```

2. Addressing a bug:

```
fix(button): resolve alignment issue
```

---

## 🌲 Conventional Branching

A standardized naming system for branches helps everyone quickly understand a branch's purpose.

### 📄 Branch Naming Format

Branch names should adhere to:

```
<type>/<short-description>
```

- **`<type>`**: Purpose of the branch, common ones being:

- 🆕 `feature`: Developing a new feature.
- 🐞 `fix`: Addressing a bug.
- 🧽 `chore`: Regular maintenance tasks.
- 🔥 `hotfix`: Immediate fixes, often tied to production issues.
- 📚 `docs`: Documentation enhancements.

- **`<short-description>`**: A brief, kebab-cased (words separated by hyphens) description of the branch's objective.

### 📝 Examples:

1. Developing a new user dashboard:

```
feature/user-dashboard
```

2. Resolving a login issue:

```
fix/login-issue
```

---

🙌 Thanks for contributing to `wapi.go`! By adhering to these conventions, we're making our repository a better place. If you're new, welcome aboard, and if you've been here, thanks for sticking around!

---
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord server
url: https://discord.gg/PytnZqWpeQ
about: Please visit our Discord server for questions and support requests.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ""
labels: ""
assignees: ""
---
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Please describe the changes this PR makes and why it should be merged:**

**Status and versioning classification:**
18 changes: 18 additions & 0 deletions .github/workflows/auto-comment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Auto Comment on New Issue Label
# This workflow is triggered when a label is added to an issue.
on:
issues:
types: [labeled]

jobs:
processLabelAction:
name: Process Label Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Process Label Action
uses: hramos/respond-to-issue-based-on-label@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: ".github/label-actions.yml"
16 changes: 16 additions & 0 deletions .github/workflows/formatTag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Format Tag'
description: 'Formats a git tag to remove potentially prefixes'
inputs:
tag:
description: 'The input tag'
required: true
outputs:
subpackage:
description: 'Whether this tag is a subpackage tag'
package:
description: 'The package string that was extracted from this tag'
semver:
description: 'The semver string that was extracted from this tag'
runs:
using: node20
main: ./index.js
22 changes: 22 additions & 0 deletions .github/workflows/formatTag/formatTag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export function formatTag(tag) {
const parsed = /(?:^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(
tag
);
const parsedPackage = /(?<package>.*)@v?-?.*/.exec(tag);

if (parsed?.groups) {
const isSubPackage = typeof parsed.groups.package === "string";
const pkg = isSubPackage
? parsed.groups.package
: parsedPackage?.groups?.package ?? "wapi.go";
const semver = parsed.groups.semver;

return {
isSubpackage: isSubPackage,
package: pkg,
semver,
};
}

return null;
}
11 changes: 11 additions & 0 deletions .github/workflows/formatTag/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getInput, setOutput } from "@actions/core";
import { formatTag } from "./formatTag.js";

const tag = getInput("tag", { required: true });
const parsed = formatTag(tag);

if (parsed) {
setOutput("subpackage", parsed.isSubpackage);
setOutput("package", parsed.package);
setOutput("semver", parsed.semver);
}
30 changes: 30 additions & 0 deletions .github/workflows/validate-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check PR title

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
- review_requested
- auto_merge_enabled

concurrency:
group: check-pr-title-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
validate-pr-title:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
statuses: write
timeout-minutes: 10
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
success-state: "PR Title follows the Conventional Commits spec"
failure-state: "PR Title does not follow the Conventional Commits spec"
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
node_modules
.vscode/
config.toml
node_modules
dist/*
22 changes: 22 additions & 0 deletions .husky/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# # Check for conventional commit format
# commit_msg=$(cat "$1")
# # Modified regex to allow for more valid formats
# conventional_commit_regex='^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(\(.+\))?(!)?(:)(\s.*)?$'

# echo "$conventional_commit_regex"

# if ! [[ "$commit_msg" =~ $conventional_commit_regex ]]; then
# echo "ERROR: Commit message does not adhere to Conventional Commits format:"
# echo "$commit_msg"
# echo "$($commit_msg =~ $conventional_commit_regex )"
# exit 1
# fi

# If not a merge commit, require commit to be signed off
if [ ! -e .git/MERGE_MSG ] && ! grep -q "^Signed-off-by: " "$1"; then
echo >&2 "Commit message must be signed off with your user name and email."
echo >&2 "To sign off your commit, add the -s flag to the git commit command."
exit 1
fi
10 changes: 10 additions & 0 deletions .husky/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

branch=$(git symbolic-ref HEAD)

if [ "$branch" = "refs/heads/master" ]; then
echo "\\033[31mDirect commit to master is not allowed.\\033[0m"
exit 1
fi

go fmt ./...
8 changes: 8 additions & 0 deletions .husky/hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh

branch=$(git symbolic-ref HEAD)

if [ "$branch" = "refs/heads/master" ]; then
echo "\\033[31mDirect push to master is not allowed.\\033[0m"
exit 1
fi
Loading

0 comments on commit aedd569

Please sign in to comment.