add format script

This commit is contained in:
Namekuji 2023-06-02 16:10:01 -04:00
parent 80e5d25698
commit c443a5601c
No known key found for this signature in database
GPG key ID: B541BD6E646CABC7
4 changed files with 7 additions and 3 deletions

View file

@ -27,7 +27,7 @@
"e2e": "start-server-and-test start:test http://localhost:61812 cy:run", "e2e": "start-server-and-test start:test http://localhost:61812 cy:run",
"mocha": "pnpm --filter backend run mocha", "mocha": "pnpm --filter backend run mocha",
"test": "pnpm run mocha", "test": "pnpm run mocha",
"format": "pnpm rome format packages/**/* --write && pnpm --filter client run format", "format": "pnpm rome format packages/**/* --write && pnpm -r run format",
"clean": "pnpm node ./scripts/clean.js", "clean": "pnpm node ./scripts/clean.js",
"clean-all": "pnpm node ./scripts/clean-all.js", "clean-all": "pnpm node ./scripts/clean-all.js",
"cleanall": "pnpm run clean-all" "cleanall": "pnpm run clean-all"

View file

@ -40,6 +40,7 @@
"test": "ava", "test": "ava",
"universal": "napi universal", "universal": "napi universal",
"version": "napi version", "version": "napi version",
"format": "cargo fmt",
"cargo:unit": "cargo test unit_test", "cargo:unit": "cargo test unit_test",
"cargo:integration": "cargo test --no-default-features -F noarray int_test -- --test-threads=1" "cargo:integration": "cargo test --no-default-features -F noarray int_test -- --test-threads=1"
} }

View file

@ -61,10 +61,10 @@ cfg_if! {
#[cfg(test)] #[cfg(test)]
mod unit_test { mod unit_test {
use crate::util::id;
use cfg_if::cfg_if; use cfg_if::cfg_if;
use pretty_assertions::{assert_eq, assert_ne}; use pretty_assertions::{assert_eq, assert_ne};
use std::thread; use std::thread;
use crate::util::id;
cfg_if! { cfg_if! {
if #[cfg(feature = "napi")] { if #[cfg(feature = "napi")] {

View file

@ -1,5 +1,8 @@
import config from "@/config/index.js"; import config from "@/config/index.js";
import { nativeCreateId, nativeInitIdGenerator } from "native-utils/built/index.js"; import {
nativeCreateId,
nativeInitIdGenerator,
} from "native-utils/built/index.js";
const length = Math.min(Math.max(config.cuid?.length ?? 16, 16), 24); const length = Math.min(Math.max(config.cuid?.length ?? 16, 16), 24);
const fingerprint = config.cuid?.fingerprint ?? ""; const fingerprint = config.cuid?.fingerprint ?? "";