Skip to content

Commit

Permalink
docs(learn): migrate "How to publish N-API package" guide to the lear…
Browse files Browse the repository at this point in the history
…n section (#6232)

* docs(learn): migrate 'How to publish Node-API package' guide to the learn section (#6229)

* docs(learn): Migrate 'How to publish N-API package' guide to the learn section (#6229).

* Update pages/en/learn/modules/publishing-node-api-modules.md

Co-authored-by: Michael Esteban <[email protected]>
Signed-off-by: Mwelwa <[email protected]>

* Update pages/en/learn/modules/publishing-node-api-modules.md

Co-authored-by: Michael Esteban <[email protected]>
Signed-off-by: Mwelwa <[email protected]>

* fix: code format

* grammar nits

Signed-off-by: Brian Muenzenmeyer <[email protected]>

* doc(modules): removed outdated point referring to node-api as experimental

---------

Signed-off-by: Mwelwa <[email protected]>
Signed-off-by: Brian Muenzenmeyer <[email protected]>
Co-authored-by: Michael Esteban <[email protected]>
Co-authored-by: Augustin Mauroy <[email protected]>
Co-authored-by: Brian Muenzenmeyer <[email protected]>
  • Loading branch information
4 people authored Jan 18, 2024
1 parent 31a50a6 commit 4bf5147
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
6 changes: 6 additions & 0 deletions i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
"outputToTheCommandLineUsingNodejs": "Output to the command line using Node.js",
"acceptInputFromTheCommandLineInNodejs": "Accept input from the command line in Node.js"
}
},
"modules": {
"links": {
"modules": "Modules",
"publishingNodeApiModules": "How to publish a Node-API package"
}
}
},
"about": {
Expand Down
9 changes: 9 additions & 0 deletions navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@
"label": "components.navigation.learn.commandLine.links.acceptInputFromTheCommandLineInNodejs"
}
}
},
"modules": {
"label": "components.navigation.learn.modules.links.modules",
"items": {
"publishingNodeApiModules": {
"link": "/learn/modules/publishing-node-api-modules",
"label": "components.navigation.learn.modules.links.publishingNodeApiModules"
}
}
}
}
},
Expand Down
1 change: 0 additions & 1 deletion pages/en/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ layout: docs.hbs
- [Anatomy of an HTTP Transaction](/guides/anatomy-of-an-http-transaction/)
- [Working with Different Filesystems](/guides/working-with-different-filesystems/)
- [Backpressuring in Streams](/guides/backpressuring-in-streams/)
- [How to publish N-API package](/guides/publishing-napi-modules/)
- [ABI Stability](/guides/abi-stability/)
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
title: How to publish N-API package
layout: docs.hbs
title: How to publish a Node-API package
layout: learn.hbs
---

# To publish N-API version of a package alongside a non-N-API version
# How to publish a Node-API version of a package alongside a non-Node-API version

The following steps are illustrated using the package `iotivity-node`:

- First, publish the non-N-API version:
- First, publish the non-Node-API version:
- Update the version in `package.json`. For `iotivity-node`, the version
becomes `1.2.0-2`.
- Go through the release checklist (ensure tests/demos/docs are OK)
- `npm publish`
- Then, publish the N-API version:
- Then, publish the Node-API version:
- Update the version in `package.json`. In the case of `iotivity-node`,
the version becomes `1.2.0-3`. For versioning, we recommend following
the pre-release version scheme as described by
Expand All @@ -21,16 +21,16 @@ The following steps are illustrated using the package `iotivity-node`:
- `npm publish --tag n-api`

In this example, tagging the release with `n-api` has ensured that, although
version 1.2.0-3 is later than the non-N-API published version (1.2.0-2), it
version 1.2.0-3 is later than the non-Node-API published version (1.2.0-2), it
will not be installed if someone chooses to install `iotivity-node` by simply
running `npm install iotivity-node`. This will install the non-N-API version
running `npm install iotivity-node`. This will install the non-Node-API version
by default. The user will have to run `npm install iotivity-node@n-api` to
receive the N-API version. For more information on using tags with npm check
receive the Node-API version. For more information on using tags with npm check
out ["Using dist-tags"][].

## To introduce a dependency on an N-API version of a package
## How to introduce a dependency on a Node-API version of a package

To add the N-API version of `iotivity-node` as a dependency, the `package.json`
To add the Node-API version of `iotivity-node` as a dependency, the `package.json`
will look like this:

```json
Expand All @@ -45,7 +45,6 @@ will look like this:
> reason for this is that the tag refers to exactly one version. So, if the
> package maintainer chooses to tag a later version of the package using the
> same tag, `npm update` will receive the later version. This should be acceptable
> given the currently experimental nature of N-API. To depend on an N-API-enabled
> version other than the latest published, the `package.json` dependency will
> have to refer to the exact version like the following:
Expand Down

0 comments on commit 4bf5147

Please sign in to comment.