Skip to content

Commit

Permalink
chore: upgrade toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Oct 30, 2023
1 parent 8b0be16 commit 037ecb7
Show file tree
Hide file tree
Showing 20 changed files with 4,352 additions and 4,026 deletions.
64 changes: 34 additions & 30 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
target: 'aarch64-pc-windows-msvc'
build: |
npm i -g @napi-rs/cli
yarn workspaces foreach --no-private -j 1 --exclude @node-rs/jsonwebtoken run build --target aarch64-pc-windows-msvc
yarn build --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@18
runs-on: ${{ matrix.settings.host }}
Expand All @@ -115,7 +115,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: nightly-2023-07-19
toolchain: nightly-2023-10-25
targets: ${{ matrix.settings.target }}

- name: Cache cargo registry
Expand Down Expand Up @@ -184,30 +184,32 @@ jobs:
- uses: actions/checkout@v3
- name: Build
id: build
uses: vmactions/freebsd-vm@v0
uses: cross-platform-actions/action@v0.21.0
env:
DEBUG: 'napi:*'
RUSTUP_HOME: /usr/local/rustup
CARGO_HOME: /usr/local/cargo
RUSTUP_HOME: /home/runner/rustup
CARGO_HOME: /home/runner/cargo
RUSTUP_IO_THREADS: 1
with:
envs: 'DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS'
usesh: true
mem: 3000
prepare: |
pkg install -y -f curl node libnghttp2 npm
npm install -g yarn --ignore-scripts
operating_system: freebsd
version: '13.2'
memory: 13G
cpu_count: 3
environment_variables: 'DEBUG RUSTUP_IO_THREADS'
shell: bash
run: |
env | sort
sudo pkg install -y -f curl node libnghttp2 npm
sudo npm install -g yarn --ignore-scripts
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
export PATH="/usr/local/cargo/bin:$PATH"
sh rustup.sh -y --default-toolchain nightly-2023-10-25
source "$HOME/.cargo/env"
echo "~~~~ rustc --version ~~~~"
rustc --version
echo "~~~~ node -v ~~~~"
node -v
echo "~~~~ yarn --version ~~~~"
yarn --version
run: |
export PATH="/usr/local/cargo/bin:$PATH"
pwd
ls -lah
whoami
Expand Down Expand Up @@ -241,7 +243,7 @@ jobs:
target: 'x86_64-apple-darwin'
- host: windows-latest
target: 'x86_64-pc-windows-msvc'
node: ['16', '18']
node: ['18', '20']
runs-on: ${{ matrix.settings.host }}

steps:
Expand Down Expand Up @@ -287,7 +289,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['16', '18']
node: ['18', '20']
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -332,17 +334,11 @@ jobs:
needs:
- build
runs-on: ubuntu-latest
container:
image: centos:7
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
curl -sL https://rpm.nodesource.com/setup_16.x | bash -
yum install nodejs -y
npm install -g yarn
yarn install --immutable --mode=skip-build
run: yarn install --immutable --mode=skip-build

- name: Download artifacts
uses: actions/download-artifact@v3
Expand All @@ -362,8 +358,16 @@ jobs:
run: yarn build:ts

- name: Test bindings
run: |
yarn test -s
uses: addnab/docker-run-action@v3
with:
image: centos:7
options: -e YARN_IGNORE_NODE=1 -v ${{ github.workspace }}:/build -w /build
run: |
curl -sL https://rpm.nodesource.com/setup_16.x | bash -
yum install nodejs -y
npm install -g yarn
yarn install --immutable --mode=skip-build
yarn test -s
test-linux-x64-musl-binding:
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
Expand All @@ -372,7 +376,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['16', '18']
node: ['18', '20']
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -421,7 +425,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['16', '18']
node: ['18', '20']
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -517,7 +521,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['16', '18']
node: ['18', '20']
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2023-07-19
toolchain: nightly-2023-10-25
components: rustfmt, clippy

- name: 'Install dependencies'
Expand Down
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.4.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.1.cjs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ nodeLinker: node-modules

