从package.json“scripts”创建WebStorm运行配置部分 [英] Create WebStorm run configurations from package.json "scripts" section

查看:2092
本文介绍了从package.json“scripts”创建WebStorm运行配置部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 package.json 文件中,我有以下脚本配置。

  ... 
scripts:{
start:watchify -o lib / index.js -v -d。,
build: browserify。| uglifyjs -cm> lib / index.js,
test:jest
}
...

这允许我运行 npm start npm build npm test



这是伟大的!但是理想情况下,我希望能够使用运行配置从WebStorm中运行这些任务,因为接口方便。我没有能够弄清楚如何做到这一点。



有没有办法创建自己的自定义运行配置或自动从我的 package.json ? / p>

解决方案

您可以使用Node.js运行配置。例如,'npm start'

 工作dir: path / to / your / package.json 

JavaScript文件:/path/to/global/node_modules/npm/bin/npm-cli.js

应用程序参数:run启动

要从命令行查找全局node_modules路径,请使用npm root -g p>

无法从文件自动创建运行配置。创建自己的运行配置的唯一方法是开发插件 - 请参见 http://confluence.jetbrains.com/ display / IDEADEV / Run + Configurations


In my package.json file, I have the following "scripts" configuration.

...
"scripts": {
    "start": "watchify -o lib/index.js -v -d .",
    "build": "browserify . | uglifyjs -cm > lib/index.js",
    "test": "jest"
}
...

This allows me to run npm start, npm build and npm test from the command line.

This is great! But ideally, I would like to be able to run those tasks from within WebStorm using run configurations, due to how convenient the interface is. I have not been able to figure out how to do this.

Is there a way to create my own custom run configurations or automatically generate them from my package.json?

解决方案

you can use Node.js Run configuration for this. For example, for 'npm start':

Working dir: /path/to/your/package.json

JavaScript file: /path/to/global/node_modules/npm/bin/npm-cli.js

Application parameters: run start

To find the global node_modules path from the command line use "npm root -g".

There is no way to auto-create run configurations from files. And the only way to create your own run configuration is developing a plugin - see http://confluence.jetbrains.com/display/IDEADEV/Run+Configurations

这篇关于从package.json“scripts”创建WebStorm运行配置部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