mirror of https://github.com/langgenius/dify.git
chore: use vite plus (#33407)
This commit is contained in:
parent
20e91990bf
commit
4203647c32
|
|
@ -1,33 +1,13 @@
|
||||||
name: Setup Web Environment
|
name: Setup Web Environment
|
||||||
description: Setup pnpm, Node.js, and install web dependencies.
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
node-version:
|
|
||||||
description: Node.js version to use
|
|
||||||
required: false
|
|
||||||
default: "22"
|
|
||||||
install-dependencies:
|
|
||||||
description: Whether to install web dependencies after setting up Node.js
|
|
||||||
required: false
|
|
||||||
default: "true"
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Install pnpm
|
- name: Setup Vite+
|
||||||
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
uses: voidzero-dev/setup-vp@b5d848f5a62488f3d3d920f8aa6ac318a60c5f07 # v1
|
||||||
with:
|
with:
|
||||||
package_json_file: web/package.json
|
node-version-file: "./web/.nvmrc"
|
||||||
run_install: false
|
cache: true
|
||||||
|
run-install: |
|
||||||
- name: Setup Node.js
|
- cwd: ./web
|
||||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
args: ['--frozen-lockfile']
|
||||||
with:
|
|
||||||
node-version: ${{ inputs.node-version }}
|
|
||||||
cache: pnpm
|
|
||||||
cache-dependency-path: ./web/pnpm-lock.yaml
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
if: ${{ inputs.install-dependencies == 'true' }}
|
|
||||||
shell: bash
|
|
||||||
run: pnpm --dir web install --frozen-lockfile
|
|
||||||
|
|
|
||||||
|
|
@ -102,13 +102,11 @@ jobs:
|
||||||
- name: Setup web environment
|
- name: Setup web environment
|
||||||
if: steps.web-changes.outputs.any_changed == 'true'
|
if: steps.web-changes.outputs.any_changed == 'true'
|
||||||
uses: ./.github/actions/setup-web
|
uses: ./.github/actions/setup-web
|
||||||
with:
|
|
||||||
node-version: "24"
|
|
||||||
|
|
||||||
- name: ESLint autofix
|
- name: ESLint autofix
|
||||||
if: steps.web-changes.outputs.any_changed == 'true'
|
if: steps.web-changes.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
pnpm eslint --concurrency=2 --prune-suppressions --quiet || true
|
vp exec eslint --concurrency=2 --prune-suppressions --quiet || true
|
||||||
|
|
||||||
- uses: autofix-ci/action@7a166d7532b277f34e16238930461bf77f9d7ed8 # v1.3.3
|
- uses: autofix-ci/action@7a166d7532b277f34e16238930461bf77f9d7ed8 # v1.3.3
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ jobs:
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
working-directory: ./web
|
working-directory: ./web
|
||||||
run: |
|
run: |
|
||||||
pnpm run lint:ci
|
vp run lint:ci
|
||||||
# pnpm run lint:report
|
# pnpm run lint:report
|
||||||
# continue-on-error: true
|
# continue-on-error: true
|
||||||
|
|
||||||
|
|
@ -102,17 +102,17 @@ jobs:
|
||||||
- name: Web tsslint
|
- name: Web tsslint
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
working-directory: ./web
|
working-directory: ./web
|
||||||
run: pnpm run lint:tss
|
run: vp run lint:tss
|
||||||
|
|
||||||
- name: Web type check
|
- name: Web type check
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
working-directory: ./web
|
working-directory: ./web
|
||||||
run: pnpm run type-check
|
run: vp run type-check
|
||||||
|
|
||||||
- name: Web dead code check
|
- name: Web dead code check
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
working-directory: ./web
|
working-directory: ./web
|
||||||
run: pnpm run knip
|
run: vp run knip
|
||||||
|
|
||||||
superlinter:
|
superlinter:
|
||||||
name: SuperLinter
|
name: SuperLinter
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ jobs:
|
||||||
|
|
||||||
- name: Setup web environment
|
- name: Setup web environment
|
||||||
uses: ./.github/actions/setup-web
|
uses: ./.github/actions/setup-web
|
||||||
with:
|
|
||||||
install-dependencies: "false"
|
|
||||||
|
|
||||||
- name: Detect changed files and generate diff
|
- name: Detect changed files and generate diff
|
||||||
id: detect_changes
|
id: detect_changes
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ jobs:
|
||||||
uses: ./.github/actions/setup-web
|
uses: ./.github/actions/setup-web
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pnpm vitest run --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --coverage
|
run: vp test run --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --coverage
|
||||||
|
|
||||||
- name: Upload blob report
|
- name: Upload blob report
|
||||||
if: ${{ !cancelled() }}
|
if: ${{ !cancelled() }}
|
||||||
|
|
@ -84,7 +84,7 @@ jobs:
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Merge reports
|
- name: Merge reports
|
||||||
run: pnpm vitest --merge-reports --reporter=json --reporter=agent --coverage
|
run: vp test --merge-reports --reporter=json --reporter=agent --coverage
|
||||||
|
|
||||||
- name: Check app/components diff coverage
|
- name: Check app/components diff coverage
|
||||||
env:
|
env:
|
||||||
|
|
@ -447,4 +447,4 @@ jobs:
|
||||||
- name: Web build check
|
- name: Web build check
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
working-directory: ./web
|
working-directory: ./web
|
||||||
run: pnpm run build
|
run: vp run build
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ const config: KnipConfig = {
|
||||||
'@iconify-json/*',
|
'@iconify-json/*',
|
||||||
|
|
||||||
'@storybook/addon-onboarding',
|
'@storybook/addon-onboarding',
|
||||||
|
|
||||||
|
'@voidzero-dev/vite-plus-core',
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
files: 'warn',
|
files: 'warn',
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@
|
||||||
"start:vinext": "vinext start",
|
"start:vinext": "vinext start",
|
||||||
"storybook": "storybook dev -p 6006",
|
"storybook": "storybook dev -p 6006",
|
||||||
"storybook:build": "storybook build",
|
"storybook:build": "storybook build",
|
||||||
"test": "vitest run",
|
"test": "vp test",
|
||||||
"test:coverage": "vitest run --coverage",
|
"test:coverage": "vp test --coverage",
|
||||||
"test:watch": "vitest --watch",
|
"test:watch": "vp test --watch",
|
||||||
"type-check": "tsc --noEmit",
|
"type-check": "tsc --noEmit",
|
||||||
"type-check:tsgo": "tsgo --noEmit",
|
"type-check:tsgo": "tsgo --noEmit",
|
||||||
"uglify-embed": "node ./bin/uglify-embed"
|
"uglify-embed": "node ./bin/uglify-embed"
|
||||||
|
|
@ -213,6 +213,7 @@
|
||||||
"@vitejs/plugin-react": "6.0.0",
|
"@vitejs/plugin-react": "6.0.0",
|
||||||
"@vitejs/plugin-rsc": "0.5.21",
|
"@vitejs/plugin-rsc": "0.5.21",
|
||||||
"@vitest/coverage-v8": "4.1.0",
|
"@vitest/coverage-v8": "4.1.0",
|
||||||
|
"@voidzero-dev/vite-plus-core": "0.1.11",
|
||||||
"agentation": "2.3.2",
|
"agentation": "2.3.2",
|
||||||
"autoprefixer": "10.4.27",
|
"autoprefixer": "10.4.27",
|
||||||
"code-inspector-plugin": "1.4.4",
|
"code-inspector-plugin": "1.4.4",
|
||||||
|
|
@ -241,9 +242,10 @@
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"uglify-js": "3.19.3",
|
"uglify-js": "3.19.3",
|
||||||
"vinext": "https://pkg.pr.new/vinext@18fe3ea",
|
"vinext": "https://pkg.pr.new/vinext@18fe3ea",
|
||||||
"vite": "8.0.0",
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.11",
|
||||||
"vite-plugin-inspect": "11.3.3",
|
"vite-plugin-inspect": "11.3.3",
|
||||||
"vitest": "4.1.0",
|
"vite-plus": "0.1.11",
|
||||||
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.11",
|
||||||
"vitest-canvas-mock": "1.1.3"
|
"vitest-canvas-mock": "1.1.3"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
|
@ -293,6 +295,8 @@
|
||||||
"svgo@>=3.0.0,<3.3.3": "3.3.3",
|
"svgo@>=3.0.0,<3.3.3": "3.3.3",
|
||||||
"tar@<=7.5.10": "7.5.11",
|
"tar@<=7.5.10": "7.5.11",
|
||||||
"typed-array-buffer": "npm:@nolyfill/typed-array-buffer@^1.0.44",
|
"typed-array-buffer": "npm:@nolyfill/typed-array-buffer@^1.0.44",
|
||||||
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.11",
|
||||||
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.11",
|
||||||
"which-typed-array": "npm:@nolyfill/which-typed-array@^1.0.44"
|
"which-typed-array": "npm:@nolyfill/which-typed-array@^1.0.44"
|
||||||
},
|
},
|
||||||
"ignoredBuiltDependencies": [
|
"ignoredBuiltDependencies": [
|
||||||
|
|
|
||||||
1293
web/pnpm-lock.yaml
1293
web/pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -1,11 +1,9 @@
|
||||||
/// <reference types="vitest/config" />
|
|
||||||
|
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import vinext from 'vinext'
|
import vinext from 'vinext'
|
||||||
import { defineConfig } from 'vite'
|
|
||||||
import Inspect from 'vite-plugin-inspect'
|
import Inspect from 'vite-plugin-inspect'
|
||||||
|
import { defineConfig } from 'vite-plus'
|
||||||
import { createCodeInspectorPlugin, createForceInspectorClientInjectionPlugin } from './plugins/vite/code-inspector'
|
import { createCodeInspectorPlugin, createForceInspectorClientInjectionPlugin } from './plugins/vite/code-inspector'
|
||||||
import { customI18nHmrPlugin } from './plugins/vite/custom-i18n-hmr'
|
import { customI18nHmrPlugin } from './plugins/vite/custom-i18n-hmr'
|
||||||
import { collectComponentCoverageExcludedFiles } from './scripts/component-coverage-filters.mjs'
|
import { collectComponentCoverageExcludedFiles } from './scripts/component-coverage-filters.mjs'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue