有没有办法为 Node.js 项目自动构建 package.json 文件 [英] Is there a way to automatically build the package.json file for Node.js projects

查看:31
本文介绍了有没有办法为 Node.js 项目自动构建 package.json 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

package.json 是否应该手动编辑?像 npm 这样的程序不能只是查看文件,查看require"语句,然后使用它在 package.json 文件中放置必要的条目吗?有没有这样的程序?

Is package.json supposed to be manually edited? Couldn't a program like npm just look through the files, see the "require" statements, and then use that to put the necessary entries in the package.json file? Are there any programs like that?

推荐答案

npm 使用 package.json 文件来了解您的 node.js 项目.

The package.json file is used by npm to learn about your node.js project.

使用npm init为你生成package.json文件!

Use npm init to generate package.json files for you!

它与 npm 捆绑在一起.在此处阅读其文档:https://docs.npmjs.com/cli/init

It comes bundled with npm. Read its documentation here: https://docs.npmjs.com/cli/init

此外,您可以使用官方工具以编程方式生成此文件:https://github.com/npm/init-package-json

Also, there's an official tool you can use to generate this file programmatically: https://github.com/npm/init-package-json

这篇关于有没有办法为 Node.js 项目自动构建 package.json 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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