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

From CDOT Wiki
Jump to: navigation, search
(Created page with "=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 y...")
 
(2. Understanding package.json)
Line 13: Line 13:
 
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 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.
  
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:
 
* https://github.com/foreverjs/forever/blob/master/package.json
 
* https://github.com/foreverjs/forever/blob/master/package.json
 
* https://github.com/expressjs/express/blob/master/package.json
 
* https://github.com/expressjs/express/blob/master/package.json
Line 32: Line 32:
  
 
The metadata in <code>package.json</code> is used by the command-line tool <code>npm</code> 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.
 
The metadata in <code>package.json</code> is used by the command-line tool <code>npm</code> 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 <code>package.json</code> files.  This could involve a number of things:
 +
* correcting errors generated by http://package-json-validator.com/ for a <code>package.json</code> file
 +
* adding missing optional fields to a <code>package.json</code> file
 +
 +
[https://www.google.ca/search?hl=en&as_q=&as_epq=inurl%3Apackage+json&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=github.com&as_occt=any&safe=images&as_filetype=pdf&as_rights=#hl=en&as_qdr=all&q=%22inurl:package.json%22+site:github.com+filetype:json list of package.json files on github.com]
 +
  
 
...
 
...

Revision as of 13:55, 13 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. Install node.js

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 will need to install node.js, which you can download here.

2. Understanding package.json

Node 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:

list of package.json files on github.com


...

Submission

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 package.json 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.