Skip to content

Latest commit

 

History

History
165 lines (122 loc) · 4.88 KB

CONTRIBUTING.md

File metadata and controls

165 lines (122 loc) · 4.88 KB

Contributing

Index

Code Contributions

Step 1: Fork

Fork the project on GitHub and check out your copy locally.

image

$ git clone git@github.com:yourusername/cnc.git
$ cd cnc
$ git remote add upstream git://github.com/cheton/cnc.git

Step 2: Branch

Create a feature branch and before starting:

$ git checkout -b my-feature-branch -t origin/master

Step 3: Install

Run npm install to install the dependencies in the local node_modules folder:

$ npm install -g npm  # Install npm v3
$ npm install

Step 4: Commit

Make sure git knows your name and email address:

$ git config --global user.name "User Name"
$ git config --global user.email "user.email@example.com"

Writing good commit logs is important. A commit log should describe what changed and why.

Step 5: Rebase

Use git rebase (not git merge) to sync your work from time to time.

$ git fetch upstream
$ git rebase upstream/master

Step 6: Build

Run npm run build to make sure the build succeed:

$ npm run build

Step 7: Push

$ git push origin my-feature-branch

Go to https://github.com/yourusername/cnc and select your feature branch. Click on the New pull request button and fill out the form.

image

Running Local Development Server

Make sure you have Node.js 4 or later verions installed, and run npm run dev to start a local development server for development and testing. Every code changes will trigger webpack Hot Module Replacement (HMR) which will be really useful while developing in React.

$ npm install  # Ensure that packages are installed
$ npm run dev  # It may take several minutes...
  :  :  :
Server is listening on 0.0.0.0:8000

Connect to http://localhost:8000 and wait until bundle finished.

webpack: wait until bundle finished: /__webpack_hmr
  :  :  :
webpack: bundle is now VALID

Now you're ready to go!

Running Production Build

$ npm install  # Ensure that packages are installed
$ npm run prepublish
$ ./bin/cnc -vv
  :  :  :
Server is listening on 0.0.0.0:8000

Build Desktop Apps

OS X

$ npm install  # Ensure that packages are installed
$ npm run prepublish && npm run build:osx-x64
$ ls -al output/osx/

Windows x86

$ npm install  # Ensure that packages are installed
$ npm run prepublish && npm run build:win-ia32
$ ls -al output/win-ia32/

Windows x64

$ npm install  # Ensure that packages are installed
$ npm run prepublish && npm run build:win-x64
$ ls -al output/win/

Linux x86

$ npm install  # Ensure that packages are installed
$ npm run prepublish && npm run build:linux-ia32
$ ls -al output/linux-ia32/

Linux x64

$ npm install  # Ensure that packages are installed
$ npm run prepublish && npm run build:linux-x64
$ ls -al output/linux/

Localization

Static Translations

Find all resource strings stored in the resource.json file, which is located in the src/web/i18n directory. You can create a pull request to submit your changes.

Runtime Translations

Moreover, you can make translations during runtime by modifying resource.json from the installed directory. Note that your path may differ based on the Node installation path you have in place.

$ cd $(dirname `which cnc`)/../lib/node_modules/cncjs/dist/web/i18n/
$ pwd
/home/cheton/.nvm/versions/node/v4.4.3/lib/node_modules/cncjs/dist/web/i18n

To verify your changes during runtime, it's recommended that you open Developer Tools and disable browser cache. For example:

Step 1: Open Developer Tools and click [Settings]

image

Step 2: Disable cache

image

Now you can modify resource strings in the dist/cnc/web/i18n directory and refresh your browser to see the updates.

Note that you should not close DevTools to make sure your browser won't cache anything.