configorama 0.4.3 → 0.4.5

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.
package/lib/main.js CHANGED
@@ -30,6 +30,7 @@ const handleSignalEvents = require('./utils/handleSignalEvents')
30
30
  const formatFunctionArgs = require('./utils/formatFunctionArgs')
31
31
  const cloudFormationSchema = require('./utils/cloudformationSchema')
32
32
  const trimSurroundingQuotes = require('./utils/trimSurroundingQuotes')
33
+ const deepLog = require('./utils/deep-log')
33
34
  /**
34
35
  * Maintainer's notes:
35
36
  *
@@ -423,6 +424,7 @@ class Configorama {
423
424
  if (DEBUG) {
424
425
  console.log(`Variable process ran ${this.callCount} times`)
425
426
  // console.log('FINAL Value', this.config)
427
+ // console.log(this.deep)
426
428
  }
427
429
  })
428
430
  }).then(() => {
@@ -609,6 +611,11 @@ class Configorama {
609
611
  }
610
612
  populateObjectImpl(objectToPopulate) {
611
613
  this.callCount = this.callCount + 1
614
+
615
+ if (DEBUG) {
616
+ deepLog(`objectToPopulate ${this.callCount}`, objectToPopulate)
617
+ }
618
+
612
619
  const leaves = this.getProperties(objectToPopulate, true, objectToPopulate)
613
620
  const populations = this.populateVariables(leaves)
614
621
 
@@ -676,8 +683,10 @@ class Configorama {
676
683
  * @returns {*} The populated value with the given results rendered according to the given matches
677
684
  */
