Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
return !reason
}
})
// get answers
const answers = await inquirer.prompt(questions)
// merge in defaults
const values = Object.assign({}, defaults, answers)
// return merge
return values
} catch (err) {
return Promise.reject(
new Errlop('Failed to fetch the answers from the user', err)
)
}
}
'unsupported-edition-engines-node-version'
) === 0
) {
fallbackEdition = edition
}
}
}
// if no edition was suitable for our environment, then try the fallback if it exists
// that is to say, ignore its engines.node
if (opts.strict === false && loaded === false && fallbackEdition) {
try {
result = loadEdition(fallbackEdition, opts)
loaded = true
} catch (editionError) {
editionsError = new Errlop(editionError, editionsError)
}
}
// if we were able to load something, then provide it
if (loaded) {
// make note of any errors if desired
if (editionsError && verbose) {
const stderr = opts.stderr || process.stderr
stderr.write(editionsError.stack + '\n')
}
return result
}
// otherwise, provide the error
else if (editionsError) {
if (opts.packagePath) {
throw errtion(
process.on('unhandledRejection', function unhandledRejection(error) {
console.error(new Errlop('An unhandled promise failed', error))
process.exit(-1)
})
/^# CUSTOM/i.test(line)
)
if (localCustomIndex !== -1) {
const remoteLines = data.split('\n')
const remoteCustomIndex = remoteLines.findIndex(line =>
/^# CUSTOM/i.test(line)
)
data = remoteLines
.slice(0, remoteCustomIndex)
.concat(localLines.slice(localCustomIndex))
.join('\n')
}
}
return write(file, data)
} catch (err) {
return Promise.reject(new Errlop(`Download of ${opts.url} FAILED`, err))
}
}
async function getNodeLTSVersions() {
const url =
'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'
try {
const response = await fetch(url)
const json = await response.json()
const lts = Object.entries(json)
return lts
} catch (err) {
throw new Errlop(`failed to fetch node.js LTS releases from ${url}`, err)
}
}
async function getMinimumNodeLTSVersion() {
safeps.exec(command, opts, function(err, stdout) {
if (err) return reject(new Errlop(`exec failed: ${command}`, err))
return resolve(stdout)
})
})
function errtion({ message, code, level }, parent) {
if (this) throw new Error('errtion is not to be created with new')
const error = new Errlop(message, parent)
if (code) error.code = code
if (level) error.level = level
return error
}