关于包的 README 文件
See Details
目录
我们强烈建议在你的软件包目录中包含一个 README.md 文件,因为它可以帮助开发者在 npm 上找到你的软件包,并在他们的项目中使用你的代码时获得良好的体验。在大多数情况下,README.md 文件包含安装、配置和使用包中代码的说明;以及用户可能觉得有用的任何其他信息。与任何 GitHub 存储库一样,README.md 文件将渲染在软件包页面上。在 npmjs.com 中,README.md 通过 GitHub API 渲染为 GitHub 风格 Markdown。
¥We highly recommend including a README.md file in your package directory as it helps developers find your package on npm and have a good experience using your code in their projects. In most cases README.md files include directions for installing, configuring, and using the code in your package; as well as any other information a user may find helpful. Just like in any GitHub repository, the README.md file will be rendered on the package's page. On npmjs.com, the README.md is rendered as GitHub Flavored Markdown via GitHub's API.
npm 包 README.md 文件必须位于包的根级目录中。
¥An npm package README.md file must be in the root-level directory of the package.
创建并将 README.md 文件添加到包中
¥Creating and adding a README.md file to a package
-
在文本编辑器中,在你的包根目录中,创建一个名为
README.md的文件。¥In a text editor, in your package root directory, create a file called
README.md. -
在
README.md文件中,添加有关你的包的有用信息。¥In the
README.mdfile, add useful information about your package. -
保存
README.md文件。¥Save the
README.mdfile.
注意:文件扩展名 .md 表示 Markdown 文件。有关 Markdown 的更多信息,请参阅 GitHub 指南“掌握 Markdown”。
¥Note: The file extension .md indicates a Markdown file. For more information about Markdown, see the GitHub Guide "Mastering Markdown".
更新现有包 README.md 文件
¥Updating an existing package README.md file
仅当你发布软件包的新版本时,README.md 文件才会在软件包页面上更新。要更新你的 README.md 文件:
¥The README.md file will only be updated on the package page when you publish a new version of your package. To update your README.md file:
-
在文本编辑器中,更新
README.md文件的内容。¥In a text editor, update the contents of the
README.mdfile. -
保存
README.md文件。¥Save the
README.mdfile. -
在命令行上,在包根目录中,运行以下命令:
¥On the command line, in the package root directory, run the following commands:
npm version patchnpm publish