configorama 0.4.0 → 0.4.1

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
@@ -29,6 +29,7 @@ const PromiseTracker = require('./utils/PromiseTracker')
29
29
  const handleSignalEvents = require('./utils/handleSignalEvents')
30
30
  const formatFunctionArgs = require('./utils/formatFunctionArgs')
31
31
  const cloudFormationSchema = require('./utils/cloudformationSchema')
32
+ const trimSurroundingQuotes = require('./utils/trimSurroundingQuotes')
32
33
  /**
33
34
  * Maintainer's notes:
34
35
  *
@@ -1299,7 +1300,7 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1299
1300
  }
1300
1301
 
1301
1302
  getValueFromFile(variableString) {
1302
- // console.log('From file', variableString)
1303
+ // console.log('From file', `"${variableString}"`)
1303
1304
  let matchedFileString = variableString.match(fileRefSyntax)[0]
1304
1305
  // console.log('matchedFileString', matchedFileString)
1305
1306
 
@@ -1325,12 +1326,15 @@ Like so: \${${variableString}, "fallbackValue"\}.`)
1325
1326
  }
1326
1327
  // console.log('argsToPass', argsToPass)
1327
1328
 
1328
- const relativePath = matchedFileString
1329
+ const relativePath = trimSurroundingQuotes(matchedFileString
1329
1330
  .replace(fileRefSyntax, (match, varName) => varName.trim())
1330
- .replace('~', os.homedir())
1331
+ .replace('~', os.homedir()))
1332
+
1331
1333
 
1332
1334
  let fullFilePath = (path.isAbsolute(relativePath) ? relativePath : path.join(this.configPath, relativePath))
1333
1335
 
1336
+ // console.log('fullFilePath', fullFilePath)
1337
+
1334
1338
  if (fs.existsSync(fullFilePath)) {
1335
1339
  // Get real path to handle potential symlinks (but don't fatal error)
1336
1340
  fullFilePath = fs.realpathSync(fullFilePath)
@@ -0,0 +1,5 @@
1
+ module.exports = function trimQuotes(str = '') {
2
+ return str
3
+ .replace(/^(")([^"\n]*?)(\1)$/, "$2")
4
+ .replace(/^(')([^'\n]*?)(\1)$/, "$2")
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configorama",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Variable support for configuration files",
5
5
  "main": "lib/index.js",
6
6
  "files": [