Skip to content
uupaa edited this page May 25, 2015 · 1 revision

This entry contains guidelines on WebModule developing workflow. ( Japanese version )

  1. Software requirements for WebModule:

    • Mac OS X 10.9.5 and later.
    • Homebrew.
    • Node.js latest version.
    • JDK version 1.7 and later. (request from Closure compiler)
    • Google Chrome Browser.
    • Xcode and iOS Simulator. (bundled on Xcode) (optional)
    • node-webkit Mac OS 64bit (optional)
    • npm modules([Plato][], [JSHint][], uupaa.compile.js)
  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 packages.
    $ npm install -g plato
    $ npm install -g jshint
    $ npm install -g uupaa.compile.js
  3. Clone WebModule to local your workspace(e.g. ~/workspace):

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

    Owner                    Repository name
    +-------------------+   +-------------------+
    | your account  (1) | / | MyExample.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 your local workspace:

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

    $ cd ~/workspace/MyExample.js
    
    $ node ../WebModule/run/setup
    >   - repositoryFullName: MyExample.js
    >   - repositoryName:     MyExample
    >   - copy source dir:    ~/workspace/WebModule/
    >   - copy target dir:    ~/workspace/MyExample.js/
    >
    >   clone:     ~/workspace/MyExample.js/lint/plato/README.md
    >   clone:     ~/workspace/MyExample.js/release/README.md
    >   clone:     ~/workspace/MyExample.js/.gitignore
    >   clone:     ~/workspace/MyExample.js/.jshintrc
    >   clone:     ~/workspace/MyExample.js/.npmignore
    >   clone:     ~/workspace/MyExample.js/.travis.yml
    >   clone:     ~/workspace/MyExample.js/index.js
    >   clone:     ~/workspace/MyExample.js/lib/MyExample.js
    >   clone:     ~/workspace/MyExample.js/test/testcase.js
    >                                       :
    >                                       :
    >   clone:     ~/workspace/MyExample.js/package.json
    >   exists:    ~/workspace/MyExample.js/README.md - overwrite it? (y/n): y
    >   overwrite: ~/workspace/MyExample.js/README.md
    >
    >   done.
    >
    >   Available next actions,
    >   `$ npm run`        # list up npm run-script
    >   `$ npm start`      # start local httpd server
    >   `$ npm run sync`   # sync scripts, install/update node modules, create test pages and minify
  7. Sync WebModule/MODULE_package.json to MyExample.js/package.json:

    $ npm run sync

Improve cycle

Edit and test.

$ npm start             # start local httpd server (port 8000)

$ edit lib/MyExample.js
$ npm run hint          # run jshint
$ npm run test          # run tests

$ npm run sim           # run test on iOS Simulator
$ npm run score         # 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