-
Notifications
You must be signed in to change notification settings - Fork 166
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
feat: 升级 vite5 #222
feat: 升级 vite5 #222
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
.DS_Store | ||
.idea | ||
.git | ||
.vscode | ||
.history | ||
.cache | ||
.temp | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
// Enable the ESlint flat config support | ||
"eslint.experimental.useFlatConfig": true, | ||
|
||
// Disable the default formatter, use eslint instead | ||
"prettier.enable": false, | ||
"editor.formatOnSave": false, | ||
|
||
// Auto fix | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit", | ||
"source.organizeImports": "never" | ||
}, | ||
|
||
// Silent the stylistic rules in you IDE, but still auto fix them | ||
"eslint.rules.customizations": [ | ||
{ "rule": "style/*", "severity": "off" }, | ||
{ "rule": "*-indent", "severity": "off" }, | ||
{ "rule": "*-spacing", "severity": "off" }, | ||
{ "rule": "*-spaces", "severity": "off" }, | ||
{ "rule": "*-order", "severity": "off" }, | ||
{ "rule": "*-dangle", "severity": "off" }, | ||
{ "rule": "*-newline", "severity": "off" }, | ||
{ "rule": "*quotes", "severity": "off" }, | ||
{ "rule": "*semi", "severity": "off" } | ||
], | ||
|
||
// Enable eslint for all supported languages | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"vue", | ||
"html", | ||
"markdown", | ||
"json", | ||
"jsonc", | ||
"yaml" | ||
], | ||
|
||
"pair-diff.patterns": [ | ||
{ | ||
"source": "./fixtures/output/**/*.*", | ||
"target": "./fixtures/input/<base>" | ||
} | ||
] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这段代码是对一个配置文件进行的修改,用于代码风格和规范的设置。下面是一些关键点:
对于代码的风险和改进建议,很难在没有上下文的情况下给出具体的建议。但可以注意以下几点:
请注意,这只是对代码进行的高级概述。具体的代码质量评估需要更多的上下文信息和详细的代码分析。 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
export default { | ||
pkgs: [ | ||
'create-fes-app', | ||
'fes', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 以下是一段代码补丁,请帮我简要进行代码审查。欢迎指出任何错误风险和/或改进建议: - module.exports = {
+ export default {
pkgs: [
'create-fes-app',
'fes', 审查结果: |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// eslint.config.js | ||
import antfu from '@antfu/eslint-config'; | ||
|
||
export default await antfu({ | ||
stylistic: { | ||
indent: 4, // 4, or 'tab' | ||
quotes: 'single', // or 'double' | ||
semi: 'always', | ||
}, | ||
typescript: true, | ||
vue: true, | ||
rules: { | ||
'vue/block-order': [ | ||
'error', | ||
{ | ||
order: ['template', 'script', 'style'], | ||
}, | ||
], | ||
}, | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 以下是您提供的代码补丁,我会为您进行简要的代码审查。欢迎指出任何潜在错误风险和改进建议: 代码中使用了以前未见过的 另外,对于 除此之外,代码看起来没有其他明显的错误,但我无法提供更多细节,因为代码片段缺少上下文。如果您提供了更多的代码或项目信息,我将能够提供更准确的建议和审查。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 使用antfu的好处是? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
"workspaces": [ | ||
"packages/*" | ||
], | ||
"type": "module", | ||
"scripts": { | ||
"bootstrap": "pnpm i", | ||
"dev": "node scripts/build.mjs --watch", | ||
|
@@ -37,16 +38,17 @@ | |
"semver": "^7.3.6" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^2.1.1", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@webank/eslint-config-webank": "1.2.7", | ||
"chokidar": "^3.5.3", | ||
"commitizen": "^4.3.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"deepmerge": "^4.2.2", | ||
"eslint": "^8.54.0", | ||
"fs-extra": "^11.1.1", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.0", | ||
"simple-git-hooks": "^2.9.0", | ||
"typescript": "^5.0.4", | ||
"vitepress": "1.0.0-alpha.73", | ||
"vue": "^3.3.4", | ||
|
@@ -57,11 +59,9 @@ | |
"npm run lint" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
"simple-git-hooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 代码补丁中做了几个更改和增加:
对于代码本身,我没有看到明显的错误风险。改进的建议包括:
这些只是根据提供的补丁进行的初步分析,完整的代码审查可能需要更多上下文和详细信息。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,59 @@ | ||
{ | ||
"name": "@fesjs/builder-vite", | ||
"version": "3.0.4", | ||
"description": "@fesjs/builder-vite", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"lib", | ||
"types.d.ts" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/WeBankFinTech/fes.js.git", | ||
"directory": "packages/fes-builder-vite" | ||
}, | ||
"keywords": [ | ||
"fes" | ||
], | ||
"author": "qlin", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/WeBankFinTech/fes.js/issues" | ||
}, | ||
"homepage": "https://github.com/WeBankFinTech/fes.js#readme", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@babel/core": "^7.21.3", | ||
"@fesjs/utils": "^3.0.1", | ||
"@vitejs/plugin-basic-ssl": "^1.0.1", | ||
"@vitejs/plugin-legacy": "^3.0.1", | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"@vitejs/plugin-vue-jsx": "^3.0.0", | ||
"autoprefixer": "^10.4.4", | ||
"babel-plugin-polyfill-corejs3": "^0.7.1", | ||
"less": "^4.1.2", | ||
"postcss-flexbugs-fixes": "^5.0.2", | ||
"postcss-safe-parser": "^6.0.0", | ||
"rollup-plugin-visualizer": "^5.6.0", | ||
"terser": "^5.16.8", | ||
"vite": "^4.2.1", | ||
"@rollup/pluginutils": "^4.2.0", | ||
"colorette": "^2.0.16", | ||
"connect-history-api-fallback": "^2.0.0", | ||
"consola": "^2.15.3", | ||
"dotenv": "^16.0.0", | ||
"dotenv-expand": "^8.0.2", | ||
"ejs": "^3.1.6", | ||
"fast-glob": "^3.2.11", | ||
"fs-extra": "^10.0.1", | ||
"html-minifier-terser": "^6.1.0", | ||
"node-html-parser": "^5.3.3", | ||
"pathe": "^0.2.0" | ||
}, | ||
"peerDependencies": { | ||
"@fesjs/fes": "^3.1.4", | ||
"core-js": "^3.29.1" | ||
}, | ||
"typings": "./types.d.ts" | ||
"name": "@fesjs/builder-vite", | ||
"version": "3.0.4", | ||
"description": "@fesjs/builder-vite", | ||
"author": "qlin", | ||
"license": "MIT", | ||
"homepage": "https://github.com/WeBankFinTech/fes.js#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/WeBankFinTech/fes.js.git", | ||
"directory": "packages/fes-builder-vite" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WeBankFinTech/fes.js/issues" | ||
}, | ||
"keywords": [ | ||
"fes" | ||
], | ||
"main": "lib/index.js", | ||
"files": [ | ||
"lib", | ||
"types.d.ts" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"peerDependencies": { | ||
"@fesjs/fes": "^3.1.4", | ||
"core-js": "^3.29.1" | ||
}, | ||
"dependencies": { | ||
"@babel/core": "^7.23.3", | ||
"@fesjs/utils": "^3.0.1", | ||
"@rollup/pluginutils": "^5.1.0", | ||
"@vitejs/plugin-basic-ssl": "^1.0.2", | ||
"@vitejs/plugin-legacy": "^5.2.0", | ||
"@vitejs/plugin-vue": "^4.5.0", | ||
"@vitejs/plugin-vue-jsx": "^3.1.0", | ||
"autoprefixer": "^10.4.4", | ||
"colorette": "^2.0.16", | ||
"connect-history-api-fallback": "^2.0.0", | ||
"consola": "^2.15.3", | ||
"dotenv": "^16.0.0", | ||
"dotenv-expand": "^8.0.2", | ||
"ejs": "^3.1.6", | ||
"fast-glob": "^3.2.11", | ||
"fs-extra": "^10.0.1", | ||
"html-minifier-terser": "^6.1.0", | ||
"less": "^4.2.0", | ||
"node-html-parser": "^5.3.3", | ||
"pathe": "^0.2.0", | ||
"postcss-flexbugs-fixes": "^5.0.2", | ||
"postcss-safe-parser": "^6.0.0", | ||
"rollup-plugin-visualizer": "^5.9.3", | ||
"terser": "^5.24.0", | ||
"vite": "^5.0.3" | ||
}, | ||
"typings": "./types.d.ts" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 以下是代码补丁的简要代码审查: 已做的更改:
改进建议:
请注意,我只对提供的代码片段进行了静态审查。对于真实的项目,细节可能因上下文而异,所以建议根据项目需求和实际情况进行更全面的代码审查。 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { join } from 'path'; | ||
import { existsSync } from 'fs'; | ||
import { join } from 'node:path'; | ||
import { existsSync } from 'node:fs'; | ||
import vue from '@vitejs/plugin-vue'; | ||
import vueJsx from '@vitejs/plugin-vue-jsx'; | ||
import { createHtmlPlugin } from './vite-plugin-html'; | ||
|
@@ -9,15 +9,15 @@ import getDefine from './getDefine'; | |
function getPostcssConfig(api) { | ||
// TODO 支持其他 postcss 配置文件类型 | ||
const configPath = `${api.paths.cwd}/postcss.config.js`; | ||
if (existsSync(configPath)) { | ||
if (existsSync(configPath)) | ||
return require(`${api.paths.cwd}/postcss.config.js`); | ||
} | ||
|
||
return {}; | ||
} | ||
|
||
export function getInnerCommonConfig(api) { | ||
const { deepmerge, resolveRuntimeEnv } = api.utils; | ||
const { server, build, define, base, ...otherViteOption } = api.config.viteOption; | ||
const { base, ...otherViteOption } = api.config.viteOption; | ||
|
||
const publicPath = base || api.config.publicPath || '/'; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 对于这段代码补丁,以下是简要的代码审核:
总体而言,这个代码补丁主要涉及模块引入的更改和字段解构赋值的调整。修复上述提到的问题后,该补丁应该可以顺利运行。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,13 @@ export default (api, publicPath) => { | |
...api.config.define, | ||
...viteOption.define, | ||
}); | ||
|
||
const formatEnv = Object.keys(env).reduce((acc, cur) => { | ||
acc[`process.env.${cur}`] = JSON.stringify(env[cur]); | ||
return acc; | ||
}, {}); | ||
console.log(formatEnv); | ||
return { | ||
'process.env': env, | ||
...formatEnv, | ||
...define, | ||
}; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这段代码主要是一个导出函数,接收两个参数:api和publicPath。它的作用是将环境变量(env)和定义(define)合并,并返回一个对象。 对于代码本身,以下是一些值得注意的地方:
总的来说,这段代码的逻辑看起来是正确的,没有明显的错误风险。如果存在其他上下文或关联的代码,可能需要更多信息来提供更全面的建议。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个代码补丁中有一些删除的行,包括
.git
和.vscode
等。这可能意味着该补丁删除了Git版本控制文件和VS Code配置文件。如果你确定这是你想要的操作,那么这部分没有问题。另外,该补丁还添加了
.DS_Store
、.idea
、.history
、.cache
和.temp
等文件/文件夹。这可能是你希望将它们添加到版本控制中。请确保这些更改与你的需求相符合。总体而言,代码补丁看起来没有明显的错误或风险。 但请记住,这只是对补丁进行的静态代码审核。为了确保补丁的正确性和功能,建议进行全面的测试和集成测试,确保没有隐藏的问题。