Files
freeCodeCamp/curriculum/challenges/chinese/05-apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning.chinese.md
Beau Carnes 6b1992ee7c fix: Add Api challenges - Chinese translation (#35164)
* fix: Add Api challenges - Chinese translation

* fix: md formatting

* fix: md formatting
2019-05-06 06:31:26 -05:00

48 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 587d7fb5367417b2b2512c01
title: Manage npm Dependencies By Understanding Semantic Versioning
localeTitle: 通过了解语义版本控制来管理npm依赖项
challengeType: 2
---
## Description
<section id='description'>
package.json的dependencies-section中的npm软件包的版本遵循所谓的语义版本控制SemVer这是软件版本控制的行业标准旨在使管理依赖项更容易。在npm上发布的库框架或其他工具应使用SemVer以便清楚地传达依赖于程序包的项目在更新时可以期望的更改类型。
SemVer在没有公共API的项目中没有意义 - 所以除非你的项目与上面的例子类似,否则使用另一种版本控制格式。 <code>0</code>那么为什么你需要了解SemVer <code>0</code>了解SemVer在开发使用外部依赖项的软件时非常有用您几乎总是这样做。有一天您对这些数字的理解将使您免于意外地对项目进行重大更改而不理解为什么“昨天有效”的事情突然之间没有。 <code>0</code>这是语义版本控制根据官方网站的工作方式: <code>0</code>给定版本号MAJOR.MINOR.PATCH当您进行不兼容的API更改时增加
MAJOR版本当以向后兼容的方式添加功能时增加
MINOR版本当您进行向后兼容的错误修复时
PATCH版本。 <code>0</code>这意味着PATCH是错误修复MINOR添加了新功能但它们都没有破坏之前的功能。最后MAJOR添加了对早期版本无效的更改。 <code>0</code>示例<code>0</code>语义版本号1.3.8 <code>0</code>说明<code>0</code>在package.json的dependencies-section中更改时刻版本以匹配MAJOR版本2MINOR版本10和PATCH版本2
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '“依赖”应该包括“时刻”'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, ''moment'', ''"dependencies" does not include "moment"''); }, xhr => { throw new Error(xhr.responseText); })'
- text: '“时刻”版应该是“2.10.2”'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert.match(packJson.dependencies.moment, /^[\^\~]?2\.10\.2/, ''Wrong version of "moment". It should be 2.10.2''); }, xhr => { throw new Error(xhr.responseText); })'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>