Skip to content

Commit

Permalink
chore: refresh the infra
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Oct 27, 2024
1 parent 0313600 commit 8cc1160
Show file tree
Hide file tree
Showing 51 changed files with 835 additions and 1,181 deletions.
38 changes: 37 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,48 @@ jobs:
run: yarn lint

- name: TypeCheck
run: yarn typecheck
run: yarn build:ts

- name: Cargo fmt
run: cargo fmt -- --check

- name: Clippy
run: cargo clippy
bench:
name: Bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.napi-rs
target
key: bench-cargo-registry

- name: Install
uses: ./.github/actions/setup-rust
with:
targets: x86_64-unknown-linux-gnu

- name: 'Install dependencies'
run: yarn install

- name: build
run: yarn build

- name: Bench
run: yarn bench

build:
strategy:
fail-fast: false
Expand Down Expand Up @@ -578,6 +613,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- lint
- bench
- build-freebsd
- test-linux-x64-gnu-binding
- test-linux-x64-musl-binding
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ resolver = "2"
rand_core = { version = "0.6", features = ["getrandom"] }
serde = "1.0"
serde_json = "1.0"
xxhash-rust = { version = "0.8", features = ["xxh32", "xxh64", "xxh3"] }
xxhash-rust = { version = "0.8", features = ["xxh32", "const_xxh32", "xxh64", "const_xxh64", "xxh3", "const_xxh3"] }
[profile.release]
codegen-units = 1
lto = true
Expand Down
13 changes: 0 additions & 13 deletions ava.config.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion depracted/deno-lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"typanion": "^3.14.0"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.63",
"@napi-rs/cli": "^3.0.0-alpha.64",
"@types/webpack": "^5.28.5"
},
"funding": {
Expand Down
25 changes: 16 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,29 @@
"artifacts": "yarn workspaces foreach -A --no-private run artifacts",
"bench": "lerna run bench --concurrency 1 --stream --no-prefix",
"build": "yarn workspaces foreach -A --no-private -j 1 run build",
"build:ts": "tsc -b tsconfig.project.json -verbose",
"build:ts": "tsc -b tsconfig.json -verbose",
"lint": "oxlint .",
"test": "ava",
"format": "run-p format:prettier format:rs format:toml",
"format:prettier": "prettier --config ./package.json -w .",
"format:rs": "cargo fmt --all",
"format:toml": "taplo format",
"typecheck": "tsc -b tsconfig.project.json -verbose",
"postinstall": "husky install"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.63",
"@napi-rs/cli": "^3.0.0-alpha.64",
"@napi-rs/wasm-runtime": "^0.2.5",
"@swc-node/core": "^1.13.3",
"@swc-node/register": "^1.10.9",
"@swc/core": "^1.7.26",
"@taplo/cli": "^0.7.0",
"@tybys/wasm-util": "^0.9.0",
"@types/node": "^22.7.4",
"ava": "^6.1.3",
"benchmark": "^2.1.4",
"codecov": "^3.8.3",
"cross-env": "^7.0.3",
"husky": "^9.1.6",
"lerna": "^8.1.8",
"lint-staged": "^15.2.10",
"npm-run-all2": "^7.0.0",
"oxlint": "^0.10.0",
"prettier": "^3.3.3",
"ts-node": "^10.9.2",
"tslib": "^2.7.0",
"typescript": "^5.6.2"
},
Expand All @@ -60,6 +53,20 @@
"cargo fmt --"
]
},
"ava": {
"extensions": {
"ts": "module"
},
"nodeArguments": [
"--import",
"@oxc-node/core/register"
],
"timeout": "1m",
"cache": false,
"files": [
"packages/*/__test__/**/*.spec.ts"
]
},
"prettier": {
"printWidth": 120,
"semi": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/argon2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ It has a simple design aimed at the highest memory filling rate and effective us

# Benchmarks

See [benchmark/](benchmark/argon2.js).
See [benchmark/](benchmark/argon2.ts).

## API

Expand Down
3 changes: 3 additions & 0 deletions packages/argon2/__test__/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const HASHED = await hash(PASSWORD, {
parallelism: CORES,
})

const bench = new Bench('Hash with all cores')
const bench = new Bench()

bench
.add('@node-rs/argon hash', async () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/argon2/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// prettier-ignore
/* eslint-disable */
// @ts-nocheck
/* auto-generated by NAPI-RS */

const { readFileSync } = require('fs')
const { createRequire } = require('node:module')
require = createRequire(__filename)

const { readFileSync } = require('node:fs')
let nativeBinding = null
const loadErrors = []

Expand Down
4 changes: 2 additions & 2 deletions packages/argon2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
},
"scripts": {
"artifacts": "napi artifacts -d ../../artifacts",
"bench": "cross-env NODE_ENV=production node benchmark/argon2.js",
"bench": "cross-env NODE_ENV=production node --import @oxc-node/core/register benchmark/argon2.ts",
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
"prepublishOnly": "napi prepublish",
"version": "napi version && git add npm"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.63",
"@napi-rs/cli": "^3.0.0-alpha.64",
"argon2": "^0.41.0",
"cross-env": "^7.0.3",
"tinybench": "^2.9.0"
Expand Down
9 changes: 9 additions & 0 deletions packages/argon2/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"composite": true
},
"exclude": ["dist"],
"include": ["benchmark", "__tests__"]
}
5 changes: 4 additions & 1 deletion packages/bcrypt/binding.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// prettier-ignore
/* eslint-disable */
// @ts-nocheck
/* auto-generated by NAPI-RS */