678
685
  renderMatches(valueObject, matches, results) {
679
- // console.log('RENDER', matches)
680
- // console.log('RESULTS', results)
686
+ /*
687
+ console.log('RENDER', matches)
688
+ console.log('RESULTS', results)
689
+ /** */
681
690
  let result = valueObject.value
682
691
  for (let i = 0; i < matches.length; i += 1) {
683
692
  this.warnIfNotFound(matches[i].variable, results[i])
@@ -687,7 +696,14 @@ class Configorama {
687
696
  if (results[i] && typeof results[i] === 'object' && results[i].__internal_only_flag) {
688
697
  valueToPop = results[i].value
689
698
  }
699
+
690
700
  result = this.populateVariable(valueObject, matches[i].match, valueToPop)
701
+ /*
702
+ console.log('> valueToPop', valueToPop)
703
+ console.log('> valueObject', valueObject)
704
+ console.log('populateVariable r', result)
705
+ console.log(this.deep)
706
+ /** */
691
707
  }
692
708
  return result
693
709
  }
@@ -707,7 +723,9 @@ class Configorama {
707
723
  }
708
724
  const property = valueObject.value
709
725
  const matches = this.getMatches(property)
710
- // console.log('matchesmatches', matches)
726
+ /*
727
+ console.log('matchesmatches', matches)
728
+ /** */
711
729
  if (!_.isArray(matches)) {
712
730
  return Promise.resolve(property)
713
731
  }
@@ -715,6 +733,10 @@ class Configorama {
715
733
  return Promise.all(populations)
716
734
  .then(results => this.renderMatches(valueObject, matches, results))
717
735
  .then((result) => {
736
+ /*
737
+ console.log('renderMatches result', result)
738
+ /** */
739
+
718
740
  if (root && matches.length) {
719
741
  return this.populateValue({ value: result.value }, root)
720
742
  }
@@ -755,9 +777,10 @@ class Configorama {
755
777
  */
756
778
 
757
779
  const parts = splitByComma(variable)
758
- // console.log('parts', parts)
780
+
759
781
  if (parts.length > 1) {
760
782
  if (DEBUG) {
783
+ console.log('parts', parts)
761
784
  console.log('parts variable:', variable)
762
785
  console.log('parts property:', valueObject.value)
763
786
  console.log('All parts:', parts)
@@ -766,7 +789,7 @@ class Configorama {
766
789
  return this.overwrite(parts, valueObject)
767
790
  }
768
791
 
769
- return this.getValueFromSource(parts[0], valueObject)
792
+ return this.getValueFromSource(parts[0], valueObject, 'splitAndGet')
770
793
  }
771
794
  /**
772
795
  * Populate a given property, given the matched string to replace and the value to replace the
@@ -780,17 +803,32 @@ class Configorama {
780
803
  populateVariable(valueObject, matchedString, valueToPopulate) {
781
804
  let property = valueObject.value
782
805
  if (DEBUG) {
783
- console.log('------')
806
+ console.log('────────START populateVariable──────────────')
784
807
  console.log('populateVariable: valueToPopulate', valueToPopulate)
785
- console.log('populateVariable: matchedString', matchedString)
786
808
  console.log('populateVariable: valueObject', valueObject)
787
809
  console.log('populateVariable: property', property)
788
- console.log('------')
810
+ console.log('populateVariable: matchedString', matchedString)
789
811
  }
790
812
 
791
813
  // total replacement
792
814
  if (property === matchedString) {
815
+ const v = valueObject.value || ''
816
+ const originalSrc = valueObject.originalSource || ''
793
817
  property = valueToPopulate
818
+ /* Handle ${self:custom.ref, ''} with deep values */
819
+ if (v.match(deepRefSyntax) && originalSrc.match(this.variableSyntax) && !v.match(/deep\:(\d*)\..*}$/)) {
820
+ // console.log('MAJAJAAJJAAJAJJAJA', this.deep)
821
+ // console.log('originalSrc', originalSrc)
822
+ // console.log('value', v)
823
+ let deepIndex = Number(v.match(/deep\:(\d*)/)[1])
824
+ let item = this.deep[deepIndex]
825
+
826
+ if (item.match(deepRefSyntax)) {
827
+ deepIndex = Number(item.match(/deep\:(\d*)/)[1])
828
+ item = this.deep[deepIndex]
829
+ }
830
+ property = this.deep[deepIndex]
831
+ }
794
832
  // partial replacement, string
795
833
  } else if (_.isString(valueToPopulate)) {
796
834
  // if (property.match(/^> function /g)) {
@@ -869,7 +907,8 @@ class Configorama {
869
907
  path: valueObject.path,
870
908
  originalSource: valueObject.originalSource,
871
909
  // set __internal_only_flag to note this is object we make not a resolved value
872
- __internal_only_flag: true
910
+ __internal_only_flag: true,
911
+ caller: 'nestedVar'
873
912
  }
874
913
  }
875
914
 
@@ -949,7 +988,9 @@ ${valueObject.path}: ${valueObject.originalSource}
949
988
  path: valueObject.path,
950
989
  originalSource: valueObject.originalSource,
951
990
  // set __internal_only_flag to note this is object we make not a resolved value
952
- __internal_only_flag: true
991
+ __internal_only_flag: true,
992
+ caller: 'end',
993
+ count: this.callCount
953
994
  }
954
995
  }
955
996
  // ###############
@@ -969,7 +1010,7 @@ ${valueObject.path}: ${valueObject.originalSource}
969
1010
  // console.log('propertyString', typeof propertyString)
970
1011
  const variableValues = variableStrings.map((variableString) => {
971
1012
  // This runs on nested variable resolution
972
- return this.getValueFromSource(variableString, valueObject)
1013
+ return this.getValueFromSource(variableString, valueObject, 'overwrite')
973
1014
  })
974
1015
 
975
1016
  // console.log('variableValues', variableValues)
@@ -981,6 +1022,7 @@ ${valueObject.path}: ${valueObject.originalSource}
981
1022
  // console.log('valuevaluevaluevaluevaluevaluevaluevalue', value)
982
1023
  if (_.isString(value) && value.match(this.variableSyntax)) {
983
1024
  deepProperties += 1
1025
+ // console.log('makeDeepVariable overwrite', value)
984
1026
  const deepVariable = this.makeDeepVariable(value)
985
1027
  const newValue = cleanVariable(deepVariable, this.variableSyntax)
986
1028
  // console.log('variableStrings', variableStrings)
@@ -999,7 +1041,7 @@ ${valueObject.path}: ${valueObject.originalSource}
999
1041
  * @param variableString The variable string to retrieve a value for.
1000
1042
  * @returns {Promise.<TResult>|*} A promise resolving to the given variables value.
1001
1043
  */
1002
- getValueFromSource(variableString, valueObject) {
1044
+ getValueFromSource(variableString, valueObject, caller) {
1003
1045
  const propertyString = valueObject.value
1004
1046
  const pathValue = valueObject.path
1005
1047
  // return resolved value
@@ -1011,7 +1053,7 @@ ${valueObject.path}: ${valueObject.originalSource}
1011
1053
  let newHasFilter
1012
1054
  // Else lookup value from various sources
1013
1055
  if (DEBUG) {
1014
- console.log('>>>>> getValueFromSource')
1056
+ console.log(`>>>>> getValueFromSource() call - ${caller}`)
1015
1057
  console.log('variableString:', variableString)
1016
1058
  console.log('propertyString:', propertyString)
1017
1059
  console.log('pathValue:', pathValue)
@@ -1063,6 +1105,8 @@ ${valueObject.path}: ${valueObject.originalSource}
1063
1105
  return false
1064
1106
  })
1065
1107
 
1108
+ // console.log('found', found)
1109
+
1066
1110
  if (found && resolverFunction) {
1067
1111
  // TODO finalize resolverFunction API
1068
1112
  const valuePromise = resolverFunction(
@@ -1076,6 +1120,7 @@ ${valueObject.path}: ${valueObject.originalSource}
1076
1120
  /* match deep refs as empty {}, they need resolving via functions */
1077
1121
  (typeof val === 'object' && _.isEmpty(val) && variableString.match(/deep\:/))
1078
1122
  ) {
1123
+ // console.log('variableString', variableString)
1079
1124
  const cleanV = cleanVariable(propertyString, this.variableSyntax)
1080
1125
  const valueCount = splitByComma(cleanV)
1081
1126
 
@@ -1113,7 +1158,7 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1113
1158
  // console.log('propertyString', propertyString)
1114
1159
  // console.log('resolved val', val)
1115
1160
  // console.log('------')
1116
-
1161
+ // console.log('newHasFilter', newHasFilter)
1117
1162
  // No filters found. return value
1118
1163
  if (!newHasFilter) {
1119
1164
  return Promise.resolve(val)
@@ -1200,7 +1245,7 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1200
1245
  const fallbackStr = getFallbackString(split, nestedVar)
1201
1246
  return this.getValueFromSource(variableString, {
1202
1247
  value: fallbackStr
1203
- })
1248
+ }, 'nestedVar')
1204
1249
  }
1205
1250
 
1206
1251
  // TODO verify we need this still with file(file.js, param)
@@ -1212,7 +1257,7 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1212
1257
  // recurse on fallback and check again
1213
1258
  return this.getValueFromSource(`${variableString})`, {
1214
1259
  value: propertyString
1215
- })
1260
+ }, 'cleanClean.match(fileRefSyntax)')
1216
1261
  }
1217
1262
  }
