@semantic-release/last-release-npm
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -12,2 +12,3 @@ 'use strict'; | ||
var plugins = _ref.plugins; | ||
var options = _ref.options; | ||
@@ -31,4 +32,10 @@ npmlog.level = npm.loglevel || 'warn'; | ||
if (!version) return cb(new SemanticReleaseError('There is no release with the dist-tag "' + npm.tag + '" yet. Tag a version first.', 'ENODISTTAG')); | ||
if (!version && options && options.fallbackTags && options.fallbackTags[npm.tag] && data['dist-tags'][options.fallbackTags[npm.tag]]) { | ||
version = data['dist-tags'][options.fallbackTags[npm.tag]]; | ||
} | ||
if (!version) { | ||
return cb(new SemanticReleaseError('There is no release with the dist-tag "' + npm.tag + '" yet.\nTag a version manually or define "fallbackTags".', 'ENODISTTAG')); | ||
} | ||
cb(null, Object.defineProperties({ | ||
@@ -35,0 +42,0 @@ version: version, |
@@ -43,4 +43,8 @@ { | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "public", | ||
"tag": "next" | ||
}, | ||
"release": { | ||
"branch": "next" | ||
}, | ||
"repository": { | ||
@@ -61,3 +65,3 @@ "type": "git", | ||
}, | ||
"version": "1.1.2" | ||
"version": "1.2.0" | ||
} |
# semantic-release last-release-npm | ||
[![npm version](https://badge.fury.io/js/%40semantic-release%2Flast-release-npm.svg)](http://badge.fury.io/js/%40semantic-release%2Flast-release-npm) | ||
[![Build Status](https://travis-ci.org/semantic-release/last-release-npm.svg?branch=master)](https://travis-ci.org/semantic-release/last-release-npm) | ||
[![Coverage Status](https://coveralls.io/repos/semantic-release/last-release-npm/badge.svg)](https://coveralls.io/r/semantic-release/last-release-npm) | ||
[![Dependency Status](https://david-dm.org/semantic-release/last-release-npm.svg)](https://david-dm.org/semantic-release/last-release-npm) | ||
[![devDependency Status](https://david-dm.org/semantic-release/last-release-npm/dev-status.svg)](https://david-dm.org/semantic-release/last-release-npm#info=devDependencies) | ||
[![Build Status](https://travis-ci.org/semantic-release/last-release-npm.svg?branch=next)](https://travis-ci.org/semantic-release/last-release-npm) | ||
[![Coverage Status](https://coveralls.io/repos/semantic-release/last-release-npm/badge.svg?branch=next&service=github)](https://coveralls.io/github/semantic-release/last-release-npm?branch=next) | ||
[![Dependency Status](https://david-dm.org/semantic-release/last-release-npm/next.svg)](https://david-dm.org/semantic-release/last-release-npm/next) | ||
[![devDependency Status](https://david-dm.org/semantic-release/last-release-npm/next/dev-status.svg)](https://david-dm.org/semantic-release/last-release-npm/next#info=devDependencies) | ||
[![Join the chat at https://gitter.im/semantic-release/semantic-release](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/semantic-release/semantic-release?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/last-release-npm) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) |
@@ -22,2 +22,3 @@ const nock = require('nock') | ||
.get('/tagged') | ||
.times(2) | ||
.reply(200, availableModule) | ||
@@ -24,0 +25,0 @@ .get('/untagged') |
@@ -14,3 +14,3 @@ const { defaults } = require('lodash') | ||
test('last release from registry', (t) => { | ||
t.plan(5) | ||
t.plan(6) | ||
@@ -45,2 +45,21 @@ t.test('get release from package name', (tt) => { | ||
t.test('get release from a fallbackTag', (tt) => { | ||
lastRelease({}, { | ||
pkg: {name: 'tagged'}, | ||
options: { | ||
fallbackTags: { | ||
bar: 'latest' | ||
} | ||
}, | ||
npm: defaults({tag: 'bar'}, npm) | ||
}, (err, release) => { | ||
tt.error(err) | ||
tt.is(release.version, '1.33.7', 'version') | ||
tt.is(release.gitHead, 'HEAD', 'gitHead') | ||
tt.is(release.tag, 'bar', 'dist-tag') | ||
tt.end() | ||
}) | ||
}) | ||
t.test('get error from an untagged package\'s name', (tt) => { | ||
@@ -47,0 +66,0 @@ lastRelease({}, { |
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
8713
181
13