merge(sj_1.2.0-beta1): 合并 sa

This commit is contained in:
xlsea 2024-08-30 16:34:49 +08:00
parent 509905e7b4
commit ac6ca1db73
13 changed files with 699 additions and 461 deletions

View File

@ -5,10 +5,10 @@ import { createServiceConfig } from '../../src/utils/service';
* Set http proxy
*
* @param env - The current env
* @param isDev - Is development environment
* @param enable - If enable http proxy
*/
export function createViteProxy(env: Env.ImportMeta, isDev: boolean) {
const isEnableHttpProxy = isDev && env.VITE_HTTP_PROXY === 'Y';
export function createViteProxy(env: Env.ImportMeta, enable: boolean) {
const isEnableHttpProxy = enable && env.VITE_HTTP_PROXY === 'Y';
if (!isEnableHttpProxy) return undefined;

View File

@ -34,7 +34,7 @@
"build:test": "vite build --mode test",
"cleanup": "sa cleanup",
"commit": "sa git-commit",
"czh": "sa git-commit -l=zh-cn",
"commit:zh": "sa git-commit -l=zh-cn",
"dev": "vite --mode test",
"dev:prod": "vite --mode prod",
"gen-route": "sa gen-route",
@ -57,53 +57,54 @@
"@sa/hooks": "workspace:*",
"@sa/materials": "workspace:*",
"@sa/utils": "workspace:*",
"@vueuse/core": "10.11.0",
"@vueuse/core": "11.0.1",
"clipboard": "2.0.11",
"dayjs": "1.11.12",
"echarts": "5.5.1",
"highlight.js": "^11.10.0",
"naive-ui": "2.39.0",
"nprogress": "0.2.0",
"pinia": "2.2.0",
"tailwind-merge": "2.4.0",
"pinia": "2.2.2",
"tailwind-merge": "2.5.2",
"ts-md5": "1.3.1",
"vue": "3.4.35",
"vue": "3.4.38",
"vue-codemirror6": "^1.3.4",
"vue-drag-resize": "^1.5.4",
"vue-draggable-plus": "0.5.2",
"vue-i18n": "9.13.1",
"vue-router": "4.4.1",
"vue-draggable-plus": "0.5.3",
"vue-i18n": "9.14.0",
"vue-router": "4.4.3",
"vue3-puzzle-vcode": "^1.1.7"
},
"devDependencies": {
"@elegant-router/vue": "0.3.8",
"@iconify/json": "2.2.232",
"@iconify/json": "2.2.238",
"@sa/scripts": "workspace:*",
"@sa/uno-preset": "workspace:*",
"@soybeanjs/eslint-config": "1.4.0",
"@types/node": "22.0.1",
"@types/node": "22.4.1",
"@types/nprogress": "0.2.3",
"@unocss/eslint-config": "0.61.9",
"@unocss/preset-icons": "0.61.9",
"@unocss/preset-uno": "0.61.9",
"@unocss/transformer-directives": "0.61.9",
"@unocss/transformer-variant-group": "0.61.9",
"@unocss/vite": "0.61.9",
"@vitejs/plugin-vue": "5.1.1",
"@vitejs/plugin-vue-jsx": "4.0.0",
"eslint": "9.8.0",
"@unocss/eslint-config": "0.62.2",
"@unocss/preset-icons": "0.62.2",
"@unocss/preset-uno": "0.62.2",
"@unocss/transformer-directives": "0.62.2",
"@unocss/transformer-variant-group": "0.62.2",
"@unocss/vite": "0.62.2",
"@vitejs/plugin-vue": "5.1.2",
"@vitejs/plugin-vue-jsx": "4.0.1",
"eslint": "9.9.0",
"eslint-plugin-vue": "9.27.0",
"lint-staged": "15.2.7",
"json5": "2.2.3",
"lint-staged": "15.2.9",
"sass": "1.77.8",
"simple-git-hooks": "2.11.1",
"tsx": "4.16.3",
"tsx": "4.17.0",
"typescript": "5.5.4",
"unplugin-icons": "0.19.1",
"unplugin-vue-components": "0.27.3",
"vite": "5.3.5",
"unplugin-icons": "0.19.2",
"unplugin-vue-components": "0.27.4",
"vite": "5.4.1",
"vite-plugin-progress": "0.0.7",
"vite-plugin-svg-icons": "2.0.1",
"vite-plugin-vue-devtools": "7.3.7",
"vite-plugin-vue-devtools": "7.3.8",
"vue-eslint-parser": "9.4.3",
"vue-tsc": "2.0.29"
},

View File

@ -11,9 +11,9 @@
},
"dependencies": {
"@sa/utils": "workspace:*",
"axios": "1.7.2",
"axios-retry": "4.4.2",
"qs": "6.12.3"
"axios": "1.7.4",
"axios-retry": "4.5.0",
"qs": "6.13.0"
},
"devDependencies": {
"@types/qs": "6.9.15"

View File

@ -14,14 +14,14 @@
},
"devDependencies": {
"@soybeanjs/changelog": "0.3.24",
"bumpp": "9.4.1",
"bumpp": "9.5.1",
"c12": "1.11.1",
"cac": "6.7.14",
"consola": "3.2.3",
"enquirer": "2.4.1",
"execa": "9.3.0",
"execa": "9.3.1",
"kolorist": "1.8.0",
"npm-check-updates": "17.0.0",
"npm-check-updates": "17.0.6",
"rimraf": "6.0.1"
}
}

