Comparing version 1.0.0 to 1.0.2
21
index.js
@@ -58,13 +58,20 @@ const fs = require('fs'); | ||
// calculate the regex to use for finding the config file | ||
var configNameSearch = buildConfigName({ | ||
configName: this.configName, | ||
extensions: Object.keys(this.extensions) | ||
}); | ||
// a list of possible configuration names | ||
var configNameSearch; | ||
if (opts.configName) { | ||
// if a configName has been provided by the user, only look for that | ||
configNameSearch = [opts.configName]; | ||
} else { | ||
// otherwise, look for the default configName using all available extensions | ||
configNameSearch = buildConfigName({ | ||
configName: this.configName, | ||
extensions: Object.keys(this.extensions) | ||
}); | ||
} | ||
// calculate configPath | ||
var configPath = findConfig({ | ||
configNameSearch: configNameSearch, | ||
searchPaths: searchPaths, | ||
configPath: opts.configPath | ||
searchPaths: searchPaths | ||
}); | ||
@@ -71,0 +78,0 @@ |
@@ -8,14 +8,10 @@ const fs = require('fs'); | ||
var configNameSearch = opts.configNameSearch; | ||
var configPath = opts.configPath; | ||
var searchPaths = opts.searchPaths; | ||
// only search for a config if a path to one wasn't explicitly provided | ||
if (!configPath) { | ||
if (!Array.isArray(searchPaths)) { | ||
throw new Error('Please provide an array of paths to search for config in.'); | ||
} | ||
if (!configNameSearch) { | ||
throw new Error('Please provide a configNameSearch.'); | ||
} | ||
configPath = fileSearch(configNameSearch, searchPaths); | ||
if (!Array.isArray(searchPaths)) { | ||
throw new Error('Please provide an array of paths to search for config in.'); | ||
} | ||
if (!configNameSearch) { | ||
throw new Error('Please provide a configNameSearch.'); | ||
} | ||
var configPath = fileSearch(configNameSearch, searchPaths); | ||
// confirm the configPath exists and return an absolute path to it | ||
@@ -22,0 +18,0 @@ if (fs.existsSync(configPath)) { |
{ | ||
"name": "liftoff", | ||
"description": "Launch your command line tool with ease.", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/tkellen/node-liftoff", | ||
@@ -6,0 +6,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23935
251