From 4bf514774efdbbcdd41e8f92389a18f853e95451 Mon Sep 17 00:00:00 2001 From: Mwelwa Date: Fri, 19 Jan 2024 00:25:29 +0200 Subject: [PATCH] docs(learn): migrate "How to publish N-API package" guide to the learn 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 Signed-off-by: Mwelwa * Update pages/en/learn/modules/publishing-node-api-modules.md Co-authored-by: Michael Esteban Signed-off-by: Mwelwa * fix: code format * grammar nits Signed-off-by: Brian Muenzenmeyer * doc(modules): removed outdated point referring to node-api as experimental --------- Signed-off-by: Mwelwa Signed-off-by: Brian Muenzenmeyer Co-authored-by: Michael Esteban Co-authored-by: Augustin Mauroy Co-authored-by: Brian Muenzenmeyer --- i18n/locales/en.json | 6 ++++++ navigation.json | 9 ++++++++ pages/en/guides/index.md | 1 - .../modules/publishing-node-api-modules.md} | 21 +++++++++---------- 4 files changed, 25 insertions(+), 12 deletions(-) rename pages/en/{guides/publishing-napi-modules.md => learn/modules/publishing-node-api-modules.md} (74%) diff --git a/i18n/locales/en.json b/i18n/locales/en.json index c83f965dd98cc..4a98b48a82487 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -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": { diff --git a/navigation.json b/navigation.json index a5851c8b79fbd..54017f49e8119 100644 --- a/navigation.json +++ b/navigation.json @@ -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" + } + } } } }, diff --git a/pages/en/guides/index.md b/pages/en/guides/index.md index e67925c058e6b..615f34caef7b9 100644 --- a/pages/en/guides/index.md +++ b/pages/en/guides/index.md @@ -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/) diff --git a/pages/en/guides/publishing-napi-modules.md b/pages/en/learn/modules/publishing-node-api-modules.md similarity index 74% rename from pages/en/guides/publishing-napi-modules.md rename to pages/en/learn/modules/publishing-node-api-modules.md index 18fc0b1cad90a..54cd99d66bb98 100644 --- a/pages/en/guides/publishing-napi-modules.md +++ b/pages/en/learn/modules/publishing-node-api-modules.md @@ -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 @@ -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 @@ -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: