configorama 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/cli.js +28 -3
  2. package/package.json +1 -1
  3. package/src/main.js +14 -0
package/cli.js CHANGED
@@ -3,17 +3,17 @@
3
3
  const fs = require('fs')
4
4
  const minimist = require('minimist')
5
5
  const Configorama = require('./src/main')
6
+ const deepLog = require('./src/utils/deep-log')
6
7
 
7
8
  // Parse command line arguments
8
9
  const argv = minimist(process.argv.slice(2), {
9
10
  string: ['output', 'o', 'format', 'f'],
10
- boolean: ['help', 'h', 'version', 'v', 'debug', 'd', 'allow-unknown', 'allow-undefined'],
11
+ boolean: ['help', 'h', 'version', 'v', 'debug', 'allow-unknown', 'allow-undefined'],
11
12
  alias: {
12
13
  h: 'help',
13
14
  v: 'version',
14
15
  o: 'output',
15
16
  f: 'format',
16
- d: 'debug'
17
17
  },
18
18
  default: {
19
19
  format: 'json'
@@ -74,6 +74,29 @@ const options = {
74
74
  dynamicArgs: argv
75
75
  }
76
76
 
77
+ if (options.dynamicArgs.verbose) {
78
+ console.log('───────────── Input Options ──────────────────────')
79
+ const dynamicArgs = options.dynamicArgs || {}
80
+ const {
81
+ _,
82
+ verbose,
83
+ v,
84
+ debug,
85
+ d,
86
+ help,
87
+ h,
88
+ version,
89
+ f,
90
+ format,
91
+ 'allow-unknown': allowUnknown,
92
+ 'allow-undefined': allowUndefined,
93
+ ...rest
94
+ } = dynamicArgs
95
+ console.log()
96
+ deepLog(rest)
97
+ console.log()
98
+ }
99
+
77
100
  // Create Configorama instance
78
101
  const configorama = new Configorama(inputFile, options)
79
102
  // console.log('configorama', configorama)
@@ -104,7 +127,9 @@ configorama.init(argv)
104
127
  fs.writeFileSync(argv.output, output)
105
128
  console.log(`Configuration written to ${argv.output}`)
106
129
  } else {
107
- console.log(output)
130
+ if (!argv.verbose) {
131
+ console.log(output)
132
+ }
108
133
  }
109
134
  })
110
135
  .catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configorama",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Variable support for configuration files",
5
5
  "main": "lib/index.js",
6
6
  "files": [
package/src/main.js CHANGED
@@ -79,6 +79,7 @@ const base64WrapperRegex = /\[_\[([A-Za-z0-9+/=\s]*)\]_\]/g
79
79
  const logLines = '─────────────────────────────────────────────────'
80
80
 
81
81
  let DEBUG = process.argv.includes('--debug') ? true : false
82
+ let VERBOSE = process.argv.includes('--verbose') ? true : false
82
83
  // DEBUG = true
83
84
 
84
85
  const ENABLE_FUNCTIONS = true
@@ -136,6 +137,13 @@ class Configorama {
136
137
  this.opts
137
138
  )
138
139
 
140
+ if (VERBOSE) {
141
+ console.log('───────────── Input Config ──────────────────────')
142
+ console.log()
143
+ deepLog(configObject)
144
+ console.log()
145
+ }
146
+
139
147
  this.configFilePath = fileOrObject
140
148
  // set config objects
141
149
  this.config = configObject
@@ -478,6 +486,12 @@ class Configorama {
478
486
  if (this.mergeKeys && this.config) {
479
487
  this.config = mergeByKeys(this.config, '', this.mergeKeys)
480
488
  }
489
+ if (VERBOSE) {
490
+ console.log('───────────── Resolved Config ───────────────────')
491
+ console.log()
492
+ deepLog(this.config)
493
+ console.log()
494
+ }
481
495
  return this.config
482
496
  })
483
497
  })