npm 默认创建项目如何自动配置

背景知识

  • NodeJs
  • NPM

创建 NodeJs 项目

mkdir my-pro && cd my-pro
npm init -y

默认自动生成配置文件 package.json ,
如何自动配置好想自动填入的内容呢?

配置

npm config set init.author.name = xxx // 配置名称
npm config set init.author.eamil = xxx //配置邮箱
npm config set init.author.url = xxx // 配置个人网址
npm config set init.license = xxx // 配置协议

查看配置

npm config list //查看基本配置
npm config list -l //查看所有配置

参考

  1. npm-config
  2. Creating a package.json file
原文地址:https://www.cnblogs.com/zhourongcode/p/12466795.html