-
-
Notifications
You must be signed in to change notification settings - Fork 486
Language & formatting improvements #1679
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
Open
henrebotha
wants to merge
2
commits into
nodejs:main
Choose a base branch
from
henrebotha:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,19 @@ C++ code needs to be compiled into executable form whether it be as an object | |
file to linked with others, a shared library, or a standalone executable. | ||
|
||
The main reason for this is that we need to link to the Node.js dependencies and | ||
headers correctly, another reason is that we need a cross platform way to build | ||
headers correctly. Another reason is that we need a cross-platform way to build | ||
C++ source into binary for the target platform. | ||
|
||
Until now **node-gyp** is the **de-facto** standard build tool for writing | ||
Node.js addons. It's based on Google's **gyp** build tool, which abstract away | ||
many of the tedious issues related to cross platform building. | ||
**node-gyp** remains the **de-facto** standard build tool for writing | ||
Node.js addons. It's based on Google's **gyp** build tool, which abstracts away | ||
many of the tedious issues related to cross-platform building. | ||
|
||
**node-gyp** uses a file called ```binding.gyp``` that is located on the root of | ||
**node-gyp** uses a file called `binding.gyp` that is located in the root of | ||
your addon project. | ||
|
||
```binding.gyp``` file, contains all building configurations organized with a | ||
JSON like syntax. The most important parameter is the **target** that must be | ||
set to the same value used on the initialization code of the addon as in the | ||
The `binding.gyp` file contains all building configurations organized with a | ||
JSON-like syntax. The most important parameter is the **target** that must be | ||
set to the same value used in the initialization code of the addon, as in the | ||
examples reported below: | ||
|
||
### **binding.gyp** | ||
|
@@ -27,8 +27,8 @@ examples reported below: | |
{ | ||
# myModule is the name of your native addon | ||
"target_name": "myModule", | ||
"sources": ["src/my_module.cc", ...], | ||
... | ||
"sources": ["src/my_module.cc", …], | ||
… | ||
] | ||
} | ||
``` | ||
|
@@ -38,25 +38,25 @@ examples reported below: | |
```cpp | ||
#include <napi.h> | ||
|
||
// ... | ||
// … | ||
|
||
/** | ||
* This code is our entry-point. We receive two arguments here, the first is the | ||
* environment that represent an independent instance of the JavaScript runtime, | ||
* This code is our entry point. We receive two arguments here: the first is the | ||
* environment that represent an independent instance of the JavaScript runtime; | ||
* the second is exports, the same as module.exports in a .js file. | ||
* You can either add properties to the exports object passed in or create your | ||
* own exports object. In either case you must return the object to be used as | ||
* the exports for the module when you return from the Init function. | ||
*/ | ||
Napi::Object Init(Napi::Env env, Napi::Object exports) { | ||
|
||
// ... | ||
// … | ||
|
||
return exports; | ||
} | ||
|
||
/** | ||
* This code defines the entry-point for the Node addon, it tells Node where to go | ||
* This code defines the entry point for the Node addon. It tells Node where to go | ||
* once the library has been loaded into active memory. The first argument must | ||
* match the "target" in our *binding.gyp*. Using NODE_GYP_MODULE_NAME ensures | ||
* that the argument will be correct, as long as the module is built with | ||
|
@@ -75,8 +75,8 @@ NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init) | |
- [Command options](https://www.npmjs.com/package/node-gyp#command-options) | ||
- [Configuration](https://www.npmjs.com/package/node-gyp#configuration) | ||
|
||
Sometimes finding the right settings for ```binding.gyp``` is not easy so to | ||
accomplish at most complicated task please refer to: | ||
Sometimes finding the right settings for `binding.gyp` is not easy, so to | ||
accomplish the most complicated tasks, please refer to: | ||
|
||
- [GYP documentation](https://gyp.gsrc.io/index.md) | ||
- [node-gyp wiki](https://github.com/nodejs/node-gyp/wiki) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you update this link that is moved to |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced that this special ellipse charater is better than the plain
...
. Could you revert this and the other cases below back to...
?