Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4590472

Browse files
author
ryan.chu
committedMar 1, 2025·
docs: add CONTRIBUTING.md and update README with contribution guidelines
1 parent 4ebb6b7 commit 4590472

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed
 

‎CONTRIBUTING.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Contributing to Watching-You
2+
We welcome contributions to improve this DOM animation library that enables element tracking across multiple frameworks. This document provides essential guidelines for setting up your development environment, implementing new features.
3+
4+
## Development Environment Setup
5+
### Prerequisites
6+
- Node.js v20.18.3: We recommend using a version manager like [asdf](https://github.com/asdf-vm/asdf) for easy version switching
7+
- Yarn v4.6.0:
8+
- [how to install yarn/berry](https://yarnpkg.com/getting-started/install)
9+
- [(optional) corepack](https://yarnpkg.com/corepack)
10+
11+
### Initial Setup
12+
1. Fork repository
13+
2. Clone repository: `git clone https://github.com/[your-username]/watching-you.git` // e.g. `git clone https://github.com/[your-username]/watching-you.git`
14+
3. Install dependencies: `yarn install` from root directory
15+
16+
## Building and Running
17+
### Core Development
18+
```bash
19+
cd packages/core
20+
yarn start # Starts core package in dev mode
21+
```
22+
23+
### Framework
24+
For framework-specific development (React, Vue, etc.):
25+
26+
```bash
27+
cd packages/[framework-name]
28+
yarn start # Starts framework implementation in dev mode
29+
```
30+
31+
## Tips
32+
33+
### Implementing New Targets
34+
Targets define coordinate calculation logic for different element types. To create a new target type:
35+
36+
1. Create new file in `packages/core/src/targetPlugin` folder
37+
2. Implement class extending BaseTarget interface ([packages/core/src/type/Target.ts](https://github.com/jj811208/watching-you/blob/main/packages/core/src/type/Target.ts)):
38+
3. Register target in plugin index:
39+
40+
```diff
41+
// packages/core/src/targetPlugin/index.ts
42+
+ import NewTarget from './NewTarget';
43+
44+
const targetPlugins = {
45+
// Existing targets
46+
mouse: MouseTarget,
47+
// Add new entry
48+
+ newTarget: NewTarget
49+
};
50+
```
51+
52+
### Support a New Framework
53+
1. Create new package in `packages` folder
54+
2. implementing (ref: [package/react](https://github.com/jj811208/watching-you/tree/main/packages/react))
55+
56+
### Testing
57+
Our testing strategy focuses on real-world usage scenarios (after build):
58+
59+
1. Build all dependencies: Always run `yarn build` in both core and all relevant framework packages before testing
60+
```bash
61+
cd packages/core
62+
yarn build
63+
cd ../react
64+
yarn build
65+
cd ../vue
66+
yarn build
67+
```
68+
69+
2. Start test environment:
70+
```bash
71+
cd packages/tests
72+
yarn start
73+
```
74+
75+
### PULL REQUEST
76+
77+
Feel free to open PRs, but please note that more comprehensive descriptions will help reviewers better understand your contributions and increase the likelihood of merging.
78+
79+
Here are some tips to improve merge probability:
80+
81+
1. **PR Description**: Provide complete and clear documentation of your contribution in the pull request description
82+
2. **Commit Hygiene**: Maintain clean, atomic commits
83+
3. **Test Coverage**: When contributing new features or bug fixes, please add corresponding test cases in `packages/tests` to validate functionality
84+

‎README.md

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ https://github.com/vitejs/vite/tree/main/packages/plugin-legacy
6868
- Some inline elements ignore the `transform` attribute (let's say `span`), so you have to give them the `display` attribute to work properly. (see: https://stackoverflow.com/questions/24961795/how-can-i-use-css3-transform-on-a-span)
6969
- You may need something like `transition: transform .1s` depending on your needs
7070

71+
## Contributing
72+
[see](https://github.com/jj811208/watching-you/blob/main/CONTRIBUTING.md)
73+
7174
## License
7275

7376
[ISC](https://github.com/jj811208/watching-you/blob/main/LICENSE.md)

0 commit comments

Comments
 (0)
Please sign in to comment.