From 75090d63091fc833b3a7630d5084b8c5178b9f22 Mon Sep 17 00:00:00 2001 From: Landon Gavin Date: Fri, 3 May 2024 13:07:06 -0400 Subject: [PATCH] chore(docs): add scripts and update readme, fix linting error (#107) --- README.md | 33 +++++++++++++++++++++++++++++++++ package.json | 5 ++++- src/createImports.mts | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37de013..00e1e6f 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,39 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( ``` +## Development + +### Install dependencies + +```bash +pnpm install +``` + +### Run tests +```bash +pnpm test +``` + +### Run linter +```bash +pnpm lint +``` + +### Run linter and fix +```bash +pnpm lint:fix +``` + +### Update snapshots +```bash +pnpm snapshot +``` + +### Build example and validate generated code +```bash +npm run build && pnpm --filter @7nohe/react-app generate:api && pnpm --filter @7nohe/react-app test:generated +``` + ## License MIT diff --git a/package.json b/package.json index e22c704..54cbf9e 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,13 @@ "workspaces": ["examples/*"], "scripts": { "build": "rimraf dist && tsc -p tsconfig.json", + "lint": "biome check .", + "lint:fix": "biome check --apply .", "preview": "npm run build && npm -C examples/react-app run generate:api", "prepublishOnly": "npm run build", "release": "npx git-ensure -a && npx bumpp --commit --tag --push", - "test": "vitest --coverage.enabled true" + "test": "vitest --coverage.enabled true", + "snapshot": "vitest --update" }, "repository": { "type": "git", diff --git a/src/createImports.mts b/src/createImports.mts index 29dd60d..8f9bcff 100644 --- a/src/createImports.mts +++ b/src/createImports.mts @@ -46,7 +46,7 @@ export const createImports = ({ ts.factory.createImportSpecifier( true, undefined, - ts.factory.createIdentifier("QueryClient") + ts.factory.createIdentifier("QueryClient"), ), ts.factory.createImportSpecifier( false,