Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliencrn committed Jun 6, 2023
1 parent 7c348bd commit 2c3c06a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
32 changes: 11 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="./screenshot.png" alt="usehooks-ts banner" align="center" />
<img src="./.github/screenshot.png" alt="usehooks-ts banner" align="center" />

<br />

Expand Down Expand Up @@ -89,7 +89,7 @@ If you need to make any other substantial changes, then follow the project setup
Before starting, make sure you have the good system dependencies:

- `[email protected]`
- `npm@^8`
- `pnpm@^8`

**Note**: To easily switch node version, consider Node Version Manager (nvm).

Expand All @@ -98,37 +98,27 @@ Then fork the repository, clone it and install.
```bash
git clone https://github.com/{your_username}/usehooks-ts.git
cd usehooks-ts
npm install
pnpm install
```

### Create or update a new hook

```bash
# This command generates boilerplate for new hooks.
# Skip if updating an existed hook.
npm run plop

# Then develop the hook (aka test:watch)
npm run dev

# Once the hooks is ready
# Launch the documentation website
# Note: to build the website, you have to compile the usehooks-ts lib
# first, which create website content in the `website/generated` folder,
# used by Gatsby to create pages
cd website
npm install
npm run start

# Before commit: exec types-checking, linters and tests
cd ..
npm run test
pnpm gen-hook

# Develop
pnpm build
pnpm types-check
pnpm lint
pnpm test
```

### How is structured a hook ?

```bash
📂 ./src
📂 ./packages/usehooks-ts
├── 📂 useHookName
│ ├── 📄 useHookName.demo.tsx # working demo
│ ├── 📝 useHookName.mdx # the documentation content
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"license": "MIT",
"scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "turbo run dev",
"build": "turbo run build",
"test": "turbo run test",
"clean": "turbo run clean",
Expand All @@ -22,7 +23,10 @@
"test:coverage": "zx ./scripts/coverage.mjs",
"update-readme": "zx ./scripts/updateReadme.mjs",
"generate-docs": "rimraf -rf ./apps/web/generated && zx ./scripts/copyHooks.mjs",
"gen-hook": "turbo gen hook"
"gen-hook": "turbo gen hook && pnpm format",
"changeset": "npx changeset",
"changeset-version": "npx changeset version",
"changeset-publish": "npx changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
Expand Down
19 changes: 15 additions & 4 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@
]
},
"lint": {
"outputs": []
"outputs": [],
"cache": false
},
"types-check": {
"outputs": []
"outputs": [],
"cache": false
},
"test": {
"outputs": []
"outputs": [],
"cache": false
},
"dev": {
"dependsOn": [
"^build"
],
"outputs": [],
"cache": false
},
"clean": {
"outputs": []
"outputs": [],
"cache": false
},
"generate-docs": {
"dependsOn": [
Expand Down

0 comments on commit 2c3c06a

Please sign in to comment.