Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to napi2 #422

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
pnpm build -- --target aarch64-linux-android
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip skia.android-arm64.node

name: stable - ${{ matrix.settings.target }} - node@14
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}

steps:
Expand Down Expand Up @@ -132,19 +132,19 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.settings.target }}-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
key: ${{ matrix.settings.target }}-cargo-registry

- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.settings.target }}-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
key: ${{ matrix.settings.target }}-cargo-index

- name: Cache pnpm store
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: npm-cache-${{ matrix.settings.target }}-node@14-${{ hashFiles('pnpm-lock.yaml') }}
key: npm-cache-${{ matrix.settings.target }}-node@16-${{ hashFiles('pnpm-lock.yaml') }}

- name: Setup pnpm
run: |
Expand All @@ -155,8 +155,6 @@ jobs:
run: ${{ matrix.settings.docker }}
env:
DOCKER_REGISTRY_URL: ghcr.io
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.settings.docker }}

- name: Setup toolchain
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
check-latest: true

- name: Install
Expand All @@ -44,19 +44,19 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: bench-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
key: bench-cargo-registry

- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: bench-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
key: bench-cargo-index

- name: Cache pnpm store
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
key: npm-cache-bench-linux-x64-gnu

- name: Setup pnpm
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
check-latest: true

- name: Install nasm
Expand All @@ -41,19 +41,19 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: lint-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
key: lint-cargo-registry

- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: lint-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
key: lint-cargo-index

- name: Cache pnpm store
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
key: npm-cache-lint-linux-x64-gnu

- name: Setup pnpm
run: |
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["LongYinan <lynweklm@gmail.com>"]
edition = "2018"
edition = "2021"
name = "canvas"
version = "0.1.0"

Expand All @@ -11,8 +11,8 @@ crate-type = ["cdylib"]
anyhow = "1"
base64 = "0.13"
cssparser = "0.29"
napi = {version = "1", features = ["serde-json"]}
napi-derive = "1"
napi = {version = "2", default-features = false, features = ["napi3", "serde-json", "compat-mode"]}
napi-derive = {version = "2", default-features = false, features = ["compat-mode"]}
nom = "7"
once_cell = "1"
ravif = "0.8"
Expand Down
Binary file modified __test__/pathkit.spec.ts.snap
Binary file not shown.
Binary file modified __test__/svg-canvas.spec.ts.snap
Binary file not shown.
30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,34 @@
"@jimp/custom": "^0.16.1",
"@jimp/jpeg": "^0.16.1",
"@jimp/png": "^0.16.1",
"@napi-rs/cli": "^1.3.5",
"@napi-rs/cli": "^2.4.2",
"@octokit/rest": "^18.12.0",
"@swc-node/register": "^1.4.0",
"@swc-node/register": "^1.4.2",
"@types/lodash": "^4.14.178",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"ava": "^3.15.0",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"ava": "^4.0.1",
"benny": "^3.7.1",
"canvas": "^2.8.0",
"canvas": "^2.9.0",
"canvaskit-wasm": "^0.33.0",
"chalk": "4",
"conventional-changelog-cli": "^2.1.1",
"echarts": "^5.2.2",
"eslint": "^8.4.1",
"colorette": "^2.0.16",
"conventional-changelog-cli": "^2.2.2",
"echarts": "^5.3.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-sonarjs": "^0.11.0",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"lint-staged": "^12.3.3",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"pinst": "^2.1.6",
"png.js": "^0.2.1",
"prettier": "^2.5.1",
"putasset": "^5.0.3",
"skia-canvas": "^0.9.27",
"typescript": "^4.5.3"
"skia-canvas": "^0.9.28",
"typescript": "^4.5.5"
},
"lint-staged": {
"*.@(js|ts|tsx|yml|yaml|md|json)": [
Expand All @@ -108,6 +108,8 @@
"extensions": [
"ts"
],
"workerThreads": false,
"cache": false,
"timeout": "3m",
"environmentVariables": {
"SWC_NODE_PROJECT": "./tsconfig.json",
Expand Down
Loading