1218
1263
  // const fallbackValue = split[1] || split[0]
@@ -1227,10 +1272,13 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1227
1272
 
1228
1273
  // has fallback but needs deeper lookup. Call getValueFromSource again
1229
1274
  if (fallbackValue) {
1275
+ if (DEBUG) {
1276
+ console.log('fallbackValue', fallbackValue)
1277
+ }
1230
1278
  // recurse on fallback and check again
1231
1279
  return this.getValueFromSource(fallbackValue, {
1232
1280
  value: propertyString
1233
- })
1281
+ }, 'fallbackValue')
1234
1282
  }
1235
1283
  }
1236
1284
 
@@ -1274,7 +1322,10 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1274
1322
  }
1275
1323
 
1276
1324
  getValueFromSelf(variableString, o, x, data) {
1277
- // console.log('self', variableString)
1325
+ /*
1326
+ console.log('getValueFromSelf variableString', variableString)
1327
+ /** */
1328
+
1278
1329
  // console.log('self data', data)
1279
1330
 
1280
1331
  const split = variableString.split(':')
@@ -1296,7 +1347,13 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1296
1347
  }
1297
1348
  }
1298
1349
 
1299
- return this.getDeeperValue(deepProperties, valueToPopulate)
1350
+ return this.getDeeperValue(deepProperties, valueToPopulate).then((res) => {
1351
+ /*
1352
+ console.log('self getDeeperValue variableString', variableString)
1353
+ console.log('self getDeeperValue result', res)
1354
+ /** */
1355
+ return res
1356
+ })
1300
1357
  }
1301
1358
 
