Matteo Scandolo | e19fa10 | 2017-03-09 15:38:59 -0800 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
| 3 | /** |
| 4 | * This file contains the variables used in other gulp files |
| 5 | * which defines tasks |
| 6 | * By design, we only put there very generic config values |
| 7 | * which are used in several places to keep good readability |
| 8 | * of the tasks |
| 9 | */ |
| 10 | |
| 11 | const path = require('path'); |
| 12 | const gutil = require('gulp-util'); |
| 13 | |
| 14 | exports.ngModule = 'app'; |
| 15 | |
| 16 | /** |
| 17 | * The main paths of your project handle these with care |
| 18 | */ |
| 19 | exports.paths = { |
| 20 | src: 'src', |
| 21 | dist: 'dist/extensions/vtr', // NOTE that 'sample' have to match the extension name provided in platform install |
| 22 | appConfig: 'conf/app', |
| 23 | tmp: '.tmp', |
| 24 | e2e: 'e2e', |
| 25 | tasks: 'gulp_tasks' |
| 26 | }; |
| 27 | |
| 28 | exports.path = {}; |
| 29 | for (const pathName in exports.paths) { |
| 30 | if (exports.paths.hasOwnProperty(pathName)) { |
| 31 | exports.path[pathName] = function pathJoin() { |
| 32 | const pathValue = exports.paths[pathName]; |
| 33 | const funcArgs = Array.prototype.slice.call(arguments); |
| 34 | const joinArgs = [pathValue].concat(funcArgs); |
| 35 | return path.join.apply(this, joinArgs); |
| 36 | }; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Common implementation for an error handler of a Gulp plugin |
| 42 | */ |
| 43 | exports.errorHandler = function (title) { |
| 44 | return function (err) { |
| 45 | gutil.log(gutil.colors.red(`[${title}]`), err.toString()); |
| 46 | this.emit('end'); |
| 47 | }; |
| 48 | }; |