From e4ac2edc42ee7fb6db11218a7dfc0e9d8de8075f Mon Sep 17 00:00:00 2001 From: lutangar Date: Thu, 2 Dec 2021 13:01:26 +0100 Subject: [PATCH 1/5] Fix docs compiling --- .gitignore | 2 ++ docs/compile.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b77bcb4..7a87f3e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ build node-addon-api prebuilds/ + +docs/index.html diff --git a/docs/compile.js b/docs/compile.js index 89daed6..a988e3b 100644 --- a/docs/compile.js +++ b/docs/compile.js @@ -5,7 +5,7 @@ var fs = require('fs') var dox = require('dox') -var jade = require('jade') +var jade = require('pug') var marked = require('marked') var hljs = require('highlight.js') var assert = require('assert') @@ -146,8 +146,8 @@ function markdown (code) { */ function highlight (code, lang) { - if (!hljs.LANGUAGES.hasOwnProperty(lang)) { + if (!hljs.listLanguages().hasOwnProperty(lang)) { lang = 'javascript' } - return hljs.highlight(lang, code).value + return hljs.highlight(code, { language: lang }).value } From 3a635fcaee1b4e7649aa3cb099087e4098ba9910 Mon Sep 17 00:00:00 2001 From: lutangar Date: Thu, 2 Dec 2021 10:32:16 +0100 Subject: [PATCH 2/5] Setup CI via Github actions --- .github/workflows/release.yml | 90 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 31 ++++++++++++ package.json | 2 +- 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f19ae0f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,90 @@ +name: Release + +on: + push: + tags: ['*'] + +jobs: + prebuilds: + strategy: + matrix: + include: + - os: ubuntu-latest + arch: x64 + - os: macos-latest + arch: x64 + - os: windows-latest + arch: x86 + - os: windows-latest + arch: x64 + runs-on: ${{ matrix.os }} + name: Build ${{ matrix.os }} ${{ matrix.arch }} + env: + NODE_VERSION: 16 + VERSION_NAME: ${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }} + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Set up node ${{ env.NODE_VERSION }} + uses: actions/setup-node@v2 + with: + registry-url: 'https://registry.npmjs.org' + node-version: ${{ env.NODE_VERSION }} + architecture: ${{ matrix.arch }} + - name: Install dependencies + shell: bash + run: npm install --build-from-source + - name: Prebuild ${{ env.VERSION_NAME }} + shell: bash + run: npm run prebuild --v8_enable_pointer_compression=false --v8_enable_31bit_smis_on_64bit_arch=false + - name: Create artifact + shell: bash + run: | + tar -zcvf $ARCHIVE_NAME -C prebuilds . + stat "$ARCHIVE_NAME" + env: + ARCHIVE_NAME: ${{ env.VERSION_NAME }}.tar.gz + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ env.VERSION_NAME }} + path: ${{ env.VERSION_NAME }}.tar.gz + retention-days: 1 + + release_and_publish: + runs-on: ubuntu-latest + needs: prebuilds + permissions: + contents: write + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Set up node ${{ env.NODE_VERSION }} + uses: actions/setup-node@v2 + with: + registry-url: 'https://registry.npmjs.org' + - run: npm install + - name: Build the docs + run: npm run docs + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + path: prebuilds + - name: Create ${{ github.ref }} release + uses: softprops/action-gh-release@v1 + with: + files: prebuilds/*/*.tar.gz + env: + ARCHIVE_NAME: ${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}.tar + - run: npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..bb72804 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: Test + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + node-version: [10.x, 12.x, 14.x, 15.x, 16.x] + fail-fast: false + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - name: Install dependencies and test + shell: bash + run: | + npm install --build-from-source + npm test + - name: Test build + shell: bash + run: npm run prebuild diff --git a/package.json b/package.json index fb8e3ff..d6203c8 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test": "nyc mocha --expose-gc", "install": "node-gyp-build", "prebuild": "prebuildify --napi --tag-armv", - "prepack": "prebuildify-ci download && ([ $(ls prebuilds | wc -l) = '5' ] || (echo 'Some prebuilds are missing'; exit 1))" + "prepack": "npm run prebuild && ([ $(ls prebuilds | wc -l) = '5' ] || (echo 'Some prebuilds are missing'; exit 1))" }, "dependencies": { "debug": "^4.3.1" From b65ecd74cfea69e6df31ec02aec97c3b6f88e830 Mon Sep 17 00:00:00 2001 From: lutangar Date: Thu, 2 Dec 2021 14:35:19 +0100 Subject: [PATCH 3/5] Change package name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6203c8..7b1103e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ref-napi", + "name": "@alphacep/ref-napi", "description": "Turn Buffer instances into \"pointers\"", "engines": { "node": ">= 10.0" From 2a5153029d5d231eec5e687fdad3ff9a92c85b20 Mon Sep 17 00:00:00 2001 From: lutangar Date: Thu, 2 Dec 2021 15:02:32 +0100 Subject: [PATCH 4/5] Bump package version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b1103e..ad90d6c 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "64", "napi" ], - "version": "4.0.0", + "version": "4.0.1", "license": "MIT", "author": "Anna Henningsen ", "repository": { From 976c6224c96db06b27b65c6c63db1f8ac47217fb Mon Sep 17 00:00:00 2001 From: lutangar Date: Thu, 2 Dec 2021 17:52:43 +0100 Subject: [PATCH 5/5] Re add node-gyp-build as a true dependency ...since it's called when the package is installed --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ad90d6c..343219c 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "prepack": "npm run prebuild && ([ $(ls prebuilds | wc -l) = '5' ] || (echo 'Some prebuilds are missing'; exit 1))" }, "dependencies": { - "debug": "^4.3.1" + "debug": "^4.3.1", + "node-gyp-build": "^4.2.1" }, "devDependencies": { "dox": "0.9.0", @@ -46,7 +47,6 @@ "marked": "^1.0.0", "mocha": "^8.4.0", "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1", "nyc": "^15.0.0", "prebuildify": "^4.1.2", "prebuildify-ci": "^1.0.5",