serverless / compose

Orchestrate Serverless Framework in monorepos
https://serverless.com/framework/docs/guides/compose
MIT License
110 stars 15 forks source link

feat: Add `package` command #150

Closed chris-hinds closed 1 year ago

chris-hinds commented 2 years ago

This PR adds the ability to run serverless package in the context of serverless compose.

The context for why this is a useful addition: https://serverless-contrib.slack.com/archives/CA4QT5VU3/p1658415216244289

Copy of slack message:

[Chris Hinds]
 [Yesterday at 3:53 PM]
Is there any way yet to just run package using serverless compose? i.e. one single command to package all services in the compose file
2 replies

[Chris Hinds]
  [18 hours ago]
For context as to why this would be useful. We currently run snapshot test and running the serverless package command which allows us to snapshot the outputted cloudformation.
We are also using serverless compose and would like to start using the params option within compose so we can pass params between services and create necessary dependencies.
If compose allows you to package all of the services then we could run our snapshots against the outputted cloudformation and not have to resort to running the serverless package command inside of each service directory (which kind of defeats the point of serverless compose IMO)

[Chris Hinds]
  [< 1 minute ago]
PR adding the package functionality to compose here https://github.com/serverless/compose/pull/150

A new test has been added to ensure the correct execution of the package command.

mnapoli commented 2 years ago

We discussed it offline and think this could be a good improvement. @pgrzesik will follow up later with concrete suggestions on the code.

mnapoli commented 1 year ago

I noticed one final problem, sorry. After that I think that's all good for me.

chris-hinds commented 1 year ago

Thanks @chris-hinds - there's a formatting check failing, but after fixing it we should be good to go

Just pushed a fix, hopefully, those checks pass now. Thanks for all your help @pgrzesik and @mnapoli

chris-hinds commented 1 year ago

Thanks both. How long until this would be available in compose via NPM?

pgrzesik commented 1 year ago

It should be available @chris-hinds with v1.3.0 release