Difference between revisions of "DPS909 & OSD600 Winter 2017 - Lab 2"

From CDOT Wiki
Jump to: navigation, search
(3. Contributing fixes to package.json files)
Line 5: Line 5:
 
* [[DPS909 & OSD600 Winter 2017 - Git Walkthrough 2 | Git Walkthrough #2 - Working Remote]]
 
* [[DPS909 & OSD600 Winter 2017 - Git Walkthrough 2 | Git Walkthrough #2 - Working Remote]]
  
==1. Install node.js==
+
==1. Intro to node.js, npm, npmjs.com==
  
We will be contributing to projects that use [https://nodejs.org/en/ node.js], its package manager [https://en.wikipedia.org/wiki/Npm_(software) npm], and the [https://www.npmjs.com/ npmjs module registry]. In order to complete this lab, you will need to install node.js, which you can [https://nodejs.org/en/download/ download here].
+
We will be contributing to projects that use [https://nodejs.org/en/ node.js], its package manager [https://en.wikipedia.org/wiki/Npm_(software) npm], and the [https://www.npmjs.com/ npmjs module registry]. In order to complete this lab, you should install node.js on your home/dev computer, which you can [https://nodejs.org/en/download/ download here].
 +
 
 +
We won't need to use node.js directly, but it's a good time to install it, since we'll be using it in subsequent labs and assignments.
  
 
==2. Understanding package.json==
 
==2. Understanding package.json==
  
Node uses a special file named <code>package.json</code> to specify metadata about a module.  You can read a complete description of <code>package.json</code> at https://docs.npmjs.com/files/package.json.
+
Node.js uses a special file named <code>package.json</code> to specify metadata about a module.  You can read a complete description of <code>package.json</code> at https://docs.npmjs.com/files/package.json.
  
 
A <code>package.json</code> file has to be valid JSON, and [https://docs.npmjs.com/getting-started/using-a-package.json#requirements must include a few fields].  However, many of the fields are optional.  Let's look at some examples from popular node.js open source projects:
 
A <code>package.json</code> file has to be valid JSON, and [https://docs.npmjs.com/getting-started/using-a-package.json#requirements must include a few fields].  However, many of the fields are optional.  Let's look at some examples from popular node.js open source projects:
Line 285: Line 287:
 
|-
 
|-
 
| 39
 
| 39
 +
|
 +
|
 +
|
 +
|
 +
|-
 +
| 40
 
|  
 
|  
 
|
 
|
Line 291: Line 299:
 
|}
 
|}
  
 
 
...
 
  
 
==Submission==
 
==Submission==
  
 
You will have completed your lab when you have done the following:
 
You will have completed your lab when you have done the following:
* Create a Pull Request to a project fixing some problem or omission in their <code>package.json</code> file
 
* Write a blog post about the process you took to complete this Pull Request, and about what happened next.  Was it accepted?  How long did it take?  What did they say?
 
* Write about your feelings contributing to your first open source project.  What went well?  What was hard?  What surprised you?
 
  
You should complete Lab 2 before the start of week 3.
+
* Added a row above with the name of a node.js module that needs a fix, and your name.  Make sure all students have a module to work on before you begin fixing yours.  We'll work as a community to help triage existing modules.
 +
* Create a Pull Request to fix some problem or omission in the <code>package.json</code> file.  I've documented a complete example in my blog, see http://blog.humphd.org/howto-first-github-pr/.  Add the URL to your Pull Request to the table above.
 +
* Write a blog post about the process you took to complete this lab and the Pull Request.  What happened next?  Was it accepted?  How long did it take?  What did they say?  What did you learn?  Also write about your feelings contributing to your first open source project.  What went well?  What was hard?  What surprised you?
 +
* Add the URL to your blog post in the table above beside your Pull Request URL
 +
 
 +
You should complete Lab 2 before the '''end''' of week 3 (it might take you a few days).

Revision as of 14:54, 18 January 2017

Contributing to an Open Source Project on Github

In this lab you will contribute a fix to an open source project on Github. Successfully completing this lab will require you to have first worked through, and understood, this week's git walkthroughs. If you have not already done so, please setup git and Github as described in the following:

1. Intro to node.js, npm, npmjs.com

We will be contributing to projects that use node.js, its package manager npm, and the npmjs module registry. In order to complete this lab, you should install node.js on your home/dev computer, which you can download here.

We won't need to use node.js directly, but it's a good time to install it, since we'll be using it in subsequent labs and assignments.

2. Understanding package.json

Node.js uses a special file named package.json to specify metadata about a module. You can read a complete description of package.json at https://docs.npmjs.com/files/package.json.

A package.json file has to be valid JSON, and must include a few fields. However, many of the fields are optional. Let's look at some examples from popular node.js open source projects:

These package.json files have common elements, such as:

There are also some optional fields you can include, for example:

The metadata in package.json is used by the command-line tool npm as well as by the online registry https://www.npmjs.com/. Providing good data for these tools makes it easier for developers to find and use node modules.

3. Contributing fixes to package.json files

For our first contribution to an open source project, we're going to go looking for ways we can help existing node.js based projects do a better job with their package.json files. This could involve a number of things:

Before we can fix any issues with existing package.json files, we have to find some! Our first task is to locate 1 module with an issue per student. Please do not fix a bug until we have found a bug for everyone.

Here are some queries to get you started. Also look at the Dependencies and Dependents lists for any module you examine on npmjs. When you find a module that is missing keywords or has some other issue, add it below, making sure to copy the style I have begun on row 1. Also, be careful not to add duplicates:

To get you started, I've already found and fixed one, and also listed a couple of others I noticed in 5 minutes of searching on npmjs and Github.

# NPMJS Module Assigned Student Pull Request URL Blog Post URL
1 request humphd https://github.com/request/request/pull/2514 http://blog.humphd.org/howto-first-github-pr/
2 gulp-util
3 dat-next
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40


Submission

You will have completed your lab when you have done the following:

  • Added a row above with the name of a node.js module that needs a fix, and your name. Make sure all students have a module to work on before you begin fixing yours. We'll work as a community to help triage existing modules.
  • Create a Pull Request to fix some problem or omission in the package.json file. I've documented a complete example in my blog, see http://blog.humphd.org/howto-first-github-pr/. Add the URL to your Pull Request to the table above.
  • Write a blog post about the process you took to complete this lab and the Pull Request. What happened next? Was it accepted? How long did it take? What did they say? What did you learn? Also write about your feelings contributing to your first open source project. What went well? What was hard? What surprised you?
  • Add the URL to your blog post in the table above beside your Pull Request URL

You should complete Lab 2 before the end of week 3 (it might take you a few days).