Skip to content

feat: [grid,alert,form]use catalog to globally upgrade vite and vitest; and add mobile build config #2680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024
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
2 changes: 1 addition & 1 deletion internals/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"rollup": "^3.7.3",
"semver": "^7.3.8",
"tsup": "7.2.0",
"vite": "catalog:",
"vite": "^4.3.8",
"typescript": "catalog:",
"tailwindcss": "^3.2.4"
},
Expand Down
2 changes: 1 addition & 1 deletion internals/unplugin-virtual-template/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export default <Options>{
entryPoints: ['src/*.ts'],
clean: true,
format: ['cjs', 'esm'],
dts: true,
dts: false,
onSuccess: 'esno scripts/postbuild.ts'
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@
"vue@3": "3.4.38",
"vue2": "npm:[email protected]",
"vue2.7": "npm:[email protected]",
"vue3": "npm:[email protected]",
"vite": "catalog:"
"vue3": "npm:[email protected]"
},
"packageExtensions": {
"[email protected]": {
Expand Down
13 changes: 9 additions & 4 deletions packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"sideEffects": false,
"main": "index.ts",
"scripts": {
"build": "pnpm -w build:ui",
"postversion": "pnpm build"
"build": "vite build"
},
"dependencies": {
"@better-scroll/core": "^2.5.0",
Expand All @@ -36,6 +35,12 @@
"@opentiny/vue-locale": "workspace:~"
},
"devDependencies": {
"vue": "^3.5.0"
"vue": "^3.5.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect Vue version specification

The specified Vue version ^3.5.0 is incorrect as Vue 3.5.0 doesn't exist yet. The latest Vue 3.x version is lower than this.

Consider updating to a valid version:

-    "vue": "^3.5.0",
+    "vue": "^3.4.0",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"vue": "^3.5.0",
"vue": "^3.4.0",

"typescript": "catalog:",
"vite": "catalog:",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"vite-plugin-dts": "^4.3.0",
"vite-svg-loader": "^5.1.0"
}
}
}
25 changes: 25 additions & 0 deletions packages/mobile/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["components/**/*.ts", "components/**/*.tsx", "components/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions packages/mobile/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
27 changes: 27 additions & 0 deletions packages/mobile/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import dts from 'vite-plugin-dts'
import svgLoader from 'vite-svg-loader'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx(), dts(), svgLoader()],
build: {
lib: {
entry: './index.ts'
},
minify: true,
rollupOptions: {
external: [/@better-scroll/, /@opentiny/],
input: ['index.ts'],
output: [
{
format: 'es',
entryFileNames: '[name].js',
preserveModules: true
}
]
}
}
})
4 changes: 2 additions & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"xss": "1.0.14"
},
"devDependencies": {
"typescript": "^5.2.2",
"typescript": "catalog:",
"vite-plugin-dts": "~4.3.0",
"vite": "^6.0.0"
"vite": "catalog:"
}
}
2 changes: 1 addition & 1 deletion packages/utils/src/crypt/sha256.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ while (mPrime < 64) {

export class SHA256Algo extends Hasher {
_hash: any
_data: any
declare _data: any
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Missing test coverage for critical cryptographic functionality

The SHA256 implementation lacks dedicated test coverage, which is concerning for cryptographic code. The codebase shows:

  • A complete SHA256 implementation in packages/utils/src/crypt/sha256.ts
  • Usage in packages/utils/src/crypt/index.ts with both WebCrypto and fallback paths
  • No corresponding test files found in the utils package

Key areas requiring test coverage:

  • SHA256Algo class implementation
  • Hash generation with different input types
  • WebCrypto API fallback logic
  • Edge cases and error handling
🔗 Analysis chain

Verify test coverage for SHA256 implementation

Given this is cryptographic code, ensure that the TypeScript upgrade hasn't impacted test coverage or existing test cases.

Let's check for test coverage:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for SHA256 test files
fd -e test.ts -e spec.ts sha256

# Search for SHA256 test cases
rg -l "describe.*SHA256|test.*SHA256|it.*SHA256"

Length of output: 84


Script:

#!/bin/bash
# Let's try a broader search for test files related to SHA256
fd test packages/utils/src/crypt

# Search for any SHA256-related tests with more flexible patterns
rg -i "sha256" --type ts -A 5 packages/utils/src/crypt

# Check the actual SHA256 implementation file
cat packages/utils/src/crypt/sha256.ts

Length of output: 4914


Script:

#!/bin/bash
# Let's check for any test files in the parent directories
fd test packages/utils

# Look for any imports or usage of SHA256 in test files
rg -l "SHA256|sha256" $(fd -e test.ts -e spec.ts packages/utils)

# Check if there are any test utilities or setup files
fd -e ts "test-utils|test-setup|jest.setup" packages/utils

Length of output: 812


Script:

#!/bin/bash
# Let's try with correct fd syntax
fd . packages/utils --type f --extension test.ts --extension spec.ts

# Check for any test configuration files
fd jest.config packages/utils

# Look for SHA256 usage in the codebase to understand test coverage importance
rg -p "SHA256|sha256" packages/utils/src -C 3

Length of output: 1080


_doReset() {
this._hash = new WordArray(H.slice(0))
Expand Down
4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ packages:

# 统一版本,方便维护
catalog:
'vitest': '^0.31.0'
'vite': '^4.3.8'
'vitest': '^2.1.8'
'vite': '^6.0.0'
Comment on lines +9 to +10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Version conflicts detected - Migration needed in internal packages

The verification revealed version conflicts that need attention:

  • Found packages still using Vite 4.x:
    • internals/unplugin-tiny-vue/example/package.json
    • internals/cli/package.json

Additionally, multiple Vite and Vitest configuration files were found that may need updates:

  • 15 Vite config files across various packages
  • 3 Vitest config files in Vue examples

Please update the remaining Vite v4 dependencies and review all configuration files for compatibility with the new versions.

🔗 Analysis chain

Major version upgrades require careful verification

The changes include significant version jumps:

  • Vite: 4.3.8 → 6.0.0 (Major upgrade)
  • Vitest: 0.31.0 → 2.1.8 (Major upgrade)

These updates likely include breaking changes that need careful review.

Let's verify the package compatibility:

Please review:

  1. Vite Migration Guide from v4 to v6
  2. Vitest Migration Guide

Consider documenting the migration steps in the PR description to help with future upgrades.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if any package.json files still reference old versions
echo "Checking for potential version conflicts..."
rg -g "package.json" "\"vite\": \"(\^4|\~4)"
rg -g "package.json" "\"vitest\": \"(\^0|\~0)"

# Check for Vite/Vitest config files that might need updates
echo "Checking for config files that might need migration..."
fd "vite.config" 
fd "vitest.config"

Length of output: 1097

'typescript': '~5.3.3'
Loading