diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..0d4e3a98 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +pnpm dlx lint-staged \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..e2911ff1 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, + "tabWidth": 2, + "useTabs": false +} diff --git a/lint-staged.config.js b/lint-staged.config.js new file mode 100644 index 00000000..d0e5d67f --- /dev/null +++ b/lint-staged.config.js @@ -0,0 +1,7 @@ +module.exports = { + '*.{js,ts,tsx,json,md,mdx,html,css,scss,yml}': 'prettier --write', + '*.sol': 'prettier --write --plugin=prettier-plugin-solidity', + '*.cairo': 'scarb fmt', + '*.prisma': 'prisma format', + '*.go': 'go fmt', +}; diff --git a/package.json b/package.json index 777da879..125995e2 100644 --- a/package.json +++ b/package.json @@ -9,23 +9,23 @@ "prisma": {}, "scripts": { "build": "turbo run build", - "build:website":"cd apps/website && pnpm run build", - "dev:website":"cd apps/website && pnpm run dev", - "build:mobile":"cd apps/mobile && pnpm run build", - "dev:mobile":"cd apps/mobile && pnpm run start", - "build:nostr_sdk":"cd packages/afk_nostr_sdk && pnpm run build", - "build:indexer-prisma":"cd packages/indexer-prisma && pnpm run build", - "build:prisma-db":"cd packages/prisma-db && pnpm pull && pnpm generate", - "build:backend":"cd apps/data-backend && pnpm run build", - "build:backend:all":"pnpm run build:prisma-db && pnpm run build:indexer-prisma && cd apps/data-backend && pnpm install && pnpm run build:all", - "run:backend":"cd apps/data-backend && pnpm run start", - "build:backend:prisma":"cd apps/data-backend && pnpm run prisma:setup", - "run:backend:prod":"cd apps/data-backend && pnpm run start:prod", + "build:website": "cd apps/website && pnpm run build", + "dev:website": "cd apps/website && pnpm run dev", + "build:mobile": "cd apps/mobile && pnpm run build", + "dev:mobile": "cd apps/mobile && pnpm run start", + "build:nostr_sdk": "cd packages/afk_nostr_sdk && pnpm run build", + "build:indexer-prisma": "cd packages/indexer-prisma && pnpm run build", + "build:prisma-db": "cd packages/prisma-db && pnpm pull && pnpm generate", + "build:backend": "cd apps/data-backend && pnpm run build", + "build:backend:all": "pnpm run build:prisma-db && pnpm run build:indexer-prisma && cd apps/data-backend && pnpm install && pnpm run build:all", + "run:backend": "cd apps/data-backend && pnpm run start", + "build:backend:prisma": "cd apps/data-backend && pnpm run prisma:setup", + "run:backend:prod": "cd apps/data-backend && pnpm run start:prod", "build:nestjs-indexer": "cd apps/nestjs-indexer && pnpm run build", "dev": "turbo run dev", - "web":"turbo run dev --filter=website", - "mobile":"turbo run start --filter=mobile", - "extension":"turbo run dev --filter=extensions", + "web": "turbo run dev --filter=website", + "mobile": "turbo run start --filter=mobile", + "extension": "turbo run dev --filter=extensions", "lint": "turbo run lint", "clean": "turbo run clean && rimraf node_modules", "format": "prettier --write \"**/*.{ts,tsx,md}\"", @@ -37,18 +37,22 @@ "generate": "turbo run generate", "export-extension": "cd /apps/extensions && pnpm run build build && next export && cp -r extension/* out/", "contributors:add": "all-contributors add", - "contributors:generate": "all-contributors generate" + "contributors:generate": "all-contributors generate", + "prepare": "husky" }, "dependencies": { "@babel/core": "^7.20.0", "@babel/plugin-proposal-export-namespace-from": "^7.18.9", - "@prisma/client":"^5.18.0", - "prettier":"^2.8.8", - "prisma":"5.18.0", - "tsup":"^8.0.2", - "turbo":"^1.13.2" + "@prisma/client": "^5.18.0", + "prettier": "^2.8.8", + "prisma": "5.18.0", + "tsup": "^8.0.2", + "turbo": "^1.13.2" }, "devDependencies": { + "husky": "^9.1.7", + "lint-staged": "^15.2.10", + "prettier-plugin-solidity": "^1.4.1", "prisma": "^5.18.0", "tsup": "^8.0.2", "typescript": "~5.3.3" @@ -57,6 +61,5 @@ "node": ">=14.0.0" }, "packageManager": "pnpm@8.15.9", - "pnpm": { - } + "pnpm": {} }