Skip to content

Commit 8dafbc7

Browse files
committed
napi -> node-api
1 parent de1e72d commit 8dafbc7

19 files changed

Lines changed: 46 additions & 46 deletions

pages/napi/getting-started/index.md

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors: gabrielschulhof, NickNaso, jschlight, mhdawson, KevinEady, avivkeller
44

55
# CMake.js
66

7-
[CMake.js](https://github.com/cmake-js/cmake-js) is good build tool alternative to [node-gyp](/learn/napi/build-tools/node-gyp.md). CMake.js is based on the [CMake](https://cmake.org) tool which must be installed.
7+
[CMake.js](https://github.com/cmake-js/cmake-js) is good build tool alternative to [node-gyp](/learn/node-api/build-tools/node-gyp.md). CMake.js is based on the [CMake](https://cmake.org) tool which must be installed.
88

99
### Pros
1010

@@ -78,7 +78,7 @@ In addition to the entries required for any CMake build, additional entries are
7878
Here are the lines required for all native modules built using CMake.js:
7979

8080
```cpp
81-
project(napi-cmake-build-example)
81+
project(node-api-cmake-build-example)
8282
include_directories(${CMAKE_JS_INC})
8383
file(GLOB SOURCE_FILES "hello.cc")
8484
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ There are two broad strategies for shipping a native addon:
1616

1717
## Build tools covered in this section
1818

19-
- [node-gyp](/learn/napi/build-tools/node-gyp.md) - the default build tool bundled with npm; uses Google's GYP format and is nearly universally supported in the Node ecosystem
20-
- [CMake.js](/learn/napi/build-tools/cmake-js.md) - a CMake-based alternative, well-suited for projects that already use CMake
21-
- [node-pre-gyp](/learn/napi/build-tools/node-pre-gyp.md) - a layer on top of node-gyp for distributing pre-built binaries via Amazon S3
19+
- [node-gyp](/learn/node-api/build-tools/node-gyp.md) - the default build tool bundled with npm; uses Google's GYP format and is nearly universally supported in the Node ecosystem
20+
- [CMake.js](/learn/node-api/build-tools/cmake-js.md) - a CMake-based alternative, well-suited for projects that already use CMake
21+
- [node-pre-gyp](/learn/node-api/build-tools/node-pre-gyp.md) - a layer on top of node-gyp for distributing pre-built binaries via Amazon S3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ node-gyp is included with npm; when npm sees `"gypfile": true` in `package.json`
1616
npm install -g node-gyp
1717
```
1818

19-
For developers who find node-gyp too constraining, [CMake.js](/learn/napi/build-tools/cmake-js.md) is a good alternative.
19+
For developers who find node-gyp too constraining, [CMake.js](/learn/node-api/build-tools/cmake-js.md) is a good alternative.
2020

2121
### Pros
2222

File renamed without changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
authors: avivkeller
3+
---
4+
5+
# Getting Started with Node-API
6+
7+
This section walks you through everything you need to begin building native Node.js addons with Node-API. It is designed for developers who are new to native addon development and want a guided path from zero to a working module.
8+
9+
## What you will learn
10+
11+
- [Prerequisites](/learn/node-api/getting-started/prerequisites.md) - the C/C++ and JavaScript knowledge you need before diving in
12+
- [The tools you'll need](/learn/node-api/getting-started/tools.md) - how to install Node, npm, Git, and the C/C++ toolchain on Windows, macOS, and Linux
13+
- [Anatomy of a Node-API project](/learn/node-api/getting-started/project-structure.md) - the common directory layout, `package.json` entries, `binding.gyp`, and the JavaScript wrapper layer shared by every `node-addon-api` project
14+
- [Your first project](/learn/node-api/getting-started/your-first-project.md) - building and running your first Node-API module
15+
- [ObjectWrap](/learn/node-api/getting-started/objectwrap.md) - exposing C++ objects as JavaScript objects using `node-addon-api`'s `ObjectWrap` class
16+
- [Migrating from NAN](/learn/node-api/getting-started/migration.md) - converting an existing NAN-based addon to Node-API
17+
18+
## Which API level should I use?
19+
20+
Node-API operates at two levels:
21+
22+
- **C API** - built directly into Node.js and documented on the [Node.js API pages](https://nodejs.org/api/n-api.html). Gives you maximum control and no extra dependencies.
23+
- **C++ wrapper (`node-addon-api`)** - an npm package that wraps the C API in a friendlier C++ object model. Recommended for most projects because it reduces boilerplate significantly while preserving full ABI stability.
24+
25+
The examples in this section use `node-addon-api`.

pages/napi/getting-started/migration.md renamed to pages/node-api/getting-started/migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This tutorial uses the conversion tool supplied with Node-API to give you a head
1010

1111
To keep things somewhat constrained, this tutorial uses [node-microtime](https://github.com/wadey/node-microtime) which is a simple NAN-based native add-on. This add-on makes system calls to determine the current time to microsecond resolution if supported by the operating system.
1212

13-
Before you start, make sure you've got all the necessary [prerequisites](/learn/napi/getting-started/prerequisites.md) and [tools](/learn/napi/getting-started/tools.md) installed.
13+
Before you start, make sure you've got all the necessary [prerequisites](/learn/node-api/getting-started/prerequisites.md) and [tools](/learn/node-api/getting-started/tools.md) installed.
1414

1515
> Node-API is stable in all currently supported Node.js releases. Use an [Active LTS or Maintenance LTS release](https://nodejs.org/en/about/releases/). You can check the version of Node.js you are running with `node -v`.
1616

pages/napi/getting-started/objectwrap.md renamed to pages/node-api/getting-started/objectwrap.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ authors: gabrielschulhof, NickNaso, jschlight, mhdawson, KevinEady, avivkeller
44

55
# Object Wrap
66

7-
This tutorial is an alternative to [Your First Project](/learn/napi/getting-started/your-first-project.md). Instead of exporting a plain function, it demonstrates how to expose a C++ object as a JavaScript object using `node-addon-api`'s `ObjectWrap` class.
7+
This tutorial is an alternative to [Your First Project](/learn/node-api/getting-started/your-first-project.md). Instead of exporting a plain function, it demonstrates how to expose a C++ object as a JavaScript object using `node-addon-api`'s `ObjectWrap` class.
88

9-
Before you start, make sure you've got all the necessary [prerequisites](/learn/napi/getting-started/prerequisites.md) and [tools](/learn/napi/getting-started/tools.md) installed, and read [Anatomy of a Node-API project](/learn/napi/getting-started/project-structure.md) to understand the common project layout and configuration files.
9+
Before you start, make sure you've got all the necessary [prerequisites](/learn/node-api/getting-started/prerequisites.md) and [tools](/learn/node-api/getting-started/tools.md) installed, and read [Anatomy of a Node-API project](/learn/node-api/getting-started/project-structure.md) to understand the common project layout and configuration files.
1010

1111
## Creating a project
1212

@@ -36,7 +36,7 @@ npm test
3636

3737
## binding.gyp
3838

39-
The project's [**binding.gyp**](https://github.com/nodejs/node-addon-examples/blob/main/src/2-js-to-native-conversion/object-wrap-demo/node-addon-api/binding.gyp) follows the standard format (see [Anatomy of a Node-API project](/learn/napi/getting-started/project-structure.md#bindinggyp) for a full explanation of the `binding.gyp` format and how `node-gyp` uses it).
39+
The project's [**binding.gyp**](https://github.com/nodejs/node-addon-examples/blob/main/src/2-js-to-native-conversion/object-wrap-demo/node-addon-api/binding.gyp) follows the standard format (see [Anatomy of a Node-API project](/learn/node-api/getting-started/project-structure.md#bindinggyp) for a full explanation of the `binding.gyp` format and how `node-gyp` uses it).
4040

4141
## src/object_wrap_demo.h and src/object_wrap_demo.cc
4242

pages/napi/getting-started/prerequisites.md renamed to pages/node-api/getting-started/prerequisites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ For your own projects, it will be necessary to have an understanding of the C/C+
1212

1313
## Command line tools
1414

15-
Many of the tools used to develop Node-API modules are run from the command line. So at least a passing familiarity and confidence with your command line tool is essential. IDEs, as described [here](/learn/napi/getting-started/tools.md#other-tools) can help. But they also rely in the command line.
15+
Many of the tools used to develop Node-API modules are run from the command line. So at least a passing familiarity and confidence with your command line tool is essential. IDEs, as described [here](/learn/node-api/getting-started/tools.md#other-tools) can help. But they also rely in the command line.
File renamed without changes.

0 commit comments

Comments
 (0)