Grunt / Bower / Component: Dependency Handling?

I am creating something like a basic template / workflow for building websites, mostly using Grunt.

Part of this pattern is the Modernizr object detection library, one of my Grunt tasks depends on.

At the moment, I just saved this dependency in the manifest bower.json

. This leads to two problems:

  • I need to update project title, version, author, etc. in mine bower.json

    and package.json

    (for Grunt).
  • I don't like the fact that my dependencies are propagated like this: I need to run npm install

    and bower install ...

    before I can start working. (Not that it was a big effort, but for me it really is counterintuitive.)

Is there a smarter, more general way to handle dependencies like this?

I've already looked at using files component.json

that can be read by various package managers (I've looked at DUO in particular), but I'm not sure if this is actually the case. The build process seems to be on, but I'm already building via Grunt.

+3


source to share


1 answer


I suggest you use the Yeoman generator.

If you want to implement a Yeoman generator for your own project, I'll leave a useful link here:

[1] http://code.tutsplus.com/tutorials/build-your-own-yeoman-generator--cms-20040?post_id= 1026796690681657_1026796687348324 # =

[2] http://yeoman.io/authoring/



1 . Basically, index.js

a Yeoman generator can prompt the user for input, save it, and write it to any file. Due to the same demand as you, I am currently building my own generator to put my favorite parts in bower.json and package.json all together and I have used these articles to good use.

I also highly recommend that you take a close look at the other generators in their git repositories. The generator is written in Javascript using Node.js and the Yeoman API.

2 . It's easy. you can create your own alias at .bash_profile

.

  • open your terminal (I'm on OSX)
  • past echo 'alias coinstall=npm install && bower install --save-dev' | tee ~/.bash_profile && source ~/.bash_profile

    and enter
  • you will have a hidden .bash_profile

    file
  • you can now install npm and bower by typing coinstall

    !
0


source







All Articles