1302
1359
  getValueFromFile(variableString) {
@@ -1468,17 +1525,28 @@ Please use ":" to reference sub properties`
1468
1525
  }
1469
1526
  getVariableFromDeep(variableString) {
1470
1527
  const index = this.getDeepIndex(variableString)
1528
+ /*
1529
+ console.log('FIND INDEX', index)
1530
+ console.log(this.deep)
1531
+ /** */
1471
1532
  return this.deep[index]
1472
1533
  }
1473
1534
  getValueFromDeep(variableString) {
1474
1535
  const deepPrefixReplace = RegExp(/(?:^deep:)\d+\.?/g)
1475
1536
  const variable = this.getVariableFromDeep(variableString)
1476
1537
  const deepRef = variableString.replace(deepPrefixReplace, '')
1538
+ /*
1539
+ console.log("GET getValueFromDeep", variableString)
1540
+ console.log('deepRef', deepRef)
1541
+ console.log('variablex', variable)
1542
+ /** */
1477
1543
  let ret = this.populateValue({ value: variable })
1544
+ // console.log('variable ret', ret)
1478
1545
  if (deepRef.length) { // if there is a deep reference remaining
1479
1546
  ret = ret.then((result) => {
1480
1547
  // console.log('DEEP RESULT', result)
1481
1548
  if (_.isString(result.value) && result.value.match(this.variableSyntax)) {
1549
+ // console.log('makeDeepVariable getValueFromDeep', result.value)
1482
1550
  const deepVariable = this.makeDeepVariable(result.value)
1483
1551
  return Promise.resolve(appendDeepVariable(deepVariable, deepRef))
1484
1552
  }
@@ -1492,8 +1560,10 @@ Please use ":" to reference sub properties`
1492
1560
  // console.log('MAKE DEEP', variable)
1493
1561
  let index = this.deep.findIndex((item) => variable === item)
1494
1562
  if (index < 0) {
1563
+ // console.log('this.deep.push', variable)
1495
1564
  index = this.deep.push(variable) - 1
1496
1565
  }
1566
+ // console.log("makeDeepVariable SET INDEX", index)
1497
1567
  const variableContainer = variable.match(this.variableSyntax)[0]
1498
1568
  const variableString = cleanVariable(variableContainer, this.variableSyntax)
1499
1569
  const deepVar = variableContainer.replace(variableString, `deep:${index}`)
@@ -1518,8 +1588,17 @@ Please use ":" to reference sub properties`
1518
1588
  * will later resolve to the deeper value
1519
1589
  */
1520
1590
  getDeeperValue(deepProperties, valueToPopulate) {
1591
+ /*
1592
+ console.log('deepProperties', deepProperties)
1593
+ console.log('valueToPopulate', valueToPopulate)
1594
+ /** */
1595
+
1521
1596
  const veryDeep = deepProperties.reduce(async (reducedValueParam, subProperty) => {
1522
1597
  let reducedValue = await reducedValueParam
1598
+ // console.log('reducedValue', reducedValue)
1599
+ // console.log(typeof reducedValue)
1600
+ // console.log('subProperty', `"${subProperty}"`)
1601
+
1523
1602
  if (_.isString(reducedValue) && reducedValue.match(deepRefSyntax)) { // build mode
1524
1603
  reducedValue = appendDeepVariable(reducedValue, subProperty)
1525
1604
  } else { // get mode
@@ -1531,9 +1610,17 @@ Please use ":" to reference sub properties`
1531
1610
  path: undefined,
1532
1611
  originalSource: undefined,
1533
1612
  // set __internal_only_flag to note this is object we make not a resolved value
1534
- __internal_only_flag: true
1613
+ __internal_only_flag: true,
1614
+ caller: 'getDeeperValue',
1535
1615
  }
