1.0.1 • Published 5 years ago

nownz-order-management v1.0.1

Weekly downloads
4
License
UNLICENSED
Repository
-
Last release
5 years ago

Now NodeJS Order Management

In the Terminal:

git clone git@bitbucket.org:now-nz/nownz-order-management.git

In IntelliJ IDEA, File->Import Project..., choose nownz-order-management folder

Then run

npm install -g coffee-script bower bunyan gulp
npm install

npm start

Start scripts

The following would usually just be run locally as npm run start|environment use gulp internally which usually wouldn't be on the production machine

Gulp is probably installed if using Heroku as we build before starting This may not apply to other deployments

Local

#!/bin/sh
npm start

or

#!/bin/sh
npm run local

Development

#!/bin/sh
npm run development

Quality Assurance

#!/bin/sh
npm run quality

Production

#!/bin/sh
npm run production

Production - Non gulp

#!/bin/sh
NOW_ENV=prod coffee service/start.coffee

General - Non gulp

#!/bin/sh
NOW_ENV=prod|qual|dev|local coffee service/start.coffee

Unit testing

To run server side unit tests

#!/bin/sh
npm test

or

#!/bin/sh
gulp test 

To run client side unit tests

#!/bin/sh
gulp test:karma 

Docker

#!/bin/sh
docker build --tag nownz/nownz-order-management .
docker run nownz/nownz-order-management

Heroku

To add Heroku remotes to your repository use

#!/bin/sh
heroku git:remote -r heroku --app nownz-<project_name>-<environment>

For example

#!/bin/sh
heroku git:remote -r heroku-dev --app nownz-order-management-dev

or

#!/bin/sh
heroku git:remote -r heroku-qual --app nownz-order-management-qual

Once you have a remote simply push to it

#!/bin/sh
git push heroku-dev master

Overall Directory Structure

At a high level, the structure looks roughly like this:

now-boilerplate/
  |- config/
  |- service/
  |- src/
  |- vendor/
  |- tasks/
  |- .bowerrc
  |- .npmrc
  |- .dockercfg
  |- bower.json
  |- build.config.js
  |- Gulpfile.js
  |- Gulpfile.coffee
  |- module.prefix
  |- module.suffix
  |- package.json
  |- boilerplate@.service
  |- Dockerfile

What follows is a brief description of each entry, but most directories contain their own README.md file with additional documentation, so browse around to learn more.

  • config/ - Configuration of our application
  • service/ - Node back-end code
  • src/ - Browser front-end code
  • vendor/ - third-party libraries. Bower will install packages here. Anything added to this directory will need to be manually added to build.config.js and karma/karma-unit.js to be picked up by the build system.
  • tasks/ - All our build scripts lay here.
  • .bowerrc - the Bower configuration file. This tells Bower to install components into the vendor/ directory.
  • .npmrc - the NPM configuration file.
  • bower.json - this is our project configuration for Bower and it contains the list of Bower dependencies we need.
  • build.config.js - our customizable build settings
  • Gulpfile.js - Bootstrap so we can use CoffeeScript for out build scripts
  • Gulpfile.coffee - Our build script
  • module.prefix and module.suffix - our compiled application script is wrapped in these, which by default are used to place the application inside a self-executing anonymous function to ensure no clashes with other libraries.
  • package.json - metadata about the app, used by NPM and our build script. Our NPM dependencies are listed here.

Licence

We have used UNLICENSED in the package as we do not wish to grant others the right to use our module

© NOW NEW ZEALAND LIMITED, All rights reserved.