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

Print a useful error if package.json is missing #61

Merged
merged 7 commits into from
Jul 31, 2019
Merged

Print a useful error if package.json is missing #61

merged 7 commits into from
Jul 31, 2019

Conversation

nunospot
Copy link
Contributor

@nunospot nunospot commented Jul 26, 2019

Hello!

This fixes #60

If I understand it right we need to check if the package.json is missing or not, like @kirbysayshi said it on the issue.
In this case I made a small condition to check this ['undefined', null].indexOf(config) > 0.

Let me know if there is more about this issue than this.


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@sindresorhus
Copy link
Owner

Please spend some more time on the code.

@nunospot
Copy link
Contributor Author

nunospot commented Jul 26, 2019

Yeah, I saw the travis build fail, I will working on it. But beside that, did you saw something wrong?

index.js Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Can you change the pull request title to be more descriptive? It should concisely explain what this PR fixes.

Also include Fixes #123 with the issue number of the issue this pull request fixes in the pull request description so the issue is closed when this PR is merged.

index.js Outdated
@@ -11,6 +11,11 @@ module.exports = (grunt, options = {}) => {

let cwd = process.cwd();
let config = options.config || pkgUp.sync();

if (config === null) {
grunt.fail.fatal('package.json not found.\nPlease make sure to create a package.json and install all dependecies before run a grunt task.');
Copy link
Owner

Choose a reason for hiding this comment

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

You have some typos.

Suggested change
grunt.fail.fatal('package.json not found.\nPlease make sure to create a package.json and install all dependecies before run a grunt task.');
grunt.fail.fatal('package.json not found.\nPlease make sure to create a package.json and install all dependencies before you run Grunt.');

@nunospot nunospot changed the title Feature/fail with descriptive error#issues60 Descriptive error if package.json is missing Jul 30, 2019
@sindresorhus sindresorhus changed the title Descriptive error if package.json is missing Print a useful error if package.json is missing Jul 31, 2019
@sindresorhus sindresorhus merged commit 6234bc9 into sindresorhus:master Jul 31, 2019
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.

3 participants