Ifycode-experiments/doc

Development environment & git workflow

Ifycode opened this issue ยท 0 comments

Development environment

Jasmine (CLI only) & eslint have already been set up and automated for development purpose. Below is the guide for working with our repos in dev mode.

less-css-helper-library repo:

  • Run npm install to install dependencies.
  • Use npm start or npm start -s to start the project. This has been configured to transpile your less code into css code.

node-mongo-starter-kit repo:

  • Run npm install to install dependencies.
  • Use npm start or npm start -s to start the project.

node-mongo-cli repo:

  • Run npm install to install dependencies.
  • To run eslint, use npm start or npm start -s .
  • To run jasmine tests, use npm test or npm test -s.
    You can decide to open separate terminals for each while you work on the CLI in another terminal.

Git workflow

Setting up

Fork the Code Collabo repo you want to work on - e.g. node-mongo-cli.

Open up your terminal on your computer and do the following:

  • Clone that forked version onto your computer with:
    git clone git@github.com:your-github-username/node-mongo-cli.git
    If you prefer or are using https:
    git clone https://github.com/your-github-username/node-mongo-cli.git
  • Set original repo as upstream:
    git remote add upstream git@github.com:code-collabo/node-mongo-cli.git

Check that your forked repo's url is set as the origin & original repo's url is set as the upstream with:
git remote -v

Updating your fork

Setting original repo as the upstream means you'll be able to update your fork, with the latest changes made to the original repo using the git pull command.

Before you start or as you work on the code, update your fork so that you'll be working with latest changes from the original repo.

To pull changes for the develop branch for example, checkout to develop:
git checkout develop

Then use the command:
git pull

In summary, just checkout to the branch you want to pull changes into git checkout branch-name and use the git pull command.

Gitflow & branches

The only time you have business with the main branch is if you choose to pull changes while in the main branch as explained in updating your fork.

๐Ÿ“Œ You are not to make changes to main branch, as it contains the production-ready version of the code.

A branch with name develop has been created for development purpose.

๐Ÿ“Œ Also, you are not to make changes to the develop branch. Instead, create a feature branch from the develop branch and make your changes there.

Creating a feature branch

  • Checkout to develop to ensure the feature branch you will create is a copy of the develop branch:
    git checkout develop

  • Create a feature branch while inside develop branch:
    git checkout -b feature-branch-name-here

๐Ÿ“Œ Note

Always make sure you checkout to develop branch before creating a new feature branch.

Naming a feature branch

To help admin/reviewers know what you are working on, give your feature branch a descriptive name containing: issueNumber-action-description.

  • IssueNumber: Check the issue to get issue number.
  • Action: Words like fix, setup, feature etc.
  • Description: What you are setting up, fixing etc.
    So, feature branch name could look like 7-setup-jasmine-test, 19-update-readme, 1001-fix-db-error etc.

Submitting your changes

After you've made the needed changes in the feature branch you created, follow these steps:

Add & commit your changes

git add .

git commit -m "Add your commit message here"

Push changes

Push your changes to the remote for the first time:
git push -u origin your-branch-name

Push every other time:
git push

Pull request

Next create & send a pull request so that your code can be reviewed. Also add description & testing checklist to your pull request. See examples of previously made pull requests for how to go about this:

Useful links