简体   繁体   English

如何将节点模块的脚本从 package.json 文件添加到根 package.json 文件

[英]How to add a Node Module's script from the package.json file to the Root package.json file

I'm making an NPM that would make setting up Bootstrap 4 for live editing faster with 1 command (after installing).我正在制作一个 NPM,可以使用 1 个命令(安装后)更快地设置 Bootstrap 4 以进行实时编辑。

I have a few script in my custom_Module package.json file that I want to programmatically add to the Root package.json file in the script definition.我的custom_Module package.json文件中有一些script ,我想以编程方式将它们添加到script定义中的Root package.json文件中。

How would I go about it?我该怎么办?

I can install the dependency modules, but I cannot run the commands with npm run SCRIPTNAME我可以安装依赖模块,但我无法使用npm run SCRIPTNAME运行命令

custom_module :自定义模块

"script":{
           "kenobi": "node-sass --watch scss -o dist/css";
           "hellothere": "concurrently \"npm run kenobi\" \"live-server --port=66\""
}

note: I want to move these script to the root package.json file.注意:我想将这些script移动到根package.json文件中。

File structure for reference:参考文件结构:

ROOT
   -package.json  //Root package.json
    ...
   -node_module
      -custom_Module
         -package.json. // Node Module's package.json

Feature is not available.功能不可用。

You're just going to need to add the script to the Root package.json .您只需要将脚本添加到 Root package.json

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

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