Added action help text for the jaws bin.

When creating a new action, quickly check if we are in the JAWS project directory.
This commit is contained in:
Jacob Evans 2015-09-14 18:56:05 +10:00
parent 91afc6a84e
commit a9dc285ab6
2 changed files with 8 additions and 3 deletions

View File

@ -28,7 +28,7 @@ program
program
.command('new <type>')
.allowUnknownOption()
.description('Make a new "project", "stage", "region", "lambda" or "endpoint"')
.description('Make a new "project", "stage", "region", or "action" [ --lambda | --endpoint | --both ] ')
.action(function() {
// Parse Args
@ -86,7 +86,7 @@ program
} else {
// Unknown Type
console.error('Unsupported type ' + type + '. Must be project|region|stage');
console.error('Unsupported type ' + type + '. Must be project|region|stage|action');
process.exit(1);
}

View File

@ -96,6 +96,11 @@ CMD.prototype._createSkeleton = Promise.method(function() {
// Fetch skeleton resources
var templatesPath = path.join(__dirname, '..', 'templates');
var actionJson = JSON.parse(fs.readFileSync(path.join(templatesPath, 'jaws.json')));
if (!fs.existsSync(path.join('./jaws.json'))) {
throw new JawsError('Must be in a JAWS project folder.');
}
var actionPath = path.join(
_this._JAWS._meta.projectRootPath,
'back',
@ -170,4 +175,4 @@ CMD.prototype._createSkeleton = Promise.method(function() {
// Write Files
writeFilesDeferred.push(utils.writeFile(path.join(actionPath, 'jaws.json'), JSON.stringify(actionJson, null, 2)));
return Promise.all(writeFilesDeferred);
});
});