Np: Fails to run with Yarn Nightly

Created on 3 Jun 2019  路  4Comments  路  Source: sindresorhus/np

Description


When using a nightly version of Yarn (via yarn policies set-version nightly), Yarn uses a non-semver version, e.g. 1.17.0-20190524.0703. This causes the Prerequisite check, Check yarn version fail.

Steps to reproduce

  1. yarn policies set-version nightly
  2. np
    3.

Expected behavior


np should work with a nightly version of Yarn.

Environment

np - 5.0.2
Node.js - 11.15.0
npm - 6.9.0
Git - 2.21.0
OS - darwin 18.6.0 (10.14.6 Beta)

bug help wanted

All 4 comments

We currently use semver for version parsing, which can't handle versions like 1.17.0-20190524.0703 and considers those to be invalid. However, @hapi/somever appears to be a viable replacement for semver (or at least for parsing versions), and can also correctly parse such versions.

@dotconnor I'd happily review and accept a PR migrating np's version parsing to use @hapi/somever instead of semver 馃檭

@itaisteinherz It doesn't look like @hapi/somever is compatible with how yall are doing version checking.

It doesn't look like @hapi/somever is compatible with how yall are doing version checking.

Why not? From a quick look at the tests, it seems like we'll be able to use @hapi/somever for cleaning the given version in the constructor, validating versions and comparing versions using ranges, which is nearly everything we need. We could also just use @hapi/somever in the constructor of Version to clean the given version using somever.version(v).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kapooostin picture kapooostin  路  5Comments

sindresorhus picture sindresorhus  路  4Comments

inker picture inker  路  4Comments

bennycode picture bennycode  路  4Comments

bennycode picture bennycode  路  4Comments