Permalink
Browse files

Display an error when component.json is required

  • Loading branch information...
1 parent cb9ba30 commit 893cfb838df6b478e5fa2c69bcbd34d7af2df6c9 @bpierre bpierre committed Mar 6, 2013
Showing with 24 additions and 2 deletions.
  1. +4 −0 bin/component-build
  2. +8 −1 bin/component-info
  3. +5 −1 bin/component-install
  4. +7 −0 bin/component-ls
View
@@ -49,6 +49,10 @@ program.on('--help', function(){
program.parse(process.argv);
+// component.json required
+
+if (!exists('component.json')) utils.fatal('missing component.json');
+
// load json
var conf = require(path.resolve('component.json'));
View
@@ -5,7 +5,10 @@
*/
var program = require('commander')
- , component = require('..');
+ , component = require('..')
+ , fs = require('fs')
+ , exists = fs.existsSync
+ , utils = component.utils;
// usage
@@ -28,6 +31,10 @@ program.on('--help', function(){
program.parse(process.argv);
+// component.json required
+
+if (!exists('component.json')) utils.fatal('missing component.json');
+
// package
var pkg = program.args.shift();
View
@@ -13,7 +13,7 @@ var program = require('commander')
, error = utils.error
, url = require('url')
, path = require('path')
- , resolve = path.resolve
+ , resolve = path.resolve;
// options
@@ -60,6 +60,10 @@ var pkgs = program.args;
var local = 0 == pkgs.length;
+// component.json required
+
+if (local && !exists('component.json')) utils.fatal('missing component.json');
+
// read json
var conf = loadConfig();
View
@@ -10,13 +10,20 @@ var program = require('commander')
, path = require('path')
, resolve = path.resolve
, lookup = component.lookup
+ , fs = require('fs')
+ , exists = fs.existsSync
+ , utils = component.utils;
// parse argv
program
.option('-d, --depth <n>', 'set the depth to <n>', Infinity)
.parse(process.argv);
+// component.json required
+
+if (!exists('component.json')) utils.fatal('missing component.json');
+
// output tree
var tree = tree('component.json');

0 comments on commit 893cfb8

Please sign in to comment.