Skip to content

Commit

Permalink
chore(infra): improve the configuration of justfile (#7526)
Browse files Browse the repository at this point in the history
  • Loading branch information
shulaoda committed Aug 12, 2024
1 parent c98a4ad commit e311871
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 45 deletions.
10 changes: 5 additions & 5 deletions crates/rspack_allocator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
edition = "2021"
license = "MIT"
name = "rspack_allocator"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
description = "rspack allocator"
edition = "2021"
license = "MIT"
name = "rspack_allocator"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[target.'cfg(target_os = "linux")'.dependencies]
Expand Down
10 changes: 5 additions & 5 deletions crates/rspack_ast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
edition = "2021"
license = "MIT"
name = "rspack_ast"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
description = "rspack ast"
edition = "2021"
license = "MIT"
name = "rspack_ast"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
[dependencies]
anyhow = { workspace = true }
swc_core = { workspace = true, features = [
Expand Down
10 changes: 5 additions & 5 deletions crates/rspack_ast_viewer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
edition = "2021"
license = "MIT"
name = "rspack_ast_viewer"
publish = false
version = "0.1.0"
description = "rspack ast viewer"
edition = "2021"
license = "MIT"
name = "rspack_ast_viewer"
publish = false
version = "0.1.0"
[[bin]]
name = "rspack-ast-viewer"
path = "src/main.rs"
Expand Down
10 changes: 5 additions & 5 deletions crates/rspack_base64/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
edition = "2021"
license = "MIT"
name = "rspack_base64"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
description = "rspack base64"
edition = "2021"
license = "MIT"
name = "rspack_base64"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"

[dependencies]
base64-simd = { version = "0.8.0", features = ["alloc"] }
Expand Down
10 changes: 5 additions & 5 deletions crates/rspack_futures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
edition = "2021"
license = "MIT"
name = "rspack_futures"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
description = "rspack futures"
edition = "2021"
license = "MIT"
name = "rspack_futures"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"

[dependencies]
async-scoped = { workspace = true, features = ["use-tokio"] }
10 changes: 5 additions & 5 deletions crates/rspack_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

[package]
edition = "2021"
license = "MIT"
name = "rspack_macros"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
description = "rspack macros"
edition = "2021"
license = "MIT"
name = "rspack_macros"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
[lib]
proc-macro = true

Expand Down
10 changes: 5 additions & 5 deletions crates/rspack_napi_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

[package]
edition = "2021"
license = "MIT"
name = "rspack_napi_macros"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
description = "rspack macros plugin"
edition = "2021"
license = "MIT"
name = "rspack_napi_macros"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
[lib]
proc-macro = true

Expand Down
10 changes: 5 additions & 5 deletions crates/rspack_tracing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
edition = "2021"
license = "MIT"
name = "rspack_tracing"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"
description = "rspack tracing"
edition = "2021"
license = "MIT"
name = "rspack_tracing"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
86 changes: 81 additions & 5 deletions justfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,82 @@
# Setup the tools needed to develop
setup-tools:
cargo install cargo-release insta
# publish rust crates
release-crates:
#!/usr/bin/env -S just --justfile

# Set shell configurations
set windows-shell := ["powershell"]
set shell := ["bash", "-cu"]

# Default target: List all tasks with updated information
_default:
just --list -u

# Setup environment for Rust and Node.js
setup:
# Install Rust-related tools
cargo install cargo-binstall
cargo binstall taplo-cli cargo-release cargo-insta cargo-deny -y

# Setup Node.js environment
corepack enable
pnpm install

@echo '✅ Setup complete!'

# Check readiness of the project
ready:
just fmt
just check
just lint
just test
@echo '✅ All passed!'

# Publish Rust crates to crates.io
release-rust:
cargo release publish --no-verify --execute --no-confirm

# Format Rust, TOML files, and JavaScript code
fmt:
cargo fmt --all -- --emit=files
taplo fmt
pnpm format:js

# Lint Rust and JavaScript code
lint:
cargo clippy --workspace --all-targets -- --deny warnings
pnpm lint:js

# Check Rust code for compilation errors
check:
cargo check --workspace

# Run tests for both Rust and Node.js
test:
just test-rust
just test-node

# Run Rust tests
test-rust:
cargo test --no-fail-fast

# Supported mode: unit, ci, webpack, plugin
test-node mode="unit":
pnpm install
pnpm build:cli:debug
pnpm test:{{mode}}

# Support `just build [debug|release] (--force)`
build mode="debug" *args="":
pnpm --filter @rspack/binding build:{{mode}}
pnpm --filter "@rspack/*" build {{args}}

# Support `just watch [all|rust|node] [debug|release]`
watch target="all" mode="debug":
just _watch-{{target}} {{mode}}

_watch-all mode:
pnpm --filter @rspack/binding watch:{{mode}}
pnpm --filter "@rspack/*" watch

_watch-rust mode:
pnpm --filter @rspack/binding watch:{{mode}}

_watch-node:
pnpm --filter "@rspack/*" watch

2 comments on commit e311871

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
nx ❌ failure
rspress ✅ success
rsbuild ✅ success
examples ✅ success

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-08-12 a7844d9) Current Change
10000_development-mode + exec 2.31 s ± 26 ms 2.32 s ± 30 ms +0.50 %
10000_development-mode_hmr + exec 697 ms ± 10 ms 696 ms ± 8.9 ms -0.10 %
10000_production-mode + exec 2.86 s ± 21 ms 2.85 s ± 32 ms -0.38 %
arco-pro_development-mode + exec 1.86 s ± 57 ms 1.88 s ± 68 ms +1.23 %
arco-pro_development-mode_hmr + exec 433 ms ± 1.1 ms 433 ms ± 2.7 ms -0.13 %
arco-pro_production-mode + exec 3.45 s ± 74 ms 3.47 s ± 64 ms +0.63 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.54 s ± 88 ms 3.53 s ± 83 ms -0.47 %
threejs_development-mode_10x + exec 1.7 s ± 12 ms 1.71 s ± 13 ms +0.42 %
threejs_development-mode_10x_hmr + exec 821 ms ± 5.6 ms 819 ms ± 4.8 ms -0.27 %
threejs_production-mode_10x + exec 5.48 s ± 32 ms 5.51 s ± 26 ms +0.56 %

Please sign in to comment.