Skip to content

Commit

Permalink
✨ feat: generate markdown table
Browse files Browse the repository at this point in the history
  • Loading branch information
Rettend committed Jan 23, 2024
1 parent c88ba13 commit 199a51c
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 49 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [main]
paths:
- src/config.ts
- src/emojis.json
- src/emojis.jsonc

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -33,6 +33,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PAT }}

- name: Install pnpm
uses: pnpm/action-setup@v2
Expand All @@ -46,8 +48,17 @@ jobs:
- name: Install
run: pnpm i --ignore-scripts

- name: Build eemoji
run: pnpm run build

- name: Setup eemoji
run: pnpm run postinstall

- name: Generate Schema
run: pnpm run schema
run: pnpm run gen:schema

- name: Generate Markdown table
run: pnpm run gen:table

- name: Setup Pages
uses: actions/configure-pages@v3
Expand All @@ -58,6 +69,14 @@ jobs:
# only upload the eemoji-config-schema.json file
path: json

- name: Push changes
run: |
git config --local user.email "eemoji-bot@users.noreply.github.com"
git config --local user.name "eemoji-bot"
git add .
git commit -m "Update JSON schema" -a
git push
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
132 changes: 90 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,51 @@ Hi, read the `README.md` first (starting with [Install](#-install)). This emoji
<details open>
<summary><b>Close/open gigantic table</b></summary>

| Type | Subtype | Emoji | Description |
| ---- | ------- | ----- | ----------- |
| `fix` | `.` | 🔧 | general fix |
| `fix` | `typo` | ✏️ | fixed typo in code, docs, ui, etc. |
| `fix` | `bug` | 🐛 | fixed a bug |
| `chore` | `.` | 🗑️ | did some chores |
| `chore` | `release` | 🔖 | new release commit (pairs well with [bumpp](https://github.com/antfu/bumpp)) |
| `chore` | `cleanup` | 🧹 | cleaned up code, removed logs and debug stuff, making things ready for production |
| `chore` | `license` | 📜 | changed the license |
| `chore` | `lint` | 🧼 | fixed linting errors |
| `chore` | `deps` | 📦 | updated dependencies |
| `chore` | `readme` | 📕,📗,📘,📙 | update the README |
| `release` | | 🔖 | |
| `cleanup` | | 🧹 | |
| `lint` | | 🧼 | |
| `deps` | `.` | 📦 | added/removed/changed dependencies |
| `deps` | `up` | ⬆️ | updated dependencies |
| `deps` | `down` | ⬇️ | downgraded dependencies |
| `build` | `.` | 🦺 | work regarding build processes |
| `build` | `deps` | 📦 | dependabot PRs |
| `docs` | `.` | 📝 | documented something |
| `docs` | `readme` | 📕,📗,📘,📙 | |
| `feat` | `.` || introduced a new feature |
| `feat` | `enhance` | 💎 | made something a little better (but still include in release notes) |
| `enhance` | | 💎 | made something a little better (omit from release notes) |
| `test` | | 🧪 | worked on tests |
| `refactor` | | ♻️ | refactored code, achieved the same with less |
| `init` &#124; `initial` | | 🎉 | started a new project! |
| `perf` | || improved performance, achieve the same faster |
| `config` | | ⚙️ | changed configuration files |
| `style` | | 🎨 | design changes, style changes |
| `ui` | | 🪟 | worked on UI, UX or layout |
| `text` | | 💬 | changed string literals, text content |
| `breaking` | | 💥 | *special type:* will be used if the commit contains an exclamation mark (`!`), indicates breaking changes |
| `revert` | || revert a commit |
| `ci` | | 🦾 | changed workflow files, CI stuff |
| `i18n` | | 🌐 | translated something |
| `wip` | | 🚧 | wildcard type, works for anything |
| `add` | || |
| `remove` | || |
<!-- emoji table start -->
| Type | Subtype | Emoji | Description |
| -------------- | --------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `fix` | `.` | 🔧 | general fix |
| `fix` | `typo` | ✏️ | fixed typo in code, docs, ui, etc. |
| `fix` | `bug` | 🐛 | fixed a bug |
| `chore` | `.` | 🗑️ | did some chores |
| `chore` | `release` | 🔖 | new release commit (pairs well with [bumpp](https://github.com/antfu/bumpp)) |
| `chore` | `cleanup` | 🧹 | cleaned up code, removed logs and debug stuff, made everyting ready for production |
| `chore` | `license` | 📜 | changed the license |
| `chore` | `lint` | 🧼 | fixed linting errors |
| `chore` | `deps` | 📦 | changed dependencies |
| `chore` | `readme` | 📕,📗,📘,📙 | update the README |
| `release` | | 🔖 | |
| `cleanup` | | 🧹 | |
| `lint` | | 🧼 | |
| `deps` | `.` | 📦 | added/removed/changed dependencies |
| `deps` | `up` | ⬆️ | updated dependencies |
| `deps` | `down` | ⬇️ | downgraded dependencies |
| `build` | `.` | 🦺 | work regarding build processes |
| `build` | `deps` | 📦 | dependabot PRs (see the prefix in the [dependabot.yml](./.github/dependabot.yml) file on how to add an emoji to our friend's PRs) |
| `docs` | `.` | 📝 | documented something |
| `docs` | `readme` | 📕,📗,📘,📙 | |
| `feat` | `.` || introduced a new feature |
| `feat` | `enhance` | 💎 | made something a little better (but still include in release notes) |
| `enhance` | | 💎 | made something a little better (omit from release notes) |
| `test` | | 🧪 | worked on tests |
| `refactor` | | ♻️ | refactored code, achieved the same with less |
| `init|initial` | | 🎉 | started a new project! |
| `up` | | ⬆️ | |
| `down` | | ⬇️ | |
| `perf` | || improved performance, achieved the same faster |
| `config` | | ⚙️ | changed configuration files |
| `security` | | 🔒 | |
| `style` | | 🎨 | design changes, style changes |
| `ui` | | 🪟 | worked on UI, UX or layout |
| `text` | | 💬 | changed string literals, text content |
| `breaking` | | 💥 | *special type:* will be used if the commit contains an exclamation mark (`!`), indicates breaking changes |
| `revert` | || revert a commit |
| `ci` | | 🦾 | changed workflow files, CI stuff |
| `i18n` | | 🌐 | translated something |
| `wip` | | 🚧 | wildcard type, works for anything |
| `add` | || |
| `remove` | || |
<!-- emoji table end -->

</details>

Expand Down Expand Up @@ -161,7 +166,7 @@ eemoji run

## 🦾 Config

The default configuration is here: [emojis.json](./src/emojis.json) and the [Emojis](#-emojis) section.
The default configuration is here: [emojis.jsonc](./src/emojis.jsonc) and the [Emojis](#-emojis) section.

This is used if no config file is found in the project.

Expand Down Expand Up @@ -329,9 +334,52 @@ If it continues to fail to work, try this as well and restart everything:

- Run this command once: `git config stash.usebuiltin false`

## 🤝 Contributing

### Adding a new emoji

To add a new emoji to the default config or modify it, please open an issue first.

Then, if it's okay:

- modify the [emojis.jsonc](./src/emojis.jsonc) file, add the emoji and a description
- The Action will take care of the rest (copying it to the json, updating the readme emoji table and the json schema)
- open a PR

### Creating a new emoji preset

SOON™️

### Development

> [!TIP]
> Install pnpm and [ni](https://github.com/antfu/ni).
>
> ```bash
> npm i -g pnpm @antfu/ni
> ```
```bash
ni
```
Use the `stub` script to run have the latest changes build:

```bash
nr stub
```

Run commands with the `dev` script:

```bash
nr dev <command>
```

Also check the [TODO](./TODO.md) file and open an issue first if you want to work on something.

## 💛 Badge

[![eemoji](https://img.shields.io/badge/😎%20eemoji-fccf1d?style=for-the-badge)]( https://github.com/Rettend/eemoji)
[![eemoji](https://img.shields.io/badge/😎%20eemoji-fccf1d?style=for-the-badge)](https://github.com/Rettend/eemoji)

```md
[![eemoji](https://img.shields.io/badge/😎%20eemoji-fccf1d?style=for-the-badge)](
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
- [x] make the consola start and success logs sane in the cleanup command
- [x] investigate speed, prepare script for init
- [x] move bin scripts to `scripts` folder and also build them from typescript
- [ ] Generate the readme emoji table from `emojis.json` (jsonc for description)
- [x] Generate the readme emoji table from `emojis.jsonc` (jsonc for description)
- [ ] try astro and create a small website explaining which emoji to use and when, + stuff
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import antfu from '@antfu/eslint-config'

export default antfu()
export default antfu({
ignores: ['src/**/*.jsonc'],
})
1 change: 1 addition & 0 deletions json/eemoji-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"down": "⬇️",
"perf": "",
"config": "⚙️",
"security": "🔒",
"style": "🎨",
"ui": "🪟",
"text": "💬",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"typecheck": "tsc --noEmit",
"schema": "tsx scripts/schema",
"gen:schema": "tsx scripts/schema",
"gen:table": "tsx scripts/readme-table",
"release": "bumpp && unbuild && pnpm publish",
"postinstall": "node ./bin/eemoji.mjs init -c none",
"preuninstall": "node ./bin/eemoji.mjs cleanup",
Expand All @@ -63,9 +64,11 @@
"@vitest/coverage-istanbul": "^1.2.1",
"@vitest/ui": "^1.2.1",
"bumpp": "^9.2.0",
"comment-json": "^4.2.3",
"eemoji": "^1.1.5",
"eslint": "^8.56.0",
"lint-staged": "^15.2.0",
"markdown-table": "^3.0.3",
"simple-git-hooks": "^2.9.0",
"tsx": "^4.7.0",
"typescript": "5.3.3",
Expand Down
45 changes: 45 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 199a51c

Please sign in to comment.