Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug Report
about: Create a report to help us improve the icon registry
title: 'Bug: [Short description]'
labels: 'bug'
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. Run command '...'
3. See error

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

## Environment:
- OS: [e.g. macOS, Windows, Linux]
- Package Version [e.g. v1.0.0]

## Additional context
Add any other context about the problem here. (e.g. "The JSON file generated by the GitHub action is malformed").
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: 'Feature: [Short description]'
labels: 'enhancement'
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. (e.g. support for a new registry structure or build script change)

## 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.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/icon_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Icon Request
about: Suggest a new icon to be added to the registry
title: 'Icon Request: [Brand/Icon Name]'
labels: 'enhancement, icon request'
assignees: ''
---

## Icon Name
What is the name of the brand or regular icon you'd like us to add?
(e.g., `facebook`, `my-brand`)

## Category
Is this a `brand` icon or a `regular` icon?

## Icon Source / Website
Please provide a link to the official brand website or official brand kit (if applicable). This helps us ensure we are using the correct and highest quality SVG.

## Why should this icon be added?
Briefly explain why this icon would be a good addition to the registry.

## Have you searched for existing requests?
- [ ] Yes, I have searched the existing issues to ensure this hasn't already been requested.
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Description

Please include a summary of the new icon(s) or changes you are proposing.

- What icon are you adding?
- Where did the icon come from (e.g., official brand kit, custom)?
- Is this fixing an existing icon?

## Checklist

Please make sure your Pull Request follows these guidelines:

- [ ] I have placed my new or updated `.json` icon file in the correct category directory (`brands/` or `regular/`).
- [ ] My file uses a lowercase name with hyphens for spaces (e.g., `my-brand.json`).
- [ ] I have **NOT** manually edited the root `brands.json` or `regular.json` files (our GitHub Actions workflow will handle this automatically!).
- [ ] My JSON configuration is valid and follows the schema.
- [ ] I have read the [CONTRIBUTING.md](../CONTRIBUTING.md) guide.

## Additional Notes
(Add any additional context or screenshots if necessary here)
45 changes: 3 additions & 42 deletions package-lock.json → .github/scripts/package-lock.json

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

11 changes: 6 additions & 5 deletions package.json → .github/scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@pphatdev/icons",
"name": "@pphatdev/icons-scripts",
"version": "1.0.0",
"description": "KFE Icons repository",
"private": true,
"description": "KFE Icons repository scripts",
"main": "index.js",
"scripts": {
"build": "tsup src/update-category.ts --format esm --clean",
"update-category": "tsx src/update-category.ts"
"build": "tsup update-category.ts --format esm --clean",
"update-category": "tsx update-category.ts"
},
"keywords": [],
"author": "",
Expand All @@ -16,4 +17,4 @@
"tsx": "^4.7.0",
"typescript": "^5.0.0"
}
}
}
6 changes: 3 additions & 3 deletions tsconfig.json → .github/scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"rootDir": "./src"
"rootDir": "./"
},
"include": [
"src/**/*"
"./**/*"
]
}
}
File renamed without changes.
17 changes: 16 additions & 1 deletion .github/workflows/update-category.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ name: Auto Update Category JSON

on:
push:
branches:
- master
- main
paths:
- '**/*.json'
- '!*.json' # Exclude root json files from triggering the workflow to prevent infinite loops
pull_request:
branches:
- master
- main
paths:
- '**/*.json'
- '!*.json'
release:
types: [published, created]
workflow_dispatch:

jobs:
Expand All @@ -21,15 +33,18 @@ jobs:
node-version: '20'

- name: Install dependencies
working-directory: .github/scripts
run: npm install

- name: Build Script
working-directory: .github/scripts
run: npm run build

- name: Execute the script
run: node dist/update-category.mjs
run: node .github/scripts/dist/update-category.mjs

- name: Commit and Push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: auto update category json files"
file_pattern: '*.json'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist/
.github/scripts/dist/
node_modules/
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ First off, thank you for considering contributing to the `@pphatdev/registry` ic
## How to Contribute

### 1. Adding a New Icon
We welcome additions of new brand icons. To add an icon, please follow these steps:
We welcome additions of new brand or regular icons. To add an icon, please follow these steps:

1. **Optimize your SVG:** Ensure your SVG is properly formatted, minified, and does not contain unnecessary tags or metadata.
2. **Add to the `brands/` folder:** Place your optimized `.svg` file into the `brands/` directory. Ensure the filename is lowercase and uses hyphens for spaces (e.g., `my-brand.svg`).
3. **Update the Registry (`index.json`):** Add a new entry to the `index.json` file in the root directory following this format:
```json
{
"name": "icon-name",
"target": "brands/icon-name.svg"
}
1. **Add your Icon JSON:** Place your newly created or updated `.json` file into the appropriate category folder (`brands/` or `regular/`).
2. **Do Not Update Root JSONs Manually:** You do **not** need to manually update `brands.json` or `regular.json`. We have a GitHub Actions workflow that automatically scans the directories and rebuilds these root index files for you whenever a PR is created or merged!
3. **Test your changes locally (Optional):** If you want to preview the compiled registry locally before submitting your PR, you can run the build script:
```bash
cd .github/scripts
npm install
npm run build
cd ../..
node .github/scripts/dist/update-category.mjs
```
4. **Test your changes:** Verify that the JSON format in `index.json` is still valid and that the path to your new SVG is correct.

### 2. Submitting a Pull Request
1. Fork the repository and create your branch from `main`.
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ pphat add facebook -f svg
## Adding New Icons

To add a new icon to the registry:
1. Add the optimized SVG file to the `brands/` directory.
2. Add a new entry to `index.json` with the format:
```json
{
"name": "icon-name",
"target": "brands/icon-name.svg"
}
```
1. Add your new icon `.json` file to the appropriate category directory (e.g., `brands/` or `regular/`).
2. That's it! You do not need to manually update `brands.json` or `regular.json`. A GitHub Actions workflow automatically compiles these index files when a Pull Request is opened or code is merged.

For more detailed information, please see our [CONTRIBUTING.md](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion brands.json
Original file line number Diff line number Diff line change
Expand Up @@ -969,4 +969,4 @@
"target": "brands/youtubeshorts.json",
"type": "brands"
}
]
]
Loading