Skip to content

Commit d1e5b6b

Browse files
authored
Merge branch 'main' into main
2 parents d69bd38 + 7bf8424 commit d1e5b6b

File tree

921 files changed

+79297
-1478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

921 files changed

+79297
-1478
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ updates:
88
- package-ecosystem: "npm" # Using npm for Docusaurus
99
directory: "/"
1010
schedule:
11-
interval: "weekly"
11+
interval: "daily" # Changed to daily from weekly
12+
# open-pull-requests-limit: 0 # Disable version updates for npm dependencies
13+
labels:
14+
- 'pr: dependencies'
1215

1316
- package-ecosystem: "github-actions"
1417
directory: "/"
1518
schedule:
1619
interval: "weekly"
20+
open-pull-requests-limit: 99
21+
labels:
22+
- 'pr: dependencies'
1723

1824
- package-ecosystem: "docker"
1925
directory: "/"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Auto Content on Labels
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request:
7+
types: [opened]
8+
9+
jobs:
10+
addContent:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check for Labels
14+
id: check_labels
15+
run: echo "::set-output name=labels::${{ toJson(github.event.issue.labels) }}"
16+
17+
- name: Add Guidance Comment
18+
if: ${{ contains(steps.check_labels.outputs.labels, 'dsa-solution') }}
19+
uses: actions/github-script@v7
20+
with:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
script: |
23+
const issueOrPR = github.context.payload.issue || github.context.payload.pull_request;
24+
const comment = `
25+
Hello there! 🌟 It looks like you've added the \`dsa-solution\` label.
26+
Please refer to our guidance on Data Structures & Algorithms solutions here: [DSA Solution Guidance](https://github.com/orgs/CodeHarborHub/discussions/3369#discussion-6940372).
27+
Thank you!
28+
`;
29+
github.issues.createComment({
30+
issue_number: issueOrPR.number,
31+
owner: github.context.repo.owner,
32+
repo: github.context.repo.repo,
33+
body: comment
34+
});

.github/workflows/auto_assign.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Lighthouse Report
2+
3+
on:
4+
pull_request_target:
5+
branches:
6+
- main
7+
- codeharborhub-v**
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
lighthouse-report:
18+
permissions:
19+
pull-requests: write # for marocchino/sticky-pull-request-comment
20+
name: Lighthouse Report
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4.1.7
25+
26+
- name: Use Node.js
27+
uses: actions/setup-node@v4.0.3
28+
with:
29+
node-version: 20
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Build website
35+
run: npm run build
36+
37+
- name: Audit URLs using Lighthouse
38+
id: lighthouse_audit
39+
uses: treosh/lighthouse-ci-action@12.1.0
40+
with:
41+
urls: |
42+
http://localhost:3000
43+
http://localhost:3000/docs
44+
http://localhost:3000/docs/category/javascript
45+
http://localhost:3000/courses
46+
http://localhost:3000/courses/category/reactjs
47+
http://localhost:3000/dsa-problems
48+
http://localhost:3000/dsa-problems/category/leetcode-problems
49+
http://localhost:3000/dsa-solutions
50+
http://localhost:3000/dsa-solutions/category/leetcode-solutions
51+
http://localhost:3000/blog
52+
http://localhost:3000/showcase
53+
http://localhost:3000/community
54+
http://localhost:3000/docs/tags
55+
http://localhost:3000/product
56+
configPath: ./.github/workflows/lighthouserc.json
57+
uploadArtifacts: true
58+
temporaryPublicStorage: true
59+
60+
- name: Format lighthouse score
61+
id: format_lighthouse_score
62+
uses: actions/github-script@v7.0.1
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
script: |
66+
const results = ${{ steps.lighthouse_audit.outputs.manifest }}
67+
const links = ${{ steps.lighthouse_audit.outputs.links }}
68+
const createLighthouseReport = (await import(`${process.env.GITHUB_WORKSPACE}/admin/scripts/formatLighthouseReport.js`)).default;
69+
const comment = createLighthouseReport({ results, links });
70+
core.setOutput("comment", comment);
71+
72+
- name: Add Lighthouse stats as comment
73+
id: comment_to_pr
74+
uses: marocchino/sticky-pull-request-comment@v2.9.0
75+
with:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
number: ${{ github.event.pull_request.number }}
78+
header: lighthouse
79+
message: ${{ steps.format_lighthouse_score.outputs.comment }}

