Skip to content

Commit

Permalink
feat: use catalog to globally upgrade vite and vitest (#2680)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcr authored Dec 19, 2024
1 parent 1bc3a1e commit 8d0429d
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 13 deletions.
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:vue@2.6.14",
"vue2.7": "npm:vue@2.7.10",
"vue3": "npm:vue@3.4.38",
"vite": "catalog:"
"vue3": "npm:vue@3.4.38"
},
"packageExtensions": {
"vue-template-compiler@2.6.14": {
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",
"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

_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'
'typescript': '~5.3.3'

0 comments on commit 8d0429d

Please sign in to comment.