From d55e4f6f1ff2bcaab5364c1c6e599bc9f4cd55d5 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 10 Feb 2022 19:00:38 +0800 Subject: [PATCH] style: format toml files --- Cargo.toml | 4 +--- bench/Cargo.toml | 12 ++++++++---- crates/backend/Cargo.toml | 2 +- crates/macro/Cargo.toml | 4 ++-- crates/napi/Cargo.toml | 10 +++++++--- examples/napi-compat-mode/Cargo.toml | 13 +++++++++---- examples/napi/Cargo.toml | 14 +++++++++++--- examples/napi/__test__/values.spec.ts.md | 1 + examples/napi/__test__/values.spec.ts.snap | Bin 605 -> 621 bytes memory-testing/Cargo.toml | 13 +++++++++---- package.json | 10 +++++++++- yarn.lock | 15 ++++++++++++++- 12 files changed, 72 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c2766d02..628c3fd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,9 +11,7 @@ members = [ "./memory-testing", ] -exclude = [ - "./testing" -] +exclude = ["./testing"] [profile.release] lto = true diff --git a/bench/Cargo.toml b/bench/Cargo.toml index dd41b348..e9f825a1 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -9,13 +9,17 @@ version = "0.1.0" crate-type = ["cdylib"] [dependencies] -napi = {path = "../crates/napi", features = ["tokio_rt", "serde-json", "compat-mode"]} -napi-derive = {path = "../crates/macro", features = ["compat-mode"]} +napi = { path = "../crates/napi", features = [ + "tokio_rt", + "serde-json", + "compat-mode", +] } +napi-derive = { path = "../crates/macro", features = ["compat-mode"] } serde = "1" serde_json = "1" [target.'cfg(all(target_arch = "x86_64", not(target_env = "musl")))'.dependencies] -mimalloc = {version = "0.1"} +mimalloc = { version = "0.1" } [build-dependencies] -napi-build = {path = "../crates/build"} +napi-build = { path = "../crates/build" } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index f15ea9cd..e0c81010 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -20,7 +20,7 @@ type-def = ["regex", "once_cell"] convert_case = "0.5" proc-macro2 = "1" quote = "1" -syn = {version = "1", features = ["fold", "full", "extra-traits"]} +syn = { version = "1", features = ["fold", "full", "extra-traits"] } [dependencies.regex] optional = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 1a9dc207..dd57c242 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -22,10 +22,10 @@ type-def = ["napi-derive-backend/type-def"] [dependencies] convert_case = "0.5" -napi-derive-backend = {version = "1.0.25", path = "../backend"} +napi-derive-backend = { version = "1.0.25", path = "../backend" } proc-macro2 = "1.0" quote = "1.0" -syn = {version = "1.0", features = ["fold", "full", "extra-traits"]} +syn = { version = "1.0", features = ["fold", "full", "extra-traits"] } [lib] proc-macro = true diff --git a/crates/napi/Cargo.toml b/crates/napi/Cargo.toml index 1c9f344b..1d89f9f2 100644 --- a/crates/napi/Cargo.toml +++ b/crates/napi/Cargo.toml @@ -18,7 +18,7 @@ independent = true [features] async = ["tokio_rt"] compat-mode = [] -default = ["napi3", "compat-mode"] # for most Node.js users +default = ["napi3", "compat-mode"] # for most Node.js users experimental = ["napi-sys/experimental"] full = ["latin1", "napi8", "async", "serde-json", "experimental"] latin1 = ["encoding_rs"] @@ -48,7 +48,7 @@ tokio_time = ["tokio/time"] [dependencies] ctor = "0.1" lazy_static = "1" -napi-sys = {version = "2.1.0", path = "../sys"} +napi-sys = { version = "2.1.0", path = "../sys" } [dependencies.encoding_rs] optional = true @@ -68,4 +68,8 @@ optional = true version = "1" [target.'cfg(windows)'.dependencies] -windows = {version = "0.30", features = ["Win32_System_WindowsProgramming", "Win32_System_LibraryLoader", "Win32_Foundation"]} +windows = { version = "0.32", features = [ + "Win32_System_WindowsProgramming", + "Win32_System_LibraryLoader", + "Win32_Foundation", +] } diff --git a/examples/napi-compat-mode/Cargo.toml b/examples/napi-compat-mode/Cargo.toml index 23d790b6..8e483576 100644 --- a/examples/napi-compat-mode/Cargo.toml +++ b/examples/napi-compat-mode/Cargo.toml @@ -14,13 +14,18 @@ napi3 = ["napi/napi3"] [dependencies] futures = "0.3" -napi = {path = "../../crates/napi", features = ["tokio_rt", "serde-json", "latin1", "compat-mode"]} -napi-derive = {path = "../../crates/macro", features = ["compat-mode"]} +napi = { path = "../../crates/napi", features = [ + "tokio_rt", + "serde-json", + "latin1", + "compat-mode", +] } +napi-derive = { path = "../../crates/macro", features = ["compat-mode"] } serde = "1" serde_bytes = "0.11" serde_derive = "1" serde_json = "1" -tokio = {version = "1", features = ["default", "fs"]} +tokio = { version = "1", features = ["default", "fs"] } [build-dependencies] -napi-build = {path = "../../crates/build"} +napi-build = { path = "../../crates/build" } diff --git a/examples/napi/Cargo.toml b/examples/napi/Cargo.toml index 9ccaf160..222537d1 100644 --- a/examples/napi/Cargo.toml +++ b/examples/napi/Cargo.toml @@ -10,11 +10,19 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3" -napi = {path = "../../crates/napi", default-features = false, features = ["tokio_fs", "napi8", "tokio_rt", "serde-json", "async", "experimental", "latin1"]} -napi-derive = {path = "../../crates/macro", features = ["type-def"]} +napi = { path = "../../crates/napi", default-features = false, features = [ + "tokio_fs", + "napi8", + "tokio_rt", + "serde-json", + "async", + "experimental", + "latin1", +] } +napi-derive = { path = "../../crates/macro", features = ["type-def"] } serde = "1" serde_derive = "1" serde_json = "1" [build-dependencies] -napi-build = {path = "../../crates/build"} +napi-build = { path = "../../crates/build" } diff --git a/examples/napi/__test__/values.spec.ts.md b/examples/napi/__test__/values.spec.ts.md index 62685277..7c313eb4 100644 --- a/examples/napi/__test__/values.spec.ts.md +++ b/examples/napi/__test__/values.spec.ts.md @@ -14,6 +14,7 @@ Generated by [AVA](https://avajs.dev). '@rollup/plugin-json', '@rollup/plugin-node-resolve', '@rollup/plugin-replace', + '@taplo/cli', '@types/debug', '@types/lodash-es', '@types/node', diff --git a/examples/napi/__test__/values.spec.ts.snap b/examples/napi/__test__/values.spec.ts.snap index 94d498ef9cbe630f29b0c362bebac74df300496d..beb82ba02a2315ab65481287714ef31c7a8419dd 100644 GIT binary patch literal 621 zcmV-z0+RhfRzVlzKrD=myg+#Y-k>Wdg3ffvAQ;63mi zxBxDJy$T`E00+DQJ^){VU%(%LRtXsb$G`-53w#2802ja|(5t~afTzH7Ud>7@0Y?(SjE$rt7EP`4%{j;N|i*ffnH}E zmR9&tCX#%DZWG;|!c`{Ye#%7bs)dQ|BC*;inp@@KUg}M+ZFG;;ZtA2BP+CbHM(YP# zH-sy;amDaID=c?#88OUZL? z`ROYZ@5X&yyFd3(-t{JTsbF(%na}OjiQJC|5QGn!JjO{%_dZjC?# zA1;cu=O2p*00000000ARlfQ0LF%-t_{7)K4(}b2%C@m6VvN9ntmWiFMqwl?L;?%J% z+czQ%NL`RvnOGQ##0CpvpMW>W%p))`uyN9xq`sqgB_uZ4@8@E16)67mW#ztm0|R)iKvS2@5OyC=*FOMz?|P_S#h@ z<9@xs~Mf$|-cE9nc=?xNOCjWSMz5Kq*(!JNAkL%MPSg+LwfV^#6d%UEZtc$_ly|(z rT`Jg&Tjq0nb0UZFLV{;ESMzbK8DLZi%10=7HVgI-T6ePY)C2$k#5W)* diff --git a/memory-testing/Cargo.toml b/memory-testing/Cargo.toml index 51091dbf..0ad743b1 100644 --- a/memory-testing/Cargo.toml +++ b/memory-testing/Cargo.toml @@ -10,13 +10,18 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3" -napi = {path = "../crates/napi", features = ["tokio_rt", "serde-json", "latin1", "compat-mode"]} -napi-derive = {path = "../crates/macro", features = ["compat-mode"]} +napi = { path = "../crates/napi", features = [ + "tokio_rt", + "serde-json", + "latin1", + "compat-mode", +] } +napi-derive = { path = "../crates/macro", features = ["compat-mode"] } serde = "1" serde_bytes = "0.11" serde_derive = "1" serde_json = "1" -tokio = {version = "1", features = ["default", "fs"]} +tokio = { version = "1", features = ["default", "fs"] } [build-dependencies] -napi-build = {path = "../crates/build"} +napi-build = { path = "../crates/build" } diff --git a/package.json b/package.json index bdf8e50d..33eef455 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,10 @@ "build:test:android:armv7": "yarn workspace compat-mode-examples build --target armv7-linux-androideabi && yarn workspace examples build --target armv7-linux-androideabi", "build:test:armv7": "yarn workspace compat-mode-examples build-armv7 && yarn workspace examples build-armv7", "bundle": "rollup -c rollup.config.js", - "format": "run-p format:prettier format:rs", + "format": "run-p format:prettier format:rs format:toml", "format:prettier": "prettier . -w", "format:rs": "cargo fmt", + "format:toml": "taplo format", "lint": "eslint -c .eslintrc.yml .", "prepublishOnly": "npm run build && pinst --disable", "test": "ava", @@ -54,6 +55,12 @@ ], "*.@(js||ts|json|md|yml|yaml)": [ "prettier --write" + ], + "*.toml": [ + "taplo format" + ], + "*.rs": [ + "cargo fmt" ] }, "husky": { @@ -67,6 +74,7 @@ "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.1.3", "@rollup/plugin-replace": "^3.0.1", + "@taplo/cli": "^0.3.2", "@types/debug": "^4.1.7", "@types/lodash-es": "^4.17.5", "@types/node": "^17.0.10", diff --git a/yarn.lock b/yarn.lock index d032a0fd..d190b9af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1348,6 +1348,18 @@ __metadata: languageName: node linkType: hard +"@taplo/cli@npm:^0.3.2": + version: 0.3.2 + resolution: "@taplo/cli@npm:0.3.2" + dependencies: + fast-glob: ^3.2.4 + node-fetch: ^2.6.1 + bin: + taplo: dist/cli.js + checksum: aa289d561b767ee3730ee431dec8a55bf2b2da5bc8e837156ca8cf39a165ae0e2edf16f669e5a40da2b5c8b67ceea5bb80cd2e91803659b09af707505741992c + languageName: node + linkType: hard + "@tootallnate/once@npm:1": version: 1.1.2 resolution: "@tootallnate/once@npm:1.1.2" @@ -3956,7 +3968,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.7, fast-glob@npm:^3.2.9": +"fast-glob@npm:^3.2.4, fast-glob@npm:^3.2.7, fast-glob@npm:^3.2.9": version: 3.2.11 resolution: "fast-glob@npm:3.2.11" dependencies: @@ -6156,6 +6168,7 @@ __metadata: "@rollup/plugin-json": ^4.1.0 "@rollup/plugin-node-resolve": ^13.1.3 "@rollup/plugin-replace": ^3.0.1 + "@taplo/cli": ^0.3.2 "@types/debug": ^4.1.7 "@types/lodash-es": ^4.17.5 "@types/node": ^17.0.10