简体   繁体   English

如何在package.json中的安装前/安装后脚本中调用多个调用

[英]How to invoke multiple calls in pre/postinstall scripts in package.json

I want to run a couple different scripts during preinstall, and a few postinstall, but the examples on npm where they split the calls using semi-colons doesn't work, and ends up throwing an error. 我想在安装前和安装后运行几个不同的脚本,但是npm上使用分号拆分调用的示例不起作用,并最终引发错误。 Was hoping to be able to do something like: 希望能够做类似的事情:

  "scripts": {
    "preinstall": "composer install; php artisan key:generate; grunt build:app",
    "install": "bower install",
    "postinstall": "bin\\post_install.sh git@bitbucket.project/project.git"
  },

I wanted to have "bower install" in postinstall, but didn't work so since install is essentially the same I put it there, now that I want a couple preinstall calls invoked I don't have the same solution available since only one option. 我想在安装后安装“ bower install”,但是没有用,因为安装与我在此处安装的基本相同,现在我希望调用几个预安装调用,因为只有一个选项,所以我没有相同的解决方案。 I didn't want to split them all out in bash scripts for each if possible. 如果可能的话,我不想在bash脚本中将它们全部分割开。

像这样使用'&&'分隔命令:

"preinstall": "composer install && php artisan key:generate && grunt build:app"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM