| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b9df1a9 commit c22f739
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,224 @@ | |||
| 1 | + # Node.js Node-API version release process | ||
| 2 | + | ||
| 3 | + This document describes the technical aspects of the Node.js Node-API version | ||
| 4 | + release process. | ||
| 5 | + | ||
| 6 | + ## Table of contents | ||
| 7 | + | ||
| 8 | + * [How to create a release](#how-to-create-a-release) | ||
| 9 | + * [0. Pre-release steps](#0-pre-release-steps) | ||
| 10 | + * [1. Update the main branch](#1-update-the-main-branch) | ||
| 11 | + * [2. Create a new branch for the release](#2-create-a-new-branch-for-the-release) | ||
| 12 | + * [3. Update `NAPI_VERSION`](#3-update-napi_version) | ||
| 13 | + * [4. Define `addon_context_register_func`](#4-define-addon_context_register_func) | ||
| 14 | + * [5. Update version guards](#5-update-version-guards) | ||
| 15 | + * [6. Create release commit](#6-create-release-commit) | ||
| 16 | + * [7. Propose release on GitHub](#7-propose-release-on-github) | ||
| 17 | + * [8. Ensure that the release branch is stable](#8-ensure-that-the-release-branch-is-stable) | ||
| 18 | + * [9. Land the release](#9-land-the-release) | ||
| 19 | + * [10. Backport the release](#10-backport-the-release) | ||
| 20 | + | ||
| 21 | + ## How to create a release | ||
| 22 | + | ||
| 23 | + Notes: | ||
| 24 | + | ||
| 25 | + * Version strings are listed below as _"vx"_ or _"x"_. Substitute for | ||
| 26 | + the release version. | ||
| 27 | + * Examples will use the integer release version `10`. | ||
| 28 | + | ||
| 29 | + ### 0. Pre-release steps | ||
| 30 | + | ||
| 31 | + Before preparing a Node.js Node-API version release, the Node-API Working Group | ||
| 32 | + must be notified at least one business day in advance of the expected release. | ||
| 33 | + | ||
| 34 | + Node-API Working Group can be contacted best by opening up an issue on the | ||
| 35 | + [abi-stable-node issue tracker][]. | ||
| 36 | + | ||
| 37 | + ### 1. Update the main Branch | ||
| 38 | + | ||
| 39 | + Checkout the staging branch locally. | ||
| 40 | + | ||
| 41 | + ```console | ||
| 42 | + $ git remote update | ||
| 43 | + $ git checkout main | ||
| 44 | + $ git reset --hard upstream/main | ||
| 45 | + ``` | ||
| 46 | + | ||
| 47 | + If the staging branch is not up to date relative to `main`, bring the | ||
| 48 | + appropriate PRs and commits into it. | ||
| 49 | + | ||
| 50 | + ### 2. Create a new branch for the release | ||
| 51 | + | ||
| 52 | + Create a new branch named `node-api-x-proposal`, off the main branch. | ||
| 53 | + | ||
| 54 | + ```console | ||
| 55 | + $ git checkout -b node-api-10-proposal upstream/main | ||
| 56 | + ``` | ||
| 57 | + | ||
| 58 | + ### 3. Update `NAPI_VERSION` | ||
| 59 | + | ||
| 60 | + Set the version for the proposed release using the following macros, which are | ||
| 61 | + already defined in `src/node_version.h`: | ||
| 62 | + | ||
| 63 | + ```c | ||
| 64 | + #define NAPI_VERSION x | ||
| 65 | + ``` | ||
| 66 | + | ||
| 67 | + > Note: Do not update the `NAPI_VERSION` defined in `src/js_native_api.h`. It | ||
| 68 | + > is a fixed constant baseline version of Node-API. | ||
| 69 | + | ||
| 70 | + ### 4. Define `addon_context_register_func` | ||
| 71 | + | ||
| 72 | + For each new version of Node-API an `else if` case must be added to | ||
| 73 | + `get_node_api_context_register_func` in `src/node_api.cc` and the numeric | ||
| 74 | + literal used in the `static_assert` statement in that function must be updated | ||
| 75 | + to the new Node-API version. | ||
| 76 | + | ||
| 77 | + ### 5. Update version guards | ||
| 78 | + | ||
| 79 | + #### Step 1. Update define version guards | ||
| 80 | + | ||
| 81 | + If this release includes new Node-APIs that were first released in this | ||
| 82 | + version, the relevant commits should already include the `NAPI_EXPERIMENTAL` | ||
| 83 | + define guards on the declaration of the new Node-API. Check for these guards | ||
| 84 | + with: | ||
| 85 | + | ||
| 86 | + ```console | ||
| 87 | + grep NAPI_EXPERIMENTAL src/js_native_api{_types,}.h src/node_api{_types,}.h | ||
| 88 | + ``` | ||
| 89 | + | ||
| 90 | + and update the define version guards with the release version: | ||
| 91 | + | ||
| 92 | + ```diff | ||
| 93 | + - #ifdef NAPI_EXPERIMENTAL | ||
| 94 | + + #if NAPI_VERSION >= 10 | ||
| 95 | + | ||
| 96 | + NAPI_EXTERN napi_status NAPI_CDECL | ||
| 97 | + node_api_function(napi_env env); | ||
| 98 | + | ||
| 99 | + - #endif // NAPI_EXPERIMENTAL | ||
| 100 | + + #endif // NAPI_VERSION >= 10 | ||
| 101 | + ``` | ||
| 102 | + | ||
| 103 | + Also, update the Node-API version value of the `napi_get_version` test in | ||
| 104 | + `test/js-native-api/test_general/test.js` with the release version `x`: | ||
| 105 | + | ||
| 106 | + ```diff | ||
| 107 | + // Test version management functions | ||
| 108 | + - assert.strictEqual(test_general.testGetVersion(), 9); | ||
| 109 | + + assert.strictEqual(test_general.testGetVersion(), 10); | ||
| 110 | + ``` | ||
| 111 | + | ||
| 112 | + #### Step 2. Update runtime version guards | ||
| 113 | + | ||
| 114 | + If this release includes runtime behavior version guards, the relevant commits | ||
| 115 | + should already include `NAPI_VERSION_EXPERIMENTAL` guard for the change. Check | ||
| 116 | + for these guards with: | ||
| 117 | + | ||
| 118 | + ```console | ||
| 119 | + grep NAPI_VERSION_EXPERIMENTAL src/js_native_api_v8* src/node_api.cc | ||
| 120 | + ``` | ||
| 121 | + | ||
| 122 | + and substitute this guard version with the release version `x`. | ||
| 123 | + | ||
| 124 | + #### Step 3. Update test version guards | ||
| 125 | + | ||
| 126 | + If this release includes add-on tests for the new Node-APIs, the relevant | ||
| 127 | + commits should already include `NAPI_EXPERIMENTAL` definition for the tests. | ||
| 128 | + Check for these definitions with: | ||
| 129 | + | ||
| 130 | + ```console | ||
| 131 | + grep NAPI_EXPERIMENTAL test/node-api/*/{*.{h,c},binding.gyp} test/js-native-api/*/{*.{h,c},binding.gyp} | ||
| 132 | + ``` | ||
| 133 | + | ||
| 134 | + and substitute the `NAPI_EXPERIMENTAL` with the release version | ||
| 135 | + `NAPI_VERSION x`; | ||
| 136 | + | ||
| 137 | + ```diff | ||
| 138 | + - #define NAPI_EXPERIMENTAL | ||
| 139 | + + #define NAPI_VERSION 10 | ||
| 140 | + ``` | ||
| 141 | + | ||
| 142 | + #### Step 4. Update document | ||
| 143 | + | ||
| 144 | + If this release includes new Node-APIs that were first released in this | ||
| 145 | + version and are necessary to document, the relevant commits should already | ||
| 146 | + have documented the new Node-API. | ||
| 147 | + | ||
| 148 | + For all Node-API functions and types with define guards updated in Step 1, | ||
| 149 | + in `doc/api/n-api.md`, add the `napiVersion: x` metadata to the Node-API types | ||
| 150 | + and functions that are released in the version, and remove the experimental | ||
| 151 | + stability banner: | ||
| 152 | + | ||
| 153 | + ```diff | ||
| 154 | + #### node_api_function | ||
| 155 | + <!-- YAML | ||
| 156 | + added: | ||
| 157 | + - v1.2.3 | ||
| 158 | + + napiVersion: 10 | ||
| 159 | + --> | ||
| 160 | + | ||
| 161 | + - > Stability: 1 - Experimental | ||
| 162 | + ``` | ||
| 163 | + | ||
| 164 | + #### Step 5. Update change history | ||
| 165 | + | ||
| 166 | + If this release includes new Node-APIs runtime version guards that were first | ||
| 167 | + released in this version and are necessary to document, the relevant commits | ||
| 168 | + should already have documented the new behavior in a "Change History" section. | ||
| 169 | + | ||
| 170 | + For all runtime version guards updated in Step 2, check for these definitions | ||
| 171 | + with: | ||
| 172 | + | ||
| 173 | + ```console | ||
| 174 | + grep NAPI_EXPERIMENTAL doc/api/n-api.md | ||
| 175 | + ``` | ||
| 176 | + | ||
| 177 | + In `doc/api/n-api.md`, update the `experimental` change history item to be the | ||
| 178 | + released version `x`: | ||
| 179 | + | ||
| 180 | + ```diff | ||
| 181 | + Change History: | ||
| 182 | + | ||
| 183 | + - * experimental (`NAPI_EXPERIMENTAL` is defined): | ||
| 184 | + + * version 10: | ||
| 185 | + ``` | ||
| 186 | + | ||
| 187 | + ### 6. Create release commit | ||
| 188 | + | ||
| 189 | + When committing these to git, use the following message format: | ||
| 190 | + | ||
| 191 | + ```text | ||
| 192 | + node-api: define version x | ||
| 193 | + ``` | ||
| 194 | + | ||
| 195 | + ### 7. Propose release on GitHub | ||
| 196 | + | ||
| 197 | + Create a pull request targeting the `main` branch. These PRs should be left | ||
| 198 | + open for at least 24 hours, and can be updated as new commits land. | ||
| 199 | + | ||
| 200 | + If you need any additional information about any of the commits, this PR is a | ||
| 201 | + good place to @-mention the relevant contributors. | ||
| 202 | + | ||
| 203 | + Tag the PR with the `notable-change` label, and @-mention the GitHub team | ||
| 204 | + @nodejs/node-api and @nodejs/node-api-implementer. | ||
| 205 | + | ||
| 206 | + ### 8. Ensure that the release branch is stable | ||
| 207 | + | ||
| 208 | + Run a **[`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/)** | ||
| 209 | + test run to ensure that the build is stable and the HEAD commit is ready for | ||
| 210 | + release. | ||
| 211 | + | ||
| 212 | + ### 9. Land the release | ||
| 213 | + | ||
| 214 | + See the steps documented in [Collaborator Guide - Landing a PR][] to land the | ||
| 215 | + PR. | ||
| 216 | + | ||
| 217 | + ### 10. Backport the release | ||
| 218 | + | ||
| 219 | + Consider backporting the release to all LTS versions following the steps | ||
| 220 | + documented in the [backporting guide][]. | ||
| 221 | + | ||
| 222 | + [Collaborator Guide - Landing a PR]: ./collaborator-guide.md#landing-pull-requests | ||
| 223 | + [abi-stable-node issue tracker]: https://github.com/nodejs/abi-stable-node/issues | ||
| 224 | + [backporting guide]: backporting-to-release-lines.md | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments