目录
目录
为了帮助其他人在 npm 上找到你的包并在他们的项目中使用你的代码获得良好的体验,我们建议在你的包目录中包含一个 README 文件。你的 README 文件可能包含安装、配置和使用包中代码的说明,以及用户可能认为有帮助的任何其他信息。自述文件将显示在包页面上。
¥To help others find your packages on npm and have a good experience using your code in their projects, we recommend including a README file in your package directory. Your README file may include directions for installing, configuring, and using the code in your package, as well as any other information a user may find helpful. The README file will be shown on the package page.
npm 包 README 文件必须位于包的根目录中。
¥An npm package README 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.md
file, add useful information about your package. -
保存
README.md
文件。¥Save the
README.md
file.
注意:文件扩展名 .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 文件
¥Updating an existing package README file
README 文件只会在你发布包的新版本时在包页面上更新。要更新你的 README 文件:
¥The README file will only be updated on the package page when you publish a new version of your package. To update your README file:
-
在文本编辑器中,更新
README.md
文件的内容。¥In a text editor, update the contents of the
README.md
file. -
保存
README.md
文件。¥Save the
README.md
file. -
在命令行上,在包根目录中,运行以下命令:
¥On the command line, in the package root directory, run the following commands:
npm version patchnpm publish