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

update main prop, sync to the current behaviour #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions component.json/specifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
A __public__ component __SHOULD__ list a few keywords.

## .main

It is recommended that you use "index.js" for the main component file,
however if you use another filename,
you __MUST__ define a "main" field for that.
This file will be returned when you require its component and autorequired by the build process.
It is recommended that you use "index.js" for the main component file.
If you omit the "main" field, the first file in the "scripts" array will be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, it's the first file in the first .use()ed field you use, which by default is "scripts". however, that's implementation and this is specifications. specs only have to say that you should and that it defaults to index.js, implementation can do whatever it wants :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, what's about a note, that the behavior when requiring is different to node.js:
you only can require the main file, if you want to expose other files, the main file should "proxy" them.
in node.js you can require any file of a module by adding a relative path to the module name

A component __MUST__ have only one "main" file specified,
and it __MUST__ still be listed in the "scripts" array.

## .scripts

The `scripts` field explicitly specifies the scripts for this component. For __public__ components, these __must__ be regular JavaScript files. For __private__ components, these __should__ be regular Javascript files.
Expand Down