diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..d7e96f2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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"). diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..3ef23d7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/icon_request.md b/.github/ISSUE_TEMPLATE/icon_request.md new file mode 100644 index 0000000..cd3f6e6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/icon_request.md @@ -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. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..2fd8179 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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) diff --git a/package-lock.json b/.github/scripts/package-lock.json similarity index 98% rename from package-lock.json rename to .github/scripts/package-lock.json index e344598..520613d 100644 --- a/package-lock.json +++ b/.github/scripts/package-lock.json @@ -1,13 +1,13 @@ { - "name": "@pphatdev/icons", + "name": "@pphatdev/icons-scripts", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@pphatdev/icons", + "name": "@pphatdev/icons-scripts", "version": "1.0.0", - "license": "ISC", + "license": "MIT", "devDependencies": { "@types/node": "^20.0.0", "tsup": "^8.0.0", @@ -588,9 +588,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -605,9 +602,6 @@ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -622,9 +616,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -639,9 +630,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -656,9 +644,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -673,9 +658,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -690,9 +672,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -707,9 +686,6 @@ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -724,9 +700,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -741,9 +714,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -758,9 +728,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -775,9 +742,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -792,9 +756,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ diff --git a/package.json b/.github/scripts/package.json similarity index 54% rename from package.json rename to .github/scripts/package.json index 2ba17be..11545e7 100644 --- a/package.json +++ b/.github/scripts/package.json @@ -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": "", @@ -16,4 +17,4 @@ "tsx": "^4.7.0", "typescript": "^5.0.0" } -} \ No newline at end of file +} diff --git a/tsconfig.json b/.github/scripts/tsconfig.json similarity index 87% rename from tsconfig.json rename to .github/scripts/tsconfig.json index f05e981..255ceab 100644 --- a/tsconfig.json +++ b/.github/scripts/tsconfig.json @@ -8,9 +8,9 @@ "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "outDir": "./dist", - "rootDir": "./src" + "rootDir": "./" }, "include": [ - "src/**/*" + "./**/*" ] -} \ No newline at end of file +} diff --git a/src/update-category.ts b/.github/scripts/update-category.ts similarity index 100% rename from src/update-category.ts rename to .github/scripts/update-category.ts diff --git a/.github/workflows/update-category.yml b/.github/workflows/update-category.yml index 4c30a2a..3921dfb 100644 --- a/.github/workflows/update-category.yml +++ b/.github/workflows/update-category.yml @@ -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: @@ -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' diff --git a/.gitignore b/.gitignore index 1eae0cf..aed35c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -dist/ +.github/scripts/dist/ node_modules/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2de2378..f107078 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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`. diff --git a/README.md b/README.md index 7a6c1b7..45f59cb 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/brands.json b/brands.json index 4246cba..d085a56 100644 --- a/brands.json +++ b/brands.json @@ -969,4 +969,4 @@ "target": "brands/youtubeshorts.json", "type": "brands" } -] \ No newline at end of file +]