Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change "id" to "name" for package.json #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions readme.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ module.exports = 1

Par défaut, node essaie de lancer `module/index.js` quand il lit `require('module')`. Aucun autre nom de fichier ne fonctionnera à moins que vous definissiez specifiez au champ `main` de `package.json` de pointer dessus.

Placez les deux fichiers dans un dossier nommé `number-one` (l'`id` dans package.json doit matcher un nom de dossier) et vous aurez un module node fonctionnel.
Placez les deux fichiers dans un dossier nommé `number-one` (l'`name` dans package.json doit matcher un nom de dossier) et vous aurez un module node fonctionnel.

En appelant la fonction `require('number-one')` vous retournez la valeur qui est 'set' dans `module.exports`

Expand Down Expand Up @@ -511,9 +511,9 @@ npm install --save request

Cela installera une copie de `request` dans le `node_modules` le plus proche et notre `package.json` ressemblera ainsi à cela:

```
```js
{
"id": "number-one",
"name": "number-one",
"version": "1.0.0",
"dependencies": {
"request": "~2.22.0"
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ npm install --save request

This installs a copy of `request` into the closest `node_modules` folder and makes our `package.json` look something like this:

```
```js
{
"id": "number-one",
"name": "number-one",
"version": "1.0.0",
"dependencies": {
"request": "~2.22.0"
Expand Down
6 changes: 3 additions & 3 deletions readme.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ module.exports = 1

Por padrão, o Node tenta carregar `module/index.js` quando você faz um `require('module')`, qualquer outro nome de arquivo não vai funcionar a menos que você defina o campo `main` no `package.json` e aponte para ele.

Coloque ambos os arquivos em uma pasta chamada `number-one` (o `id` em `package.json` deve coincidir com o nome da pasta) e você terá um módulo Node para trabalhar.
Coloque ambos os arquivos em uma pasta chamada `number-one` (o `name` em `package.json` deve coincidir com o nome da pasta) e você terá um módulo Node para trabalhar.

Chamando a função `require('number-one')` será retornado o valor de qualquer `module.exports` que estiver definido dentro do módulo:

Expand Down Expand Up @@ -524,9 +524,9 @@ npm install request --save

Isto vai instalar uma cópia de `request` na pasta mais próxima do `node_modules` e fazer o nosso `package.json` se parecer assim:

```
```js
{
"id": "number-one",
"name": "number-one",
"version": "1.0.0",
"dependencies": {
"request": "~2.22.0"
Expand Down
6 changes: 3 additions & 3 deletions readme.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ module.exports = 1

默认情况下,当你调用`require('module')`时node会试图加载`module/index.js`,除非你在`package.json`中设定了`main`一项内容指向你的代码,不然用的名称的文件无法被node识别。

把这两个文件放到`number-one`目录下(`package.json`中的`id`一项必须和目录的名称相同),然后你就可以加载他们了。
把这两个文件放到`number-one`目录下(`package.json`中的`name`一项必须和目录的名称相同),然后你就可以加载他们了。

调用`require('number-one')` 这一命令会返回你在模块中`module.exports`输出的内容:

Expand All @@ -490,9 +490,9 @@ npm install --save request
```
这个命令会安装`request`模块到最近的`node_modules`文件夹中,并会把`package.json`改成这样:

```
```js
{
"id": "number-one",
"name": "number-one",
"version": "1.0.0",
"dependencies": {
"request": "~2.22.0"
Expand Down