Skip to content
uupaa edited this page Oct 11, 2014 · 29 revisions

This file contains guidelines on WebModule developing workflow.

  1. Software requirements for WebModule:

    • Mac OS X 10.8 and later.
    • Homebrew.
    • Node.js latest version.
    • Google Chrome Browser.
    • iOS Simulator. (bundled on Xcode) (optional)
  2. Installation steps:

    $ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
    $ brew -v
    > Homebrew 0.9.5
    
    $ brew install node
    $ npm -v
    > 2.0.2
    • Add a NODE_PATH to your shell .rc file.
    $ echo 'export NODE_PATH="/usr/local/lib/node_modules"' >> ${HOME}/.zshrc
    $ source ${HOME}/.zshrc
    $ env | grep NODE_PATH
    > NODE_PATH=/usr/local/lib/node_modules
    • Install dependency npm modules.
    $ npm install -g plato
    $ npm install -g jshint
    $ npm install -g http-server
    $ npm install -g uupaa.compile.js
  3. Clone WebModule to local workspace:

    $ mkdir ~/workspace
    $ cd workspace
    $ git clone git@github.com:uupaa/WebModule.git
  4. Create an example WebModule repository on GitHub:

    • Creating a new repository
      • (1) Select your account.
      • (2) Input WebModule name. naming hint.
      • (3) Input description (optional).
      • (4) Check the box and select license.
      • (5) Click to create.
    Owner                    Repository name
    +-------------------+   +-------------------+
    | your account  (1) | / | WMExample.js  (2) |
    +-------------------+   +-------------------+
    
    Description (optional)
    +------------------------------------------------+
    | my first webmodule  (3)                        |
    +------------------------------------------------+
    
    [x] Public
    
    [x] Initialize this repository with a README  (4)
    +----------------------+  |  +---------------------------------+
    |                      |  |  | Add a license: MIT License  (4) |
    +----------------------+  |  +---------------------------------+
    
    +------------------------+
    | Create repository  (5) |
    +------------------------+
    
  5. Clone an example WebModule repository to local workspace:

    • Clone and change directory to it.
    $ pwd
    > ~/workspace
    
    $ git clone git@github.com:YOUR-ACCOUNT/WMExample.js.git
    $ cd WMExample.js
  6. Clone WebModule structure:

    $ pwd
    > ~/workspace/WMExample.js
    
    $ node ../WebModule/clone
    > clone:     ~/workspace/WMExample.js/lint/plato/README.md
    > clone:     ~/workspace/WMExample.js/release/README.md
    > clone:     ~/workspace/WMExample.js/.gitignore
    > clone:     ~/workspace/WMExample.js/.jshintrc
    > clone:     ~/workspace/WMExample.js/.npmignore
    > clone:     ~/workspace/WMExample.js/.travis.yml
    > clone:     ~/workspace/WMExample.js/index.js
    > clone:     ~/workspace/WMExample.js/lib/WMExample.js
    > clone:     ~/workspace/WMExample.js/test/test.js
    > clone:     ~/workspace/WMExample.js/package.json
    > exists:    ~/workspace/WMExample.js/README.md - overwrite it? (y/n): y
    > overwrite: ~/workspace/WMExample.js/README.md
  7. Initialize WMExample.js:

    $ pwd
    > ~/workspace/WMExample.js
    
    $ npm run init
    > npm update
    > npm run build
    > npm run test-page

Improve cycle

Edit and test.

$ vi lib/WMExample.js   # edit

$ npm run hint          # run jshint
$ npm run test          # run tests
$ npm run test-sim      # run test on iOS Simulator
$ npm run coverage      # run coverage tools

Commit and publish

  • Update patch version.

    $ npm run patch         # update patch version
    > update patch version. 0.0.0 -> 0.0.1
  • Commit and publish.

    $ git add .
    $ git commit -m "first commit"
    $ git push
    $ npm publish

Clone this wiki locally