mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-05-06 20:42:48 +08:00
chore: 前端跑一遍 format、lint,尝试在 ci 中加入前端 lint 检查 (#353)
This commit is contained in:
31
.github/workflows/pr-check.yaml
vendored
31
.github/workflows/pr-check.yaml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: ['opened', 'reopened', 'synchronize', 'ready_for_review']
|
types: ["opened", "reopened", "synchronize", "ready_for_review"]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# Allow only one workflow per any non-`main` branch.
|
# Allow only one workflow per any non-`main` branch.
|
||||||
@@ -18,8 +18,8 @@ env:
|
|||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
check-backend:
|
||||||
name: Run Clippy and tests
|
name: Run backend checks
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
|
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
|
||||||
steps:
|
steps:
|
||||||
@@ -41,3 +41,28 @@ jobs:
|
|||||||
|
|
||||||
- name: cargo test
|
- name: cargo test
|
||||||
run: cargo test
|
run: cargo test
|
||||||
|
check-frontend:
|
||||||
|
name: Run frontend checks
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: web
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
- name: Cache dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.bun/install/cache
|
||||||
|
key: ${{ runner.os }}-bun-${{ hashFiles('docs/bun.lockb') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-bun-
|
||||||
|
- name: Check Frontend
|
||||||
|
run: bun run lint
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<Sidebar.Group>
|
<Sidebar.Group>
|
||||||
<Sidebar.GroupLabel
|
<Sidebar.GroupLabel
|
||||||
class="text-muted-foreground mb-2 px-2 text-xs font-medium uppercase tracking-wider"
|
class="text-muted-foreground mb-2 px-2 text-xs font-medium tracking-wider uppercase"
|
||||||
>
|
>
|
||||||
视频来源
|
视频来源
|
||||||
</Sidebar.GroupLabel>
|
</Sidebar.GroupLabel>
|
||||||
|
|||||||
@@ -3,14 +3,12 @@
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
|
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
|
||||||
import { Button } from '$lib/components/ui/button/index.js';
|
import { Button } from '$lib/components/ui/button/index.js';
|
||||||
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
|
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
|
||||||
import type { ApiError, VideoInfo } from '$lib/types';
|
import type { VideoInfo } from '$lib/types';
|
||||||
import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
|
import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
|
||||||
import InfoIcon from '@lucide/svelte/icons/info';
|
import InfoIcon from '@lucide/svelte/icons/info';
|
||||||
import UserIcon from '@lucide/svelte/icons/user';
|
import UserIcon from '@lucide/svelte/icons/user';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import api from '$lib/api';
|
|
||||||
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
|
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
|
||||||
import { toast } from 'svelte-sonner';
|
|
||||||
|
|
||||||
export let video: VideoInfo;
|
export let video: VideoInfo;
|
||||||
export let showActions: boolean = true; // 控制是否显示操作按钮
|
export let showActions: boolean = true; // 控制是否显示操作按钮
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export interface AppState {
|
|||||||
export const appStateStore = writable<AppState>({
|
export const appStateStore = writable<AppState>({
|
||||||
query: '',
|
query: '',
|
||||||
currentPage: 0,
|
currentPage: 0,
|
||||||
videoSource: null,
|
videoSource: null
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ToQuery = (state: AppState): string => {
|
export const ToQuery = (state: AppState): string => {
|
||||||
@@ -41,36 +41,40 @@ export const setQuery = (query: string) => {
|
|||||||
export const setVideoSourceFilter = (filter: { type: string; id: string }) => {
|
export const setVideoSourceFilter = (filter: { type: string; id: string }) => {
|
||||||
appStateStore.update((state) => ({
|
appStateStore.update((state) => ({
|
||||||
...state,
|
...state,
|
||||||
videoSource: filter,
|
videoSource: filter
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const clearVideoSourceFilter = () => {
|
export const clearVideoSourceFilter = () => {
|
||||||
appStateStore.update((state) => ({
|
appStateStore.update((state) => ({
|
||||||
...state,
|
...state,
|
||||||
videoSource: null,
|
videoSource: null
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setCurrentPage = (page: number) => {
|
export const setCurrentPage = (page: number) => {
|
||||||
appStateStore.update((state) => ({
|
appStateStore.update((state) => ({
|
||||||
...state,
|
...state,
|
||||||
currentPage: page,
|
currentPage: page
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const resetCurrentPage = () => {
|
export const resetCurrentPage = () => {
|
||||||
appStateStore.update((state) => ({
|
appStateStore.update((state) => ({
|
||||||
...state,
|
...state,
|
||||||
currentPage: 0,
|
currentPage: 0
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setAll = (query: string, currentPage: number, videoSource: { type: string; id: string } | null) => {
|
export const setAll = (
|
||||||
|
query: string,
|
||||||
|
currentPage: number,
|
||||||
|
videoSource: { type: string; id: string } | null
|
||||||
|
) => {
|
||||||
appStateStore.set({
|
appStateStore.set({
|
||||||
query,
|
query,
|
||||||
currentPage,
|
currentPage,
|
||||||
videoSource,
|
videoSource
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,6 +82,6 @@ export const clearAll = () => {
|
|||||||
appStateStore.set({
|
appStateStore.set({
|
||||||
query: '',
|
query: '',
|
||||||
currentPage: 0,
|
currentPage: 0,
|
||||||
videoSource: null,
|
videoSource: null
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export interface VideoResponse {
|
|||||||
// 重置视频响应类型
|
// 重置视频响应类型
|
||||||
export interface ResetVideoResponse {
|
export interface ResetVideoResponse {
|
||||||
resetted: boolean;
|
resetted: boolean;
|
||||||
video: VideoInfo,
|
video: VideoInfo;
|
||||||
pages: PageInfo[];
|
pages: PageInfo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
|
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
|
||||||
import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
|
import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
|
||||||
import api from '$lib/api';
|
import api from '$lib/api';
|
||||||
import type {
|
import type { VideosResponse, VideoSourcesResponse, ApiError } from '$lib/types';
|
||||||
VideosResponse,
|
|
||||||
VideoSourcesResponse,
|
|
||||||
ApiError,
|
|
||||||
ResetAllVideosResponse
|
|
||||||
} from '$lib/types';
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { setVideoSources, videoSourceStore } from '$lib/stores/video-source';
|
import { videoSourceStore } from '$lib/stores/video-source';
|
||||||
import { VIDEO_SOURCES } from '$lib/consts';
|
import { VIDEO_SOURCES } from '$lib/consts';
|
||||||
import { setBreadcrumb } from '$lib/stores/breadcrumb';
|
import { setBreadcrumb } from '$lib/stores/breadcrumb';
|
||||||
import {
|
import {
|
||||||
@@ -24,12 +19,9 @@
|
|||||||
resetCurrentPage,
|
resetCurrentPage,
|
||||||
setAll,
|
setAll,
|
||||||
setCurrentPage,
|
setCurrentPage,
|
||||||
setQuery,
|
|
||||||
setVideoSourceFilter,
|
|
||||||
ToQuery
|
ToQuery
|
||||||
} from '$lib/stores/filter';
|
} from '$lib/stores/filter';
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
import { Title } from '$lib/components/ui/card';
|
|
||||||
|
|
||||||
const pageSize = 20;
|
const pageSize = 20;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user