Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .codex/hooks/yarn-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# afterFileEdit hook: Run yarn install when package.json is changed
# afterFileEdit hook: Run Yarn install when package.json is changed
# Receives JSON via stdin: {"file_path": "...", "edits": [...]}

# Read stdin (required for hooks)
Expand All @@ -13,11 +13,11 @@ if [ -z "$file_path" ]; then
exit 0
fi

# Only run yarn install if package.json was changed
# Only run Yarn install if package.json was changed
if [ "$file_path" = "package.json" ]; then
# Change to project directory
cd "$(dirname "$0")/../.." || exit 0

echo "package.json changed - running yarn install to update yarn.lock..."
yarn install
fi
Expand Down
6 changes: 3 additions & 3 deletions .cursor/hooks/yarn-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# afterFileEdit hook: Run yarn install when package.json is changed
# afterFileEdit hook: Run Yarn install when package.json is changed
# Receives JSON via stdin: {"file_path": "...", "edits": [...]}

# Read stdin (required for hooks)
Expand All @@ -13,11 +13,11 @@ if [ -z "$file_path" ]; then
exit 0
fi

# Only run yarn install if package.json was changed
# Only run Yarn install if package.json was changed
if [ "$file_path" = "package.json" ]; then
# Change to project directory
cd "$(dirname "$0")/../.." || exit 0

echo "package.json changed - running yarn install to update yarn.lock..."
yarn install
fi
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- 'scripts/**'
- 'config/**'
- '.github/**'
- '.yarnrc.yml'
- 'package.json'
- 'yarn.lock'
push:
Expand All @@ -23,6 +24,7 @@ on:
- 'scripts/**'
- 'config/**'
- '.github/**'
- '.yarnrc.yml'
- 'package.json'
- 'yarn.lock'

Expand All @@ -39,8 +41,8 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- run: HUSKY=0 yarn install --frozen-lockfile --network-concurrency 1
- run: corepack enable
- run: yarn install --immutable
- run: yarn lint
- run: yarn type-check
- name: Run unit tests with coverage
Expand Down Expand Up @@ -90,8 +92,8 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- run: HUSKY=0 yarn install --frozen-lockfile --network-concurrency 1
- run: corepack enable
- run: yarn install --immutable
- uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ coverage/
**/coverage-summary.json

node_modules/
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
packages/*/dist/
packages/example/.next/
.env.local
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.12.0
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
6 changes: 4 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ This repo is a temporary fork of [plebbit/plebbit-react-hooks](https://github.co
- Vitest for unit tests
- Playwright for e2e tests
- Prettier for formatting
- yarn
- Node 22 LTS via `nvm`
- Corepack-managed Yarn 4

## Project Structure

Expand All @@ -69,7 +70,7 @@ src/

### Package and Dependency Rules

- Use `yarn`, never `npm`.
- Use Node 22 via `.nvmrc` and Corepack-managed Yarn 4, never npm/pnpm/bun or a global Yarn v1 install.
- Pin exact dependency versions (`[email protected]`), never `^` or `~`.
- Keep lockfile synchronized when dependency manifests change.

Expand Down Expand Up @@ -121,6 +122,7 @@ src/
### Verification Rules

- Never mark work complete without verification.
- Run `nvm install && nvm use`, then `corepack enable` once per machine before using the commands below.
- After code changes, run: `yarn build`.
- After test changes, run: `yarn test`.
- Do not commit local `dist/` rebuild output. `dist/` is CI-managed in this repo; if verification dirties tracked files there, run `git restore --worktree -- dist` before committing.
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ yarn add https://github.com/bitsocialnet/bitsocial-react-hooks.git#<commit-hash>

Use a pinned commit hash (or tag) so installs are reproducible.

## Development Setup

```bash
nvm install
nvm use
corepack enable
yarn install
```

Run `corepack enable` once per machine so plain `yarn` resolves to the pinned Yarn 4 release.

---

## Table of Contents
Expand Down
4 changes: 2 additions & 2 deletions docs/agent-playbooks/hooks-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ If your AI coding assistant supports lifecycle hooks, configure these for this r
| Hook | Command | Purpose |
| --------------- | ------------------------------- | ---------------------------------------------- |
| `afterFileEdit` | `.cursor/hooks/format.sh` | Auto-format files after AI edits (prettier) |
| `afterFileEdit` | `.cursor/hooks/yarn-install.sh` | Run `yarn install` when `package.json` changes |
| `afterFileEdit` | `.cursor/hooks/yarn-install.sh` | Run Yarn install when `package.json` changes |
| `stop` | `.cursor/hooks/verify.sh` | Build and test at end |

## Why
Expand Down Expand Up @@ -50,7 +50,7 @@ exit 0

```bash
#!/bin/bash
# Run yarn install when package.json is changed
# Run Yarn install when package.json is changed
# Hook receives JSON via stdin with file_path

input=$(cat)
Expand Down
2 changes: 2 additions & 0 deletions docs/mock-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
yarn add https://github.com/bitsocialnet/bitsocial-react-hooks
```

If you are developing in this repo, run `corepack enable` once first so `yarn` uses the pinned Yarn 4 release.

#### Add env variable for mocking

- Create a .env file in your react project with the content:
Expand Down
4 changes: 3 additions & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#### Install

- `yarn`
- `nvm install && nvm use`
- `corepack enable` once per machine
- `yarn install`

#### Unit tests

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"access": "public"
},
"version": "0.1.0",
"packageManager": "[email protected]",
"files": [
"dist"
],
Expand Down Expand Up @@ -66,7 +67,7 @@
"minimatch": "3.1.3",
"elliptic": "6.6.1",
"bn.js": "5.2.3",
"**/elliptic/bn.js": "4.12.3",
"elliptic/bn.js": "4.12.3",
"jose": "4.15.5",
"lodash": "4.17.23",
"tmp": "0.2.4",
Expand Down
Loading
Loading