diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73964ab..b8409db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,62 +3,60 @@ name: CI on: push: paths-ignore: - - '*.md' - branches: [ main ] + - "*.md" + branches: [main] tags: - - '*' + - "*" pull_request: - branches: [ main ] + branches: [main] jobs: build: runs-on: ubuntu-latest steps: - - - name: Git checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '16' - - - name: Cache node_modules - uses: actions/cache@v3 - with: - path: | - ~/.npm - ~/.nvm - ~/work/better-sqlite3-wrapper/better-sqlite3-wrapper/node_modules - ~/work/better-sqlite3-wrapper/better-sqlite3-wrapper/package-lock.json - key: ${{ runner.os }}-node_modules-cache-v3-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node_modules-cache-v3- - - - name: Extract Tag Name - run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV - if: ${{ startsWith(github.ref, 'refs/tags') }} - - - name: Run tests - run: | - npm i - node --test - if: ${{ env.TAG_NAME == '' }} - - - name: Build SNAPSHOT - run: npm pack - if: ${{ env.TAG_NAME == '' }} - - - name: Publish RELEASE - run: | - VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)" - echo "Publish a release version=$VERSION for tag $TAG_NAME" - npm --no-git-tag-version --allow-same-version version $VERSION - npm pack - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc - npm publish --access=public farjs-better-sqlite3-wrapper-${VERSION}.tgz - if: ${{ env.TAG_NAME != '' }} - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Git checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Cache node_modules + uses: actions/cache@v4 + with: + path: | + ~/.npm + ~/.nvm + ~/work/better-sqlite3-wrapper/better-sqlite3-wrapper/node_modules + ~/work/better-sqlite3-wrapper/better-sqlite3-wrapper/package-lock.json + key: ${{ runner.os }}-node_modules-cache-v4-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node_modules-cache-v4- + + - name: Extract Tag Name + run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV + if: ${{ startsWith(github.ref, 'refs/tags') }} + + - name: Run tests + run: | + npm i + node ./index.test.js + if: ${{ env.TAG_NAME == '' }} + + - name: Build SNAPSHOT + run: npm pack + if: ${{ env.TAG_NAME == '' }} + + - name: Publish RELEASE + run: | + VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)" + echo "Publish a release version=$VERSION for tag $TAG_NAME" + npm --no-git-tag-version --allow-same-version version $VERSION + echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc + npm publish + if: ${{ env.TAG_NAME != '' }} + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/ci_bun.yml b/.github/workflows/ci_bun.yml index 1699942..42cf19c 100644 --- a/.github/workflows/ci_bun.yml +++ b/.github/workflows/ci_bun.yml @@ -3,27 +3,36 @@ name: Bun CI on: push: paths-ignore: - - '*.md' - branches: [ main ] + - "*.md" + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: runs-on: ubuntu-latest steps: + - name: Git checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Git checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: "1.0.1" - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: "0.5.8" + - name: Cache Dependencies + uses: actions/cache@v4 + with: + path: | + ~/.bun/install/cache + ~/work/better-sqlite3-wrapper/better-sqlite3-wrapper/bun.lockb + key: ${{ runner.os }}-bun-cache-v1-${{ hashFiles('package.json') }} + restore-keys: | + ${{ runner.os }}-bun-cache-v1- - - name: Run tests - run: | - bun install - bun test + - name: Run tests + run: | + bun install + bun test diff --git a/package.json b/package.json index 3c346e4..1d1ad6a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "url": "git+https://github.com/farjs/better-sqlite3-wrapper.git" }, "author": "viktor-podzigun", - "private": false, "description": "Thin api wrapper around better-sqlite3 and bun:sqlite to allow cross- runtime/engine usage", "license": "MIT", "bugs": { @@ -27,12 +26,16 @@ "main": "./index.js", "exports": "./index.js", "typings": "./index.d.ts", + "private": false, + "publishConfig": { + "access": "public" + }, "browserslist": "maintained node versions", "engines": { - "node": ">=14.21.1", - "bun": ">=0.5.8" + "node": ">=18", + "bun": ">=0.8" }, "optionalDependencies": { - "better-sqlite3": "^8.2.0" + "better-sqlite3": "^11.5.0" } }