Learn how to set up your development environment, get the code, and verify that it’s working.
This page will walk you through setting up the main CanJS repository on your computer. Remember that CanJS is split into multiple repositories, but you can apply the same general steps to set up any of the other repos.
We’ll cover the following details in this guide:
- Setting up your development environment.
- Getting the repository’s code and verify it’s working.
The following video walks through most of the following steps:
Setting up your development environment
Developing CanJS requires:
- A GitHub account and git client.
- Node.js version 5 or later.
- Firefox for running automated tests.
Sign up for GitHub and set up Git
If you don’t already have a GitHub account, you’ll need to create a new one.
There are a variety of ways to get a git command line client connected to your GitHub account. GitHub has great documentation on how to set up Git.
If you already have
git installed, make sure you’ve
set up your ssh keys.
Download Node.js version 5 or later at NodeJS.org. You can verify Node’s version with:
Firefox is used to run the repository’s tests.
Getting the code and verifying that it’s working
Once your environment is set up, you should be able to clone the repository you want to change, install its dependencies, and verify you’ve set up your development environment correctly.
Forking and cloning the repository
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.
To start, click the Fork button to fork the repository from which you will be working. For example, you can fork can-compute by pressing its Fork button on GitHub:
Next, you’ll want to clone your forked version of the repository. GitHub’s guide will instruct you to clone it with a command like:
git clone email@example.com:<your username>/<repository-name>.git
For example, if your username is
justinbmeyer and you forked
git clone firstname.lastname@example.org:justinbmeyer/can-compute.git
Before continuing, move into your project’s directory. For example:
Installing the dependencies
Now install the project’s dependencies with npm:
Running the tests
Make sure Firefox is closed and run the test suite with:
Note: When adding tests, make sure you check out can-test-helpers as it provides some useful helpers for some tests.
If every test passed, congrats! You have everything you need to change code and have the core team review it.
Building the documentation
To build the site, run:
npm run document
Viewing the site
After you build the site, your
canjs repository will now also contain the website.
To view the site, we recommend you install http-server.
npm install http-server -g
After it’s installed, you can start a server in the current directory:
http-server will tell you where you can go in your browser to see the site. It will be something like http://127.0.0.1:8080.
Making your changes
Next, learn about making changes and submitting a pull request.