Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Contributing

Yury Delendik edited this page Mar 14, 2018 · 12 revisions

Welcome! Please get familiar with project vision and its architecture.

We always looking for help with issues assigned to the projects mentioned at Projects, and you can always start off with easy issues. Adding tests for non-verified code is highly appreciated too.

Contributing code

Here is the typical process of contributing the code for this project:

  1. Fork
  2. Create feature branch
  3. Make changes
  4. Run testing
  5. Push changes to your fork/branch
  6. Create pull request
  7. Code review and automated testing
  8. Merge into master

Prerequisites

  • Git client
  • GitHub account
  • Node.js (v8+)
  • A browser that supports WebAssembly

1. Fork

To fork the repository you need to have a GitHub account. Once you have an account you can click the fork button up top. Now that you have your fork you need to clone it locally. Notice that git's origin reference will point to your forked repository.

It is useful to have the upstream repository registered as well using:

git remote add upstream https://github.com/wasdk/WebAssemblyStudio.git

and periodically fetch it using git fetch upstream.

2. Create feature branch

We always work with feature branches. For example, to create and switch to branch use:

git checkout -b {branch_name} upstream/master

and replace {branch_name} with a meaningful name that describes your feature or change. For instance, if you are working on adding the export button to the toolbar, a good branch name would be export-toolbar-button.

3. Make changes

Now that you have a new branch you can edit/create/delete files. Follow the standard Git workflow to stage and locally commit your changes -- there are lots of guides that explain Git. Make sure the commit message explains the change (see more examples).

We recommend to often combine touch-up commits with main one (squash) -- the git commit --amend can be used for that. The latter command will help updating the last commit message as well. (You may use git force push after that.) If the branch contains lot of small commits, you might be asked to squash the commits.

4. Run testing

Make sure that your code follows our coding guidelines and run from the WebAssemblyStudio/ folder:

npm run test

It is recommended to add unit test(s) to the newly added or modified code. See testing for details about that.

5. Push changes to your fork/branch

After lint and all tests pass, push the changes to your fork/branch on GitHub:

git push origin {branch_name}

For first time push, you may choose to use --set-upstream (or -u) option, so subsequent pushes can be done via just git push. For force push, which will destroy previous commits on the server, use --force (or -f) option.

6. Create pull request

Create a pull request on GitHub for your feature branch. The code will then be reviewed and tested further by our contributors and test bot.

7. Code review and automated testing

In addition to the GitHub pull request workflow, it is highly recommended that you communicate with the WebAssembly Studio team, for example via the #general slack channel at wasm-studio.slack.com. That will help to find a reviewer for your patch and speed up the review process.

You can speed up fetching a remote GitHub branch (possibly belonging to another user) using git try {username} {branch_name}. Add the following to the .git/config file to be able to do that:

[alias]
  try = !sh -c 'IFS=\":\" read -ra ARGS <<< \"$0\" && git fetch https://github.com/${ARGS[0]}/WebAssemblyStudio.git ${ARGS[1]} && git checkout FETCH_HEAD'

The things that are looked at during review:

  • How the change is related to the items listed in the projects.
  • How easy to maintain and support the solution in long run.
  • Quality of the patch: its coding style, be easy to read, be well documented, etc.

8. Merge into master

If all goes well, a collaborator will merge your changes into the main repository.