我是靠谱客的博主 矮小苗条,最近开发中收集的这篇文章主要介绍nodejs的package.json配置参数,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

一直对node设置package.json的参数不甚了解,借着vscode工具的注释,我把package.json中的options全部展示一下,中文注释部分可能不是package.json里的配置参数,要慎用!!!至于没有注释的要么是重复的,要么就是没有提示。

后来找到的官方文档地址:/nodejs/node_modules/npm/html/doc/files/package.json.html

找到你下载的node目录,然后根据上面的路径打开html页面。当然你也可以通过npm i npm --save下载下来根据上面的路径查找。

{
  "name": "express", // The name of the package.
  "version": "1.0.0", // Version must be parseable by node-semver, which is bundled with npm as a dependency.
  "description": "express", // This helps people discover your package, as it's listed in 'npm search'.
  "main": "index.js", // The main field is a module ID that is the primary entry point to your program.
  // The 'scripts' member is an object hash of script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the 
  // command to run at that point.
  "scripts": {
    "test": "test"
  },
  // Specify the place where your code lives. This is helpful for people who want to contribute.
  "repository": {
    "type": "git",
    "url": ""
  },
  // This helps people discover your package as it's listed in 'npm search'.
  "keywords": [
    "express"
  ],
  "author": "", // A person who has been involved in creating or maintaining this package
  "license": "MIT", // You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.
  "licenses": [],
  // The url to your project's issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package.
  "bugs": {
    "url": ""
  },
  "homepage": "", // The url to the project homepage
  "bundleDependencies": [], // Array of package names that will be bundled when publishing the package.
  "config": {}, // A 'config' hash can be used to set configuration parameters used in package scripts that persist across upgrades.
  "contributors": [], // A list of people who contributed to this package
  "cpu": [], // If your code only runs on certain cpu architectures, you can specify which ones
  // Dependencies are specified with a simple hash of package name to version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL
  "dependencies": {},
  "devDependencies": {},
  "esnext": "", // A module ID with untranspiled code that is the primary entry point to your program.
  "files": [], // The 'files' field is an array of files to include in your project. If you name a folder in the array, then it will also include the files inside that folder
  "maintainers": [], // A list of people who maintains this package
  "man": [], // Specify either a single file or an array of filenames to put in place for the man program to find.
  "module": "", // An ECMAScript module ID that is the primary entry point to your program
  // Dependencies are specified with a simple hash of package name to version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
  "optionalDependencies": {},
  "os": [], // You can specify which operating systems your module will run on
  "peerDependencies": {}, // Dependencies are specified with a simple hash of package name to version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL
  "preferGlobal": true, // If your package is primarily a command-line application that should be installed globally, then set this value to true to provide a warning if it is installed locally
  "prettier": {}, // Schema for .prettierrc  Prettier configuration
  "private": false, // If set to true, then npm will refuse to publish it.
  "resolutions": {}, // Dependencies are specified with a simple hash of package name to version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
  "types": "", // Set the types property to point to your bundled declaration file
  "typings": "", // Note that the "typings" field is synonymous with "types", and could be used as well.
  
  "activationEvents": [], // VS Code 扩展的激活事件
  "badges": [], // 在 Marketplace 的扩展页边栏中显示的徽章数组
  "bin": "",
  "categories": [], // VS Code 库用于对扩展进行分类的类别
  "contributes": {}, // 由此包表示的 VS Code 扩展的所有贡献
  "directories": {},
  "displayName": "", // VS Code 库中使用的扩展的显示名称
  "dist": {},
  "engines": {}, // 引擎兼容性
  "engineStrict": false,
  "extensionDependencies": [], // 其他扩展的依赖关系。扩展的标识符始终是 ${publisher}.${name}。例如: vscode.csharp。
  "extensionPack": [], // 可一起安装的一组扩展。扩展的标识符始终为 ${publisher}.${name}。例如: vscode.csharp。
  "galleryBanner": {}, // VS Code 商城使用的横幅
  "icon": "", // 128 x 128 像素图标的路径
  "jspm": {},
  "markdown": "github", // 控制商店中使用的 Markdown 渲染引擎。可为 "github" (默认) 或 "standard" (标准)
  "preview": true, // 在 Marketplace 中设置扩展,将其标记为“预览”。
  "publishConfig": {},
  "publisher": "", // VS Code 扩展的发布者
  "qna": "marketplace", // 控制市场中的“问与答”(Q&A)链接。设置为 "marketplace" 可启用市场的默认“问与答”页面。设置为其他字符串可指向自定义的“问与答”页面。设置为 "false" 可完全禁用“问与答”
  "readme": ""
}

 

最后

以上就是矮小苗条为你收集整理的nodejs的package.json配置参数的全部内容,希望文章能够帮你解决nodejs的package.json配置参数所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(42)

评论列表共有 0 条评论

立即
投稿
返回
顶部