Skip to content

Commit

Permalink
Merge pull request #255 from Bashamega/fix
Browse files Browse the repository at this point in the history
GH fix
  • Loading branch information
Bashamega authored Aug 8, 2024
2 parents aff888f + fde6406 commit 8bfeefe
Show file tree
Hide file tree
Showing 27 changed files with 547 additions and 542 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "next/core-web-vitals"
}
"extends": "next/core-web-vitals"
}
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ body:
id: steps
attributes:
label: Steps to Reproduce
description: To help us recreate the bug, provide a numbered list of the exact steps taken to trigger the buggy behavior.
value: |
description: To help us recreate the bug, provide a numbered list of the exact steps taken to trigger the buggy behavior.
value: |
If you know the steps, follow the below format and provide steps to reproduce
For example:
Expand Down
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ Fixes #(issue)
- [ ] Any dependent changes have been merged and published in downstream modules

## Screenshots (if applicable):

22 changes: 11 additions & 11 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check & fix styling (prettier)
name: Run Format

on:
push:
Expand All @@ -9,18 +9,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run prettier
uses: permafrost-dev/prettier-docker-ga@main
- name: Set up Node.js
uses: actions/setup-node@v2
with:
args: --config prettier.config.js ./src
node-version: "14" # You can specify the Node.js version here

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
continue-on-error: true
- name: Install dependencies
run: npm install

- name: Run script
run: npm run format:check # Replace with the path to your script
61 changes: 30 additions & 31 deletions .github/workflows/seo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,39 @@ name: Run SEO script
on:
pull_request:
branches:
- '**'

- "**"

jobs:
run-script:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14' # You can specify the Node.js version here

- name: Install dependencies
run: npm install

- name: Run script
run: node scripts/seo.js # Replace with the path to your script

- name: Configure git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Commit changes
run: |
git add .
git commit -m "Automated changes by GitHub Actions"
git push origin HEAD:${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "14" # You can specify the Node.js version here

- name: Install dependencies
run: npm install

- name: Run script
run: node scripts/seo.js # Replace with the path to your script

- name: Configure git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Commit changes
run: |
git add .
git commit -m "Automated changes by GitHub Actions"
git push origin HEAD:${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
2 changes: 0 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
tasks:
- init: npm install && npm run build
command: npm run start


4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ Here're some of the project's best features:
<h2>🛠️ Installation Steps:</h2>

1. **Fork and Clone**:

```bash
git clone https://github.com/Bashamega/WebDevTools.git
cd WebDevTools
```

2. **Install Dependencies**:

```bash
npm install
```
Expand All @@ -37,7 +39,7 @@ Here're some of the project's best features:
```bash
npm run dev
```
<h2>💻 Built with</h2>
<h2>💻 Built with</h2>

Technologies used in the project:

Expand Down
8 changes: 4 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const nextConfig = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
port: '',
pathname: '/**',
protocol: "https",
hostname: "avatars.githubusercontent.com",
port: "",
pathname: "/**",
},
],
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"format": "prettier . --write",
"format:write": "prettier . --write",
"format:check": "prettier . --check",
"lint": "next lint",
"seo": "node scripts/seo.js"
},
Expand Down
2 changes: 1 addition & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
tabWidth: 2,
useTabs: false
useTabs: false,
};
76 changes: 40 additions & 36 deletions scripts/seo.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
const fs = require('fs');
const path = require('path');
const xml2js = require('xml2js');
const fs = require("fs");
const path = require("path");
const xml2js = require("xml2js");

// Define paths relative to the script folder
const toolsFilePath = path.join(__dirname, '../src/db/tools.json');
const sitemapFilePath = path.join(__dirname, '../src/app/sitemap.xml');
const toolsFilePath = path.join(__dirname, "../src/db/tools.json");
const sitemapFilePath = path.join(__dirname, "../src/app/sitemap.xml");

// Read and parse JSON file
const toolsData = JSON.parse(fs.readFileSync(toolsFilePath, 'utf-8'));
const toolsData = JSON.parse(fs.readFileSync(toolsFilePath, "utf-8"));

// Extract tool links from the JSON data
const toolsLinks = toolsData.map(tool => `https://wdt.adambashaahmednaji.com${tool.link}`);
const toolsLinks = toolsData.map(
(tool) => `https://wdt.adambashaahmednaji.com${tool.link}`,
);

// Read and parse the sitemap XML file
const sitemapXml = fs.readFileSync(sitemapFilePath, 'utf-8');
const sitemapXml = fs.readFileSync(sitemapFilePath, "utf-8");
const parser = new xml2js.Parser();

