你如何运行多个grunt scripts.postinstall?

我试图从grunt的scripts.postinstall运行多个CLI命令。 我不知道如何让两个运行。 如果我添加第二个命令既不运行。 另外他们都在postinstall和控制台上工作。

我试过把它们包装在一个数组中:

"scripts": { "postinstall": ["node_modules/.bin/bower install", "grunt setup"] }, 

我试图用分号分隔它们:

  "scripts": { "postinstall": "node_modules/.bin/bower install; grunt setup" }, 

我似乎无法findNPM脚本的解决scheme

我为这些部分的gruntfile.js看起来像这样:

 mkdir: { setup: { options: { create: [ 'app/main/source/www', 'app/main/build', 'app/main/docs', 'app/main/tests', 'app/development', 'app/releases' ] } } } grunt.registerTask('setup', [ 'mkdir:setup', 'bowercopy:wordpress' ]); 

如果这有助于我的package.json的缩减版本,我剪下上面的代码示例,主要是为了提供上下文。

 { "name": "webapp", "version": "0.1.0", "description": "A web app using bower and grunt", "main": "gruntfile.js", "scripts": { "postinstall": "node_modules/.bin/bower install" }, "repository": { "type": "git", "url": "someurl.com" }, "keywords": [ "web", "app" ], "author": { "company": "somecompany", "name": "somename", "email": "email@me.com" }, "license": "MIT", "homepage": "https://someurl.com", "bugs": { "url": "someurl.com" }, "devDependencies": { "grunt": "^0.4.5", "bower" : "~1.3.5", etc } } 

您可以使用&&在npm脚本部分运行多个命令

 "scripts": { "postinstall": "bower install && grunt setup" }, 

您可以尝试编写一个执行这两个命令的Bash脚本,然后运行它。

post_install.sh:

 #!/bin/bash node_modules/.bin/bower install grunt setup 

的package.json:

 "scripts": { "postinstall": "./post_install.sh" },