dougmoscrop / serverless-plugin-include-dependencies

MIT License
184 stars 40 forks source link

Excludes Ignored at 1.1.0 #1

Closed HappyCodeSloth closed 7 years ago

HappyCodeSloth commented 7 years ago

Firstly, thank you for producing this plugin it is really useful.

Unfortunately at the latest version 1.1.0 I am finding that all my package excludes are being included in the package.

I have not identified why this is happening yet.

dougmoscrop commented 7 years ago

Oh no! If you could provide any details that would be great, I'll have a look.

HappyCodeSloth commented 7 years ago

I think it is this line: dependencies[current] = path.join(current, '**');

As the includes override the excludes this I think adds all files excluded back in. https://serverless.com/framework/docs/providers/aws/guide/packaging/

dougmoscrop commented 7 years ago

It will, but only for the 'current' path which is of some module.

So yeah if you have say module foo.. and in your handler.js you require('foo'), it will add node_modules/foo/** to the include. Are you trying to exclude something within node_modules/foo/__ ?

On Tue, Dec 20, 2016 at 12:10 PM, Karl Martin-Chambers < notifications@github.com> wrote:

I think it is this line: dependencies[current] = path.join(current, '**');

As the includes override the excludes this I think adds all files excluded back in. https://serverless.com/framework/docs/providers/aws/ guide/packaging/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dougmoscrop/serverless-plugin-include-dependencies/issues/1#issuecomment-268300004, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzFLufmlYeBLAp8Ezls0yll9wRzO8qks5rKAvrgaJpZM4LRsxH .

HappyCodeSloth commented 7 years ago

No I dont think so.

Here are my dependencies: "dependencies": { "aws-sdk": "^2.7.13", "dotenv": "^2.0.0", "dynogels": "^6.1.1", "dynogels-promisified": "^1.0.3", "halson": "^2.3.1", "joi": "^10.0.6", "lodash": "^4.17.2" },

This is the resultant include list (Shortened): [ 'src/**', 'handler.js', '**', 'node_modules\\lodash\\**', 'node_modules\\joi\\**', 'node_modules\\topo\\**', 'node_modules\\hoek\\**', 'node_modules\\items\\**', 'node_modules\\isemail\\**', 'node_modules\\halson\\**', 'node_modules\\dynogels-promisified\\**', 'node_modules\\bluebird\\**' ]

It's the first ** that forces the inclusion of everything. So, it must be including the root as a module I guess. And current must be empty.

dougmoscrop commented 7 years ago

Thanks, will investigate!

On Wed, Dec 21, 2016, 7:23 AM Karl Martin-Chambers notifications@github.com wrote:

No I dont think so.

Here are my dependencies: "dependencies": { "aws-sdk": "^2.7.13", "dotenv": "^2.0.0", "dynogels": "^6.1.1", "dynogels-promisified": "^1.0.3", "halson": "^2.3.1", "joi": "^10.0.6", "lodash": "^4.17.2" },

This is the resultant include list (Shortened): [ 'src/', 'handler.js', '', 'node_modules\lodash\', 'node_modules\joi\', 'node_modules\topo\', 'node_modules\hoek\', 'node_modules\items\', 'node_modules\isemail\', 'node_modules\halson\', 'node_modules\dynogels-promisified\', 'node_modules\bluebird\**' ]

It's the first ** that forces the inclusion of everything. So, it must be including the root as a module I guess. And current must be empty.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/dougmoscrop/serverless-plugin-include-dependencies/issues/1#issuecomment-268510420, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzFGBZu-Cmzxlx_l3lqKUBjJTNUK8dks5rKRpGgaJpZM4LRsxH .

dougmoscrop commented 7 years ago

Could you try 1.1.1? I didn't reproduce your situation exactly but there was a bug with local vs. npm dependency discovery which would have made a bunch of things behave dumb.

HappyCodeSloth commented 7 years ago

Given it a try and all good now. Awesome stuff thank you.