claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 276 forks source link

Allow user specified s3 key in conjunction with --use-s3-bucket in cr… #210

Closed cjbarnaby closed 4 years ago

cjbarnaby commented 4 years ago

…eate and update commands

Hi there!

This is for allowing users to specify an S3 key (path and file name) in conjunction with the --use-s3-bucket option for both the create and update commands (inspired by this old conversation in Gitter). Is backwards compatible with current implementation of --use-s3-bucket.

If the parameter provided for that option includes a / character, the string following that character will be treated as the path for the uploaded file. The string after the final / character in the parameter provided will be treated as the key for the file itself. The file extension (.zip) is automatically appended to the key.

Examples:

New tests added to spec/create-spec.js and spec/update-spec.js.

Thanks!

gojko commented 4 years ago

Hi - thanks for this. I would prefer to use a different option, since identifying a key within a parameter called "bucket" is a bit roundabout, as is then magically adding .zip; perhaps we could do this with a --use-s3-key that would set the whole key (including the extension), so if a user wants it uploaded to a specific key then can set the whole thing.

cjbarnaby commented 4 years ago

Thanks for the feedback, Gojko. I've create a new option --s3-key for both create and update, updated the tests I'd made before and added some config validation tests (so that --s3-key can only be used in conjunction with --use-s3-bucket).

gojko commented 4 years ago

this is now on npm, as @5.12.0. thanks!