From fac2e66d39e9005ed4f52092ba6399046819d033 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 12 Oct 2015 18:19:55 +0400 Subject: [PATCH] report proper error in c9 publish if readme is missing --- plugins/c9.cli.publish/publish.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/c9.cli.publish/publish.js b/plugins/c9.cli.publish/publish.js index 9d11b867..81cb6459 100644 --- a/plugins/c9.cli.publish/publish.js +++ b/plugins/c9.cli.publish/publish.js @@ -267,19 +267,21 @@ define(function(require, exports, module) { if (!json.categories || json.categories.length == 0) return callback(new Error("ERROR: At least one category is required in package.json")); + var description = json.description; + + if (description) + console.warn("WARNING: Description property in package.json will be ignored. README.md will be used."); + // Validate README.md - if (!fs.existsSync(join(cwd, "README.md"))) { + if (fs.existsSync(join(cwd, "README.md"))) { + description = fs.readFileSync(join(cwd, "README.md"), "utf8") + .replace(/^\#.*\n*/, ""); + } else { console.warn("WARNING: README.md is missing."); if (!force) return callback(new Error("Use --force to ignore these warnings.")); } - if (json.description) - console.warn("WARNING: Description property in package.json will be ignored. README.md will be used."); - - var description = fs.readFileSync(join(cwd, "README.md"), "utf8") - .replace(/^\#.*\n*/, ""); - // Validate plugins var plugins = {};