From d22e666c769e66a5df956ecbe1bac95335eaa30b Mon Sep 17 00:00:00 2001 From: Paul Spencer Date: Thu, 18 Jul 2013 07:47:42 -0700 Subject: [PATCH] Updated Moving to NPM and Grunt (markdown) --- Moving-to-NPM-and-Grunt.md | 81 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/Moving-to-NPM-and-Grunt.md b/Moving-to-NPM-and-Grunt.md index d07a099..e0d2e16 100644 --- a/Moving-to-NPM-and-Grunt.md +++ b/Moving-to-NPM-and-Grunt.md @@ -8,6 +8,87 @@ The primary tool for managing dependencies and invoking various development task The actual development tasks will be run via [Grunt](gruntjs.com). Grunt requires a grunt-cli module to be installed. To avoid another dependency the user has to install, it can be installed as a direct dependency via npm and various grunt tasks can be invoked by npm via scripts. This will keep some consistency in the command line descriptions (npm install, npm test, npm build etc) and keep the prerequisites to a minimum. +## Installation + +### From Source +`git clone https://github.com/openlayers/ol3.git` +`cd ol3` +`npm install` + +### From NPM + +_assuming we publish an ol3 package with npm_ + +`npm install ol3` + +### Steps + +Both `npm install` and `npm install ol3` will process the `package.json` dependencies (and devDependencies if the environment variable `NODE_ENV` is **not** set to `production`). The `postinstall` script can be used to run an initial build if desired, this is what Tim has currently set up in his [use-node PR](https://github.com/openlayers/ol3/pull/804). + +## Build Targets + +### Current Situation + +* build - build `ol.css`, `ol.js`, `ol-simple.js` and `ol-whitespace.js` + +* check - runs `lint`, builds `ol.css`, `ol-all.js`, runs `test` + +* todo/fixme - greps code for TODO and FIXME comments + +* integration-test - runs `lint`, `build`, `build-all`, `test`, `build-examples`, `check-examples`, `doc` + +* build-all - builds `ol-all.js` + +* build-examples - runs `examples`, `EXAMPLES_COMBINED` + +* examples - ultimately runs bin/exampleparser.py + +* lint - runs gjslint on recently modified src, generated and requires files and a whitespace check + +* plovr - installs plovr + +* doc - builds documentation + +* test-deps + +* test + +* checkdeps - checks for the existence of executables that cannot be managed by ol3, i.e. java, python, git, gjslint, jsdoc, phantomjs (NOTE we can pare this down with npm) + +* reallyclean + +* serve - runs `plover`, `test-deps` and `examples` + +* serve-integration-test - runs `plovr`, `test-deps`, `INTERNAL_SRC` and runs plovr on ol-all.json and test.json. + +* host-resources - cleans build/hosts//resources and deploys new resources there + +* host-examples - runs `build`, `host-resources`, `examples` + +## NPM scripts required + +* postinstall - grunt install + +* test - what Tim did! + +* build - build ol.js, ol-simple.js, ol-whitespace.js (touch ol.css) + +* lint - grunt lint + +* clean - grunt clean + +* reallyclean + +* todo/fixme - grunt todo + +### Grunt Tasks + +* install - (custom code here) install / update dependencies + +* todo ([https://npmjs.org/package/grunt-todos](https://npmjs.org/package/grunt-todos)) + +* lint - ([https://npmjs.org/package/grunt-gjslint](https://npmjs.org/package/grunt-gjslint) which uses [https://github.com/jmendiara/node-closure-linter-wrapper](https://github.com/jmendiara/node-closure-linter-wrapper)) + ## Notes and Information ### Related issues and PRs