From 151b8f2e14324c0cf1d50e4d4691bab3dd75cef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Mon, 4 Sep 2017 15:16:52 +0100 Subject: [PATCH] Document the build process better Add comments in gulpfile.js indicating how to add new files to the build. Add documentation for getting a development environment up and running in the README. Document each task defined in gulpfile.js in the README. --- README.md | 15 ++++++++++++++- gulpfile.js | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f0a08af..ee5ec3b5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,20 @@ For local development, **node.js** build system is used. 1. Install node.js 1. From project folder run `npm install` -1. To build JS and CSS use ` ./node_modules/gulp/bin/gulp.js` +1. To build the JS and CSS files and start the configurator: + - With NW.js: Run `npm start`. + - With Chrome: Run `./node_modules/gulp/bin/gulp.js`. Then open `chrome://extensions`, enable + the `Developer mode`, click on the `Load unpacked extension...` button and select the `inav-configurator` directory. + +Other tasks are also defined in `gulpfile.js`. To run a task, use `./node_modules/gulp/bin/gulp.js task-name`. Available ones are: + +- **build**: Generate JS and CSS output files used by the configurator from their sources. It must be run whenever changes are made to any `.js` or `.css` files in order to have those changes appear +in the configurator. If new files are added, they must be included in `gulpfile.js`. See the comments at the top of `gulpfile.js` to learn how to do so. See also the `watch` task. +- **watch**: Watch JS and CSS sources for changes and run the `build` task whenever they're edited. +- **dist**: Create a distribution of the app (valid for packaging both as a Chrome app or a NW.js app) +in the `./dist/` directory. +- **release**: Create NW.js apps for each supported platform (win32, osx64 and linux64) in the `./apps` +directory. ## Authors diff --git a/gulpfile.js b/gulpfile.js index 8f548431..2be8c366 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,6 +7,31 @@ var del = require('del'); var runSequence = require('run-sequence'); var NwBuilder = require('nw-builder'); + +// Each key in the *sources* variable must be an array of +// the source files that will be combined into a single +// file and stored in *outputDir*. Each key in *sources* +// must be also present in *output*, whose value indicates +// the filename for the output file which combines the +// contents of the source files. +// +// Keys must be camel cased and end with either 'Css' or +// 'Js' (e.g. someSourcesCss or someSourcesJs). For each +// key, a build task will be generated named by prepending +// 'build-' and converting the key to dash-separated words +// (e.g. someSourcesCss will generate build-some-sources-css). +// +// Tasks with names ending with '-js' will be executed by the +// build-all-js task, while the ones ending with '-css' will +// be done by build-all-css. There's also a build task which +// runs both build-all-css and build-all-js. +// +// The watch task will monitor any files mentioned in the *sources* +// variable and regenerate the corresponding output file when +// they change. +// +// See README.md for details on the other tasks. + var sources = {}; sources.css = [