parser.parseString(sitemapXml, (err, result) => {
if (err) throw err;

// Extract existing links from the sitemap
const existingLinks = result.urlset.url.map(url => url.loc[0]);

// Find tools that are not in the sitemap
const newTools = toolsLinks.filter(toolLink => !existingLinks.includes(toolLink));

// If there are new tools, add them to the sitemap
if (newTools.length > 0) {
newTools.forEach(newTool => {
result.urlset.url.push({
loc: [newTool],
lastmod: [new Date().toISOString()],
priority: ["0.80"]
});
});

// Convert the updated sitemap back to XML
const builder = new xml2js.Builder();
const updatedSitemapXml = builder.buildObject(result);

// Write the updated sitemap back to the file
fs.writeFileSync(sitemapFilePath, updatedSitemapXml);
console.log(`Added ${newTools.length} new tools to the sitemap.`);
} else {
console.log('All tools are already present in the sitemap.');
}
if (err) throw err;

// Extract existing links from the sitemap
const existingLinks = result.urlset.url.map((url) => url.loc[0]);

// Find tools that are not in the sitemap
const newTools = toolsLinks.filter(
(toolLink) => !existingLinks.includes(toolLink),
);

// If there are new tools, add them to the sitemap
if (newTools.length > 0) {
newTools.forEach((newTool) => {
result.urlset.url.push({
loc: [newTool],
lastmod: [new Date().toISOString()],
priority: ["0.80"],
});
});

// Convert the updated sitemap back to XML
const builder = new xml2js.Builder();
const updatedSitemapXml = builder.buildObject(result);

// Write the updated sitemap back to the file
fs.writeFileSync(sitemapFilePath, updatedSitemapXml);
console.log(`Added ${newTools.length} new tools to the sitemap.`);
} else {
console.log("All tools are already present in the sitemap.");
}
});
2 changes: 1 addition & 1 deletion src/app/api/users/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function GET(req) {
// Get paginated users from cache
const paginatedUsers = cachedUsers.slice(
startIndex,
startIndex + usersPerPage
startIndex + usersPerPage,
);
return NextResponse.json(paginatedUsers, { status: 200 });
}
2 changes: 1 addition & 1 deletion src/app/components/nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function Nav({ isDarkMode, toggleTheme }) {

const toggleDropdown = (category) => {
setIsDropdownOpen((prevState) =>
prevState === category ? null : category
prevState === category ? null : category,
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function Search({ isDarkMode }) {

useEffect(() => {
const filteredData = toolList.filter(
(item) => item.name.toLowerCase().includes(searchValue.toLowerCase()) // Filter the JSON data based on the search value
(item) => item.name.toLowerCase().includes(searchValue.toLowerCase()), // Filter the JSON data based on the search value
);
setSearchResults(filteredData); // Update the filtered search results
setShowDropdown(searchValue !== "" && filteredData.length > 0); // Show the dropdown if search value is not empty and there are filtered results
Expand Down
2 changes: 1 addition & 1 deletion src/app/contribute/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ContributePage() {
// Fetch new data and update cache
try {
const response = await fetch(
"https://api.github.com/repos/bashamega/webdevtools/contributors"
"https://api.github.com/repos/bashamega/webdevtools/contributors",
);
const data = await response.json();
setContributors(data);
Expand Down
2 changes: 1 addition & 1 deletion src/app/convert/json-yaml/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const YAML = require("json-to-pretty-yaml");
export default function HTML_JSX() {
const [isDarkMode, setIsDarkMode] = useState(false);
const [value, setValue] = useState(
`{"name": "Alice", "age": 25, "email": "[email protected]", "isStudent": false, "courses": ["Math", "Science", "History"]}`
`{"name": "Alice", "age": 25, "email": "[email protected]", "isStudent": false, "courses": ["Math", "Science", "History"]}`,
);
const handleChange = (val) => {
setValue(val);
Expand Down
6 changes: 3 additions & 3 deletions src/app/customizer/JsonGenerator/components/CardForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export default function CardForm({ isDarkMode }) {
responseData,
(_, value) =>
typeof value === "bigint" ? value.toString() : value,
2
2,
),
],
{ type: "application/json" }
{ type: "application/json" },
);
saveAs(blob, "WebDevTools.json");
}
Expand Down Expand Up @@ -188,7 +188,7 @@ export default function CardForm({ isDarkMode }) {
responseData,
(_, value) =>
typeof value === "bigint" ? value.toString() : value,
2
2,
)}
</pre>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/app/customizer/JsonGenerator/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class Categories {
getOptionFunc(category, optionName) {
const categoryData = this.#categories[category];
const option = categoryData?.find(
(specificOption) => specificOption.name === optionName
(specificOption) => specificOption.name === optionName,
);

return option?.func;
Expand Down
2 changes: 1 addition & 1 deletion src/app/customizer/Readme-generator/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ ${license}`;
}; color: ${
isDarkMode ? "white" : "black"
}; }</style></head><body class="markdown-body">${snarkdown(
generateMarkdown()
generateMarkdown(),
)}</body></html>`}
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/customizer/box-shadow-generator/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ const Page = () => {
`box-shadow: ${shadow.hOffset}px ${shadow.vOffset}px ${shadow.blur}px ${
shadow.spread
}px ${shadow.color} ${shadow.inset ? "inset" : ""};`,
[shadow]
[shadow],
);

const tailwindShadowStyle = useMemo(
() =>
`shadow-[${shadow.inset ? "inset_" : ""}${shadow.hOffset}px_${
shadow.vOffset
}px_${shadow.blur}px_${shadow.spread}px_${shadow.color}]`,
[shadow]
[shadow],
);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/customizer/colorPicker/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function ColorPicker() {
return result
? `(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(
result[3],
16
16,
)})`
: null;
};
Expand Down
Loading

0 comments on commit 8bfeefe

Please sign in to comment.