npmRegistryServer: 'https://registry.npmjs.org/'

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.6.4.cjs
yarnPath: .yarn/releases/yarn-4.0.1.cjs
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-rs",
"packageManager": "yarn@3.6.4",
"packageManager": "yarn@4.0.1",
"version": "0.0.0",
"description": "Node & Rust bindings monorepo",
"author": "LongYinan <lynweklm@gmail.com>",
Expand All @@ -10,9 +10,9 @@
"packages/*"
],
"scripts": {
"artifacts": "yarn workspaces foreach --no-private run artifacts",
"artifacts": "yarn workspaces foreach -A --no-private run artifacts",
"bench": "lerna run bench --concurrency 1 --stream --no-prefix",
"build": "yarn workspaces foreach --no-private -j 1 run build",
"build": "yarn workspaces foreach -A --no-private -j 1 run build",
"build:ts": "tsc -b tsconfig.project.json -verbose",
"lint": "eslint . -c ./.eslintrc.yml \"packages/**/*.{ts,js}\"",
"test": "ava",
Expand All @@ -25,29 +25,29 @@
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"@swc-node/core": "^1.10.4",
"@swc-node/register": "^1.6.6",
"@swc/core": "^1.3.72",
"@swc-node/core": "^1.10.6",
"@swc-node/register": "^1.6.8",
"@swc/core": "^1.3.95",
"@taplo/cli": "^0.5.2",
"@types/node": "^20.4.5",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@types/node": "^20.8.9",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"ava": "^5.3.1",
"benchmark": "^2.1.4",
"codecov": "^3.8.3",
"cross-env": "^7.0.3",
"eslint": "^8.46.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.3",
"lerna": "^7.1.4",
"lint-staged": "^15.0.0",
"lerna": "^7.4.1",
"lint-staged": "^15.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.0",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",
"tslib": "^2.6.1",
"typescript": "^5.1.6"
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"lint-staged": {
"*.@(js|ts|tsx)": [
Expand Down
4 changes: 2 additions & 2 deletions packages/argon2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ version = "0.0.0"
crate-type = ["cdylib"]

[dependencies]
argon2 = "0.5"
argon2 = { version = "0.5", features = ["rand"] }
global_alloc = { path = "../../crates/alloc" }
napi = { version = "2", default-features = false, features = ["napi3"] }
napi-derive = { version = "2", default-features = false, features = [
"type-def",
] }
rand = { version = "0.8", features = ["nightly", "simd_support", "getrandom"] }
rand_core = { version = "0.6", features = ["getrandom"] }

[build-dependencies]
napi-build = "2"
2 changes: 1 addition & 1 deletion packages/argon2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"argon2": "^0.31.0",
"argon2": "^0.31.1",
"cross-env": "^7.0.3"
}
}
3 changes: 2 additions & 1 deletion packages/argon2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ use napi::bindgen_prelude::*;
use napi_derive::napi;

use argon2::{
password_hash::{rand_core::OsRng, PasswordHasher, PasswordVerifier, SaltString},
password_hash::{PasswordHasher, PasswordVerifier, SaltString},
Argon2, Params,
};
use rand_core::OsRng;

#[napi]
pub enum Algorithm {
Expand Down
4 changes: 2 additions & 2 deletions packages/bcrypt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"@types/bcrypt": "^5.0.0",
"bcrypt": "^5.1.0",
"@types/bcrypt": "^5.0.1",
"bcrypt": "^5.1.1",
"bcryptjs": "^2.4.3",
"cross-env": "^7.0.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/crc32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"@types/crc": "^3.8.0",
"@types/crc": "^3.8.2",
"buffer": "^6.0.3",
"crc": "^4.3.2",
"sse4_crc32": "^7.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/deno-lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@
},
"dependencies": {
"clipanion": "^3.2.1",
"typanion": "^3.13.0"
"typanion": "^3.14.0"
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"@types/webpack": "^5.28.1"
"@types/webpack": "^5.28.4"
},
"funding": {
"type": "github",
Expand Down
2 changes: 1 addition & 1 deletion packages/jsonwebtoken/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ napi = { version = "2", default-features = false, features = [
"serde-json",
] }
napi-derive = { version = "2" }
rand = "0.8"
rand_core = { version = "0.6", features = ["std"] }
serde = "1.0"
serde_json = "1.0"

Expand Down
5 changes: 3 additions & 2 deletions packages/jsonwebtoken/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
Expand Down Expand Up @@ -62,7 +63,7 @@
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"@types/jsonwebtoken": "^9.0.2",
"jsonwebtoken": "^9.0.1"
"@types/jsonwebtoken": "^9.0.4",
"jsonwebtoken": "^9.0.2"
}
}
4 changes: 1 addition & 3 deletions packages/jsonwebtoken/src/sign.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use jsonwebtoken::{self};
use napi::{bindgen_prelude::*, JsBuffer, JsBufferValue, Ref};
use napi_derive::napi;
use std::borrow::Borrow;

use crate::{claims::Claims, header::Header};

Expand Down Expand Up @@ -68,7 +66,7 @@ pub struct SignTask {
impl SignTask {
#[inline]
pub fn sign(claims: &Claims, header: &Header, key: &[u8]) -> Result<String> {
let header: &jsonwebtoken::Header = &header.borrow().into();
let header: &jsonwebtoken::Header = &header.into();
let claims = &claims;
let sign_key = &into_encoding_key(key, &header.alg)?;

Expand Down
7 changes: 3 additions & 4 deletions packages/jsonwebtoken/src/verify.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use napi::{bindgen_prelude::*, JsBuffer, JsBufferValue, Ref};
use napi_derive::napi;
use std::borrow::Borrow;

use crate::{claims::Claims, validation::Validation};

Expand Down Expand Up @@ -66,7 +65,7 @@ pub struct VerifyTask {

impl VerifyTask {
pub fn verify(token: &str, key: &[u8], validation: &Validation) -> Result<Claims> {
let validation: &jsonwebtoken::Validation = &validation.borrow().into();
let validation: &jsonwebtoken::Validation = &validation.into();

let first_alg = validation.algorithms.first().ok_or(Error::new(
Status::InvalidArg,
Expand Down Expand Up @@ -112,7 +111,7 @@ pub fn verify(
VerifyTask {
token,
key: AsyncKeyInput::from_either(key)?,
validation: validation.unwrap_or(Validation::default()),
validation: validation.unwrap_or_default(),
},
abort_signal,
))
Expand All @@ -124,6 +123,6 @@ pub fn verify_sync(
key: Either<String, Buffer>,
validation: Option<Validation>,
) -> Result<Claims> {
let validation = validation.unwrap_or(Validation::default());
let validation = validation.unwrap_or_default();
VerifyTask::verify(&token, key.as_ref(), &validation)
}
4 changes: 2 additions & 2 deletions packages/xxhash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"@types/xxhashjs": "^0.2.2",
"webpack": "^5.88.2",
"@types/xxhashjs": "^0.2.3",
"webpack": "^5.89.0",
"xxhash": "^0.3.0",
"xxhashjs": "^0.2.2"
},
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-07-19
nightly-2023-10-25
Loading

0 comments on commit 037ecb7

Please sign in to comment.