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
5 changes: 5 additions & 0 deletions index.js
Expand Up @@ -11,6 +11,11 @@ module.exports = (grunt, options = {}) => {

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

if (config === null) {
console.error('\u001B[41m%s\u001B[0m', 'ABORTED: package.json not found.\nPlease be sure to create a package.json and install all dependecies before run a grunt task.');
sindresorhus marked this conversation as resolved.
Show resolved Hide resolved
}

if (typeof config === 'string') {
const configPath = path.resolve(config);
cwd = path.dirname(configPath);
Expand Down