Skip to content

Commit

Permalink
Add better entry point description (#1177)
Browse files Browse the repository at this point in the history
The current docs say
>   is used to define the entry point of your code used by programs like Node.js. If unspecified it will default to index.js.

Since Node is not a program, is an execution environment, the description given proposes to change, to avoid misconceptions about how javascript and javascript packages really work.
I think is convenient to try to unify definitions and criteria. Also,  today NodeJS purpose the "exports" entry point usage instead of "main" entry, and this entry point (exports) has better support for universal packages.
  • Loading branch information
jircdev committed Nov 15, 2022
1 parent 844b9e4 commit 22906bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lang/en/docs/creating-a-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ The fields you see in the `package.json` have the following meanings:
a package as much as you want but they must have new versions.
- **description** is an optional but recommended field that gets used by other
Yarn users to search for and understand your project.
- **main** is used to define the entry point of your code used by programs like
Node.js. If unspecified it will default to `index.js`.
- **main** s used to define the entry point of your code used by packagers or development environments as NodeJS. If unspecified it will default to `index.js`.
- **repository** is another optional but recommended field that helps users of
your package find the source code to contribute back.
- **author** is the creator or maintainer of a package. It follows the format
`"Your Name <you@example.com> (https://your-website.com)"`
- **license** is the published legal terms of your package and what is the
allowed usage of the code in your package.

> Today package.json supports the "exports" entry point which is taken over "main" entry point if it is defined.
When you run `yarn init`, all it is doing is creating this file, nothing
happens in the background. You can feel free to edit this file as much as you
want.
Expand Down

0 comments on commit 22906bf

Please sign in to comment.