1
+
2
+ import { writeFile } from 'fs' ;
3
+ import { GetStaticProps } from 'next' ;
1
4
import { NextSeo } from 'next-seo' ;
2
5
import React from 'react' ;
6
+ import ContributeProject from '../components/ContributeProject' ;
7
+ import ELink from '../components/ELink' ;
3
8
import Layout from '../components/Layout' ;
9
+ import { getGoodFirstIssueProjects , getGithubColors , GitHubColors , GFIProject } from '../util' ;
10
+
11
+ interface ContributeProps {
12
+ gfiProjects : GFIProject [ ] ,
13
+ githubColors : GitHubColors
14
+ }
4
15
5
- function Contribute ( ) : JSX . Element {
16
+ function Contribute ( { gfiProjects, githubColors } : ContributeProps ) : JSX . Element {
17
+ const displayedgfiProjects = gfiProjects . map ( ( project ) =>
18
+ < ContributeProject project = { project } githubColors = { githubColors } key = { project . project . repo } /> ,
19
+ ) ;
6
20
return (
7
21
< Layout >
8
22
< div className = "container" >
@@ -19,12 +33,140 @@ function Contribute(): JSX.Element {
19
33
site_name : 'open source at ACM at UCLA' ,
20
34
} }
21
35
/>
22
- < h1 >
23
- get started
24
- </ h1 >
36
+ < div className = 'row spaced-row' >
37
+ < h1 > get started </ h1 >
38
+ < a href = '#good-first-issues' > < button > good first issues</ button > </ a >
39
+ </ div >
40
+ < hr />
41
+ < h2 >
42
+ what is open source?
43
+ </ h2 >
44
+ < p >
45
+ Open source software is code that is made freely available for < b > anyone</ b > to
46
+ use or enhance! Here at ACM, we take pride in < strong > all</ strong > of our projects being open-source
47
+ and open for anyone to work on.
48
+ </ p >
49
+ < h2 >
50
+ what makes open source possible?
51
+ </ h2 >
52
+ < p >
53
+ The main backbone of open source initiatives are tools that simplify collaboration and sharing of code.
54
+ Git and < ELink link = 'https://github.com/' > Github</ ELink > are two popular tools used by researchers,
55
+ companies, and students; at ACM, we use both.
56
+ </ p >
57
+ < h2 >
58
+ how can i contribute?
59
+ </ h2 >
60
+ < p >
61
+ We'll quickly go over how we can use git/github to work on some open source projects. If
62
+ you want to learn more about the specifics of what we'll cover, you can check out { ' ' }
63
+ < ELink link = 'https://git-scm.com/doc' > git's documentation</ ELink >
64
+ { ' ' } or our writeups on { ' ' }
65
+ < ELink link = 'https://github.com/uclaacm/centralized-intern-training/tree/main/01_html_css_github#git-vs-github' >
66
+ git workflows
67
+ </ ELink >
68
+ { ' ' } and { ' ' }
69
+ < ELink link = 'https://github.com/uclaacm/centralized-intern-training/tree/main/02_intermediate_css_github_workflows#github-as-a-collaboration-tool' >
70
+ github as a collaboration tool
71
+ </ ELink >
72
+ { ' ' }
73
+ to get a closer look at what we're doing!
74
+ </ p >
75
+ < h3 >
76
+ jumping into contributing on a project
77
+ </ h3 >
78
+ < p >
79
+ There are thousands of open-source projects out there - it's hard to even find out where to start!
80
+ Luckily, some < strong > repositories</ strong > , or the main hub of projects, have < strong > issues</ strong > , or
81
+ project tasks, marked as < strong > good first issue</ strong > .
82
+ These are great starting points for people to hop in and contribute!
83
+ </ p >
84
+
85
+ < p className = 'spaced-row' > Check out some of our projects tagged with good first issues here!< a href = '#good-first-issues' > < button > ACM's Good First Issues</ button > </ a > </ p >
86
+
87
+ < h2 > contribution workflow</ h2 >
88
+ < p >
89
+ Repositories normally tell you how the steps you need to take to get to work, usually within their
90
+ README.mdor their CONTRIBUTING.md but generally, there's generally a standard couple steps
91
+ you'll have to take. For a detailed contribution guide, check out github's { ' ' }
92
+ < ELink link = 'https://docs.github.com/en/get-started/quickstart/contributing-to-projects' >
93
+ contribution guide
94
+ </ ELink > !
95
+ </ p >
96
+ < h3 > forking and cloning a repo</ h3 >
97
+ < p > By clicking fork on a project that you want to contribute to, GitHub generates a personal copy of that
98
+ repo under your account. To clone it onto your computer, you can click the code button above the list of files
99
+ and run
100
+ </ p >
101
+ < p > < code > $ git clone git@github.com:uclaacm/opensource.git</ code > </ p >
102
+ < p > to get it onto your machine.</ p >
103
+ < h3 > branching, making changes</ h3 >
104
+ < p >
105
+ Generally, when you want to make a specific change to a project, you make a branch,
106
+ so that you can work on a new feature without affecting other people's work.
107
+ To do so, run the < code > git checkout -b BRANCH_NAME</ code > command
108
+ to generate a new branch or < code > git checkout BRANCH_NAME</ code > to switch between branches.
109
+ </ p >
110
+ < p >
111
+ After you've made your changes, run { ' ' }
112
+ < code > git add .</ code > then < code > git commit -m "a short commit description"</ code > { ' ' }
113
+ to take a snapshot of all the changes you've made and < code > git push</ code > to push the changes you
114
+ made to GitHub.
115
+ </ p >
116
+ < h3 > making a pull request</ h3 >
117
+ < p >
118
+ Now that you've successfully made the changes you want on your fork of the project,
119
+ if you head over to the original project repository and click < strong > Open a pull request</ strong > ,
120
+ you can put in a title and description of your changes.
121
+ </ p >
122
+ < p >
123
+ After making a pull request, the maintainers of the project will check if your code is up to snuff
124
+ and request changes as necessary. Once they approve your changes however, you can merge your changes
125
+ in and you've successfully contributed to the project!
126
+ </ p >
127
+ < p className = 'action' > what are you waiting for? go work on some projects!</ p >
128
+
129
+ < h2 id = 'good-first-issues' >
130
+ acm's projects w/ good first issues
131
+ </ h2 >
132
+ < p >
133
+ < span > acm currently has </ span >
134
+ < strong > { displayedgfiProjects . length } </ strong >
135
+ {
136
+ `
137
+ ${ displayedgfiProjects . length > 1 ? 'projects' : 'project' }
138
+ with good first issues!`
139
+ }
140
+ </ p >
141
+ < div className = 'card' >
142
+ < div className = 'card-body' >
143
+ { displayedgfiProjects }
144
+ </ div >
145
+ </ div >
25
146
</ div >
26
- </ Layout >
147
+ </ Layout >
27
148
) ;
28
149
}
29
150
30
151
export default Contribute ;
152
+
153
+
154
+ export const getStaticProps : GetStaticProps = async ( ) => {
155
+ // TODO(mattxwang): change the auth scope and get members, etc.
156
+ // see: https://docs.github.com/en/rest/reference/orgs
157
+
158
+ const gfiProjects = await getGoodFirstIssueProjects ( ) ;
159
+ const gfisJson = JSON . stringify ( gfiProjects ) ;
160
+ writeFile ( './test/fixtures/gfiProjects.json' , gfisJson , ( ) => {
161
+ return ;
162
+ } ) ;
163
+
164
+ const githubColors = await getGithubColors ( ) ;
165
+ return {
166
+ props : {
167
+ gfiProjects,
168
+ githubColors,
169
+ } ,
170
+ revalidate : 3600 ,
171
+ } ;
172
+ } ;
0 commit comments