Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: inject versions into friendly errors #195

Merged
merged 1 commit into from
Mar 30, 2018

Conversation

tabrindle
Copy link
Contributor

In your error message, you can include {{wantedVersion}} and {{installedVersion}} to give the user version information, or even to customize scripts to help them install or update.

  "Yarn": [
    {
      "rule": "cli",
      "binary": "yarn",
      "error": "You have yarn@{{installedVersion}}, and need yarn@{{wantedVersion}}. Fix with `npm install -g yarn@{{wantedVersion}}`"
    }
  ]

@codecov
Copy link

codecov bot commented Mar 30, 2018

Codecov Report

Merging #195 into master will increase coverage by 0.12%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #195      +/-   ##
==========================================
+ Coverage   80.76%   80.88%   +0.12%     
==========================================
  Files          33       33              
  Lines         629      633       +4     
  Branches      108      111       +3     
==========================================
+ Hits          508      512       +4     
  Misses         83       83              
  Partials       38       38
Impacted Files Coverage Δ
src/extensions/functions/checkCLI.ts 89.47% <100%> (+2.8%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfe8fd8...39fe7a6. Read the comment docs.

@tabrindle tabrindle requested a review from GantMan March 30, 2018 16:40
@@ -26,9 +26,15 @@ module.exports = async (rule: CLIRule, context: SolidarityRunContext): Promise<s
binarySemantic += '.0'
}

const customMessage = (rule.error || '')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're one of the few people I know who knows emptystring evaluates as falsy.

Copy link
Member

@GantMan GantMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me! Thanks so much @tabrindle

@GantMan GantMan merged commit d5ed9d4 into master Mar 30, 2018
@GantMan GantMan deleted the feature/friendlier-errors branch March 30, 2018 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants