agutoli / serverless-layers

Serverless.js plugin implementing AWS Lambda Layers, reducing lambda size, warm-up, and deployment time.
MIT License
229 stars 54 forks source link

Npm dependencies installed locally do not create a new layer #39

Closed Capelinha closed 3 years ago

Capelinha commented 4 years ago

Hi, it's me again, I would like to know if there is already a way to force the installation of the premises and the creation of a new layer when deploying.

I'm using a locally installed dependency to develop before publishing it on npm and every time I update it and try to deploy it a new layer is not created.

Looking at the code and thinking about a possible solution it seems that if you deploy using the command sls deploy --force-install it is possible to identify the argument --force-install in the options property in the main plugin class. I don't know if edde is the most appropriate way to do this.

This is a print of the index.js main function, explaining a possible solution that seems to work for me.

image

agutoli commented 3 years ago

Hi @Capelinha. Sorry for the late reply. I'm not having much time to focus on this project lately. I just added this option, not sure if still something you need, tho.

https://github.com/agutoli/serverless-layers/blob/master/src/index.js#L238