dougmoscrop / serverless-plugin-include-dependencies

MIT License
184 stars 40 forks source link

get the dependencies for includes #17

Closed rschick closed 6 years ago

rschick commented 6 years ago

These are the changes I was thinking about, to go through the includes and find dependencies which might not be statically required.

In my project this adds a fair amount of processing time, so I'm thinking we should probably have a default-off option to enable this.

rschick commented 6 years ago

Updated with support for function-level includes.

rschick commented 6 years ago

I moved the include list into custom options, so existing deployments won't be affected. Also allows you to include globs in the package that are not scanned for dependencies.

For example, in my project I'm using:

custom:
  includeDependencies:
    always:
      - 'api/**'

package:
  individually: true
  exclude:
    - '**/*'
  include:
    - 'public/**' # don't want this scanned for dependencies

(edit: I went with always, and remove the redundant include)

dougmoscrop commented 6 years ago

Nice! I wonder if we could avoid the repeated include directive in package (let this plugin add it for you)?

I also wonder if 'include' could be named better. like includeDependencies: always: or explicit or local .. or maybe include is fine.

rschick commented 6 years ago

I incorporated your feedback - what do you think?

dougmoscrop commented 6 years ago

Just the one bug with .package!