Skip to content

Commit 366f3e1

Browse files
MaxymGornColdForeigndependabot[bot]Copilot
authored
Release 1.5.1: Migrated JavaScript codebase to TypeScript, Fix error during blazor server prerendering, Enhanced XML documentation (#456)
## Target <!-- Why are you making this change? --> - Migrated JavaScript codebase to TypeScript with strict type checking and namespace organization - Replaced Excubo.WebCompiler with Webpack build system including source maps, code splitting, and TypeScript declaration generation - Integrated Vitest for JavaScript/TypeScript testing, ESLint for linting, and Prettier for code formatting - Enhanced XML documentation for CropperComponent events with detailed parameter descriptions - Fix error during blazor server prerendering in dispose methods - Update packages #### Open Questions <!-- OPTIONAL - [ ] Use the GitHub checklists to spark discussion on issues that may arise from your approach. Please tick the box and explain your answer. --> ## Checklist <!-- It serves as a gentle reminder for common tasks. Confirm it's done and check everything that applies. --> - [ ] Tests cover new or modified code - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the site documentation - [ ] I have made corresponding changes to the README, NuGet README file - [ ] My changes generate no new warnings - [ ] New dependencies added or updated - [ ] Includes breaking changes - [ ] Version bumped ## Visuals <!-- OPTIONAL Show results both before and after this change. When the output changes, it can be a screenshot of a trace, metric, or log illustrating the change. --> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ColdForeign <tankon46555@gmail.com> Co-authored-by: George Radchuk <38187349+ColdForeign@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 5c31674 commit 366f3e1

78 files changed

Lines changed: 2385 additions & 1344 deletions

File tree

Some content is hidden

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

.editorconfig

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
11
root = true
2-
3-
# All files
4-
[*]
52
indent_style = space
6-
csharp_indent_labels = no_change
7-
csharp_using_directive_placement = outside_namespace:silent
8-
csharp_prefer_simple_using_statement = true:suggestion
9-
csharp_prefer_braces = true:silent
10-
csharp_style_namespace_declarations = block_scoped:silent
11-
csharp_style_prefer_method_group_conversion = true:silent
12-
csharp_style_prefer_top_level_statements = true:silent
13-
csharp_style_prefer_primary_constructors = true:suggestion
14-
csharp_style_expression_bodied_methods = false:silent
15-
csharp_style_expression_bodied_constructors = false:silent
16-
csharp_style_expression_bodied_operators = false:silent
17-
csharp_style_expression_bodied_properties = true:silent
18-
csharp_style_expression_bodied_indexers = true:silent
19-
csharp_style_expression_bodied_accessors = true:silent
20-
csharp_style_expression_bodied_lambdas = true:silent
21-
csharp_style_expression_bodied_local_functions = false:silent
223

234
[*.{csproj,sln,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
245
indent_size = 4
@@ -44,7 +25,23 @@ indent_style = space
4425
indent_size = 2
4526

4627
[*.{cs,vb}]
47-
#### Naming styles ####
28+
# Naming styles
29+
csharp_indent_labels = no_change
30+
csharp_using_directive_placement = outside_namespace:silent
31+
csharp_prefer_simple_using_statement = true:suggestion
32+
csharp_prefer_braces = true:silent
33+
csharp_style_namespace_declarations = block_scoped:silent
34+
csharp_style_prefer_method_group_conversion = true:silent
35+
csharp_style_prefer_top_level_statements = true:silent
36+
csharp_style_prefer_primary_constructors = true:suggestion
37+
csharp_style_expression_bodied_methods = false:silent
38+
csharp_style_expression_bodied_constructors = false:silent
39+
csharp_style_expression_bodied_operators = false:silent
40+
csharp_style_expression_bodied_properties = true:silent
41+
csharp_style_expression_bodied_indexers = true:silent
42+
csharp_style_expression_bodied_accessors = true:silent
43+
csharp_style_expression_bodied_lambdas = true:silent
44+
csharp_style_expression_bodied_local_functions = false:silent
4845

4946
# Naming rules
5047

@@ -64,33 +61,21 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
6461

6562
dotnet_naming_symbols.interface.applicable_kinds = interface
6663
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
67-
dotnet_naming_symbols.interface.required_modifiers =
6864

6965
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
7066
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
71-
dotnet_naming_symbols.types.required_modifiers =
7267

7368
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
7469
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
75-
dotnet_naming_symbols.non_field_members.required_modifiers =
7670

7771
# Naming styles
7872

7973
dotnet_naming_style.begins_with_i.required_prefix = I
80-
dotnet_naming_style.begins_with_i.required_suffix =
81-
dotnet_naming_style.begins_with_i.word_separator =
8274
dotnet_naming_style.begins_with_i.capitalization = pascal_case
83-
84-
dotnet_naming_style.pascal_case.required_prefix =
85-
dotnet_naming_style.pascal_case.required_suffix =
86-
dotnet_naming_style.pascal_case.word_separator =
8775
dotnet_naming_style.pascal_case.capitalization = pascal_case
88-
89-
dotnet_naming_style.pascal_case.required_prefix =
90-
dotnet_naming_style.pascal_case.required_suffix =
91-
dotnet_naming_style.pascal_case.word_separator =
9276
dotnet_naming_style.pascal_case.capitalization = pascal_case
9377
dotnet_style_operator_placement_when_wrapping = beginning_of_line
78+
9479
tab_width = 4
9580
indent_size = 4
9681
end_of_line = crlf

.github/codecov.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
---
22
comment:
3-
require_changes: true
3+
require_changes: false
4+
behavior: "new"
5+
show_carryforward_flags: true
6+
47
coverage:
8+
precision: 2
59
status:
610
project:
711
default:
8-
target: 100% # the required coverage value
9-
threshold: 0.1% # the leniency in hitting the target
12+
target: 80%
13+
dotnet:
14+
flags:
15+
- DotNet
16+
target: 100%
17+
threshold: 0%
18+
19+
typescript:
20+
flags:
21+
- TypeScript
22+
target: 6%
23+
threshold: 0%
24+
1025
patch:
1126
default:
27+
target: 6%
28+
dotnet:
29+
flags:
30+
- DotNet
1231
target: 100%
13-
threshold: 10%
32+
threshold: 0%
33+
34+
typescript:
35+
flags:
36+
- TypeScript
37+
target: 6%
38+
threshold: 0%

.github/linters/.jscpd.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"**/*.md",
88
"**/*excubowebcompiler.json",
99
"**/bin/**",
10-
"**/obj/**"
10+
"**/obj/**",
11+
"**/node_modules/**"
1112
],
1213
"absolute": true,
1314
"minTokens": 75

.github/workflows/build-test-template.yml

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ on:
1414
required: false
1515
type: boolean
1616
default: true
17+
run-js-tests:
18+
description: "Run JS/TS tests"
19+
required: false
20+
type: boolean
21+
default: false
1722
secrets:
1823
CODECOV_TOKEN:
1924
required: true
2025

2126
permissions:
2227
contents: read
28+
id-token: write
2329

2430
env:
2531
CONFIGURATION: ${{ inputs.configuration }}
@@ -55,21 +61,64 @@ jobs:
5561

5662
- name: Restore dotnet tool
5763
run: dotnet tool restore
58-
working-directory: src/Cropper.Blazor/Cropper.Blazor
59-
64+
working-directory: src/Cropper.Blazor/Cropper.Blazor
65+
6066
- name: DotNet Build
6167
run: dotnet build -c "$CONFIGURATION" --no-restore
6268
working-directory: src/Cropper.Blazor
6369

6470
- name: Test
65-
run: dotnet test -c "$CONFIGURATION" --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByAttribute='ExcludeFromCodeCoverage' /p:SkipAutoProps=true /p:Exclude="[*]Cropper.Blazor.Testing.*"
71+
run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByAttribute='ExcludeFromCodeCoverage' /p:SkipAutoProps=true /p:Exclude="[*]Cropper.Blazor.Testing.*"
6672
working-directory: src/Cropper.Blazor/Cropper.Blazor.UnitTests
6773

68-
- name: Coverage
74+
- name: Run JS/TS tests and generate coverage
75+
if: ${{ inputs.run-js-tests == true }}
76+
run: |
77+
cd Cropper.Blazor
78+
npm run coverage
79+
working-directory: src/Cropper.Blazor
80+
81+
- name: Verify coverage files
82+
working-directory: src/Cropper.Blazor
83+
run: |
84+
FILES=(
85+
Cropper.Blazor.UnitTests/coverage.net6.0.cobertura.xml
86+
Cropper.Blazor.UnitTests/coverage.net7.0.cobertura.xml
87+
Cropper.Blazor.UnitTests/coverage.net8.0.cobertura.xml
88+
Cropper.Blazor.UnitTests/coverage.net9.0.cobertura.xml
89+
Cropper.Blazor.UnitTests/coverage.net10.0.cobertura.xml
90+
)
91+
92+
if [ "${{ inputs.run-js-tests }}" = "true" ]; then
93+
FILES+=("Cropper.Blazor/coverage/cobertura-coverage.xml")
94+
fi
95+
96+
for file in "${FILES[@]}"; do
97+
if [ ! -f "$file" ]; then
98+
echo "❌ Coverage file missing: $file"
99+
exit 1
100+
fi
101+
echo "✅ Found $file"
102+
done
103+
104+
- name: Upload DotNet coverage to Codecov
69105
if: ${{ inputs.publish-coverage == true }}
70-
uses: codecov/codecov-action@v5.5.1
106+
uses: codecov/codecov-action@v5.5.2
71107
with:
72108
token: ${{ secrets.CODECOV_TOKEN }}
73-
files: coverage.net6.0.cobertura.xml, coverage.net7.0.cobertura.xml, coverage.net8.0.cobertura.xml, coverage.net9.0.cobertura.xml, coverage.net10.0.cobertura.xml
109+
files: src/Cropper.Blazor/Cropper.Blazor.UnitTests/coverage.net6.0.cobertura.xml,src/Cropper.Blazor/Cropper.Blazor.UnitTests/coverage.net7.0.cobertura.xml,src/Cropper.Blazor/Cropper.Blazor.UnitTests/coverage.net8.0.cobertura.xml,src/Cropper.Blazor/Cropper.Blazor.UnitTests/coverage.net9.0.cobertura.xml,src/Cropper.Blazor/Cropper.Blazor.UnitTests/coverage.net10.0.cobertura.xml
110+
flags: DotNet
74111
fail_ci_if_error: true
112+
disable_search: true
75113
verbose: true
114+
115+
- name: Upload TypeScript coverage to Codecov
116+
if: ${{ inputs.publish-coverage == true && inputs.run-js-tests == true }}
117+
uses: codecov/codecov-action@v5.5.2
118+
with:
119+
token: ${{ secrets.CODECOV_TOKEN }}
120+
files: src/Cropper.Blazor/Cropper.Blazor/coverage/cobertura-coverage.xml
121+
flags: TypeScript
122+
fail_ci_if_error: true
123+
disable_search: true
124+
verbose: true

.github/workflows/cd.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
---
22
name: Deploy to GitHub Pages
33

4-
permissions:
5-
contents: read
6-
74
concurrency:
85
group: github-pages
96
cancel-in-progress: true
@@ -16,12 +13,19 @@ on:
1613

1714
jobs:
1815
code-quality-check:
16+
permissions:
17+
id-token: write
18+
contents: read
1919
name: Check code quality
2020
uses: CropperBlazor/Cropper.Blazor/.github/workflows/build-test-template.yml@dev
2121
secrets:
2222
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
23+
with:
24+
run-js-tests: true
2325

2426
deploy-to-github-pages:
27+
permissions:
28+
contents: read
2529
runs-on: ubuntu-latest
2630
environment: github-pages
2731
needs: [code-quality-check, demo-projects-build]
@@ -121,6 +125,8 @@ jobs:
121125
repository-name: CropperBlazor/CropperBlazor.github.io
122126

123127
demo-projects-build:
128+
permissions:
129+
contents: read
124130
name: Build Demo Projects
125131
runs-on: windows-latest
126132
needs: code-quality-check

.github/workflows/ci.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,40 @@ on:
99
pull_request:
1010
branches-ignore:
1111
- master
12-
13-
permissions:
14-
contents: read
12+
paths-ignore:
13+
- '**.md'
1514

1615
jobs:
1716
code-quality-check:
17+
permissions:
18+
id-token: write
19+
contents: read
1820
name: Check code quality
1921
uses: CropperBlazor/Cropper.Blazor/.github/workflows/build-test-template.yml@dev
2022
secrets:
2123
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
24+
with:
25+
run-js-tests: true
26+
27+
es-linting:
28+
permissions:
29+
contents: read
30+
needs: code-quality-check
31+
name: ESLint - TypeScript Linting
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v5
36+
with:
37+
persist-credentials: false
38+
39+
- name: Install npm dependencies
40+
run: npm install
41+
working-directory: src/Cropper.Blazor/Cropper.Blazor
42+
43+
- name: Run ESLint
44+
run: npm run lint
45+
working-directory: src/Cropper.Blazor/Cropper.Blazor
2246

2347
code-linting:
2448
permissions:
@@ -61,8 +85,10 @@ jobs:
6185
VALIDATE_MARKDOWN_PRETTIER: false
6286
VALIDATE_YAML_PRETTIER: false
6387
VALIDATE_JSON_PRETTIER: false
88+
VALIDATE_TYPESCRIPT_PRETTIER: false
89+
VALIDATE_TYPESCRIPT_ES: false
6490

65-
FILTER_REGEX_EXCLUDE: '(\W|^)(obj/|bin/)|(\W|^)(.*([.]min[.]css))($)|(\W|^)(.*([.]min[.]js))($)'
91+
FILTER_REGEX_EXCLUDE: '(\W|^)(obj/|bin/|node_modules/|webpack\.config\.js)|(\W|^).*([.]min[.]css)($)|(\W|^).*([.]min[.]js)($)'
6692
FILTER_REGEX_INCLUDE: "/github/workspace/src/Cropper.Blazor/.*|/github/workspace/.github/.*"
6793

6894
JSCPD_CONFIG_FILE: ".jscpd.json"

.github/workflows/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ jobs:
1414
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1515
permissions:
1616
contents: read
17+
id-token: write
1718
with:
1819
configuration: "Release"
1920
publish-coverage: true
21+
run-js-tests: true
2022

2123
deploy-to-nuget:
2224
name: Deploy to NuGet
@@ -72,6 +74,15 @@ jobs:
7274
if ! jq -e '.Root.Children["cropper.min.js"]' "$json_path" > /dev/null; then
7375
error_messages+="For .NET $net_version: Key 'cropper.min.js' does not exist.\n"
7476
fi
77+
if ! jq -e '.Root.Children["blob-helper.d.ts"]' "$json_path" > /dev/null; then
78+
error_messages+="For .NET $net_version: Key 'blob-helper.d.ts' does not exist.\n"
79+
fi
80+
if ! jq -e '.Root.Children["cropperJsInterop.d.ts"]' "$json_path" > /dev/null; then
81+
error_messages+="For .NET $net_version: Key 'cropperJsInterop.d.ts' does not exist.\n"
82+
fi
83+
if ! jq -e '.Root.Children["cropper-url-image-helper.d.ts"]' "$json_path" > /dev/null; then
84+
error_messages+="For .NET $net_version: Key 'cropper-url-image-helper.d.ts' does not exist.\n"
85+
fi
7586
else
7687
error_messages+="File $json_path does not exist for .NET $net_version.\n"
7788
fi

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ _ReSharper*/
2929
[Tt]est[Rr]esult*
3030
.vs/
3131
.idea/
32+
*.cobertura.xml
3233
#Nuget packages folder
3334
packages/
35+
# Node.js
36+
node_modules/
37+
coverage/
38+
package-lock.json

0 commit comments

Comments
 (0)