|
| 1 | +# Contributing to can-simple-observable |
| 2 | + |
| 3 | +## Developing Locally |
| 4 | + |
| 5 | +This section will walk you through setting up the [repository](https://github.com/canjs/can-simple-observable) on your computer. |
| 6 | + |
| 7 | +### Signing up for GitHub |
| 8 | + |
| 9 | +If you don’t already have a GitHub account, you’ll need to [create a new one](https://help.github.com/articles/signing-up-for-a-new-github-account/). |
| 10 | + |
| 11 | +### Forking & cloning the repository |
| 12 | + |
| 13 | +A “fork” is a copy of a repository in your personal GitHub account. “Cloning” is the process of getting the repository’s source code on your computer. |
| 14 | + |
| 15 | +GitHub has a guide for [forking a repo](https://help.github.com/articles/fork-a-repo/). To fork can-simple-observable, you can start by going to its [fork page](https://github.com/canjs/can-simple-observable/fork). |
| 16 | + |
| 17 | +Next, you’ll want to clone the repo. [GitHub’s cloning guide](https://help.github.com/articles/cloning-a-repository/) explains how to do this on Linux, Mac, or Windows. |
| 18 | + |
| 19 | +GitHub’s guide will [instruct you](https://help.github.com/articles/fork-a-repo/#step-2-create-a-local-clone-of-your-fork) to clone it with a command like: |
| 20 | + |
| 21 | +```shell |
| 22 | +git clone https://github.com/YOUR-USERNAME/can-simple-observable |
| 23 | +``` |
| 24 | + |
| 25 | +Make sure you replace `YOUR-USERNAME` with your GitHub username. |
| 26 | + |
| 27 | +### Installing the dependencies |
| 28 | + |
| 29 | +After you’ve forked & cloned the repository, you’ll need to install the project’s dependencies. |
| 30 | + |
| 31 | +First, make sure you’ve [installed Node.js and npm](https://docs.npmjs.com/getting-started/installing-node). |
| 32 | + |
| 33 | +If you just cloned the repo from the command line, you’ll want to switch to the folder with your clone: |
| 34 | + |
| 35 | +```shell |
| 36 | +cd can-simple-observable |
| 37 | +``` |
| 38 | + |
| 39 | +Next, install the project’s dependencies with npm: |
| 40 | + |
| 41 | +```shell |
| 42 | +npm install |
| 43 | +``` |
| 44 | + |
| 45 | +### Starting the development server |
| 46 | + |
| 47 | +Run the following to start a dev server: |
| 48 | + |
| 49 | +```shell |
| 50 | +npm run develop |
| 51 | +``` |
| 52 | + |
| 53 | +### Running the tests |
| 54 | + |
| 55 | +You can manually run this repository’s tests in any browser by starting the dev server (see the section above) and visiting this page: http://localhost:8080/test/test.html |
| 56 | + |
| 57 | +Firefox is used to run the repository’s automated tests from the command line. If you don’t already have it, [download Firefox](https://www.mozilla.org/en-US/firefox/new/). Mozilla has guides for installing it on [Linux](https://support.mozilla.org/t5/Install-and-Update/Install-Firefox-on-Linux/ta-p/2516), [Mac](https://support.mozilla.org/t5/Install-and-Update/How-to-download-and-install-Firefox-on-Mac/ta-p/3453), and [Windows](https://support.mozilla.org/t5/Install-and-Update/How-to-download-and-install-Firefox-on-Windows/ta-p/2210). |
| 58 | + |
| 59 | +After Firefox is installed, you can run: |
| 60 | + |
| 61 | +```shell |
| 62 | +npm test |
| 63 | +``` |
| 64 | + |
| 65 | +### Making a build |
| 66 | + |
| 67 | +Run the following command to create a build: |
| 68 | + |
| 69 | +```shell |
| 70 | +npm run build |
| 71 | +``` |
| 72 | + |
| 73 | +This will create a `dist/` folder that contains the AMD, CommonJS, and global module versions of the project. |
| 74 | + |
| 75 | +#### Minifying your build output |
| 76 | + |
| 77 | +To output minified versions, in the `build.js` add `minify: true` to the outputs. |
| 78 | + |
| 79 | +```js |
| 80 | +{ |
| 81 | + // in build.js export config |
| 82 | + outputs: { |
| 83 | + "+cjs": { minify: true }, |
| 84 | + "+amd": { minify: true }, |
| 85 | + "+global-js": { minify: true } |
| 86 | + } |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | + |
| 91 | +See [Steal's export options](https://stealjs.com/docs/steal-tools.export.object.html#outputs) for more details. |
| 92 | + |
| 93 | +### Building the documentation |
| 94 | + |
| 95 | +To generate the docs: |
| 96 | + |
| 97 | +```shell |
| 98 | +npm run document |
| 99 | +``` |
| 100 | + |
| 101 | +This will create a `docs/` folder that contains a browsable site with all of your documentation. |
| 102 | + |
| 103 | +With the dev server running, you can view the docs at http://localhost:8080/docs/ |
0 commit comments