@datkt/konanc-config
Advanced tools
Comparing version 4.2.0 to 5.0.0
@@ -0,1 +1,12 @@ | ||
<a name="5.0.0"></a> | ||
# [5.0.0](https://github.com/datkt/konanc-config/compare/4.2.0...5.0.0) (2018-11-07) | ||
### Features | ||
* **bin/konanc-config:** Support repo path prefix from cli ([f453fbd](https://github.com/datkt/konanc-config/commit/f453fbd)) | ||
* **index.js:** Support 'package.kc' and prefix from supplied 'env' ([bbbec15](https://github.com/datkt/konanc-config/commit/bbbec15)) | ||
<a name="4.2.0"></a> | ||
@@ -2,0 +13,0 @@ # [4.2.0](https://github.com/datkt/konanc-config/compare/4.1.0...4.2.0) (2018-11-06) |
15
index.js
@@ -12,3 +12,3 @@ const { extname, dirname, resolve } = require('path') | ||
const PROTOCOL_REGEX = /[a-zA-Z0-9|+|-]+:\/\// | ||
const PREFIX = process.env.PREFIX || 'node_modules/' | ||
const PACKAGE_CONF = process.env.PACKAGE_CONF || 'package.kc' | ||
@@ -20,2 +20,11 @@ function load(name, defaults, env) { | ||
try { | ||
if (statSync(name).isDirectory()) { | ||
debug('resolved %s in %s', PACKAGE_CONF, name) | ||
name = resolve(name, PACKAGE_CONF) | ||
} | ||
} catch (err) { | ||
debug(err) | ||
} | ||
const config = '.kc' == extname(name) ? name : `${name}.kc` | ||
@@ -28,2 +37,4 @@ const cwd = process.cwd() | ||
const prefix = env.PREFIX || 'node_modules/' | ||
const conf = rc(name, defaults, { config }, (content) => { | ||
@@ -59,3 +70,3 @@ Object.assign(env, process.env, { | ||
for (const repo of conf.repo.slice()) { | ||
const prefixed = PREFIX + repo | ||
const prefixed = prefix + repo | ||
if (!conf.repo.includes(prefixed)) { | ||
@@ -62,0 +73,0 @@ conf.repo.push(prefixed) |
{ | ||
"name": "@datkt/konanc-config", | ||
"version": "4.2.0", | ||
"version": "5.0.0", | ||
"description": "Command line utility to read '*.kc' konanc config files to print compiler flags", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,3 +21,3 @@ konanc-config | ||
```sh | ||
usage: konanc-config: [-hV] [options] <configs> | ||
usage: konanc-config: [-hDV] [options] <configs> | ||
@@ -27,7 +27,14 @@ where options can be: | ||
-h, --help Print this message | ||
-D, --debug Enable debug output | ||
-V, --version Print program version | ||
-c, --cflags Print compiler flags | ||
-r, --repos, --repositories Print repositories | ||
-l --libs, --libraries Print libraries | ||
-l, --libs, --libraries Print libraries | ||
-p, --prefix=<path> Set repositories path prefix (default: 'node_modules/') | ||
Enable debug output by using the '-D, --debug' flag or set the | ||
'DEBUG=konanc-config' environment variable. | ||
Report bugs to <https://github.com/datkt/konanc-config/issues>. | ||
``` | ||
@@ -38,20 +45,23 @@ | ||
```sh | ||
$ konanc-config module.kc --libraries --repos --cflags | ||
$ konanc-config . --libraries --repos --cflags | ||
-opt -r /home/werle/repos/datkt/konanc-config/node_modules/@datkt -l sodium/sodium -l tape/tape | ||
``` | ||
where `module.kc` is | ||
where `.` contains a file called `package.kc`: | ||
```ini | ||
repo[] = "node_modules/@datkt" | ||
cflags[] = -opt | ||
require[] = sodium/sodium | ||
library[] = sodium/sodium | ||
library[] = tape/tape | ||
cflags[] = -opt | ||
repo[] = "node_modules/@datkt" | ||
``` | ||
## Writing A Config File | ||
## Writing A Config File `package.kc` | ||
Configuration files for the `konanc-config` command are in INI or JSON | ||
format. Any property can be defined, but currently, the command only | ||
supports printing libraries, repositories, and compiler flags. | ||
supports printing libraries, repositories, and compiler flags. The | ||
`konanc-config` command will recognize `package.kc` files found in | ||
directories by default. | ||
@@ -58,0 +68,0 @@ ### Adding Libraries |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
18276
162
180