View File

@ -11,13 +11,15 @@ export const locales = {
},
gitCommitTypes: [
['feat', '新功能'],
['feat-wip', '开发中的功能,比如某功能的部分代码'],
['fix', '修复Bug'],
['docs', '只更新文档'],
['docs', '只涉及文档更新'],
['typo', '代码或文档勘误,比如错误拼写'],
['style', '修改代码风格,不影响代码含义的变更'],
['refactor', '代码重构,既不修复 bug 也不添加功能的代码变更'],
['perf', '可提高性能的代码更改'],
['optimize', '优化代码质量的代码更改'],
['test', '添加缺失的测试或更正现有测'],
['test', '添加缺失的测试或更正现有测'],
['build', '影响构建系统或外部依赖项的更改'],
['ci', '对 CI 配置文件和脚本的更改'],
['chore', '没有修改src或测试文件的其他变更'],
@ -47,8 +49,10 @@ export const locales = {
},
gitCommitTypes: [
['feat', 'A new feature'],
['feat-wip', 'Features in development, such as partial code for a certain feature'],
['fix', 'A bug fix'],
['docs', 'Documentation only changes'],
['typo', 'Code or document corrections, such as spelling errors'],
['style', 'Changes that do not affect the meaning of the code'],
['refactor', 'A code change that neither fixes a bug nor adds a feature'],
['perf', 'A code change that improves performance'],

File diff suppressed because it is too large Load Diff

View File

@ -98,11 +98,15 @@ export function useRouterPush(inSetup = true) {
return routerPushByKey('login', { query, params: { module } });
}
/** Redirect from login */
async function redirectFromLogin() {
/**
* Redirect from login
*
* @param [needRedirect=true] Whether to redirect after login. Default is `true`
*/
async function redirectFromLogin(needRedirect = true) {
const redirect = route.value.query?.redirect as string;
if (redirect) {
if (needRedirect && redirect) {
routerPush(redirect);
} else {
toHome();

View File

@ -53,9 +53,7 @@ export function setupAppVersionNotification() {
}
async function getHtmlBuildTime() {
const baseURL = import.meta.env.VITE_BASE_URL;
const res = await fetch(`${baseURL}index.html`);
const res = await fetch(`/index.html?time=${Date.now()}`);
const html = await res.text();

View File

@ -81,9 +81,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
if (pass) {
await routeStore.initAuthRoute();
if (redirect) {
await redirectFromLogin();
}
await redirectFromLogin(redirect);
if (routeStore.isInitAuthRoute) {
window.$notification?.success({

View File

@ -30,6 +30,9 @@ declare namespace Api {
total: number;
};
/** common search params of table */
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'page' | 'size'>;
/**
* enable status
*

View File

@ -26,7 +26,7 @@ declare namespace NaiveUI {
type TableColumn<T> = TableColumnWithKey<T> | DataTableSelectionColumn<T> | DataTableExpandColumn<T>;
type TableApiFn<T = any, R = Api.SystemManage.CommonSearchParams> = (
type TableApiFn<T = any, R = Api.Common.CommonSearchParams> = (
params: R
) => Promise<FlatResponseData<Api.Common.PaginatingQueryRecord<T>>>;

View File

@ -1,3 +1,5 @@
import json5 from 'json5';
/**
* Create service config by current env
*
@ -8,10 +10,12 @@ export function createServiceConfig(env: Env.ImportMeta) {
let other = {} as Record<App.Service.OtherBaseURLKey, string>;
try {
other = VITE_OTHER_SERVICE_BASE_URL ? JSON.parse(VITE_OTHER_SERVICE_BASE_URL) : {};
if (VITE_OTHER_SERVICE_BASE_URL) {
other = json5.parse(VITE_OTHER_SERVICE_BASE_URL);
}
} catch (error) {
// eslint-disable-next-line no-console
console.error('VITE_OTHER_SERVICE_BASE_URL is not a valid JSON string');
console.error('VITE_OTHER_SERVICE_BASE_URL is not a valid json5 string');
}
const httpConfig: App.Service.SimpleServiceConfig = {

View File

@ -9,6 +9,8 @@ export default defineConfig(configEnv => {
const buildTime = getBuildTime();
const enableProxy = configEnv.command === 'serve' && !configEnv.isPreview;
return {
base: viteEnv.VITE_BASE_URL,
resolve: {
@ -32,7 +34,7 @@ export default defineConfig(configEnv => {
host: '0.0.0.0',
port: 9527,
open: true,
proxy: createViteProxy(viteEnv, configEnv.command === 'serve'),
proxy: createViteProxy(viteEnv, enableProxy),
fs: {
cachedChecks: false
}