.github/workflows/lighthouserc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"startServerCommand": "npm run serve",
5+
"startServerReadyPattern": "Serving",
6+
"startServerReadyTimeout": 10000,
7+
"numberOfRuns": 1,
8+
"settings": {
9+
"skipAudits": [
10+
"robots-txt",
11+
"canonical",
12+
"tap-targets",
13+
"is-crawlable",
14+
"works-offline",
15+
"offline-start-url"
16+
]
17+
}
18+
}
19+
}
20+
}

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Welcome to CodeHarborHub! Your gateway to top-notch tech education. **Tired of l
88

99
<a href="https://www.producthunt.com/posts/codeharborhub"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=464236&theme=light" alt="CodeHarborHub - Tired&#0032;of&#0032;limitations&#0063;&#0032;CodeHarborHub&#0032;shatters&#0032;them&#0046; | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
1010

11-
[![Website](https://img.shields.io/website?url=https%3A%2F%2Fwww.codeharborhub.live%2F)](https://www.codeharborhub.live/)
11+
[![Website](https://img.shields.io/website?url=https%3A%2F%2Fcodeharborhub.github.io%2F)](https://codeharborhub.github.io/)
1212
[![License](https://img.shields.io/github/license/CodeHarborHub/codeharborhub)](https://github.com/CodeHarborHub/codeharborhub/blob/main/LICENSE)
1313
[![Contributors](https://img.shields.io/github/contributors/CodeHarborHub/codeharborhub)](https://github.com/CodeHarborHub/codeharborhub/graphs/contributors)
1414
[![slack](https://img.shields.io/badge/slack-CodeHarborHub-brightgreen.svg?logo=slack)](https://join.slack.com/t/codeharborhub/shared_invite/zt-2mana2uz5-oUQqFAnLqoywHjB9fXTGpA)
@@ -24,11 +24,16 @@ At CodeHarborHub, our mission is clear: to provide accessible and comprehensive
2424
- **Inspiring Showcases**: Explore inspiring showcases of real-world projects and innovative web solutions.
2525
- **Engaging Community**: Connect with a vibrant community of developers, share knowledge, and collaborate on projects.
2626

27+
## Announcement:
28+
29+
**New Project:** Loan Calculator! Check it out on [LinkedIn](https://www.linkedin.com/posts/ajay-dhangar_loan-calculator-activity-7221402171957768195-1WYs?utm_source=share&utm_medium=member_desktop) 🚀
30+
2731
## Discord Channel for GSSoC 2024 Contributors
2832

2933
Now, resolve your all doubts and communicate with our all contributors.
3034

31-
[![](https://img.shields.io/badge/Discord-5865F2.svg?style=for-the-badge&logo=Discord&logoColor=white)](https://discord.com/channels/1231112132595028008/1238672287037919333)
35+
[![](https://img.shields.io/badge/Discord-5865F2.svg?style=for-the-badge&logo=Discord&logoColor=white)](https://discord.com/channels/1231112132595028008/1238672287037919333) [![Follow on LinkedIn](https://img.shields.io/badge/Follow%20on-LinkedIn-blue?style=for-the-badge&logo=linkedin)](https://www.linkedin.com/comm/mynetwork/discovery-see-all?usecase=PEOPLE_FOLLOWS&followMember=ajay-dhangar)
36+
3237

3338
## Getting Started
3439

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// @ts-check
2+
3+
/**
4+
* @typedef {Record<'performance' | 'accessibility' | 'best-practices' | 'seo',
5+
* number>} LighthouseSummary
6+
*/
7+
8+
/** @type {Record<keyof LighthouseSummary, string>} */
9+
const summaryKeys = {
10+
performance: "Performance",
11+
accessibility: "Accessibility",
12+
"best-practices": "Best Practices",
13+
seo: "SEO",
14+
};
15+
16+
/** @param {number} rawScore */
17+
const scoreEntry = (rawScore) => {
18+
const score = Math.round(rawScore * 100);
19+
const scoreIcon = score >= 90 ? "🟢" : score >= 50 ? "🟡" : "🔴";
20+
return `${scoreIcon} ${score}`;
21+
};
22+
23+
/**
24+
* @param {string} url
25+
* @returns {module:url.URL}
26+
*/
27+
function createURL(url) {
28+
try {
29+
return new URL(url);
30+
} catch (e) {
31+
throw new Error(`Can't create URL for string=${url}`, { cause: e });
32+
}
33+
}
34+
35+
/**
36+
* @param {Object} param0
37+
* @param {string} param0.url
38+
* @param {LighthouseSummary} param0.summary
39+
* @param {string} param0.reportUrl
40+
*/
41+
const createMarkdownTableRow = ({ url, summary, reportUrl }) =>
42+
[
43+
`| [${createURL(url).pathname}](${url})`,
44+
.../** @type {(keyof LighthouseSummary)[]} */ (
45+
Object.keys(summaryKeys)
46+
).map((k) => scoreEntry(summary[k])),
47+
`[📄](${reportUrl}) |`,
48+
].join(" | ");
49+
50+
const createMarkdownTableHeader = () => [
51+
["| URL 🌐", ...Object.values(summaryKeys), "📊 |"].join(" | "),
52+
["|---", ...Array(Object.keys(summaryKeys).length).fill("---"), "---|"].join(
53+
"|",
54+
),
55+
];
56+
57+
/**
58+
* @param {Object} param0
59+
* @param {Record<string, string>} param0.links
60+
* @param {{url: string, summary: LighthouseSummary}[]} param0.results
61+
*/
62+
const createLighthouseReport = ({ results, links }) => {
63+
const tableHeader = createMarkdownTableHeader();
64+
const tableBody = results.map((result) => {
65+
const testUrl = /** @type {string} */ (
66+
Object.keys(links).find((key) => key === result.url)
67+
);
68+
const reportPublicUrl = /** @type {string} */ (links[testUrl]);
69+
70+
return createMarkdownTableRow({
71+
url: testUrl,
72+
summary: result.summary,
73+
reportUrl: reportPublicUrl,
74+
});
75+
});
76+
const comment = [
77+
"### ⚡️ Lighthouse Report for the Deploy Preview of this PR 🚀",
78+
"",
79+
`🔗 Site: [CodeHarborHub](https://github.com/CodeHarborHub/codeharborhub.github.io) | [Live Site](https://codeharborhub.github.io/)`,
80+
"",
81+
...tableHeader,
82+
...tableBody,
83+
"",
84+
];
85+
return comment.join("\n");
86+
};
87+
88+
export default createLighthouseReport;

admin/scripts/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "chh-scripts",
3+
"description": "These are the scripts used in various places of CodeHarborHub to automate tasks.",
4+
"private": true,
5+
"license": "MIT",
6+
"type": "module",
7+
"version": "1.0.0",
8+
"main": "formatLighthouseReport.js",
9+
"scripts": {
10+
"test": "echo \"Error: no test specified\" && exit 1"
11+
},
12+
"author": "ajay-dhangar"
13+
}

assets/Aho_Corasick_algo.png

11.2 KB
Loading

assets/Burrows_Wheeler_Transform.png

30 KB
Loading

assets/Manachers_Algorithm.png

76.6 KB
Loading

0 commit comments

Comments
 (0)