Just an FYI that might help people.

Grunt usually doesn't need be installed globally, and generally shouldn't
be. Users may want to install grunt-cli (
https://www.npmjs.org/package/grunt-cli) globally for convenience, but it
shouldn't be needed by a build system. As far as I can tell grunt-cli
doesn't have any JSHint dependency, though it has many others. grunt-cli
provides the executable 'grunt' which uses project specific versions of the
actual grunt package.

Normal usage of Grunt, for example in jQuery, is that grunt is listed in
'devDependencies' in package.json. A user or build system then runs 'npm
install' which installs all the devDependencies into the project, not
globally. After that a user can run 'grunt' within the project directory,
which will use the globally installed grunt-cli but the local version of
grunt proper.

But grunt-cli doesn't even need to be installed globally, and I recommend
it isn't. grunt-cli can be listed as a dependency in package.json, as it is
in jQuery.

# Exact commands to run grunt jshint on jquery:
sudo apt-get install git nodejs npm
git clone https://github.com/jquery/jquery.git
cd jquery
npm install
node_modules/.bin/grunt jshint

# Users can create an alias that works like Ruby's 'bundle exec':
alias npm-exec='PATH=$(npm bin):$PATH'
npm-exec grunt jshint

I realize all this might not be of any help when is comes to building
Debian packages (if you don't want non-free to be used as part of the build
process), but it might help end-users working on applications.

-Anton

Reply via email to