claygregory/serverless-prune-plugin

Integration with Serverless Framework v3

mnapoli opened this issue ยท 6 comments

Hi ๐Ÿ‘‹ , Serverless Framework core team here!

We're working on the v3 beta version right now. The v3 will include a redesigned CLI output:

image

You can try the v3 beta with: npm i serverless@pre-3

To help plugins integrate with that new design (and build a great user experience), we've added new APIs for plugins:

Any feedback is appreciated! If you want to update the plugin to use these new APIs, feel free to ping me if you have any questions!

If you don't have time to update the plugin, let me know, we can send a pull request!

Hi @mnapoli! The new output API looks great. I'm actually pretty noisy on output right now, so this will be a great opportunity to make the plugin a bit more restrained going forward.

I'll hopefully give this some attention in the next week or so.

Awesome, let me know if you need any help!

By the way, we did use your plugin as an example case when drafting out the new API. It was a while ago, but here are some ideas that could help in case you don't know where to start:

  • in the prune command you could use "log.success()" to print a success message (with the checkmark) after the task has completed
  • you can log any detail to --verbose (via log.verbose()/log.info())
  • you can create an interactive progress when purging older versions (that progress would show up in the prune command, as well as in the deploy command, which could work well)

Here are some screenshots from that older WIP version:

Screen 2021-10-08 16-07(1)

image(1)

Screen 2021-10-08 16-44(1)

Screen 2021-10-08 16-30(1)

Screen 2021-10-08 16-38(1)

Hi again, @mnapoli! The new output API is pretty great โ€” I found plugin activity maps nicely to the log levels + interactive progress indicators. If you want to check it out, you can install a pre-release via npm i -D serverless-prune-plugin@next.

Do you have an ETA on Framework 3.x coming to prime time? I want to plan accordingly to have the plugin update on a release version by then.

Hi @claygregory, that's awesome!

Do you have an ETA on Framework 3.x coming to prime time?

Very likely January.

If you want to check it out, you can install a pre-release via npm i -D serverless-prune-plugin@next.

I gave it a try and ended up with the following problem:

  • npm i -D serverless-prune-plugin@next installs serverless-prune-plugin@2.0.0-beta.0
  • serverless-prune-plugin@2.0.0-beta.0 has a peer dependency on serverless: 1 || 2 || 3 -> the latest v2 is installed in node_modules
  • serverless --version then runs v2 from node_modules (which is not what I want, I want v3):

image

- to force using v3 in the project, I run `npm i -D serverless@pre-3` -> that command fails, probably because `serverless@pre-3` doesn't satisfy the `serverless: 1 || 2 || 3` constraint of peerDependencies

image

Let me share that with @medikoo and @pgrzesik to see if they know how to best deal with that.

Just to clarify: our goal is for end users to be able to test Serverless Framework v3 beta with the version of your plugin that is compatible with v3 (serverless-prune-plugin@2.0.0-beta.0).

@mnapoli what version of npm you're working with?

I had no trouble installing pre-3 over v2 with npm v2, it issued warnings but doesn't crash for errors (in general peer dependencies mismatch should not raise errors).

Screenshot 2021-11-22 at 12 05 08

Otherwise, with pre-release it's not really possible to achieve well working (no warnings raised) setup with peer dependencies involved, as peer dependencies require version ranges, and pre-release afaik cannot be addressed by ranges (only fixed versions).

I think the only sensible fix (to remove the warning) is to remove serverless from peerDependencies settings in serverless-prune-plugin pre-release, and put it back for public release, once v3 of Framework is released.

Thanks @medikoo, I was on NPM 7. I upgraded to NPM 8 and I can install successfully now.

I think the warning is acceptable for the beta version.

@claygregory I tried the updated version and that looks great!

Feel free to close this issue whenever you want.