fix(curriculum): nest package versions in code blocks (#49223)

fix: nest package versions in code
This commit is contained in:
Kubatbek-A
2023-02-01 20:22:52 +01:00
committed by GitHub
parent 1206694545
commit 9834091143
4 changed files with 9 additions and 9 deletions
@@ -22,7 +22,7 @@ In this section, packages your project requires are stored using the following f
# --instructions--
Add version "1.1.0" of the `@freecodecamp/example` package to the `dependencies` field of your `package.json` file.
Add version `1.1.0` of the `@freecodecamp/example` package to the `dependencies` field of your `package.json` file.
**Note:** `@freecodecamp/example` is a faux package used as a learning tool.
@@ -22,9 +22,9 @@ If you use Replit, follow these steps to set up the project:
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the Solution Link field.
The `package.json` file is the center of any Node.js project or npm package. It stores information about your project, similar to how the <head> section of an HTML document describes the content of a webpage. It consists of a single JSON object where information is stored in key-value pairs. There are only two required fields; "name" and "version", but it’s good practice to provide additional information about your project that could be useful to future users or maintainers.
The `package.json` file is the center of any Node.js project or npm package. It stores information about your project, similar to how the `head` section of an HTML document describes the content of a webpage. It consists of a single JSON object where information is stored in key-value pairs. There are only two required fields; `name` and `version`, but it’s good practice to provide additional information about your project that could be useful to future users or maintainers.
If you look at the file tree of your project, you will find the package.json file on the top level of the tree. This is the file that you will be improving in the next couple of challenges.
If you look at the file tree of your project, you will find the `package.json` file on the top level of the tree. This is the file that you will be improving in the next couple of challenges.
One of the most common pieces of information in this file is the `author` field. It specifies who created the project, and can consist of a string or an object with contact or other details. An object is recommended for bigger projects, but a simple string like the following example will do for this project.
@@ -34,13 +34,13 @@ One of the most common pieces of information in this file is the `author` field.
# --instructions--
Add your name as the `author` of the project in the package.json file.
Add your name as the `author` of the project in the `package.json` file.
**Note:** Remember that you’re writing JSON, so all field names must use double-quotes (") and be separated with a comma (,).
# --hints--
package.json should have a valid "author" key
`package.json` should have a valid "author" key
```js
(getUserInput) =>
@@ -10,13 +10,13 @@ dashedName: use-the-caret-character-to-use-the-latest-minor-version-of-a-depende
Similar to how the tilde we learned about in the last challenge allows npm to install the latest PATCH for a dependency, the caret (`^`) allows npm to install future updates as well. The difference is that the caret will allow both MINOR updates and PATCHes.
Your current version of `@freecodecamp/example` should be "~1.2.13" which allows npm to install to the latest 1.2.x version. If you were to use the caret (^) as a version prefix instead, npm would be allowed to update to any 1.x.x version.
Your current version of `@freecodecamp/example` should be `~1.2.13` which allows npm to install to the latest `1.2.x` version. If you were to use the caret (^) as a version prefix instead, npm would be allowed to update to any `1.x.x` version.
```json
"package": "^1.3.8"
```
This would allow updates to any 1.x.x version of the package.
This would allow updates to any `1.x.x` version of the package.
# --instructions--
@@ -10,7 +10,7 @@ dashedName: use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-
In the last challenge, you told npm to only include a specific version of a package. That’s a useful way to freeze your dependencies if you need to make sure that different parts of your project stay compatible with each other. But in most use cases, you don’t want to miss bug fixes since they often include important security patches and (hopefully) don’t break things in doing so.
To allow an npm dependency to update to the latest PATCH version, you can prefix the dependency’s version with the tilde (`~`) character. Here's an example of how to allow updates to any 1.3.x version.
To allow an npm dependency to update to the latest PATCH version, you can prefix the dependency’s version with the tilde (`~`) character. Here's an example of how to allow updates to any `1.3.x` version.
```json
"package": "~1.3.8"
@@ -18,7 +18,7 @@ To allow an npm dependency to update to the latest PATCH version, you can prefix
# --instructions--
In the package.json file, your current rule for how npm may upgrade `@freecodecamp/example` is to use a specific version (1.2.13). But now, you want to allow the latest 1.2.x version.
In the package.json file, your current rule for how npm may upgrade `@freecodecamp/example` is to use a specific version (`1.2.13`). But now, you want to allow the latest `1.2.x` version.
Use the tilde (`~`) character to prefix the version of `@freecodecamp/example` in your dependencies, and allow npm to update it to any new _patch_ release.