Skip to content

Commit

Permalink
Directory structure clean-up (lucavallin#184)
Browse files Browse the repository at this point in the history
* update directory structure for clarity

* update deps

* remove deprecated @next/font

---------
  • Loading branch information
lucavallin committed Sep 28, 2023
1 parent 5b16ce5 commit 6d51cf9
Show file tree
Hide file tree
Showing 16 changed files with 1,775 additions and 6,406 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**The repository has**:

- [ ] At least three issues with the `good first issue`, or other labels specified in `firstissue.json` (see `labels` and the end).
- [ ] At least three issues with the `good first issue`, or other labels specified in `config.json` (see `labels` and the end).
- Link:
- [ ] At least 10 contributors.
- [ ] At least 1000 stars.
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ on:

# Allows you to trigger this workflow from another workflow
workflow_call:

# Cron schedule, everyday at midnight
schedule:
- cron: '0 0 * * *'

# Cron schedule, everyday at midnight
schedule:
- cron: "0 0 * * *"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand Down Expand Up @@ -63,16 +62,14 @@ jobs:
run: npm run build
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
- name: Update firstissue.json
- name: Update config.json
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: update firstissue.json [skip actions]
commit_message: update config.json [skip actions]
branch: json-updates
file_pattern: 'firstissue.json'
file_pattern: "config.json"
skip_checkout: true
push_options: '--force'
- name: Static HTML export with Next.js
run: npm run export
push_options: "--force"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
NODE_ENV: "development"
- name: Static HTML export with Next.js
run: npm run export
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
Expand Down
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You're welcome to add a new project in First Issue, just follow these steps:

- To maintain the quality of projects in First Issue, please make sure the GitHub repository you want to add meets the following criteria:

- It has at least three issues with the `good first issue` label or other labels defined in `firstissue.json` (see `labels` and the end).
- It has at least three issues with the `good first issue` label or other labels defined in `config.json` (see `labels` and the end).

- It has at least 10 contributors.

Expand All @@ -26,39 +26,41 @@ You're welcome to add a new project in First Issue, just follow these steps:

- It is actively maintained (last update less than 1 month ago).

- Add your repository's path (in the format `owner/name` and lexicographic order) to [firstissue.json](firstissue.json).
- Add your repository's path (in the format `owner/name` and lexicographic order) to [config.json](config.json).

- Create a new pull-request. Please add the link to the issues page of the repository in the PR description. Once the pull request is merged, the changes will be live on [firstissue.dev](https://firstissue.dev/).

## Help us grow!
## Help us grow

Navigating open-source projects can be quite overwhelming for begineers and experienced contributers alike. First-issue looks to solve this problem by providing a platform that serves as a starting point for those looking to get started with open-source or those who are looking to get into a new project.

#### How to help
## How to help

It's easy! The more people who know about [FirstIssue.dev](http://firstissue.dev), the better. There are various ways you can help us grow:
- Contribute to `Awesome` lists. Everyone uses them. They are community built resources on a wide variety of topics. Find one that relates to getting started with open-source and get [FirstIssue.dev](http://firstissue.dev) put in there. You could even create one yourself!

- Contribute to `awesome` lists. Everyone uses them. They are community built resources on a wide variety of topics. Find one that relates to getting started with open-source and get [FirstIssue.dev](http://firstissue.dev) put in there. You could even create one yourself!
- Blog about us. Have you ever used [FirstIssue.dev](http://firstissue.dev) and do you like what we are doing? Share your experience on platforms like:
- [Medium](https://medium.com)
- [Dev.to](https://dev.to)
- [FreeCodeCamp](https://freecodecamp.org)
- [ItsFoss](https://itsfoss.com)
- [Reddit](https://reddit.com/)
- [Discord](https://discord.com)
- [Medium](https://medium.com)
- [Dev.to](https://dev.to)
- [FreeCodeCamp](https://freecodecamp.org)
- [ItsFoss](https://itsfoss.com)
- [Reddit](https://reddit.com/)
- [Discord](https://discord.com)
- Reach out to bloggers, tech influencers, developer and open-source on Twitter and YouTube, for example. Try and get [FirstIssue.dev](http://firstissue.dev/) mentioned in a video or tweet!
- Make a guide, like a blog post or a video. Teaching is a great way to learn: share your experience getting started in open-source and mention us in your content 😉
- Be creative! This is a non-comprehensive list of ideas. Once you have written an article, recorded a video, or have gotten us mentioned somewhere, come back here and add your name along with a link to the media to the [list of contributors below](https://github.com/lucavallin/first-issue#credits)!
- Be creative! This is a non-comprehensive list of ideas. Once you have written an article, recorded a video, or have gotten us mentioned somewhere, come back here and let us know!

## How does it work?

First Issue is a static website that uses Next.js, React and Typescript. The data shown on the website is loaded from the [generated.json](generated.json) file, which is generated by [generate.ts](generate.ts) by querying the GitHub API to fetch issues from the repositories listed in [firstissue.json](firstissue.json). The labels defined in [firstissue.json](firstissue.json) are used to filter issues for the repositories.
First Issue is a static website that uses Next.js, React and Typescript. The data shown on the website is loaded from the [data.json](data/data.json) file, which is generated by [data/get.ts](data/get.ts) by querying the GitHub API to fetch issues from the repositories listed in [config.json](config.json). The labels defined in [config.json](config.json) are used to filter issues for the repositories.

To contribute new features and changes to the website, you would want to run the app locally. Please follow these steps:


## How to setup the project locally

1. Fork the repository, clone it locally, create a new branch to work on a specific feature or bug fix without affecting the main branch of the repository. Make sure you have a recent version of Node.js installed on your computer.
1. You can use the included [generated.json](generated.json) as dummy data or you can run `npm run prebuild` to fetch the latest data from GitHub yourself: for this, you will need to set the `GH_PERSONAL_ACCESS_TOKEN` environment variable to a valid GitHub Personal Access Token (PAT). Notice: repositories not maching the criteria listed above (see rules in [generated.json](generated.json)) are automatically removed from [firstissue.json](firstissue.json) when the [generated.json](generated.json) script runs.
1. You can use the included [data.json](data/data.json) as dummy data or you can run `npm run prebuild` to fetch the latest data from GitHub yourself: for this, you will need to set the `GH_PERSONAL_ACCESS_TOKEN` environment variable to a valid GitHub Personal Access Token (PAT). Notice: repositories not maching the criteria listed above (see rules in [data.json](data/data.json)are automatically removed from [config.json](config.json) when the [data.json]data/data.json) script runs.
1. Start the development server and open the app in your browser.

```bash
Expand All @@ -70,7 +72,7 @@ $ npm run dev

Good to know when you commit: the project contains a `pre-commit` hook that runs linters automatically to ensure code quality!

#### Credits
## Credits

This project is based on [good-first-issue](https://github.com/deepsourcelabs/good-first-issue). The app and generation scripts have been rewritten using Next.js, React and Typescript, new features have been added and the UI is being updated too. The deployment process has been streamlined, complexity has been reduced and further improvements are planned.

Expand Down
89 changes: 89 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"repositories": [
"4paradigm/OpenMLDB",
"AcademySoftwareFoundation/openvdb",
"activecm/rita",
"agola-io/agola",
"akka/akka",
"alexellis/arkade",
"alibaba/GraphScope",
"alibaba/nacos",
"alibaba/Sentinel",
"allure-framework/allure2",
"ampproject/amphtml",
"angular/components",
"ankidroid/Anki-Android",
"ansible/awx",
"AntennaPod/AntennaPod",
"antrea-io/antrea",
"apache/age",
"apache/airflow",
"apache/apisix",
"apache/arrow-datafusion",
"apache/arrow-rs",
"apache/beam",
"apache/dolphinscheduler",
"apache/doris",
"apache/dubbo",
"apache/iceberg",
"apache/incubator-hugegraph",
"apache/incubator-streampark",
"apache/inlong",
"apache/kyuubi",
"apache/mxnet",
"apache/netbeans",
"apache/nuttx",
"apache/openwhisk",
"apache/pinot",
"apache/pulsar",
"apache/rocketmq",
"apache/rocketmq-client-go",
"apache/shardingsphere",
"apache/shenyu",
"apache/skywalking",
"apache/superset",
"apache/trafficserver",
"apolloconfig/apollo",
"apostrophecms/apostrophe",
"appbaseio/reactivesearch",
"apple/foundationdb",
"apple/sourcekit-lsp",
"apple/swift",
"apple/swift-argument-parser",
"apple/swift-async-algorithms",
"apple/swift-book",
"apple/swift-nio",
"apple/swift-package-manager",
"apple/swift-protobuf",
"apple/swift-syntax",
"appsmithorg/appsmith",
"appwrite/appwrite",
"aquasecurity/kube-bench",
"aquasecurity/trivy",
"ArduPilot/ardupilot",
"argoproj/argo-cd",
"AssemblyScript/assemblyscript",
"astropy/astropy",
"Automattic/wp-calypso",
"automl/auto-sklearn",
"aws-amplify/amplify-cli",
"aws-amplify/amplify-js",
"aws/amazon-vpc-cni-k8s",
"aws/aws-cdk",
"aws/aws-lambda-go",
"aws/aws-node-termination-handler",
"aws/aws-sdk-pandas",
"aws/copilot-cli",
"aws/eks-anywhere",
"aws/eks-distro",
"aws/s2n-tls",
"Azure/azure-sdk-for-java",
"Azure/azure-sdk-for-js",
"Azure/azure-sdk-for-python",
"Azure/Azurite"
],
"labels": [
"good first issue",
"help wanted"
]
}
2 changes: 1 addition & 1 deletion context/AppDataContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { createContext, useState } from "react";

import data from "../generated.json";
import data from "../data/data.json";
import { AppData, CountableTag, Repository, RepositorySortOrder } from "../types";

const DEFAULT_VALUE: AppData = {
Expand Down
1 change: 1 addition & 0 deletions data/data.json

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions generate.ts → data/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ import fs from "fs";
import millify from "millify";
import slugify from "slugify";

import firstissue from "./firstissue.json";
import config from "../config.json";
import {
CountableTag as CountableTagModel,
Issue as IssueModel,
Repository as RepositoryModel,
Tag as TagModel
} from "./types";
} from "../types";

console.log(
"⚠️ This command must be run from the root of the project directory with `npm run prebuild`"
);

/** Number of repositories to query per request (max 100, but set to a smaller number to prevent timeouts) */
const REPOS_PER_REQUEST = 25;
Expand Down Expand Up @@ -117,7 +121,7 @@ const getRepositories = async (
}
stargazerCount
# return first 10 open issues with one or more of the labels we want
issues(
issues(
states: OPEN
filterBy: {labels: [${labels.map((label) => `"${label}"`).join(",")}]}
orderBy: {field: CREATED_AT, direction: DESC}
Expand Down Expand Up @@ -239,8 +243,8 @@ const getRepositories = async (
return repoData.filter((repo) => repo.issues.length >= 3);
};

[...new Set(firstissue.repositories)]
.slice(0, process.env.NODE_ENV === "development" ? 200 : firstissue.repositories.length)
[...new Set(config.repositories)]
.slice(0, process.env.NODE_ENV === "development" ? 200 : config.repositories.length)
.reduce((repoChunks: string[][], repo: string, index) => {
// Split repositories into smaller chunks, this helps prevent request timeouts
const chunkIndex = Math.floor(index / REPOS_PER_REQUEST);
Expand All @@ -255,7 +259,7 @@ const getRepositories = async (
console.log(
`Getting repositories - chunk ${index + 1} of ${arr.length} (size: ${chunk.length})`
);
const repositories = await getRepositories(chunk, firstissue.labels);
const repositories = await getRepositories(chunk, config.labels);

// wait 1s between requests
await new Promise((resolve) => setTimeout(resolve, 1000));
Expand Down Expand Up @@ -306,16 +310,16 @@ const getRepositories = async (
})
.then((data) => {
// Write generated data to file for use in the app
fs.writeFileSync("./generated.json", JSON.stringify(data));
console.log("Generated generated.json");
fs.writeFileSync("data/data.json", JSON.stringify(data));
console.log("Generated data/data.json");

// Update firstissue.json with new list of repositories
firstissue.repositories = data.repositories
// Update config.json with new list of repositories
config.repositories = data.repositories
.map((repo) => `${repo.owner}/${repo.name}`)
// Sort alphabetically
.sort((a, b) => a.localeCompare(b));
fs.writeFileSync("./firstissue.json", JSON.stringify(firstissue, null, 2));
console.log("Generated firstissue.json");
fs.writeFileSync("config.json", JSON.stringify(config, null, 2));
console.log("Generated config.json");

// Build sitemap
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -338,8 +342,8 @@ const getRepositories = async (
</urlset>
`;

fs.writeFileSync("./public/sitemap.xml", sitemap);
console.log("Generated sitemap.xml");
fs.writeFileSync("public/sitemap.xml", sitemap);
console.log("Generated public/sitemap.xml");
})
.finally(() => {
console.log("Data generation complete.");
Expand Down
Loading

0 comments on commit 6d51cf9

Please sign in to comment.