3

I have build something like a base template/workflow for creating websites, mostly using Grunt.

Part of that template is the Modernizr feature detection library, one of my Grunt tasks depends on.

At the moment I just have stored that dependency in my bower.json manifest. That brings two problems to the table:

  1. I need to update the project's name, version, author etc. in both my bower.json and package.json (for Grunt).
  2. I don't like the fact that my dependencies are spreaded out like this – I would need to run npm install and bower install ... before I can start to work. (Not that its a great effort, but to me thats really counter intuitive.)

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

I already took a look into using component.json files which can be read by various package managers (I looked a DUO in particular), but I am not sure if thats what I actually need. There seems to be a build process included, but I already build through Grunt.

Sven
  • 12,997
  • 27
  • 90
  • 148

1 Answers1

0

I suggest you to use Yeoman generator.

If you want to implement Yeoman generator for your own project, I will leave an useful tutorial 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 of Yeoman generator can prompt an user for his input, store it, and write it on any file. Because of the same demand like you, I am currently creating my own generator to put my favorite pieces into bower.json and package.json all together, and I used those articles usefully.

I also highly recommend you to take a close look at other generators on their git repos. The generator is written in Javascript with both Node.js and Yeoman's API.

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

  • open up your terminal (I am on OSX)
  • past echo 'alias coinstall=npm install && bower install --save-dev' | tee ~/.bash_profile && source ~/.bash_profile and enter
  • you will have the hidden .bash_profile file
  • now you can install npm and bower by typing coinstall!
seoyoochan
  • 822
  • 3
  • 14
  • 28