From 690f6e9e6a8aeead3fab770c5f25f3721d3db88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E7=91=BE?= <74231782+sj817@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:33:04 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat=EF=BC=9A=E5=88=A0=E9=99=A4=20CI=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E4=BB=A5=E6=94=AF=E6=8C=81=20npm=20?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 164 ---------------------------------- .github/workflows/release.yml | 38 ++++++++ .gitignore | 1 + package.json | 36 +++----- 4 files changed, 51 insertions(+), 188 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 81c22d94b..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,164 +0,0 @@ -name: CI -on: - workflow_dispatch: - pull_request: - push: - branches: - - master - tags: - - '*' -env: - FORCE_COLOR: 1 -concurrency: - group: ${{ github.head_ref || github.run_id }} - cancel-in-progress: true -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - macos-latest - - ubuntu-20.04 - - windows-latest - host: - - x64 - target: - - x64 - node: - - 18 - include: - - os: windows-latest - node: 18 - host: x86 - target: x86 - - os: macos-m1 - node: 18 - host: arm64 - target: arm64 - name: ${{ matrix.os }} (host=${{ matrix.host }}, target=${{ matrix.target }}) - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - architecture: ${{ matrix.host }} - - - name: Add yarn (self-hosted) - if: matrix.os == 'macos-m1' - run: npm install -g yarn - - - name: Add setuptools for Python 3.12 (temp) - if: matrix.os != 'macos-m1' - run: pip install setuptools - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.3 - if: contains(matrix.os, 'windows') - with: - msbuild-architecture: ${{ matrix.target }} - - - name: Install dependencies - run: yarn install --ignore-scripts - - - name: Check Node compatibility - run: node tools/semver-check.js - - - name: Add env vars - shell: bash - run: | - echo "V=1" >> $GITHUB_ENV - - if [ "${{ matrix.target }}" = "x86" ]; then - echo "TARGET=ia32" >> $GITHUB_ENV - else - echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV - fi - - - name: Add Linux env vars - if: contains(matrix.os, 'ubuntu') - run: | - echo "CFLAGS=${CFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV - echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV - - - name: Build binaries - run: yarn prebuild -a ${{ env.TARGET }} - - - name: Print binary info - if: contains(matrix.os, 'ubuntu') - run: | - ldd build/**/node_sqlite3.node - echo "---" - nm build/**/node_sqlite3.node | grep "GLIBC_" | c++filt || true - echo "---" - file build/**/node_sqlite3.node - - - name: Run tests - run: yarn test - - - name: Upload binaries to commit artifacts - uses: actions/upload-artifact@v4 - if: matrix.node == 18 - with: - name: prebuilt-binaries - path: prebuilds/* - retention-days: 7 - - - name: Upload binaries to GitHub Release - run: yarn upload --upload-all ${{ github.token }} - if: matrix.node == 18 && startsWith(github.ref, 'refs/tags/') - - build-qemu: - runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') - strategy: - fail-fast: false - matrix: - node: - - 18 - target: - - linux/arm64 - variant: - - bullseye - - alpine3.15 - include: - # musl x64 builds - - target: linux/amd64 - variant: alpine3.15 - node: 18 - name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }}) - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build binaries and test - run: | - docker buildx build \ - --file ./tools/BinaryBuilder.Dockerfile \ - --load \ - --tag sqlite-builder \ - --platform ${{ matrix.target }} \ - --no-cache \ - --build-arg VARIANT=${{ matrix.variant }} \ - --build-arg NODE_VERSION=${{ matrix.node }} \ - . - CONTAINER_ID=$(docker create -it sqlite-builder) - docker cp $CONTAINER_ID:/usr/src/build/prebuilds/ ./prebuilds - - - name: Upload binaries to commit artifacts - uses: actions/upload-artifact@v4 - if: matrix.node == 18 - with: - name: prebuilt-binaries - path: prebuilds/* - retention-days: 7 - - - name: Upload binaries to GitHub Release - run: yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }} - if: matrix.node == 18 && startsWith(github.ref, 'refs/tags/') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..8b65b8aff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: release +on: + push: + # 监听 main 分支的 push 事件 + branches: + - main +# 赋予 release-please-action 权限 +permissions: + contents: write + pull-requests: write +jobs: + # 设置 release-please 任务 + release-please: + # 设置任务运行环境为 ubuntu-latest + runs-on: ubuntu-latest + steps: + # 使用 release-please-action 动作来自动创建发布 PR + - uses: googleapis/release-please-action@v4 + id: release + with: + # 设置发布类型为 node + release-type: node + # 检出代码 + - uses: actions/checkout@v4 + if: ${{ steps.release.outputs.release_created }} + # 设置 Node.js 环境 + - uses: actions/setup-node@v4 + with: + # 设置 Node.js 版本 + node-version: 20 + # 设置 npm 源 + registry-url: https://registry.npmjs.org + if: ${{ steps.release.outputs.release_created }} + # 发布到 npm + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + if: ${{ steps.release.outputs.release_created }} diff --git a/.gitignore b/.gitignore index 108a59ae0..586b76565 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ setup.sh package-lock.json yarn.lock prebuilds +pnpm-lock.yaml diff --git a/package.json b/package.json index ab413ff4a..7e13d6817 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "sqlite3", + "name": "@karinjs/sqlite3", "description": "Asynchronous, non-blocking SQLite3 bindings", "version": "5.1.7", "homepage": "https://github.com/TryGhost/node-sqlite3", @@ -33,44 +33,32 @@ "Ben Noordhuis " ], "files": [ - "binding.gyp", - "deps/", "lib/*.js", "lib/*.d.ts", - "src/" + "!README.md", + "!LICENSE" ], "repository": { "type": "git", "url": "https://github.com/TryGhost/node-sqlite3.git" - }, - "dependencies": { + }, + "devDependencies": { + "eslint": "8.56.0", + "mocha": "10.2.0", + "prebuild": "12.1.0", + "node-gyp": "8.x", "bindings": "^1.5.0", "node-addon-api": "^7.0.0", "prebuild-install": "^7.1.1", "tar": "^6.1.11" }, - "devDependencies": { - "eslint": "8.56.0", - "mocha": "10.2.0", - "prebuild": "12.1.0" - }, - "peerDependencies": { - "node-gyp": "8.x" - }, - "peerDependenciesMeta": { - "node-gyp": { - "optional": true - } - }, - "optionalDependencies": { - "node-gyp": "8.x" - }, "scripts": { - "install": "prebuild-install -r napi || node-gyp rebuild", + "install": "npx @karinjs/prebuild-install -r napi --binary-name=sqlite3", "prebuild": "prebuild --runtime napi --all --verbose", "rebuild": "node-gyp rebuild", "upload": "prebuild --verbose --prerelease", - "test": "node test/support/createdb.js && mocha -R spec --timeout 480000" + "test": "node test/support/createdb.js && mocha -R spec --timeout 480000", + "init": "npx @karinjs/prebuild-install -r napi --binary-name=sqlite3" }, "license": "BSD-3-Clause", "keywords": [ From 67b68d84bcddbbf24847428d9dd752133c4a39ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E7=91=BE?= <74231782+sj817@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:58:33 +0800 Subject: [PATCH 2/5] =?UTF-8?q?docs:=20=E5=88=86=E6=94=AF=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 62a4c81ae..4680849a3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # ⚙️ node-sqlite3 +> [!IMPORTANT] +> **注意:本仓库为 sqlite3 的 fork 版本,二进制包默认使用阿里云镜像下载,仅支持预构建二进制,不支持源码编译和 node-gyp rebuild。** +> 更新时间:2025年4月15日 + + Asynchronous, non-blocking [SQLite3](https://sqlite.org/) bindings for [Node.js](http://nodejs.org/). [![Latest release](https://img.shields.io/github/release/TryGhost/node-sqlite3.svg)](https://www.npmjs.com/package/sqlite3) From 19bbd649ebca5dc07835fc00e39bd0a23f572a85 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:59:25 +0800 Subject: [PATCH 3/5] chore(main): release 1.0.0 (#1) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 10 ++++++++++ package.json | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..75abf5f9f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +## 1.0.0 (2025-04-15) + + +### Bug Fixes + +* 534 by enforcing use of latest node-pre-gyp - refs mapbox/node-pre-gyp[#187](https://github.com/KarinJS/node-sqlite3/issues/187) ([a8b6bf1](https://github.com/KarinJS/node-sqlite3/commit/a8b6bf1213fd37a00e17a55b68883fc8926249ce)) +* broken link to MapBox site ([#1369](https://github.com/KarinJS/node-sqlite3/issues/1369)) ([6967909](https://github.com/KarinJS/node-sqlite3/commit/6967909bb1b0b1e12b71fd38115043eb620ea959)) +* Update brew (CI Failure) ([#1108](https://github.com/KarinJS/node-sqlite3/issues/1108)) ([a9dc5a3](https://github.com/KarinJS/node-sqlite3/commit/a9dc5a3cff1db452c24044d31dfa3047fdcc72ac)) diff --git a/package.json b/package.json index 7e13d6817..4b250343c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@karinjs/sqlite3", "description": "Asynchronous, non-blocking SQLite3 bindings", - "version": "5.1.7", + "version": "1.0.0", "homepage": "https://github.com/TryGhost/node-sqlite3", "author": { "name": "Mapbox", @@ -41,7 +41,7 @@ "repository": { "type": "git", "url": "https://github.com/TryGhost/node-sqlite3.git" - }, + }, "devDependencies": { "eslint": "8.56.0", "mocha": "10.2.0", From eeb148d2317b8fd44f50e312f9a362adb2ed0141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E7=91=BE?= <74231782+sj817@users.noreply.github.com> Date: Tue, 15 Apr 2025 20:24:11 +0800 Subject: [PATCH 4/5] fix: init --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4b250343c..5aed65fe9 100644 --- a/package.json +++ b/package.json @@ -53,12 +53,12 @@ "tar": "^6.1.11" }, "scripts": { - "install": "npx @karinjs/prebuild-install -r napi --binary-name=sqlite3", + "install": "npx @karinjs/prebuild-install -r napi --pkg_version=5.1.7 --pkg_name=sqlite3", "prebuild": "prebuild --runtime napi --all --verbose", "rebuild": "node-gyp rebuild", "upload": "prebuild --verbose --prerelease", "test": "node test/support/createdb.js && mocha -R spec --timeout 480000", - "init": "npx @karinjs/prebuild-install -r napi --binary-name=sqlite3" + "init": "npx @karinjs/prebuild-install -r napi --pkg_version=5.1.7 --pkg_name=sqlite3" }, "license": "BSD-3-Clause", "keywords": [ From f216f1ac7251d2e4d2b02fd272d13dc6c508a50f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 20:24:49 +0800 Subject: [PATCH 5/5] chore(main): release 1.0.1 (#2) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75abf5f9f..f3ae1f7b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.0.1](https://github.com/KarinJS/node-sqlite3/compare/v1.0.0...v1.0.1) (2025-04-15) + + +### Bug Fixes + +* init ([eeb148d](https://github.com/KarinJS/node-sqlite3/commit/eeb148d2317b8fd44f50e312f9a362adb2ed0141)) + ## 1.0.0 (2025-04-15) diff --git a/package.json b/package.json index 5aed65fe9..fb579ecc2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@karinjs/sqlite3", "description": "Asynchronous, non-blocking SQLite3 bindings", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/TryGhost/node-sqlite3", "author": { "name": "Mapbox",