|
1 | | -var fs = require('fs') |
2 | | -var path = require('path') |
| 1 | +var fs = require('fs'); |
| 2 | +var path = require('path'); |
3 | 3 |
|
4 | 4 | function read(dir) { |
5 | | - var f = path.resolve(dir, '.node-dev.json') |
6 | | - return fs.existsSync(f) ? JSON.parse(fs.readFileSync(f)) : {} |
| 5 | + var f = path.resolve(dir, '.node-dev.json'); |
| 6 | + return fs.existsSync(f) ? JSON.parse(fs.readFileSync(f)) : {}; |
7 | 7 | } |
8 | 8 |
|
9 | 9 | function resolvePath(unresolvedPath) { |
10 | | - return path.resolve(process.cwd(), unresolvedPath) |
| 10 | + return path.resolve(process.cwd(), unresolvedPath); |
11 | 11 | } |
12 | 12 |
|
13 | | -module.exports = function(main, opts) { |
14 | | - var dir = main ? path.dirname(main) : '.' |
15 | | - var c = read(dir) |
| 13 | +module.exports = function (main, opts) { |
16 | 14 |
|
17 | | - c.__proto__ = read(process.env.HOME || process.env.USERPROFILE) |
| 15 | + var dir = main ? path.dirname(main) : '.'; |
| 16 | + var c = read(dir); |
| 17 | + |
| 18 | + /* eslint-disable no-proto */ |
| 19 | + c.__proto__ = read(process.env.HOME || process.env.USERPROFILE); |
18 | 20 |
|
19 | 21 | // Truthy == --all-deps, false: one level of deps |
20 | | - if (typeof c.deps != 'number') c.deps = c.deps ? -1 : 1 |
| 22 | + if (typeof c.deps !== 'number') c.deps = c.deps ? -1 : 1; |
21 | 23 |
|
22 | 24 | if (opts) { |
23 | 25 | // Overwrite with CLI opts ... |
24 | | - if (opts.allDeps) c.deps = -1 |
25 | | - if (!opts.deps) c.deps = 0 |
26 | | - if (opts.dedupe) c.dedupe = true |
| 26 | + if (opts.allDeps) c.deps = -1; |
| 27 | + if (!opts.deps) c.deps = 0; |
| 28 | + if (opts.dedupe) c.dedupe = true; |
| 29 | + if (opts.respawn) c.respawn = true; |
27 | 30 | } |
28 | 31 |
|
29 | | - var ignore = (c.ignore || []).map(resolvePath) |
| 32 | + var ignore = (c.ignore || []).map(resolvePath); |
30 | 33 |
|
31 | 34 | return { |
32 | | - vm : c.vm !== false, |
33 | | - fork : c.fork !== false, |
34 | | - notify : c.notify !== false, |
35 | | - deps : c.deps, |
36 | | - timestamp : c.timestamp || (c.timestamp !== false && 'HH:MM:ss'), |
37 | | - clear : !!c.clear, |
38 | | - dedupe : !!c.dedupe, |
39 | | - ignore : ignore, |
40 | | - extensions : c.extensions || { |
41 | | - coffee: "coffee-script/register", |
42 | | - ls: "LiveScript" |
| 35 | + vm: c.vm !== false, |
| 36 | + fork: c.fork !== false, |
| 37 | + notify: c.notify !== false, |
| 38 | + deps: c.deps, |
| 39 | + timestamp: c.timestamp || (c.timestamp !== false && 'HH:MM:ss'), |
| 40 | + clear: !!c.clear, |
| 41 | + dedupe: !!c.dedupe, |
| 42 | + ignore: ignore, |
| 43 | + respawn: c.respawn || false, |
| 44 | + extensions: c.extensions || { |
| 45 | + coffee: 'coffee-script/register', |
| 46 | + ls: 'LiveScript' |
43 | 47 | } |
44 | | - } |
45 | | -} |
| 48 | + }; |
| 49 | +}; |
0 commit comments