Giter Club home page Giter Club logo

available-versions's Introduction

available-versions

Fetches new versions for a given NPM package higher than given version.

NPM

ci semantic-release manpm

for Node >= 4

Install and use

npm install -g available-versions

Installs several aliases, use any one you like available, versions, vers or releases

What are all releases for library lazy-ass?

releases lazy-ass

What are new releases after 1.0.0?

releases [email protected]
releases lazy-ass 1.0.0

The module always exits with 0, even if the NPM module was not found.

Output

A table with versions, timestamps and relative age

$ vers [email protected]
babel since 6.1.15
--------------------------
version  age      dist-tag
-------  -------  --------
6.1.16   a month
6.1.17   a month
6.1.18   a month
6.2.4    19 days
6.3.13   10 days  stable

For most modules, it will also fetch release notes from GitHub, for example

$ vers [email protected]
manpm since 1.10.0 from git+https://github.com/bahmutov/manpm.git
------------------------------------------------------------------------------------------------------------
version  age       release                                                                          dist-tag
-------  --------  -------------------------------------------------------------------------------  --------
1.10.1   8 months  github: parsing github url (a00ed3e7)
1.10.2   6 months  node5: testing on node 4 and 5, fixed get, (0ffdc31a, closes #22)
1.10.3   6 months  node: supporting older versions of node without harmony, (88ef0a4d, closes #21)
1.10.4   6 months  log: removed extra console log statement (30d2da81)
1.10.5   5 months  deps: upgraded a lot of deps, trying to see if #23 is still broken (2ed9051e)
1.10.6   4 months  readme: fixed getting readme by downgrading simple-get, (e7e15a25, closes #24)   latest

The comments are clipped and cleaned up to be a single line, I recommend using semantic-release to make sure the output is useful.

API

You can use this module from other modules

var available = require('available-versions');
var query = {
  name: 'deps-ok',
  version: '0.1.0' // version is optional
};
available(query).then(function (result) {
  console.log(result.name);
  console.log(result.versions); // array of versions
});

You can also pass second argument to keep version cleanup error messages quiet

available(query, true) ...

Supported servers

Public and private NPM registries, GitHub (public) and GitLab (public and private) servers. For private GitLab server, you should have environment variable GITLAB_AUTH_TOKEN set with your personal access token.

GITLAB_AUTH_TOKEN=xxxyyyy vers @org/my-module

I recommend using as-a to simplify using environment variables. In this case you would do something like this

as-a gitlab vers @org/my-module

Debug

To debug this program, run it with DEBUG=vers variable

DEBUG=vers releases chalk

Small print

Author: Gleb Bahmutov © 2014

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2014 Gleb Bahmutov

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 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.

available-versions's People

Contributors

bahmutov avatar cy6erskunk avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

cy6erskunk

available-versions's Issues

Fails for Mocha

Running vers mocha crashes in code

if (release) {
        console.log(release)
        r.release = release.body ? cleanReleaseNotesGitHub(release.body)
          : cleanReleaseNotesGitLab(release.commit);
      }
$ vers mocha
{ url: 'https://api.github.com/repos/mochajs/mocha/releases/4134661',
  assets_url: 'https://api.github.com/repos/mochajs/mocha/releases/4134661/assets',
  upload_url: 'https://uploads.github.com/repos/mochajs/mocha/releases/4134661/assets{?name,label}',
  html_url: 'https://github.com/mochajs/mocha/releases/tag/v3.0.2',
  id: 4134661,
  tag_name: 'v3.0.2',
  target_commitish: 'master',
  name: 'v3.0.2',
  draft: false,
  author: 
   { login: 'boneskull',
     id: 924465,
     avatar_url: 'https://avatars0.githubusercontent.com/u/924465?v=3',
     gravatar_id: '',
     url: 'https://api.github.com/users/boneskull',
     html_url: 'https://github.com/boneskull',
     followers_url: 'https://api.github.com/users/boneskull/followers',
     following_url: 'https://api.github.com/users/boneskull/following{/other_user}',
     gists_url: 'https://api.github.com/users/boneskull/gists{/gist_id}',
     starred_url: 'https://api.github.com/users/boneskull/starred{/owner}{/repo}',
     subscriptions_url: 'https://api.github.com/users/boneskull/subscriptions',
     organizations_url: 'https://api.github.com/users/boneskull/orgs',
     repos_url: 'https://api.github.com/users/boneskull/repos',
     events_url: 'https://api.github.com/users/boneskull/events{/privacy}',
     received_events_url: 'https://api.github.com/users/boneskull/received_events',
     type: 'User',
     site_admin: false },
  prerelease: false,
  created_at: '2016-08-08T07:39:46Z',
  published_at: '2016-09-14T19:23:01Z',
  assets: [],
  tarball_url: 'https://api.github.com/repos/mochajs/mocha/tarball/v3.0.2',
  zipball_url: 'https://api.github.com/repos/mochajs/mocha/zipball/v3.0.2',
  body: '' }
available versions error
Error: missing commit null
    at lazyAssLogic (/Users/irinakous/.nvm/versions/node/v6.8.1/lib/node_modules/available-versions/node_modules/lazy-ass/index.js:110:14)
    at lazyAss (/Users/irinakous/.nvm/versions/node/v6.8.1/lib/node_modules/available-versions/node_modules/lazy-ass/index.js:115:28)
    at cleanReleaseNotesGitLab (/Users/irinakous/.nvm/versions/node/v6.8.1/lib/node_modules/available-versions/src/human-format.js:123:3)
    at /Users/irinakous/.nvm/versions/node/v6.8.1/lib/node_modules/available-versions/src/human-format.js:164:13
    at Array.forEach (native)
    at toHumanFormat (/Users/irinakous/.nvm/versions/node/v6.8.1/lib/node_modules/available-versions/src/human-format.js:152:12)
    at printReleases (/Users/irinakous/.nvm/versions/node/v6.8.1/lib/node_modules/available-versions/src/print-releases.js:17:21)
    at process._tickCallback (internal/process/next_tick.js:103:7)

We need to better handle if body or commit are missing

Known moderate severity security vulnerability detected in hoek < 4.2.1

GitHub reported issue to my project which depends on ci-publish, which depends on available-versions:
Where hoek is a sub-dependency of CI publish:

└─┬ [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        ├─┬ [email protected]
        │ └── [email protected]  deduped
        ├── [email protected]
        └─┬ [email protected]
          └── [email protected]  deduped

This fix is required for bahmutov/ci-publish#12

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Preset name not found within published preset config (monorepo:babel6). Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Fetch tags

To show if the release was "latest" or different tag

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Support private registries

For example, should support vers @org/name if the @org/name comes from a private registry, described in the .npmrc file for example

registry=https://registry.npmjs.org
@org:registry=http://registry.org.com

Show several tags is version has it

For example cypress 0.20.0 currently has two tags

'dist-tags': { latest: '0.20.0', dev: '0.20.0' }

but vers cypress only shows dev

vers cypress
0.20.0                      10 hours  dev 

Crashes if package is missing repo

Fails to grab property of an undefined object in

function isSupportedRepo(repo) {
  return check.object(repo) &&
    repo.type === 'git' &&
    isGithubRepo(repo.url) || isGitlabRepo(repo.url);
}

Breaks for scoped package

$ vers @bahmutov/parse-github-repo-url
[Error: could not find versions in {
  "db_name": "registry",
  "doc_count": 239550,
  "doc_del_count": 358,
  "update_seq": 964056,
  "purge_seq": 0,
  "compact_running": false,
  "disk_size": 1064980603,
  "data_size": 862258787,
  "instance_start_time": "1435359748966717",
  "disk_format_version": 6,
  "committed_update_seq": 964056
}]

/Users/kensho/.nvm/versions/node/v0.12.7/lib/node_modules/available-versions/node_modules/npm-utils/node_modules/q/q.js:876
    throw error;
          ^
Could not fetch versions for

Problem could be in npm-utils?

empty output w/ npm 5.3.0

on MacOS Sierra version 10.12.6

$ npm install -g available-versions
npm WARN deprecated [email protected]: Use uuid module instead
/usr/local/bin/releases -> /usr/local/lib/node_modules/available-versions/bin/available.js
/usr/local/bin/versions -> /usr/local/lib/node_modules/available-versions/bin/available.js
/usr/local/bin/available -> /usr/local/lib/node_modules/available-versions/bin/available.js
/usr/local/bin/vers -> /usr/local/lib/node_modules/available-versions/bin/available.js
+ [email protected]
added 145 packages in 6.865s

$ vers
[email protected]
 > Returns a promise with new versions higher than given for a 
 > npm module
USE: vers <module name> [start version]
    "vers chalk"
    "vers chalk 0.3.0"

$npm view lazy-ass@* version
[email protected] '0.1.0'
[email protected] '0.1.1'
[email protected] '0.1.2'
[email protected] '0.2.0'
[email protected] '0.4.0'
[email protected] '0.4.1'
[email protected] '0.5.0'
[email protected] '0.5.1'
[email protected] '0.5.2'
[email protected] '0.5.3'
[email protected] '0.5.4'
[email protected] '0.5.5'
[email protected] '0.5.6'
[email protected] '0.5.8'
[email protected] '0.6.0'
[email protected] '1.0.0'
[email protected] '1.1.0'
[email protected] '1.2.0'
[email protected] '1.3.0'
[email protected] '1.4.0'
[email protected] '1.5.0'
[email protected] '1.5.1'
[email protected] '1.6.0'

$ vers lazy-ass
$ 

Show latest feature for each release

Can we find the latest feature in each release tag?

version  |  when   | what
---------------------------------
0.1.0     |   2 days | feat(api): added command line

Fetching release notes fails for module "standard"

$ vers standard
available versions error
Error: missing remote server url from git://github.com/feross/standard.git
    at lazyAssLogic (/Users/gleb/.nvm/versions/node/v6.3.1/lib/node_modules/available-versions/node_modules/lazy-ass/index.js:110:14)
    at lazyAss (/Users/gleb/.nvm/versions/node/v6.3.1/lib/node_modules/available-versions/node_modules/lazy-ass/index.js:115:28)
    at githubRemoteApi (/Users/gleb/.nvm/versions/node/v6.3.1/lib/node_modules/available-versions/src/fetch-release-notes.js:11:3)

Breaks when installed

But not the source latest code

$ vers rxjs
/Users/gleb/.nvm/versions/node/v4.2.2/lib/node_modules/available-versions/node_modules/npm-utils/node_modules/q/q.js:876
    throw error;
    ^

Error: Cannot extract versions from {
  "name": "rxjs",
  "versions": [
    "5.0.0-alpha.10",
    "5.0.0-alpha.11",
    "5.0.0-alpha.12",
    "5.0.0-alpha.13",
    "5.0.0-alpha.14",
    "5.0.0-beta.0",
    "5.0.0-beta.1",
    "5.0.0-beta.2"
  ],
  "dist-tags": {
    "latest": "5.0.0-beta.2"
  }
}
    at withoutTimestamps (/Users/gleb/.nvm/versions/node/v4.2.2/lib/node_modules/available-versions/src/human-format.js:24:9)
    at toHumanFormat (/Users/gleb/.nvm/versions/node/v4.2.2/lib/node_modules/available-versions/src/human-format.js:54:12)
    at printReleases (/Users/gleb/.nvm/versions/node/v4.2.2/lib/node_modules/available-versions/src/print-releases.js:15:21)

Check if response is JSON

Before trying to serialize response from the server

function onNPMversions(err, response, body) {
    if (err) {
      console.error('ERROR when fetching info for package', name);
      return deferred.reject(new Error(err.message));
    }

    var result = {};

    try {
      var info = JSON.parse(body);

first check the response. Sometimes the server on WIFI is not allowed to make requests, so it fails badly processing HTML page.

  • need better response check
    If response is not JSON, throw error: "expected JSON response but got HTML response from host: 'n68.network-auth.com' and print contents of the response?

Breaks for ci-publish package

Weird, but when running locally from code works fine - the timestamps are there
When running from another folder, breaks with timestamps being undefined

 name: 'ci-publish',
  versions: [ '1.0.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.1.0' ],
  timestamps: undefined,
  'dist-tags': { latest: '1.1.0' } 

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/ci.yml
npm
package.json
  • axios 1.7.3

  • Check this box to trigger a request for Renovate to run again on this repository

What is RenoveApp doing?

@rarkins I am lost here

Hmm, now I am really confused about what RenovateApp has actually done.

What I assume it was doing

  • see if there are newer versions of dependencies
  • if there was one / many depending on the rules
    • open PR, and if the PR is passing and auto merge is on, would merge the PR
    • this would trigger CI build on master and my semantic-release would publish new version

So I started with simple configuration that should only upgrade axios that was behind

{
  "extends": ["config:base"],
  "packageRules": [
    {
      "packagePatterns": ["*"],
      "excludePackagePatterns": ["^axios"],
      "enabled": false
    }
  ]
}

What seems to have happened

  • PR was made #31
    • I merged this PR manually (why wasn't it automerged?)
  • BUT before this PR has even landed, it seems Renovate bot has pushed the upgrade commit into master and then deleted it

Now I have two problems

  • PR that is not merged, but has already been published
  • publishing new versions is screwed up, here is what Travis reports (semantic release part)
> semantic-release pre && npm publish && semantic-release post
semantic-release WARN invalid config loglevel="notice"
ok to publish from this version of Node 8
semantic-release ERR! commits The commit the last release of this package was derived from is not in the direct history of the "master" branch.
semantic-release ERR! commits This means semantic-release can not extract the commits between now and then.
semantic-release ERR! commits This is usually caused by force pushing, releasing from an unrelated branch, or using an already existing package name.
semantic-release ERR! commits You can recover from this error by publishing manually or restoring the commit "b645ca389bdabd0df5c9fe72413106cf127b61f9".
semantic-release ERR! pre Failed to determine new version.
semantic-release ERR! pre ENOTINHISTORY Commit not in history
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Aghhh,

I want to like this tool, but it is not clear what it would do and what it did!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.