mirror of
https://github.com/loro-dev/loro.git
synced 2024-11-24 12:20:06 +00:00
chore: replace justfile with deno task
This commit is contained in:
parent
8f7a5a08e0
commit
7a6e50931d
11 changed files with 101 additions and 76 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,10 +1,13 @@
|
|||
{
|
||||
"cSpell.words": [
|
||||
"arbtest",
|
||||
"clippy",
|
||||
"flate",
|
||||
"Leeeon",
|
||||
"LOGSTORE",
|
||||
"nextest",
|
||||
"Peritext",
|
||||
"RUSTFLAGS",
|
||||
"smstring",
|
||||
"thiserror",
|
||||
"txns",
|
||||
|
|
11
crates/loro-core/deno.json
Normal file
11
crates/loro-core/deno.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"tasks": {
|
||||
"test": "cargo nextest run",
|
||||
"deny": "cargo deny check",
|
||||
"fuzz": "cargo fuzz run",
|
||||
"quick-fuzz": "deno run -A ./scripts/fuzz.ts text recursive encoding",
|
||||
"mem": "RUSTFLAGS='--cfg=mem' cargo run --example mem -r --features=test_utils",
|
||||
"flame": "cargo flamegraph --example text_sync --features=test_utils --root",
|
||||
"bench": "cargo bench --features test_utils"
|
||||
}
|
||||
}
|
|
@ -2,4 +2,4 @@
|
|||
use libfuzzer_sys::fuzz_target;
|
||||
use loro_core::fuzz::{test_multi_sites, Action};
|
||||
|
||||
fuzz_target!(|actions: Vec<Action>| { test_multi_sites(2, actions) });
|
||||
fuzz_target!(|actions: Vec<Action>| { test_multi_sites(2, &mut actions.clone()) });
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
build:
|
||||
cargo build
|
||||
|
||||
test:
|
||||
cargo nextest run
|
||||
|
||||
check-unsafe:
|
||||
env RUSTFLAGS="-Funsafe-code --cap-lints=warn" cargo check
|
||||
|
||||
deny:
|
||||
cargo deny check
|
||||
|
||||
crev:
|
||||
cargo crev crate check
|
||||
|
||||
fuzz-long TARGET:
|
||||
cargo fuzz run {{TARGET}} -- -max_total_time=300 -max_len=4000 -jobs=2
|
||||
|
||||
quick-fuzz:
|
||||
cargo fuzz run yata -- -max_total_time=10 -max_len=1000 &
|
||||
cargo fuzz run text -- -max_total_time=10 -max_len=1000 &
|
||||
cargo fuzz run recursive -- -max_total_time=10 -max_len=1000
|
||||
|
||||
flame:
|
||||
cargo flamegraph --example text_sync --features=test_utils --root
|
||||
|
||||
bench *FLAGS:
|
||||
cargo bench --features test_utils {{FLAGS}}
|
||||
|
||||
mem:
|
||||
RUSTFLAGS="--cfg=mem" cargo run --example mem -r --features=test_utils
|
28
crates/loro-core/scripts/fuzz.ts
Normal file
28
crates/loro-core/scripts/fuzz.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import __ from "https://deno.land/x/dirname@1.1.2/mod.ts";
|
||||
const { __dirname } = __(import.meta);
|
||||
import { resolve } from "https://deno.land/std@0.105.0/path/mod.ts";
|
||||
|
||||
const validTargets = Array.from(
|
||||
Deno.readDirSync(resolve(__dirname, "../fuzz/fuzz_targets"))
|
||||
).map((x) => x.name.replace(/.rs$/, ""));
|
||||
|
||||
const targets =
|
||||
Deno.args.length === 0
|
||||
? validTargets
|
||||
: Deno.args.filter((x) => validTargets.includes(x));
|
||||
|
||||
const promises = [];
|
||||
for (const target of targets) {
|
||||
const cmd = ["cargo", "fuzz", "run", target, "--", "-max_total_time=1"];
|
||||
console.log("🔨" + cmd.join(" "));
|
||||
promises.push(
|
||||
Deno.run({
|
||||
cmd,
|
||||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
cwd: resolve(__dirname, ".."),
|
||||
}).status()
|
||||
);
|
||||
}
|
||||
|
||||
await Promise.allSettled(promises);
|
11
crates/loro-wasm/deno.json
Normal file
11
crates/loro-wasm/deno.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"tasks": {
|
||||
"build": "wasm-pack build --target web .",
|
||||
"test": "deno test --allow-read"
|
||||
},
|
||||
"test": {
|
||||
"files": {
|
||||
"include": ["deno_test/"]
|
||||
}
|
||||
}
|
||||
}
|
28
crates/loro-wasm/deno.lock
Normal file
28
crates/loro-wasm/deno.lock
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"version": "2",
|
||||
"remote": {
|
||||
"https://deno.land/std@0.105.0/_util/assert.ts": "2f868145a042a11d5ad0a3c748dcf580add8a0dbc0e876eaa0026303a5488f58",
|
||||
"https://deno.land/std@0.105.0/_util/os.ts": "dfb186cc4e968c770ab6cc3288bd65f4871be03b93beecae57d657232ecffcac",
|
||||
"https://deno.land/std@0.105.0/path/_constants.ts": "1247fee4a79b70c89f23499691ef169b41b6ccf01887a0abd131009c5581b853",
|
||||
"https://deno.land/std@0.105.0/path/_interface.ts": "1fa73b02aaa24867e481a48492b44f2598cd9dfa513c7b34001437007d3642e4",
|
||||
"https://deno.land/std@0.105.0/path/_util.ts": "2e06a3b9e79beaf62687196bd4b60a4c391d862cfa007a20fc3a39f778ba073b",
|
||||
"https://deno.land/std@0.105.0/path/common.ts": "eaf03d08b569e8a87e674e4e265e099f237472b6fd135b3cbeae5827035ea14a",
|
||||
"https://deno.land/std@0.105.0/path/glob.ts": "3b84af55c53febacf6afe214c095624b22a56b6f57d7312157479cc783a0de65",
|
||||
"https://deno.land/std@0.105.0/path/mod.ts": "4465dc494f271b02569edbb4a18d727063b5dbd6ed84283ff906260970a15d12",
|
||||
"https://deno.land/std@0.105.0/path/posix.ts": "b81974c768d298f8dcd2c720229639b3803ca4a241fa9a355c762fa2bc5ef0c1",
|
||||
"https://deno.land/std@0.105.0/path/separator.ts": "8fdcf289b1b76fd726a508f57d3370ca029ae6976fcde5044007f062e643ff1c",
|
||||
"https://deno.land/std@0.105.0/path/win32.ts": "f4a3d4a3f2c9fe894da046d5eac48b5e789a0ebec5152b2c0985efe96a9f7ae1",
|
||||
"https://deno.land/x/dirname@1.1.2/mod.ts": "4029ca6b49da58d262d65f826ba9b3a89cc0b92a94c7220d5feb7bd34e498a54",
|
||||
"https://deno.land/x/dirname@1.1.2/types.ts": "c1ed1667545bc4b1d69bdb2fc26a5fa8edae3a56e3081209c16a408a322a2319",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/_util/assert.ts": "e1f76e77c5ccb5a8e0dbbbe6cce3a56d2556c8cb5a9a8802fc9565af72462149",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/_constants.ts": "aba480c4a2c098b6374fdd5951fea13ecc8aaaf8b8aa4dae1871baa50243d676",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/_interface.ts": "67b276380d297a7cedc3c17f7a0bf122edcfc96a3e1f69de06f379d85ba0e2c0",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/_util.ts": "7820a788b35c26dfc27ff329df12507fc0553ae92727009597046f6cf856b4fa",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/common.ts": "e4ec66a7416d56f60331b66e27a8a4f08c7b1cf48e350271cb69754a01cf5c04",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/glob.ts": "54fea22f0f47dee07399d22e18a34a84eaf4b8a3771bbed96db43bbec71ef237",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/mod.ts": "6de8885c2534757097818e302becd1cefcbc4c28ac022cc279e612ee04e8cfd1",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/posix.ts": "7c2539b5d9e22b47f02ccc5b6ef11e3975a5c60f49d2241271eaa5936e6082a0",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/separator.ts": "9dd15d46ff84a16e13554f56af7fee1f85f8d0f379efbbe60ac066a60561f036",
|
||||
"https://lra6z45nakk5lnu3yjchp7tftsdnwwikwr65ocha5eojfnlgu4sa.arweave.net/XEHs860CldW2m8JEd_5lnIbbWQq0fdcI4OkckrVmpyQ/path/win32.ts": "47114c941681ecbabab4ec355cb41d525fb5a14175cc47a5c76fdc5eaee2685a"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,11 @@
|
|||
import init, { Loro } from "../pkg/loro_wasm.js";
|
||||
const wasm = await Deno.readFile("../pkg/loro_wasm_bg.wasm");
|
||||
import { resolve } from "https://deno.land/std@0.105.0/path/mod.ts";
|
||||
import __ from "https://deno.land/x/dirname@1.1.2/mod.ts";
|
||||
const { __dirname } = __(import.meta);
|
||||
|
||||
const wasm = await Deno.readFile(
|
||||
resolve(__dirname, "../pkg/loro_wasm_bg.wasm")
|
||||
);
|
||||
|
||||
await init(wasm);
|
||||
const loro = new Loro();
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
build:
|
||||
wasm-pack build --target web .
|
||||
|
||||
test:
|
||||
cd deno_test && deno run -A test.ts
|
12
deno.json
Normal file
12
deno.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"tasks": {
|
||||
"build": "cargo build",
|
||||
"test": "RUST_BACKTRACE=full cargo nextest run --features=test_utils",
|
||||
"test-all": "deno task test & deno task quick-fuzz",
|
||||
"test-prop": "RUSTFLAGS='--cfg=proptest' cargo nextest run --features=test_utils",
|
||||
"check": "cargo clippy --all-features",
|
||||
"quick-fuzz": "cd crates/loro-core && just quick-fuzz",
|
||||
"fix": "cargo clippy --fix --features=test_utils",
|
||||
"vet": "cargo vet"
|
||||
}
|
||||
}
|
38
justfile
38
justfile
|
@ -1,38 +0,0 @@
|
|||
build:
|
||||
cargo build
|
||||
|
||||
test *FLAGS:
|
||||
RUST_BACKTRACE=full cargo nextest run --features=test_utils {{FLAGS}}
|
||||
|
||||
test-all:
|
||||
cargo nextest run --features=test_utils &
|
||||
just _quickfuzz
|
||||
|
||||
test-prop:
|
||||
RUSTFLAGS="--cfg=proptest" cargo nextest run --features=test_utils
|
||||
|
||||
_quickfuzz:
|
||||
cd crates/loro-core && just quick-fuzz
|
||||
|
||||
check:
|
||||
cargo clippy
|
||||
|
||||
check-unsafe:
|
||||
env RUSTFLAGS="-Funsafe-code --cap-lints=warn" cargo check
|
||||
|
||||
fix *FLAGS:
|
||||
cargo clippy --fix --features=test_utils {{FLAGS}}
|
||||
|
||||
deny:
|
||||
cargo deny check
|
||||
|
||||
vet:
|
||||
cargo vet
|
||||
|
||||
bench-rle:
|
||||
cd crates/rle
|
||||
cargo build --release --examples
|
||||
cd ../..
|
||||
hyperfine --warmup=3 "./target/release/examples/string_tree_bench"
|
||||
|
||||
|
Loading…
Reference in a new issue