k1LoW / serverless-s3-sync

A plugin to sync local directories and S3 prefixes for Serverless Framework :zap:
182 stars 68 forks source link

Move hook to before:deploy:finalize rather than after:deploy:deploy #58

Closed Jaffa closed 4 years ago

Jaffa commented 4 years ago

I'm attempting to have a single source project containing both React app and serverless spec, and have sls deploy:

  1. Deploy backend resources to AWS
  2. Use serverless-stack-output to update React app with details from CloudFormation
  3. Run npm build
  4. Use serverless-s3-sync to copy the React build/ directory up to S3.

Currently both serverless-stack-output and serverless-s3-sync run off after:deploy:deploy asynchronously. I'm not sure there's a way of defining the ordering or dependency between them without writing my own plugin, but it might be sufficient to move S3 sync later (and stack output earlier).

I think this could be achieved by changing after:deploy:deploy to before:deploy:finalize in index.js.

(Alternatively is there a way of defining the {{nos3sync}} for S3 deploy, and I can have the stack-output-handler maybe invoke S3 sync directly?)

Jaffa commented 4 years ago

Alternatively, it might be related to https://github.com/sbstjn/serverless-stack-output/issues/18 ?

Jaffa commented 4 years ago

Yep, the above is an issue of: