From 2e46a79bfe84635e0b79704b654a5434218849a9 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 28 Aug 2015 14:34:13 +0400 Subject: [PATCH] only include plugins from package.json in built extension --- plugins/c9.cli.publish/publish.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/plugins/c9.cli.publish/publish.js b/plugins/c9.cli.publish/publish.js index 2a4504f6..9d11b867 100644 --- a/plugins/c9.cli.publish/publish.js +++ b/plugins/c9.cli.publish/publish.js @@ -282,6 +282,17 @@ define(function(require, exports, module) { // Validate plugins var plugins = {}; + + var warned, failed; + Object.keys(json.plugins || {}).forEach(function(name){ + var filename = name + ".js"; + if (!fs.existsSync(join(cwd, name + "_test.js"))) { + console.warn("ERROR: Plugin '" + name + "' has no test associated with it. There must be a file called '" + name + "_test.js' containing tests."); + warned = true; + } + plugins[filename] = json.plugins[name]; + }); + fs.readdirSync(cwd).forEach(function(filename) { if (/(__\w*__|_test)\.js$/.test(filename) || !/\.js$/.test(filename)) return; try { @@ -293,18 +304,8 @@ define(function(require, exports, module) { if (!/\(options,\s*imports,\s*register\)/.test(val)) return; if (!/consumes\s*=/.test(val)) return; if (!/provides\s*=/.test(val)) return; - plugins[filename] = {}; - }); - - var warned, failed; - Object.keys(plugins).forEach(function(name){ - if (!json.plugins[name.replace(/\.js$/, "")]) { - console.warn("WARNING: Plugin '" + name + "' is not listed in package.json."); - warned = true; - } - else if (!fs.existsSync(join(cwd, name.replace(/\.js$/, "_test.js")))) { - console.warn("ERROR: Plugin '" + name + "' has no test associated with it. There must be a file called '" + name.replace(/\.js$/, "") + "_test.js' containing tests."); - warned = true; + if (!plugins[filename]) { + console.warn("WARNING: Plugin '" + filename + "' is not listed in package.json."); } });