git-tags-remote
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,2 +0,17 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.latest=exports.get=void 0;const e=require("tslib"),t=require("semver"),r=require("child_process");exports.get=s=>e.__awaiter(void 0,void 0,void 0,(function*(){return(e=>{const r=new Map;return e.split("\n").forEach(e=>{const t=e.split(/\t/);r.set(t[1].split("/")[2].replace(/\^\{\}$/,""),t[0])}),new Map([...r.entries()].filter(e=>t.valid(e[0])).sort((e,r)=>t.compare(e[0],r[0])).reverse())})(yield(e=>new Promise((t,s)=>{r.exec("git ls-remote --tags "+e,(e,r,o)=>{o&&s(new Error(o)),t(r.toString().trim())})}))(s))})),exports.latest=t=>e.__awaiter(void 0,void 0,void 0,(function*(){return(yield exports.get(t)).entries().next().value})),module.exports={get:exports.get,latest:exports.latest}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("semver"),t=require("child_process"); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function r(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}const n=n=>r(void 0,void 0,void 0,(function*(){var r;return(t=>{const r=new Map;return t.split("\n").forEach((e=>{const t=e.split(/\t/);r.set(t[1].split("/")[2].replace(/\^\{\}$/,""),t[0])})),new Map([...r.entries()].filter((t=>e.valid(t[0]))).sort(((t,r)=>e.compare(t[0],r[0]))).reverse())})(yield(r=n,new Promise(((e,n)=>{let o="",i="";const s=t.spawn("git",["ls-remote","--tags",r]);s.stdout.on("data",(e=>{i+=e})),s.stderr.on("data",(e=>{o+=e})),s.on("error",n),s.on("close",(t=>{(0!==t||o.length)&&n(new Error(o)),e(i.toString().trim())}))}))))})),o=e=>r(void 0,void 0,void 0,(function*(){return(yield n(e)).entries().next().value}));module.exports={get:n,latest:o},exports.get=n,exports.latest=o; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "git-tags-remote", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Get remote repository tags.", | ||
@@ -30,6 +30,7 @@ "keywords": [ | ||
"clean": "rm -rf dist", | ||
"coverage": "nyc --reporter=json ava", | ||
"lint": "eslint . --ext .js,.ts", | ||
"prepublishOnly": "npm run build:prod && npm run lint && npm test", | ||
"release": "standard-version -sa", | ||
"test": "nyc ava" | ||
"test": "ava" | ||
}, | ||
@@ -45,6 +46,6 @@ "ava": { | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^5.0.2", | ||
"@rollup/plugin-typescript": "^8.2.1", | ||
"@types/semver": "^7.3.1", | ||
"@typescript-eslint/eslint-plugin": "^3.8.0", | ||
"@typescript-eslint/parser": "^3.8.0", | ||
"@typescript-eslint/eslint-plugin": "^4.28.0", | ||
"@typescript-eslint/parser": "^4.28.0", | ||
"ava": "^3.11.1", | ||
@@ -57,6 +58,6 @@ "eslint": "^7.6.0", | ||
"rollup": "^2.23.0", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"standard-version": "^8.0.2", | ||
"typescript": "^3.9.7" | ||
"rollup-plugin-terser": "^7.0.2", | ||
"standard-version": "^9.3.0", | ||
"typescript": "^4.3.4" | ||
} | ||
} |
# git-tags-remote | ||
[![GitHub issues](https://img.shields.io/npm/v/git-tags-remote.svg)](https://www.npmjs.com/package/git-tags-remote) [![Build Status](https://travis-ci.org/sh0ji/git-tags-remote.svg?branch=master)](https://travis-ci.org/sh0ji/git-tags-remote) [![dependencies Status](https://david-dm.org/sh0ji/git-tags-remote/status.svg)](https://david-dm.org/sh0ji/git-tags-remote) | ||
[![NPM version](https://img.shields.io/npm/v/git-tags-remote.svg)](https://www.npmjs.com/package/git-tags-remote) | ||
[![Build Status](https://github.com/sh0ji/git-tags-remote/workflows/Integration/badge.svg)](https://github.com/sh0ji/git-tags-remote/actions?query=workflow%3AIntegration) | ||
[![codecov](https://codecov.io/gh/sh0ji/git-tags-remote/branch/master/graph/badge.svg)](https://codecov.io/gh/sh0ji/git-tags-remote) | ||
> Get remote repository tags. | ||
@@ -8,24 +12,33 @@ | ||
## Install | ||
```sh | ||
$ npm install --save git-tags-remote | ||
npm install git-tags-remote | ||
``` | ||
Note that a [git binary and command line interface](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) is a prerequisite. | ||
## Usage | ||
```javascript | ||
const gitTagsRemote = require('git-tags-remote'); | ||
const gtr = require('git-tags-remote'); | ||
gitTagsRemote.get('git@github.com:sh0ji/focus-rover.git') | ||
.then(tags => console.log(tags)); | ||
// => Map {'v1.0.0-rc.2' => '8e048a0fd9cb668366eef550be445ac761efd667', ...} | ||
gtr.get('git@github.com:sh0ji/git-tags-remote.git').then(console.log); | ||
// Map { | ||
// 'v1.0.3' => 'a21074841b25eb4efe141ea4d7c2a1519c218b90', | ||
// 'v1.0.2' => '0d50a47d20275ea6de9defd0518332dc0f96d195', | ||
// 'v1.0.0' => 'f009ac7ee3ed9396700467ff13fd3085351a0cac' | ||
// } | ||
``` | ||
## API | ||
`.get(gitUrl)` | ||
Returns a `Promise<Map<string, string>>` with the Git tags as keys and their commit SHA as values, just like [remote-git-tags](https://github.com/sindresorhus/remote-git-tags). | ||
* `gitUrl` must be a [valid git url](https://git-scm.com/docs/git-clone#_git_urls_a_id_urls_a). | ||
e.g. `'https://github.com/sh0ji/git-tags-remote.git'` is valid but `'github.com/sh0ji/git-tags-remote'` is not. | ||
Returns a `Promise<Map<string, string>>` with the Git tags as keys and their commit SHA as values, just like [remote-git-tags](https://github.com/sindresorhus/remote-git-tags). | ||
- `gitUrl` must be a [valid git url](https://git-scm.com/docs/git-clone#_git_urls_a_id_urls_a). | ||
- In other words, `https://github.com/sh0ji/git-tags-remote.git` is valid but `github.com/sh0ji/git-tags-remote` is not. | ||
`.latest(gitUrl)` | ||
Returns a promised tuple (`Promise<[string, string]>`) with the latest git tag and commit SHA value. | ||
e.g. `['v1.0.0-rc.2', '8e048a0fd9cb668366eef550be445ac761efd667']` | ||
Returns a promised tuple (`Promise<[string, string]>`) with the latest git tag and commit SHA value. | ||
- Example return: `['v1.0.0-rc.2', '8e048a0fd9cb668366eef550be445ac761efd667']` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
22493
20
44
1
7