-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dest.js
32 lines (26 loc) · 683 Bytes
/
dest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
var path = require('path');
var debug = require('../debug');
var utils = require('../utils');
/**
* Set a `dest` path on `app.options`.
*
* ```sh
* $ app --dest=foo
* ```
* @name dest
* @api public
*/
module.exports = function(app) {
var dests = app.options.dest ? [app.options.dest] : [app.cwd];
return function(val, key, config, next) {
debug.field(key, val);
app.options.dest = path.resolve(val);
if (dests[dests.length - 1] !== app.options.dest) {
var dir = utils.magenta('~/' + utils.homeRelative(app.options.dest));
utils.timestamp('using dest path ' + dir);
dests.push(app.options.dest);
}
next();
};
};