问题
I'm evaluating task runners, Grunt and Gulp in particular, but there's one thing I dislike about both of them: the fact that they require a package.json
file for your project. This is even though your project might not even be an npm project in the first place. In my case, I'm already using composer.json
, which basically does the exact same thing.
I ended up creating my package.json
like this:
{
"name": "myproject",
"version": "0.0.0",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-phpcs": "~0.2.3",
"grunt-phplint": "0.0.5",
"grunt-phpdocumentor": "~0.4.1"
}
}
Note that I'm not maintaining the version number, as that is unnecessary overhead. This works though, in the sense that I can run my grunt tasks after executing npm install
. I feel that I should be able to do without this file though. I read that it's possible to use Grunt without a package.json
, but my take is that you'd then have to install the node modules manually, which is more overhead. Gulp is no different, or at least I found no evidence to the contrary.
So the question is, are there any task runners that don't require you to define your project's metadata twice, need only a single file, and are not too bleeding edge?
回答1:
Answering myself, the only thing I could find that seems to fit my requirements is bldr. It is PHP based, uses composer as package management backend, and does it without hijacking the composer.json
you might already be using, as it uses bldr.json
instead. It also does not require you to add metadata to the file that describes your bldr dependencies. Here's an example dependencies file (taken from http://docs.bldr.io/en/latest/blocks.html):
{
"require": {
"acme/demo-block": "@stable"
}
}
Then, when you run bldr install
, your dependencies are installed and you can run your bldr tasks.
来源:https://stackoverflow.com/questions/27703049/using-a-task-runner-without-package-json