Skip to content

Commit

Permalink
chore: upgrade deps (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jul 29, 2023
1 parent f227d80 commit 96c4771
Show file tree
Hide file tree
Showing 9 changed files with 824 additions and 710 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins:

extends:
- eslint:recommended
- plugin:prettier/recommended
- prettier

rules:
# 0 = off, 1 = warn, 2 = error
Expand Down
64 changes: 22 additions & 42 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ env:
DEBUG: napi:*
APP_NAME: snappy
MACOSX_DEPLOYMENT_TARGET: '10.13'
permissions:
contents: write
id-token: write
'on':
push:
branches:
Expand All @@ -18,7 +21,6 @@ env:
pull_request: null
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
fail-fast: false
matrix:
Expand All @@ -42,19 +44,15 @@ jobs:
build: |-
set -e &&
yarn build --target x86_64-unknown-linux-gnu &&
strip *.node
strip *.node &&
chmod 777 -R target
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: set -e && yarn build && strip *.node
- host: macos-latest
target: aarch64-apple-darwin
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
yarn build --target aarch64-apple-darwin
strip -x *.node
- host: ubuntu-latest
Expand All @@ -63,7 +61,8 @@ jobs:
build: |-
set -e &&
yarn build --target aarch64-unknown-linux-gnu &&
aarch64-unknown-linux-gnu-strip *.node
aarch64-unknown-linux-gnu-strip *.node &&
chmod 777 -R target
- host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
setup: |
Expand All @@ -75,21 +74,11 @@ jobs:
- host: ubuntu-latest
target: aarch64-linux-android
build: |
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CC="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CXX="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
export AR="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
yarn build --target aarch64-linux-android
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
- host: ubuntu-latest
target: armv7-linux-androideabi
build: |
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CC="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CXX="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
export AR="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
yarn build --target armv7-linux-androideabi
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
- host: ubuntu-latest
Expand All @@ -99,11 +88,12 @@ jobs:
set -e &&
rustup target add aarch64-unknown-linux-musl &&
yarn build --target aarch64-unknown-linux-musl &&
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node &&
chmod 777 -R target
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@16
name: stable - ${{ matrix.settings.target }} - node@18
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
Expand All @@ -112,26 +102,21 @@ jobs:
if: ${{ !matrix.settings.docker }}
with:
node-version: 18
check-latest: true
cache: yarn
- name: Install
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
with:
profile: minimal
override: true
toolchain: stable
target: ${{ matrix.settings.target }}
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache/registry/index/
.cargo-cache/registry/cache/
.cargo-cache/git/db/
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- uses: goto-bus-stop/setup-zig@v2
Expand All @@ -147,13 +132,12 @@ jobs:
run: yarn config set supportedArchitectures.cpu "ia32"
shell: bash
- name: Install dependencies
run: yarn install --mode=skip-build
run: yarn install
- name: Setup node x86
uses: actions/setup-node@v3
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 16
check-latest: true
node-version: 18
cache: yarn
architecture: x86
- name: Build in docker
Expand Down Expand Up @@ -191,9 +175,7 @@ jobs:
usesh: true
mem: 3000
prepare: |
pkg install -y -f curl node libnghttp2
curl -qL https://www.npmjs.com/install.sh | sh
npm install --location=global --ignore-scripts yarn
pkg install -y -f curl node libnghttp2 npm yarn
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain beta
export PATH="/usr/local/cargo/bin:$PATH"
Expand All @@ -210,12 +192,13 @@ jobs:
whoami
env
freebsd-version
yarn install --mode=skip-build
yarn install
yarn build
strip -x *.node
yarn test
rm -rf node_modules
rm -rf target
rm -rf .yarn/cache
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -230,10 +213,11 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
node:
- '14'
- '16'
- '18'
runs-on: ${{ matrix.settings.host }}
Expand All @@ -243,7 +227,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Install dependencies
run: yarn install --mode=skip-build
Expand All @@ -265,7 +248,6 @@ jobs:
fail-fast: false
matrix:
node:
- '14'
- '16'
- '18'
runs-on: ubuntu-latest
Expand All @@ -278,7 +260,7 @@ jobs:
check-latest: true
cache: yarn
- name: Install dependencies
run: yarn install --mode=skip-build
run: yarn install
- name: Download artifacts
uses: actions/download-artifact@v3
with:
Expand All @@ -297,7 +279,6 @@ jobs:
fail-fast: false
matrix:
node:
- '14'
- '16'
- '18'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -396,7 +377,6 @@ jobs:
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build'
run: |
set -e
apk add nodejs npm yarn
yarn test
test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
Expand Down Expand Up @@ -455,7 +435,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: yarn
- name: Install dependencies
run: yarn install --mode=skip-build
Expand All @@ -470,6 +449,7 @@ jobs:
shell: bash
- name: Publish
run: |
npm config set provenance true
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,16 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18
cache: 'yarn'

- name: Install
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, clippy

- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: node_modules
key: npm-cache-lint-node@14-${{ hashFiles('yarn.lock') }}
components: clippy, rustfmt

- name: 'Install dependencies'
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
run: yarn install --mode=skip-build

- name: ESLint
run: yarn lint
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
target
.yarn
node_modules
7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
exclude = ["node_modules/**/*.toml"]

# https://taplo.tamasfe.dev/configuration/formatter-options.html
[formatting]
align_entries = true
indent_tables = true
reorder_keys = true
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
authors = ["LongYinan <lynweklm@gmail.com>"]
edition = "2021"
name = "napi-snappy"
name = "napi-snappy"
version = "0.1.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
napi = { version = "2", features = ["napi5", "serde-json"] }
napi = { version = "2", features = ["napi5", "serde-json"] }
napi-derive = { version = "2" }
snap = "1"
snap = "1"

[target.'cfg(not(target_os = "linux"))'.dependencies]
mimalloc-rust = "0.2"
Expand All @@ -23,4 +23,4 @@ napi-build = "2"

[profile.release]
codegen-units = 1
lto = true
lto = true
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */

/* auto-generated by NAPI-RS */

const { existsSync, readFileSync } = require('fs')
const { join } = require('path')

Expand Down
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
"scripts": {
"artifacts": "napi artifacts",
"bench": "node -r @swc-node/register benchmark/bench.ts",
"build": "napi build --platform --release --pipe \"prettier --loglevel silent -w\"",
"build": "napi build --platform --release --pipe \"prettier --log-level silent -w\"",
"build:debug": "napi build --platform",
"format": "run-p format:source format:rs",
"format": "run-p format:source format:rs format:toml",
"format:toml": "taplo format",
"format:rs": "cargo fmt",
"format:source": "prettier --config ./package.json --write .",
"lint": "eslint -c ./.eslintrc.yml .",
Expand All @@ -65,29 +66,29 @@
"version": "napi version && conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
},
"devDependencies": {
"@napi-rs/cli": "^2.14.1",
"@swc-node/register": "^1.5.5",
"@swc/core": "^1.3.24",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"ava": "^5.1.0",
"@napi-rs/cli": "^2.16.2",
"@swc-node/register": "^1.6.6",
"@swc/core": "^1.3.72",
"@taplo/cli": "^0.5.2",
"@types/node": "^20.4.5",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"ava": "^5.3.1",
"benny": "^3.7.1",
"chalk": "^5.2.0",
"chalk": "^5.3.0",
"conventional-changelog-cli": "^3.0.0",
"esbuild": "^0.18.0",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"esbuild": "^0.18.17",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-import": "^2.28.0",
"husky": "^8.0.3",
"legacy-snappy": "npm:snappy@6",
"lint-staged": "^13.1.0",
"lint-staged": "^13.2.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.1",
"pretty-bytes": "^6.0.0",
"prettier": "^3.0.0",
"pretty-bytes": "^6.1.1",
"table": "^6.8.1",
"typescript": "^5.0.0"
"typescript": "^5.1.6"
},
"lint-staged": {
"*.@(js|ts|tsx)": [
Expand Down

0 comments on commit 96c4771

Please sign in to comment.