@datkt/konanc-config
Advanced tools
Comparing version 3.2.1 to 4.0.0
@@ -0,1 +1,16 @@ | ||
<a name="4.0.0"></a> | ||
# [4.0.0](https://github.com/datkt/konanc-config/compare/3.2.1...4.0.0) (2018-11-05) | ||
### Bug Fixes | ||
* **index.js:** Make resolution work with 'find-up' ([e162f03](https://github.com/datkt/konanc-config/commit/e162f03)) | ||
### Features | ||
* **bin/konanc-config:** Enable debug output ([f8e743a](https://github.com/datkt/konanc-config/commit/f8e743a)) | ||
<a name="3.2.1"></a> | ||
@@ -2,0 +17,0 @@ ## [3.2.1](https://github.com/datkt/konanc-config/compare/3.2.0...3.2.1) (2018-11-05) |
33
index.js
const { extname, dirname, resolve } = require('path') | ||
const { existsSync } = require('fs') | ||
const { parse } = require('rc/lib/utils') | ||
const debug = require('debug')('konanc-config') | ||
const find = require('find-up').sync | ||
const rc = require('rc') | ||
@@ -27,3 +29,8 @@ | ||
__filename: resolve(config), | ||
resolve(lookup) { | ||
debug('resolve lookup:', lookup) | ||
return find(lookup) | ||
} | ||
}) | ||
return parse(template(content)) | ||
@@ -33,7 +40,13 @@ }) | ||
if ('string' == typeof conf.repo) { | ||
if (!PROTOCOL_REGEX.test(conf.repo)) { | ||
conf.repo = [ resolve(dirname(config), conf.repo) ] | ||
const { repo } = conf | ||
if (!PROTOCOL_REGEX.test(repo)) { | ||
conf.repo = [ resolve(dirname(config), repo) ] | ||
} else { | ||
conf.repo = [ conf.repo ] | ||
conf.repo = [ repo ] | ||
} | ||
if (!conf.repo.includes(repo)) { | ||
conf.repo.push(repo) | ||
} | ||
} | ||
@@ -44,6 +57,12 @@ | ||
if ('string' == typeof repo && !PROTOCOL_REGEX.test(repo)) { | ||
const path = resolve(cwd, repo) | ||
if (!conf.repo.includes(path)) { | ||
const path = resolve(repo) | ||
const found = find(repo) | ||
if (path && !conf.repo.includes(path)) { | ||
conf.repo.push(path) | ||
} | ||
if (found && !conf.repo.includes(found)) { | ||
conf.repo.push(found) | ||
} | ||
} | ||
@@ -73,3 +92,5 @@ } | ||
for (const repo of repos) { | ||
merge(conf, load(resolve(repo, dep), defaults, env)) | ||
if (repo && 'string' === typeof repo) { | ||
merge(conf, load(resolve(repo, dep), defaults, env)) | ||
} | ||
} | ||
@@ -76,0 +97,0 @@ } |
{ | ||
"name": "@datkt/konanc-config", | ||
"version": "3.2.1", | ||
"version": "4.0.0", | ||
"description": "Command line utility to read '*.kc' konanc config files to print compiler flags", | ||
@@ -28,2 +28,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"debug": "^4.1.0", | ||
"find-up": "^3.0.0", | ||
@@ -30,0 +31,0 @@ "minimist": "^1.2.0", |
Sorry, the diff of this file is not supported yet
15412
133
4
+ Addeddebug@^4.1.0
+ Addeddebug@4.4.0(transitive)
+ Addedms@2.1.3(transitive)