diff --git a/.github/workflows/test-website.yml b/.github/workflows/test-website.yml new file mode 100644 index 00000000..9c91f05b --- /dev/null +++ b/.github/workflows/test-website.yml @@ -0,0 +1,26 @@ +name: Test Website Builds + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + test-website: + runs-on: ubuntu-latest + container: node + steps: + - name: Harden Runner + uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 + with: + egress-policy: audit + + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - run: npx envinfo + - name: Build and Deploy + env: + NODE_OPTIONS: --openssl-legacy-provider + working-directory: ./website + run: | + npm install + npx gatsby build --prefix-paths diff --git a/website/docs/special-topics/object-function-refs.md b/website/docs/special-topics/object-function-refs.md index 2b96a87e..5a707951 100644 --- a/website/docs/special-topics/object-function-refs.md +++ b/website/docs/special-topics/object-function-refs.md @@ -40,9 +40,9 @@ This example code shows how to use the `FunctionReference` class. ### src/native-addon.h -[**native-addon.h**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/src/native-addon.h) +[**native-addon.h**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.h) -`embed:src/4-references-and-handle-scope/function-reference-demo/src/native-addon.h` +`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.h` The `NativeAddon` C++ class has two data members that are populated in the `NativeAddon` constructor: @@ -51,9 +51,9 @@ The `NativeAddon` C++ class has two data members that are populated in the `Nati ### src/native-addon.cc -[**native-addon.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/src/native-addon.cc) +[**native-addon.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.cc) -`embed:src/4-references-and-handle-scope/function-reference-demo/src/native-addon.cc` +`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/native-addon.cc` The `NativeAddon` constructor, which is called from JavaScript, takes two function arguments. The first argument is stored as a `Napi::FunctionReference` and the second is stored as a `Napi::Function`. @@ -65,17 +65,17 @@ The `NativeAddon` class implements two methods which can be called from JavaScri ### src/binding.cc -[**binding.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/src/binding.cc) +[**binding.cc**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/binding.cc) -`embed:src/4-references-and-handle-scope/function-reference-demo/src/binding.cc` +`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/src/binding.cc` This is a standard `binding.cc` file: ### index.js -[**index.js**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/index.js) +[**index.js**](https://github.com/nodejs/node-addon-examples/blob/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api/index.js) -`embed:src/4-references-and-handle-scope/function-reference-demo/index.js` +`embed:src/4-references-and-handle-scope/function-reference-demo/node-addon-api/index.js` This JavaScript code shows the use of the `NativeAddon` class. Note that the call to the native `tryCallByStoredFunction` method fails because the data member on which it relies is not valid.