diff --git a/src/index.js b/src/index.js index 1e57908..da726a7 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ const npmlog = require('npmlog') const RegClient = require('npm-registry-client') module.exports = function (pluginConfig, {pkg, npm, plugins}, cb) { - npmlog.level = npm.loglevel || 'error' + npmlog.level = npm.loglevel || 'warn' const client = new RegClient({log: npmlog}) client.get(`${npm.registry}${pkg.name.replace('/', '%2F')}`, { @@ -19,7 +19,11 @@ module.exports = function (pluginConfig, {pkg, npm, plugins}, cb) { cb(null, { version, - gitHead: data.versions[version].gitHead + gitHead: data.versions[version].gitHead, + get tag () { + npmlog.warn('deprecated', 'tag will be removed with the next major release') + return npm.tag + } }) }) } diff --git a/test/specs/index.js b/test/specs/index.js index d424304..b947d78 100644 --- a/test/specs/index.js +++ b/test/specs/index.js @@ -20,6 +20,7 @@ test('last release from registry', (t) => { tt.error(err) tt.is(release.version, '1.33.7', 'version') tt.is(release.gitHead, 'HEAD', 'gitHead') + tt.is(release.tag, 'latest', 'dist-tag') tt.end() }) @@ -33,6 +34,7 @@ test('last release from registry', (t) => { tt.error(err) tt.is(release.version, '0.8.15', 'version') tt.is(release.gitHead, 'bar', 'gitHead') + tt.is(release.tag, 'foo', 'dist-tag') tt.end() }) @@ -57,6 +59,7 @@ test('last release from registry', (t) => { tt.error(err) tt.is(release.version, '1.33.7', 'version') tt.is(release.gitHead, 'HEAD', 'gitHead') + tt.is(release.tag, 'latest', 'dist-tag') tt.end() })