Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function versionsWithoutTimestamps (releases, tags) {
const vers = releases.versions
if (is.arrayOf(semverAllowTags, vers)) {
debug('returning versions without timestamps')
// debug(releases);
return vers.map(version => {
const result = {
version: version
}
if (tags && tags[version]) {
result['dist-tag'] = tags[version]
}
return result
})
}
if (is.arrayOf(is.object, vers)) {
la(
vers.every(is.has('version')),
'some objects do not have version property',
function versionsWithoutTimestamps (releases, tags) {
const vers = releases.versions
if (is.arrayOf(semverAllowTags, vers)) {
debug('returning versions without timestamps')
// debug(releases);
return vers.map(version => {
const result = {
version: version
}
if (tags && tags[version]) {
result['dist-tag'] = tags[version]
}
return result
})
}
if (is.arrayOf(is.object, vers)) {
la(
vers.every(is.has('version')),
'some objects do not have version property',
releases
)
return _.pluck(vers, 'version')
}
throw new Error(
'Cannot extract versions from ' + JSON.stringify(releases, null, 2)
)
}
it('does not like tags in list', function () {
var versions = ['0.0.0-semantic-release', '0.0.0', '0.1.0']
la(!is.arrayOf(is.semver, versions), 'not sem vers', versions)
})
})
it('handles list with tags', function () {
var versions = [
'0.0.0-semantic-release',
'0.0.0',
'0.1.0'
]
la(is.arrayOf(semverAllowTags, versions),
'not sem vers', versions)
})
})
it('handles clean list', function () {
var versions = ['0.0.0', '0.0.2', '0.1.0']
la(is.arrayOf(is.semver, versions), 'not sem vers', versions)
})
function dontBreakDependents (options, dependents) {
if (check.arrayOf(check.object, dependents) || check.arrayOfStrings(dependents)) {
dependents = {
projects: dependents
}
}
la(check.arrayOf(function (item) {
return check.object(item) || check.string(item)
}, dependents.projects), 'invalid dependents', dependents.projects)
debug('dependents', dependents)
if (check.empty(dependents)) {
return Promise.resolve()
}
banner(' testing the following dependents\n ' + JSON.stringify(dependents))
var logSuccess = function logSuccess () {
console.log('all dependents tested')
function dontBreakDependents (options, dependents) {
if (check.arrayOf(check.object, dependents) || check.arrayOfStrings(dependents)) {
dependents = {
projects: dependents
}
}
la(check.arrayOf(function (item) {
return check.object(item) || check.string(item)
}, dependents.projects), 'invalid dependents', dependents.projects)
debug('dependents', dependents)
if (check.empty(dependents)) {
return Promise.resolve()
}
banner(' testing the following dependents\n ' + JSON.stringify(dependents))
var logSuccess = function logSuccess () {
console.log('all dependents tested')
}
return testDependents(options, dependents)
.then(logSuccess)
}