Skip to content

Commit ed7232a

Browse files
authored
Merge pull request #433 from mosch/modernize-and-fix-issues
Modernize codebase, fix bugs, add tests
2 parents b760120 + 517b0e4 commit ed7232a

43 files changed

Lines changed: 5391 additions & 3382 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ jobs:
88
test:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
12-
- uses: pnpm/action-setup@v2
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 22
16+
17+
- uses: pnpm/action-setup@v4
1318
with:
1419
version: 10
1520
run_install: false
@@ -19,7 +24,7 @@ jobs:
1924
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
2025

2126
- name: Use pnpm store
22-
uses: actions/cache@v3
27+
uses: actions/cache@v4
2328
id: pnpm-cache
2429
with:
2530
path: ${{ steps.pnpm-store.outputs.pnpm_cache_dir }}
@@ -30,13 +35,17 @@ jobs:
3035
- name: Install Dependencies
3136
run: pnpm install --frozen-lockfile --prefer-offline
3237

33-
- name: Install Playwright
34-
run: pnpm --filter react-avatar-editor exec playwright install
38+
- name: Build
39+
run: pnpm build
3540

36-
- uses: actions/setup-node@v3
37-
with:
38-
node-version: 18
39-
cache: 'pnpm'
41+
- name: Lint
42+
run: pnpm lint
43+
44+
- name: Format check
45+
run: pnpm fmt:check
46+
47+
- name: Unit tests (core)
48+
run: pnpm --filter @react-avatar-editor/core test
4049

41-
- name: Run test
42-
run: pnpm --filter react-avatar-editor test
50+
- name: Unit tests (lib)
51+
run: pnpm --filter react-avatar-editor test:unit

.oxfmtrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"semi": false,
6+
"printWidth": 80,
7+
"sortPackageJson": false,
8+
"ignorePatterns": []
9+
}

.oxlintrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"categories": {
4+
"correctness": "error",
5+
"suspicious": "warn"
6+
},
7+
"rules": {},
8+
"ignorePatterns": ["dist", "node_modules"]
9+
}

DESIGN.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ A collection of design contribution guidelines and resources for react-avatar-ed
66
77
## 👋 Welcome
88

9-
We're glad you're looking to help us improve the end user facing parts of this tiny little plugin.
9+
We're glad you're looking to help us improve the end user facing parts of this tiny little plugin.
1010
You might have seen it already in action in thousands of places where you upload and modify your profile image.
1111

1212
You can find a quick demo of it in action: https://react-avatar-editor.netlify.app
1313

1414
## 🚢 How to contribute design
1515

1616
1. Check out open [issues](https://github.com/mosch/react-avatar-editor
17-
/issues) here on GitHub (we label them with `design: 💅required`)
17+
/issues) here on GitHub (we label them with `design: 💅required`)
1818
2. Feel free to open an issue on your own if you find something you would like to contribute to the project and use the `design: 💡idea` label for it.
1919
3. We do not have any design files in place yet so feel free to create new ones and share them publicly
2020
4. Add your contributions to an issue and we promise we will review your contribution carefully and foster discussions
2121

22-
2322
## 🎭 Target audience
2423

2524
Our target audience is 100% React developers who are using this component. But the design choices made might unfluence the end user who is interacting with the Avatar editor drastically.
@@ -28,7 +27,7 @@ Our target audience is 100% React developers who are using this component. But t
2827

2928
As mentioned above – we do not have any design related materials (Logo, Figma mocks, etc) yet. Feel free to add them to this document as things evolve.
3029

31-
You can look at our demo here to get a clue of how it currently looks like:
30+
You can look at our demo here to get a clue of how it currently looks like:
3231
https://react-avatar-editor.netlify.app
3332

3433
## 🎓 License

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Build Status](https://travis-ci.org/mosch/react-avatar-editor.svg?branch=master)](https://travis-ci.org/mosch/react-avatar-editor)
66
[![Design](https://contribute.design/api/shield/mosch/react-avatar-editor)](https://contribute.design/mosch/react-avatar-editor)
77

8-
Avatar / profile picture cropping component (like on Facebook).
8+
Avatar / profile picture cropping component (like on Facebook).
99
Resize, crop and rotate your uploaded image using a simple and clean user interface.
1010

1111
## Features
@@ -15,7 +15,7 @@ Resize, crop and rotate your uploaded image using a simple and clean user interf
1515
- Resize
1616
- Crop
1717
- Rotate
18-
- Rounded or square image result
18+
- Rounded or square image result
1919

2020
## Install
2121

@@ -33,7 +33,6 @@ pnpm add react-avatar-editor
3333

3434
![](https://thumbs.gfycat.com/FlawedBlushingGermanwirehairedpointer-size_restricted.gif)
3535

36-
3736
## Usage
3837

3938
```javascript

netlify.toml

Lines changed: 0 additions & 6 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,15 @@
99
"clean": "pnpm --filter 'react-avatar-editor*' clean",
1010
"demo:build": "pnpm build && pnpm --filter 'react-avatar-editor*' build",
1111
"demo:dev": "pnpm build && pnpm --filter react-avatar-editor-demo dev",
12-
"lint": "eslint . --cache --ext .ts,.tsx"
12+
"lint": "oxlint .",
13+
"fmt": "oxfmt --write .",
14+
"fmt:check": "oxfmt --check ."
1315
},
1416
"devDependencies": {
15-
"@types/react": "^19.0.0",
16-
"@typescript-eslint/eslint-plugin": "6.12.0",
17-
"@typescript-eslint/parser": "6.12.0",
18-
"eslint": "8.54.0",
19-
"eslint-config-prettier": "9.0.0",
20-
"prettier": "3.1.0",
21-
"typescript": "5.3.2"
17+
"@types/react": "^19.2.14",
18+
"oxfmt": "0.41.0",
19+
"oxlint": "^1.56.0",
20+
"typescript": "^5.9.3"
2221
},
23-
"license": "MIT",
24-
"prettier": {
25-
"singleQuote": true,
26-
"trailingComma": "all",
27-
"semi": false
28-
}
22+
"license": "MIT"
2923
}

packages/core/package.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "@react-avatar-editor/core",
3+
"version": "1.0.0",
4+
"description": "Framework-agnostic core logic for avatar editing",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.mjs",
7+
"types": "./dist/index.d.ts",
8+
"sideEffects": false,
9+
"exports": {
10+
".": {
11+
"require": {
12+
"types": "./dist/index.d.ts",
13+
"default": "./dist/index.cjs"
14+
},
15+
"import": {
16+
"types": "./dist/index.d.ts",
17+
"default": "./dist/index.mjs"
18+
}
19+
}
20+
},
21+
"scripts": {
22+
"build": "vite build",
23+
"clean": "rm -rf dist",
24+
"test": "vitest run"
25+
},
26+
"files": [
27+
"dist",
28+
"src"
29+
],
30+
"devDependencies": {
31+
"@vitest/coverage-v8": "^4.1.0",
32+
"jsdom": "^29.0.1",
33+
"typescript": "^5.9.3",
34+
"vite": "^8.0.1",
35+
"vite-plugin-dts": "^4.5.4",
36+
"vitest": "^4.1.0"
37+
},
38+
"repository": {
39+
"type": "git",
40+
"url": "git+https://github.com/mosch/react-avatar-editor.git",
41+
"directory": "packages/core"
42+
},
43+
"license": "MIT",
44+
"keywords": [
45+
"canvas",
46+
"avatar",
47+
"editor",
48+
"image",
49+
"core"
50+
]
51+
}

0 commit comments

Comments
 (0)