Skip to content

Commit ae55bdf

Browse files
committed
build: prepare v2 stable version
1 parent 2bee699 commit ae55bdf

33 files changed

+357
-143
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
This form is only for submitting bug reports. If you have a usage question
1010
or are unsure if this is really a bug, make sure to:
1111
12-
- Read the [docs](https://fengyuanchen.github.io/cropperjs/v2/)
12+
- Read the [docs](https://fengyuanchen.github.io/cropperjs)
1313
- Ask on [GitHub Discussions](https://github.com/fengyuanchen/cropperjs/discussions)
1414
- Look for / ask questions on [Stack Overflow](https://stackoverflow.com/questions/ask?tags=cropperjs)
1515
@@ -27,7 +27,7 @@ body:
2727
attributes:
2828
label: Link to minimal reproduction
2929
description: |
30-
The easiest way to provide a reproduction is by showing the bug in the [Playground](https://fengyuanchen.github.io/cropperjs/v2/playground.html).
30+
The easiest way to provide a reproduction is by showing the bug in the [Playground](https://fengyuanchen.github.io/cropperjs/playground.html).
3131
If it cannot be reproduced in the playground and requires a proper build setup, try [StackBlitz](https://stackblitz.com/?starters=frontend).
3232
If neither of these are suitable, you can always provide a GitHub repository.
3333

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ name: CI
33
on:
44
push:
55
branches:
6-
- v2
6+
- main
77
pull_request:
88
branches:
9-
- v2
9+
- main
1010

1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-node@v3
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
1818
with:
19-
node-version: 18
19+
node-version: 22
2020
- run: npm install
2121
- run: npm run lint
2222
- run: npm run build

.github/workflows/deploy.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,17 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-node@v4
1717
with:
18-
node-version: 18
18+
node-version: 22
1919
- run: npm install
2020
- run: npm run build
2121
- run: cp -r docs/.vitepress/dist .temp
2222
- uses: actions/checkout@v4
2323
with:
2424
ref: gh-pages
2525
clean: false
26-
- run: rm -rf v2
27-
- run: mkdir -p v2
28-
- run: cp -rf .temp/* v2
29-
- run: rm -r .temp
26+
- run: cp -rf ./temp .
3027
- run: git config user.name "${{ github.actor }}"
3128
- run: git config user.email "${{ github.actor }}@users.noreply.github.com"
32-
- run: git add v2
29+
- run: git add .
3330
- run: git commit --message "${{ github.ref_name }}"
3431
- run: git push

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Cropper.js
22

3-
[![Coverage Status](https://img.shields.io/codecov/c/github/fengyuanchen/cropperjs/v2.svg)](https://codecov.io/gh/fengyuanchen/cropperjs) [![Downloads](https://img.shields.io/npm/dm/cropperjs.svg)](https://www.npmjs.com/package/cropperjs) [![Version](https://img.shields.io/npm/v/cropperjs/next.svg)](https://www.npmjs.com/package/cropperjs)
3+
[![Coverage Status](https://img.shields.io/codecov/c/github/fengyuanchen/cropperjs.svg)](https://codecov.io/gh/fengyuanchen/cropperjs) [![Downloads](https://img.shields.io/npm/dm/cropperjs.svg)](https://www.npmjs.com/package/cropperjs) [![Version](https://img.shields.io/npm/v/cropperjs.svg)](https://www.npmjs.com/package/cropperjs)
44

5-
> JavaScript image cropper. This is the branch for v2.x, for v1.x, check out the [`main`](https://github.com/fengyuanchen/cropperjs/tree/main) branch.
5+
> JavaScript image cropper. This is the branch for v2.x, for v1.x, check out the [`v1`](https://github.com/fengyuanchen/cropperjs/tree/v1) branch.
66
7-
- [Website](https://fengyuanchen.github.io/cropperjs/v2/)
7+
- [Website](https://fengyuanchen.github.io/cropperjs/)
88

99
## Versioning
1010

docs/.vitepress/config.mts

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ import lerna from '../../lerna.json';
77
const packages = resolve(__dirname, '../../packages');
88

99
export default defineConfig({
10-
base: '/cropperjs/v2/',
10+
base: '/cropperjs/',
1111
head: [
1212
[
1313
'link',
1414
{
1515
rel: 'apple-touch-icon',
1616
sizes: '180x180',
17-
href: '/cropperjs/v2/apple-touch-icon.png',
17+
href: '/cropperjs/apple-touch-icon.png',
1818
},
1919
],
2020
[
2121
'link',
2222
{
2323
rel: 'icon',
24-
href: '/cropperjs/v2/favicon.ico',
24+
href: '/cropperjs/favicon.ico',
2525
},
2626
],
2727
[
@@ -30,7 +30,7 @@ export default defineConfig({
3030
rel: 'icon',
3131
type: 'image/png',
3232
size: '16x16',
33-
href: '/cropperjs/v2/favicon-16x16.png',
33+
href: '/cropperjs/favicon-16x16.png',
3434
},
3535
],
3636
[
@@ -39,7 +39,7 @@ export default defineConfig({
3939
rel: 'icon',
4040
type: 'image/png',
4141
size: '32x32',
42-
href: '/cropperjs/v2/favicon-32x32.png',
42+
href: '/cropperjs/favicon-32x32.png',
4343
},
4444
],
4545
[
@@ -67,7 +67,7 @@ export default defineConfig({
6767
socialLinks: [
6868
{
6969
icon: 'github',
70-
link: 'https://github.com/fengyuanchen/cropperjs/tree/v2',
70+
link: 'https://github.com/fengyuanchen/cropperjs',
7171
},
7272
],
7373
footer: {
@@ -90,7 +90,7 @@ export default defineConfig({
9090
description: 'JavaScript image cropper.',
9191
themeConfig: {
9292
editLink: {
93-
pattern: 'https://github.com/fengyuanchen/cropperjs/edit/v2/docs/:path',
93+
pattern: 'https://github.com/fengyuanchen/cropperjs/edit/main/docs/:path',
9494
text: 'Edit this page on GitHub',
9595
},
9696
nav: [
@@ -113,13 +113,13 @@ export default defineConfig({
113113
{
114114
text: lerna.version,
115115
items: [
116-
{ text: 'Changelog', link: 'https://github.com/fengyuanchen/cropperjs/blob/v2/CHANGELOG.md' },
117-
{ text: 'Contributing', link: 'https://github.com/fengyuanchen/cropperjs/blob/v2/.github/CONTRIBUTING.md' },
116+
{ text: 'Changelog', link: 'https://github.com/fengyuanchen/cropperjs/blob/main/CHANGELOG.md' },
117+
{ text: 'Contributing', link: 'https://github.com/fengyuanchen/cropperjs/blob/main/.github/CONTRIBUTING.md' },
118118
],
119119
},
120120
{
121121
text: '1.x',
122-
link: 'https://fengyuanchen.github.io/cropperjs',
122+
link: 'https://fengyuanchen.github.io/cropperjs/v1/',
123123
},
124124
],
125125
sidebar: {
@@ -194,7 +194,7 @@ export default defineConfig({
194194
label: '在当前页面上',
195195
},
196196
editLink: {
197-
pattern: 'https://github.com/fengyuanchen/cropperjs/edit/v2/docs/:path',
197+
pattern: 'https://github.com/fengyuanchen/cropperjs/edit/main/docs/:path',
198198
text: '在 GitHub 上编辑此页',
199199
},
200200
docFooter: {
@@ -220,7 +220,7 @@ export default defineConfig({
220220
},
221221
{
222222
text: '1.x',
223-
link: 'https://fengyuanchen.github.io/cropperjs',
223+
link: 'https://fengyuanchen.github.io/cropperjs/v1',
224224
},
225225
],
226226
sidebar: {

docs/api/cropper-canvas.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The default minimum width and minimum height of this element are `200px` and `10
3434

3535
```html
3636
<cropper-canvas background>
37-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
37+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
3838
<cropper-handle action="move" plain></cropper-handle>
3939
</cropper-canvas>
4040
```
@@ -49,7 +49,7 @@ All pointer events are disabled.
4949

5050
```html
5151
<cropper-canvas background disabled>
52-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
52+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
5353
<cropper-handle action="move" plain></cropper-handle>
5454
</cropper-canvas>
5555
```

docs/api/cropper-handle.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The default width and height of this element is `0`.
2424

2525
```html
2626
<cropper-canvas background>
27-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
27+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
2828
<cropper-handle action="move"></cropper-handle>
2929
</cropper-canvas>
3030
```
@@ -37,7 +37,7 @@ The default width and height of this element is `0`.
3737

3838
```html
3939
<cropper-canvas background>
40-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
40+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
4141
<cropper-selection width="100" height="100" movable>
4242
<cropper-handle action="move"></cropper-handle>
4343
</cropper-selection>

docs/api/cropper-image.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The default width and height of this element is `0`.
2323
:::live-demo
2424

2525
```html
26-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" style="width: 100%;" rotatable scalable skewable translatable></cropper-image>
26+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" style="width: 100%;" rotatable scalable skewable translatable></cropper-image>
2727
```
2828

2929
:::
@@ -85,7 +85,7 @@ The built-in `<img>` element will inherit the following attributes by default:
8585
cropperImage.$ready((image) => {
8686
console.log(image.naturalWidth, image.naturalHeight);
8787
});
88-
cropperImage.src = '/cropperjs/v2/picture.jpg';
88+
cropperImage.src = '/cropperjs/picture.jpg';
8989
```
9090

9191
Defers the callback to execute after successfully loading the image.

docs/api/cropper-selection.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Set the `dynamic` property to `true` to change as the image changes.
7272

7373
```html
7474
<cropper-canvas style="height: 360px;" background>
75-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
75+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
7676
<cropper-shade hidden></cropper-shade>
7777
<cropper-handle action="move" plain></cropper-handle>
7878
<cropper-selection initial-coverage="0.5" dynamic movable resizable zoomable>
@@ -101,7 +101,7 @@ Set the `multiple` property to `true` to support multiple selections on the same
101101

102102
```html
103103
<cropper-canvas style="height: 360px;" background>
104-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
104+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
105105
<cropper-shade hidden></cropper-shade>
106106
<cropper-handle action="select" plain></cropper-handle>
107107
<cropper-selection id="cropperSelection" x="20" y="20" width="40" height="40" movable resizable multiple keyboard>

docs/api/cropper-shade.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The default width and height of this element is `0`.
4848

4949
```html
5050
<cropper-canvas background>
51-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
51+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
5252
<cropper-shade hidden></cropper-shade>
5353
<cropper-handle action="select" plain></cropper-handle>
5454
<cropper-selection movable resizable hidden>

docs/api/cropper-viewer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The default height of this element is `0`.
2424

2525
```html
2626
<cropper-canvas style="height: 240px;" background>
27-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
27+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
2828
<cropper-shade hidden></cropper-shade>
2929
<cropper-handle action="select" plain></cropper-handle>
3030
<cropper-selection id="cropperSelection" initial-aspect-ratio="1.5" initial-coverage="0.5" movable resizable>

docs/guide.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Cropper.js 2.0 is a series of web components for image cropping.
4141
npm is the recommended installation method when building large-scale applications with Cropper.js.
4242

4343
```sh
44-
npm install cropperjs@next
44+
npm install cropperjs
4545
```
4646

4747
For a specific package:
@@ -55,7 +55,7 @@ npm install @cropper/element-canvas
5555
For prototyping or learning purposes, you can use the latest version with:
5656

5757
```html
58-
<script src="https://unpkg.com/cropperjs@next"></script>
58+
<script src="https://unpkg.com/cropperjs"></script>
5959
```
6060

6161
For production, we recommend linking to a specific version number and build to avoid unexpected breakage from newer versions.
@@ -73,7 +73,7 @@ const cropper = new Cropper('#image');
7373
```
7474

7575
```html
76-
<img id="image" src="/cropperjs/v2/picture.jpg" alt="Picture">
76+
<img id="image" src="/cropperjs/picture.jpg" alt="Picture">
7777
```
7878

7979
#### Use in DOM
@@ -88,7 +88,7 @@ import 'cropperjs';
8888

8989
```html
9090
<cropper-canvas background>
91-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
91+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
9292
<cropper-shade hidden></cropper-shade>
9393
<cropper-handle action="select" plain></cropper-handle>
9494
<cropper-selection initial-coverage="0.5" movable resizable>
@@ -127,7 +127,7 @@ CropperHandle.$define();
127127

128128
```html
129129
<cropper-canvas background>
130-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
130+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
131131
<cropper-handle action="move" plain></cropper-handle>
132132
</cropper-canvas>
133133
```
@@ -140,18 +140,18 @@ Cropper.js contains a series of [npm](https://www.npmjs.com/) packages:
140140

141141
| Package | Version | Description |
142142
| --- | --- | --- |
143-
| `cropperjs` | [![Version](https://img.shields.io/npm/v/cropperjs/next)](https://www.npmjs.com/package/cropperjs/v/next) | The all-in-one package. |
144-
| `@cropper/element` | [![Version](https://img.shields.io/npm/v/@cropper/element/next)](https://www.npmjs.com/package/@cropper/element) | An abstract class for constructing Cropper elements. |
145-
| `@cropper/element-canvas` | [![Version](https://img.shields.io/npm/v/@cropper/element-canvas/next)](https://www.npmjs.com/package/@cropper/element-canvas) | A custom canvas element for the Cropper. |
146-
| `@cropper/element-image` | [![Version](https://img.shields.io/npm/v/@cropper/element-image/next)](https://www.npmjs.com/package/@cropper/element-image) | A custom image element for the Cropper. |
147-
| `@cropper/element-shade` | [![Version](https://img.shields.io/npm/v/@cropper/element-shade/next)](https://www.npmjs.com/package/@cropper/element-shade) | A custom shade element for the Cropper. |
148-
| `@cropper/element-handle` | [![Version](https://img.shields.io/npm/v/@cropper/element-handle/next)](https://www.npmjs.com/package/@cropper/element-handle) | A custom handle element for the Cropper. |
149-
| `@cropper/element-selection` | [![Version](https://img.shields.io/npm/v/@cropper/element-selection/next)](https://www.npmjs.com/package/@cropper/element-selection) | A custom selection element for the Cropper. |
150-
| `@cropper/element-grid` | [![Version](https://img.shields.io/npm/v/@cropper/element-grid/next)](https://www.npmjs.com/package/@cropper/element-grid) | A custom grid element for the Cropper. |
151-
| `@cropper/element-crosshair` | [![Version](https://img.shields.io/npm/v/@cropper/element-crosshair/next)](https://www.npmjs.com/package/@cropper/element-crosshair) | A custom crosshair element for the Cropper. |
152-
| `@cropper/element-viewer` | [![Version](https://img.shields.io/npm/v/@cropper/element-viewer/next)](https://www.npmjs.com/package/@cropper/element-viewer) | A custom viewer element for the Cropper. |
153-
| `@cropper/elements` | [![Version](https://img.shields.io/npm/v/@cropper/elements/next)](https://www.npmjs.com/package/@cropper/elements) | A series of custom elements for the Cropper. |
154-
| `@cropper/utils` | [![Version](https://img.shields.io/npm/v/@cropper/utils/next)](https://www.npmjs.com/package/@cropper/utils) | A series of common constants and utility functions for Cropper. |
143+
| `cropperjs` | [![Version](https://img.shields.io/npm/v/cropperjs)](https://www.npmjs.com/package/cropperjs/v) | The all-in-one package. |
144+
| `@cropper/element` | [![Version](https://img.shields.io/npm/v/@cropper/element)](https://www.npmjs.com/package/@cropper/element) | An abstract class for constructing Cropper elements. |
145+
| `@cropper/element-canvas` | [![Version](https://img.shields.io/npm/v/@cropper/element-canvas)](https://www.npmjs.com/package/@cropper/element-canvas) | A custom canvas element for the Cropper. |
146+
| `@cropper/element-image` | [![Version](https://img.shields.io/npm/v/@cropper/element-image)](https://www.npmjs.com/package/@cropper/element-image) | A custom image element for the Cropper. |
147+
| `@cropper/element-shade` | [![Version](https://img.shields.io/npm/v/@cropper/element-shade)](https://www.npmjs.com/package/@cropper/element-shade) | A custom shade element for the Cropper. |
148+
| `@cropper/element-handle` | [![Version](https://img.shields.io/npm/v/@cropper/element-handle)](https://www.npmjs.com/package/@cropper/element-handle) | A custom handle element for the Cropper. |
149+
| `@cropper/element-selection` | [![Version](https://img.shields.io/npm/v/@cropper/element-selection)](https://www.npmjs.com/package/@cropper/element-selection) | A custom selection element for the Cropper. |
150+
| `@cropper/element-grid` | [![Version](https://img.shields.io/npm/v/@cropper/element-grid)](https://www.npmjs.com/package/@cropper/element-grid) | A custom grid element for the Cropper. |
151+
| `@cropper/element-crosshair` | [![Version](https://img.shields.io/npm/v/@cropper/element-crosshair)](https://www.npmjs.com/package/@cropper/element-crosshair) | A custom crosshair element for the Cropper. |
152+
| `@cropper/element-viewer` | [![Version](https://img.shields.io/npm/v/@cropper/element-viewer)](https://www.npmjs.com/package/@cropper/element-viewer) | A custom viewer element for the Cropper. |
153+
| `@cropper/elements` | [![Version](https://img.shields.io/npm/v/@cropper/elements)](https://www.npmjs.com/package/@cropper/elements) | A series of custom elements for the Cropper. |
154+
| `@cropper/utils` | [![Version](https://img.shields.io/npm/v/@cropper/utils)](https://www.npmjs.com/package/@cropper/utils) | A series of common constants and utility functions for Cropper. |
155155

156156
## Interfaces
157157

docs/public/manifest.webmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Cropper.js",
33
"short_name": "Cropper.js",
44
"description": "JavaScript image cropper.",
5-
"start_url": "/cropperjs/v2/index.html",
5+
"start_url": "/cropperjs/index.html",
66
"display": "standalone",
77
"background_color": "#fff",
88
"theme_color": "#39f"

docs/zh/api/cropper-canvas.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
```html
3636
<cropper-canvas background>
37-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
37+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
3838
<cropper-handle action="move" plain></cropper-handle>
3939
</cropper-canvas>
4040
```
@@ -49,7 +49,7 @@
4949

5050
```html
5151
<cropper-canvas background disabled>
52-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
52+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
5353
<cropper-handle action="move" plain></cropper-handle>
5454
</cropper-canvas>
5555
```

docs/zh/api/cropper-handle.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
```html
2626
<cropper-canvas background>
27-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
27+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
2828
<cropper-handle action="move"></cropper-handle>
2929
</cropper-canvas>
3030
```
@@ -37,7 +37,7 @@
3737

3838
```html
3939
<cropper-canvas background>
40-
<cropper-image src="/cropperjs/v2/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
40+
<cropper-image src="/cropperjs/picture.jpg" alt="Picture" rotatable scalable skewable translatable></cropper-image>
4141
<cropper-selection width="100" height="100" movable>
4242
<cropper-handle action="move"></cropper-handle>
4343
</cropper-selection>

0 commit comments

Comments
 (0)