Skip to content

Commit

Permalink
Require Node.js 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 14, 2019
1 parent 34a241e commit 93760d4
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 80 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false
language: node_js
node_js:
- '6'
- '4'
- '12'
- '10'
- '8'
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ module.exports = input => new Promise((resolve, reject) => {
input = input.replace(/^(?!(?:https|git):\/\/)/, 'https://');

const tcp = net.connect({
host: url.parse(input).host,
host: url.parse(input).host, // eslint-disable-line node/no-deprecated-api
port: 9418
});
const client = gitclient(input);
const tags = new Map();

client.refs.on('data', ref => {
const name = ref.name;
const {name} = ref;

if (/^refs\/tags/.test(name)) {
// Strip off the indicator of dereferenced tags so we can
Expand Down
20 changes: 4 additions & 16 deletions license
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
82 changes: 40 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
{
"name": "remote-git-tags",
"version": "2.0.0",
"description": "Get tags from a remote Git repo. Using only JS. No Git binary required.",
"license": "MIT",
"repository": "sindresorhus/remote-git-tags",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"git",
"tags",
"tag",
"remote",
"repo",
"repository",
"vanilla",
"js",
"javascript",
"ls",
"commit",
"sha",
"url"
],
"dependencies": {
"git-fetch-pack": "^0.1.1",
"git-transport-protocol": "^0.1.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "remote-git-tags",
"version": "2.0.0",
"description": "Get tags from a remote Git repo",
"license": "MIT",
"repository": "sindresorhus/remote-git-tags",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"git",
"tags",
"tag",
"remote",
"ls-remote",
"ls",
"repo",
"repository",
"commit",
"sha",
"url"
],
"dependencies": {
"git-fetch-pack": "^0.1.1",
"git-transport-protocol": "^0.1.0"
},
"devDependencies": {
"ava": "^2.1.0",
"xo": "^0.24.0"
}
}
19 changes: 7 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# remote-git-tags [![Build Status](https://travis-ci.org/sindresorhus/remote-git-tags.svg?branch=master)](https://travis-ci.org/sindresorhus/remote-git-tags)

> Get tags from a remote git repo
> Get tags from a remote Git repo
Like [`git ls-remote`](http://git-scm.com/docs/git-ls-remote.html), which doesn't require cloning the repo, but this is 100% JavaScript, meaning no dependency on the Git binary.

Expand All @@ -12,7 +12,7 @@ I'm using this successfully against GitHub repos, but the underlaying modules ar
## Install

```
$ npm install --save remote-git-tags
$ npm install remote-git-tags
```


Expand All @@ -21,26 +21,21 @@ $ npm install --save remote-git-tags
```js
const remoteGitTags = require('remote-git-tags');

remoteGitTags('github.com/sindresorhus/remote-git-tags').then(tags => {
console.log(tags);
//=> Map {'v1.0.0' => '69e308412e2a5cffa692951f0274091ef23e0e32'}
});
(async () => {
console.log(await remoteGitTags('https://github.com/sindresorhus/remote-git-tags'));
//=> Map {'v1.0.0' => '69e308412e2a5cffa692951f0274091ef23e0e32', …}
})();
```


## API

### remoteGitTags(url)

Returns a `Promise<Map>` with the Git tags as keys and their commit SHA as values.
Returns a `Promise<Map<string, string>>` with the Git tags as keys and their commit SHA as values.

#### url

Type: `string`

Git repo URL.


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import test from 'ava';
import m from '.';
import remoteGitTags from '.';

test(async t => {
const tags = await m('github.com/sindresorhus/got');
test('main', async t => {
const tags = await remoteGitTags('https://github.com/sindresorhus/got');
t.is(tags.get('v6.0.0'), 'e5c2d9e93137263c68db985b3dc5b57865c67b82');
t.is(tags.get('v5.0.0'), '0933d0bb13f704bc9aabcc1eec7a8e33dc8aba51');
});

0 comments on commit 93760d4

Please sign in to comment.