const { readFileSync } = require('fs')
const { createRequire } = require('node:module')
require = createRequire(__filename)

const { readFileSync } = require('node:fs')
let nativeBinding = null
const loadErrors = []

Expand Down
4 changes: 2 additions & 2 deletions packages/bcrypt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"scripts": {
"artifacts": "napi artifacts -d ../../artifacts",
"bench": "cross-env NODE_ENV=production node --import @swc-node/register/esm-register benchmark/bcrypt.ts",
"bench": "cross-env NODE_ENV=production node --import @oxc-node/core/register benchmark/bcrypt.ts",
"build": "napi build --platform --release --js binding.js --dts binding.d.ts",
"build:debug": "napi build --platform",
"prepublishOnly": "napi prepublish",
Expand All @@ -72,7 +72,7 @@
"devDependencies": {
"@cwasm/openbsd-bcrypt": "^0.1.0",
"@cwasm/openwall-bcrypt": "^0.1.0",
"@napi-rs/cli": "^3.0.0-alpha.63",
"@napi-rs/cli": "^3.0.0-alpha.64",
"@types/bcrypt": "^5.0.2",
"@types/bcryptjs": "^2.4.6",
"bcrypt": "^5.1.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/bcrypt/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
"outDir": "dist",
"composite": true
},
"exclude": ["dist"],
"include": ["__tests__"]
Expand Down
18 changes: 0 additions & 18 deletions packages/crc32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,6 @@ js_crc32 for inputs 16931844B, avg 2066B x 22.12 ops/sec ±5.20% (40 runs sample
+---------------------+-------------------+----------------------+
```

## Support matrix

| | node12 | node14 | node16 | node18 |
| ---------------- | ------ | ------ | ------ | ------ |
| Windows x64 |||||
| Windows x32 |||||
| Windows arm64 |||||
| macOS x64 |||||
| macOS arm64 |||||
| Linux x64 gnu |||||
| Linux x64 musl |||||
| Linux arm gnu |||||
| Linux arm64 gnu |||||
| Linux arm64 musl |||||
| Android arm64 |||||
| Android armv7 |||||
| FreeBSD x64 |||||

## API

> The type of **input initial crc** and **output crc number** is `u32`
Expand Down
2 changes: 1 addition & 1 deletion packages/crc32/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava'
import { crc32 as nodeCrc32 } from 'crc'

import { crc32c, crc32 } from '../index'
import { crc32c, crc32 } from '../index.js'

const fx = Buffer.from('crc32c - test')

Expand Down
3 changes: 3 additions & 0 deletions packages/crc32/__tests__/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
Loading

0 comments on commit 8cc1160

Please sign in to comment.