dlindahl/grunt-pkg-to-component

'dependencies' can't be overridden in grunt.js if not present in package.json

Closed this issue · 7 comments

Hey Derek,

Thanks for your work on this!

I noticed that if my package.json file doesn't contain a dependencies hash, including a dependencies hash in the component hash in grunt.js throws an error:

TypeError: Cannot set property 'jquery' of undefined

I'm including an empty dependencies hash in package.json as a workaround for now.

Oops!

I'll take a look at it in the next few days.

Just out of curiosity, what is your use case where you need a dependencies hash in grunt.js that differs from your package.json?

I wrote a jQuery plugin that depends on jQuery and another jQuery plugin. jquery is both an NPM package and Bower package, but the other jQuery plugin is not an NPM package. So, npm install fails.

Since I only use Node/NPM for the build process, my thinking is that the dependencies in package.json don't really apply to that environment (I instead use devDependencies for build dependencies). But in the browser/Bower environment, they do, and so I want them in package.json.

Crazy talk?

No, not at all.

So you have a hard dependency on something that cannot be added to package.json.

Totally makes sense and reminds me why I added that feature in the first place 😉

I'll probably knock this out over the holiday or sooner.

Great. Thanks again!

Let me know if this works for you and I'll bump the version number.

Hey Derek,

Sorry for the delay in replying. Your fixes works great. I'd say the version number can be bumped. Thanks!

Bumped and released. Thanks!