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/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..f3ae1f7b1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# 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) + + +### 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/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) diff --git a/package.json b/package.json index ab413ff4a..fb579ecc2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "sqlite3", + "name": "@karinjs/sqlite3", "description": "Asynchronous, non-blocking SQLite3 bindings", - "version": "5.1.7", + "version": "1.0.1", "homepage": "https://github.com/TryGhost/node-sqlite3", "author": { "name": "Mapbox", @@ -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 --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" + "test": "node test/support/createdb.js && mocha -R spec --timeout 480000", + "init": "npx @karinjs/prebuild-install -r napi --pkg_version=5.1.7 --pkg_name=sqlite3" }, "license": "BSD-3-Clause", "keywords": [