Comparing version 3.4.0 to 3.4.1
{ | ||
"name": "devlab", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Node utility for running containerized tasks", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,2 +5,3 @@ 'use strict' | ||
const fs = require('fs') | ||
const path = require('path') | ||
@@ -14,10 +15,22 @@ const config = { | ||
* Loads config from yaml, attempts to parse to object | ||
* @param {string} (path) Path to config file or use defaultPath | ||
* @param {string} (configPath) Path to config file or use defaultPath | ||
* @returns {object} | ||
*/ | ||
load: (path = config.defaultPath) => { | ||
load: (configPath = config.defaultPath) => { | ||
try { | ||
return yaml.safeLoad(fs.readFileSync(path, 'utf8')) | ||
fs.statSync(configPath) | ||
} catch (err) { | ||
throw new Error([ | ||
`No config found at ${configPath}.`, | ||
'Please create a ./devlab.yml file or specify one with the `-c` flag.' | ||
].join(' ')) | ||
} | ||
try { | ||
return yaml.safeLoad(fs.readFileSync(configPath, 'utf8')) | ||
} catch (e) { | ||
throw new Error('Cannot load config file. Please ensure you have a valid ./devlab.yml file or specify one with the `-c` flag') | ||
const relPath = path.relative(process.cwd(), configPath) | ||
const error = new Error(`Please fix the errors in ${relPath}`) | ||
error.message = error.message + `:\n\n${e.message}` | ||
throw error | ||
} | ||
@@ -24,0 +37,0 @@ } |
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
31792
612