mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
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:
parent
91afc6a84e
commit
a9dc285ab6
4
bin/jaws
4
bin/jaws
@ -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);
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user