1536
- } else if (subProperty !== '' || '' in reducedValue) {
1616
+ } else if (subProperty !== '' || (typeof reducedValue === 'object' && '' in reducedValue)) {
1617
+ try {
1618
+ // if JSON parse it
1619
+ reducedValue = JSON.parse(reducedValue)
1620
+ } catch (e) {}
1621
+
1622
+ reducedValue = reducedValue[subProperty]
1623
+ } else if (_.isString(reducedValue)) {
1537
1624
  try {
1538
1625
  // if JSON parse it
1539
1626
  reducedValue = JSON.parse(reducedValue)
@@ -1542,10 +1629,11 @@ Please use ":" to reference sub properties`
1542
1629
  reducedValue = reducedValue[subProperty]
1543
1630
  }
1544
1631
  if (typeof reducedValue === 'string' && reducedValue.match(this.variableSyntax)) {
1632
+ // console.log('makeDeepVariable reducedValue', reducedValue)
1545
1633
  reducedValue = this.makeDeepVariable(reducedValue)
1546
1634
  }
1547
1635
  }
1548
-
1636
+ // console.log('fin', reducedValue)
1549
1637
  return Promise.resolve(reducedValue)
1550
1638
  }, Promise.resolve(valueToPopulate))
1551
1639
 
@@ -1553,17 +1641,22 @@ Please use ":" to reference sub properties`
1553
1641
  }
1554
1642
 
1555
1643
  warnIfNotFound(variableString, valueToPopulate) {
1644
+ let varType
1645
+ if (variableString.match(envRefSyntax)) {
1646
+ varType = 'environment variable'
1647
+ } else if (variableString.match(optRefSyntax)) {
1648
+ varType = 'option'
1649
+ } else if (variableString.match(selfRefSyntax)) {
1650
+ varType = 'config attribute'
1651
+ } else if (variableString.match(fileRefSyntax)) {
1652
+ varType = 'file'
1653
+ } else if (variableString.match(deepRefSyntax)) {
1654
+ varType = 'deep'
1655
+ }
1556
1656
  if (!isValidValue(valueToPopulate)) {
1557
- let varType
1558
- if (variableString.match(envRefSyntax)) {
1559
- varType = 'environment variable'
1560
- } else if (variableString.match(optRefSyntax)) {
1561
- varType = 'option'
1562
- } else if (variableString.match(selfRefSyntax)) {
1563
- varType = 'config attribute'
1564
- } else if (variableString.match(fileRefSyntax)) {
1565
- varType = 'file'
1566
- }
1657
+ // console.log("MISSING", variableString)
1658
+ // console.log(this.deep)
1659
+ // console.log(valueToPopulate)
1567
1660
 
1568
1661
  const notFoundMsg = `No ${varType} found to satisfy the '\${${variableString}}' variable. Attempting fallback value`
1569
1662
  if (DEBUG) {
@@ -1617,7 +1710,7 @@ function verifyVariable(variableString, valueObject, variableTypes, config) {
1617
1710
  })
1618
1711
  // If not found in variable resolvers and is missing a colon throw
1619
1712
  if (!isRealVariable && variableString.match(/:/)) {
1620
- console.log('variableString', variableString)
1713
+ // console.log('variableString', variableString)
1621
1714
  throw new Error(`
1622
1715
  Variable \${${variableString}} is invalid variable syntax.
1623
1716
  Value Path: ${(valueObject.path) ? valueObject.path.join('.') : 'na'}
@@ -22,7 +22,7 @@ async function _getValueFromGit(variableString) {
22
22
  const variable = variableString.split(`${GIT_PREFIX}:`)[1]
23
23
  let value = null
24
24
  // console.log('variableStringvariableString', variableString)
25
- if (variable.match(/^remote/)) {
25
+ if (variable.match(/^remote/i)) {
26
26
  const hasParams = functionRegex.exec(variableString)
27
27
  const remoteName = (hasParams && hasParams[2]) ? formatFunctionArgs(hasParams[2]) : 'origin'
28
28
  value = await getGitRemote(remoteName)
@@ -30,22 +30,42 @@ async function _getValueFromGit(variableString) {
30
30
  }
31
31
 
32
32
  const verifyMsg = `Verify the cwd has a .git directory\n`
33
+ const normalizedVar = (variable || '').toLowerCase()
33
34
 
34
- switch (variable) {
35
- case 'describe':
36
- try {
37
- value = await _exec('git describe --always')
38
- } catch (err) {
39
- throw new Error(`\${git:describeLight} error. ${verifyMsg}`)
40
- }
41
- break
42
- case 'describeLight':
43
- try {
44
- value = await _exec('git describe --always --tags')
45
- } catch (err) {
46
- throw new Error(`\${git:describeLight} error. ${verifyMsg}`)
47
- }
48
- break
35
+ switch (normalizedVar) {
36
+ // Repo owner/name
37
+ case 'repo':
38
+ case 'repository':
39
+ case 'reposlug':
40
+ case 'repo-slug':
41
+ const urla = await getGitRemote()
42
+ const parseda = GitUrlParse(urla)
43
+ value = parseda.full_name
44
+ break;
45
+ // Repo name
46
+ case 'name':
47
+ case 'reponame': // repoName
48
+ case 'repo-name':
49
+ value = await _exec('basename `git rev-parse --show-toplevel`')
50
+ break;
51
+ // Repo org or owner
52
+ case 'org':
53
+ case 'owner':
54
+ case 'organization':
55
+ case 'repoowner': // repoOwner
56
+ case 'repo-owner':
57
+ const url = await getGitRemote()
58
+ const parsed = GitUrlParse(url)
59
+ value = parsed.organization || parsed.owner
60
+ break;
61
+ // Repo url
62
+ case 'url':
63
+ case 'repourl': // repoUrl
64
+ case 'repo-url':
65
+ value = await getGitRemote()
66
+ break;
67
+ // Current commit sha
68
+ case 'sha':
49
69
  case 'sha1':
50
70
  try {
51
71
  value = await _exec('git rev-parse --short HEAD')
@@ -53,38 +73,70 @@ async function _getValueFromGit(variableString) {
53
73
  throw new Error(`\${git:sha1} error ${verifyMsg}`)
54
74
  }
55
75
  break
76
+ // Current commit full sha
56
77
  case 'commit':
78
+ case 'commitsha':
79
+ case 'commit-sha':
80
+ case 'commithash':
81
+ case 'commit-hash':
57
82
  try {
58
83
  value = await _exec('git rev-parse HEAD')
59
84
  } catch (err) {
60
85
  throw new Error(`\${git:commit} error. ${verifyMsg}`)
61
86
  }
62
87
  break
88
+ // Branches
63
89
  case 'branch':
90
+ case 'branchname':
91
+ case 'branch-name':
92
+ case 'currentbranch': // currentBranch
93
+ case 'current-branch':
64
94
  try {
65
95
  value = await _exec('git rev-parse --abbrev-ref HEAD')
66
96
  } catch (err) {
67
97
  throw new Error(`\${git:branch} error. ${verifyMsg}`)
68
98
  }
69
99
  break
100
+ // Commit msg
101
+ case 'msg':
70
102
  case 'message':
103
+ case 'commitmessage': // commitMessage
104
+ case 'commit-message':
105
+ case 'commitmsg': // commitMsg
106
+ case 'commit-msg':
71
107
  try {
72
108
  value = await _exec('git log -1 --pretty=%B')
73
109
  } catch (err) {
74
110
  throw new Error(`\${git:message} error. ${verifyMsg}`)
75
111
  }
76
- break
112
+ break;
113
+ // Git tags
114
+ case 'tag':
115
+ case 'describe':
116
+ try {
117
+ value = await _exec('git describe --always')
118
+ } catch (err) {
119
+ throw new Error(`\${git:describeLight} error. ${verifyMsg}`)
120
+ }
121
+ break;
122
+ // Git tags
123
+ case 'describeLight':
124
+ case 'describelight':
125
+ case 'describe-light':
126
+ try {
127
+ value = await _exec('git describe --always --tags')
128
+ } catch (err) {
129
+ throw new Error(`\${git:describeLight} error. ${verifyMsg}`)
130
+ }
131
+ break;
132
+ // Is branch dirty
77
133
  case 'isDirty':
134
+ case 'isdirty':
135
+ case 'is-dirty':
78
136
  const writeTree = await _exec('git write-tree')
79
137
  const changes = await _exec(`git diff-index ${writeTree} --`)
80
138
  value = `${changes.length > 0}`
81
139
  break
82
- case 'repository':
83
- value = await _exec('basename `git rev-parse --show-toplevel`')
84
- break
85
- case 'url': case 'repoUrl':
86
- value = await getGitRemote()
87
- break
88
140
  default:
89
141
  throw new Error(`Git variable ${variable} is unknown. Candidates are 'describe', 'describeLight', 'sha1', 'commit', 'branch', 'message', 'repository'`)
90
142
  }
@@ -0,0 +1,10 @@
1
+ const util = require('util')
2
+
3
+ module.exports = function deepLog(objOrLabel, logVal) {
4
+ let obj = objOrLabel
5
+ if (typeof objOrLabel === 'string') {
6
+ obj = logVal
7
+ console.log(objOrLabel)
8
+ }
9
+ console.log(util.inspect(obj, false, null, true))
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configorama",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Variable support for configuration files",
5
5
  "main": "lib/index.js",
6
6
  "files": [