tagged-versions
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -7,9 +7,2 @@ module.exports = { | ||
rules: { | ||
'no-underscore-dangle': ['error', | ||
{ | ||
allow: ['_id'], | ||
allowAfterThis: true, | ||
allowAfterSuper: true, | ||
}, | ||
], | ||
'max-len': ['error', | ||
@@ -21,10 +14,3 @@ { | ||
], | ||
'no-console': 0, | ||
'class-methods-use-this': 0, | ||
'new-cap': ['error', | ||
{ | ||
capIsNewExceptions: ['Router'], // express.Router | ||
}, | ||
], | ||
}, | ||
}; |
{ | ||
"name": "tagged-versions", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Get tagged semver-compatible project versions", | ||
@@ -11,3 +11,3 @@ "main": "src/index.js", | ||
"validate": "./node_modules/eslint/bin/eslint.js src", | ||
"test": "ava --verbose", | ||
"test": "./node_modules/.bin/nyc ./node_modules/.bin/ava --verbose", | ||
"watch": "ava --watch", | ||
@@ -14,0 +14,0 @@ "coverage": "nyc ava" |
# tagged-versions | ||
> Get tagged semver-compatible project versions | ||
> Get tagged semver-compatible project versions [{ version, tag, hash}] | ||
[![Build Status](https://travis-ci.org/ikhemissi/tagged-versions.svg?branch=master)](https://travis-ci.org/ikhemissi/tagged-versions) | ||
[![Coverage Status](https://coveralls.io/repos/github/ikhemissi/tagged-versions/badge.svg)](https://coveralls.io/github/ikhemissi/tagged-versions) | ||
[![Build Status][travis-badge]][travis-link] | ||
[![Coverage Status][coveralls-badge]][coveralls-link] | ||
[![NPM version][shields-badge]][npm-link] | ||
## Installation | ||
```sh | ||
npm install tagged-versions --save | ||
``` | ||
Supported Node versions: 5+ | ||
## Usage | ||
@@ -58,3 +66,9 @@ | ||
## Contributing | ||
Please follow the [Airbnb guidelines](https://github.com/airbnb/javascript), commit your changes with `git cz`, and then create a pull request. | ||
Thank you :-) | ||
Please follow the [Airbnb guidelines](https://github.com/airbnb/javascript) and commit your changes with [commitzen](https://www.npmjs.com/package/commitizen) using `git cz`. | ||
[travis-badge]: https://travis-ci.org/ikhemissi/tagged-versions.svg?branch=master | ||
[travis-link]: https://travis-ci.org/ikhemissi/tagged-versions | ||
[coveralls-badge]: https://coveralls.io/repos/github/ikhemissi/tagged-versions/badge.svg?branch=master | ||
[coveralls-link]: https://coveralls.io/github/ikhemissi/tagged-versions?branch=master | ||
[shields-badge]: https://img.shields.io/npm/v/tagged-versions.svg | ||
[npm-link]: https://www.npmjs.com/package/tagged-versions |
@@ -5,4 +5,10 @@ 'use strict'; | ||
const childProcess = require('child-process-promise'); | ||
const tagAndHashRegex = /.*tag:([^,]+).*;(.+)/; | ||
function runCommand(command) { | ||
return childProcess.exec(command) | ||
.then(result => result.stdout); | ||
} | ||
function getList(range) { | ||
@@ -13,4 +19,7 @@ return runCommand('git log --no-walk --tags --pretty="%D;%H" --decorate=short') | ||
.then(tags => tags.filter(tagAndHash => Array.isArray(tagAndHash) && tagAndHash.length === 3)) | ||
.then(tags => tags.map(([_, tag, hash]) => ({ tag: tag.trim(), hash: hash.trim() }))) | ||
.then(tags => tags.map(({ tag, hash }) => ({ hash, tag, version: semver.valid(tag) }))) | ||
.then(tags => tags.map((details) => { | ||
const tag = details[1].trim(); | ||
const hash = details[2].trim(); | ||
return { tag, hash, version: semver.valid(tag) }; | ||
})) | ||
.then(tags => tags.filter(details => !!details.version)) | ||
@@ -26,7 +35,2 @@ .then(tags => tags.filter(details => !range || semver.satisfies(details.version, range))) | ||
function runCommand(command) { | ||
return childProcess.exec(command) | ||
.then(result => result.stdout); | ||
} | ||
module.exports = { | ||
@@ -33,0 +37,0 @@ getList, |
Sorry, the diff of this file is not supported yet
9307
74
108