Skip to content

Commit cc6a4e4

Browse files
authored
fix: improve Vite configuration for development mode (#136)
# Description - update Node.js version in workflows and Dockerfiles - add pre-build checks - update file encoding method - improve Vite configuration for development mode - bump package versions to 3.3.2 Fixes #135 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## Checklist - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] Any dependent changes have been merged and published in downstream modules
2 parents 4a8f084 + f4411c4 commit cc6a4e4

13 files changed

Lines changed: 93 additions & 23 deletions

File tree

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fetch-depth: 0
2424

2525
- name: Set up Node.js
26-
uses: actions/setup-node@v5
26+
uses: actions/setup-node@v6
2727
with:
2828
node-version: latest
2929

.github/workflows/deploy.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
name: Deploy Client
2+
3+
permissions:
4+
contents: write
5+
26
on:
37
push:
48
branches:
59
- main
6-
permissions:
7-
contents: write
10+
workflow_dispatch:
11+
812
jobs:
913
build-and-deploy:
1014
runs-on: ubuntu-latest
@@ -13,7 +17,7 @@ jobs:
1317
uses: actions/checkout@v5
1418

1519
- name: Set up Node.js
16-
uses: actions/setup-node@v5
20+
uses: actions/setup-node@v6
1721
with:
1822
node-version: latest
1923

.github/workflows/pre-build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Pre-build Checks
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
pre-build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v5
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v6
24+
with:
25+
node-version: latest
26+
27+
- name: Pre-build server
28+
run: |
29+
cd server
30+
npm install
31+
npm run build
32+
33+
- name: Pre-build client
34+
run: |
35+
cd client
36+
npm install
37+
npm run build

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [3.3.2] - 2025-10-21
6+
7+
### Added
8+
9+
- Add GitHub Actions workflow to run pre build checks
10+
11+
### Changed
12+
13+
- Bump dependencies to fix security vulnerabilities
14+
515
## [3.3.1] - 2025-08-19
616

717
### Fixed

client/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20-alpine as build
1+
FROM node:22-alpine as build
22

33
WORKDIR /app
44

client/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "3.3.1",
3+
"version": "3.3.2",
44
"private": true,
55
"type": "module",
66
"scripts": {

client/src/utils/fileProtocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class FileProtocol {
115115
const message = TRANSFER_CONFIG.retryPrefix + JSON.stringify(retryData)
116116
const encoder = new TextEncoder()
117117
const encoded = encoder.encode(message)
118-
return encoded.buffer.slice(
118+
return (encoded.buffer as ArrayBuffer).slice(
119119
encoded.byteOffset,
120120
encoded.byteOffset + encoded.byteLength,
121121
)

client/tsconfig.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,28 @@
55
"strict": true,
66
"jsx": "preserve",
77
"importHelpers": true,
8-
"moduleResolution": "node",
8+
"moduleResolution": "bundler",
99
"experimentalDecorators": true,
1010
"esModuleInterop": true,
1111
"skipLibCheck": true,
1212
"forceConsistentCasingInFileNames": true,
1313
"baseUrl": ".",
1414
"paths": {
15-
"@/*": ["./src/*"]
15+
"@/*": [
16+
"./src/*"
17+
]
1618
},
17-
"lib": ["esnext", "dom"]
19+
"lib": [
20+
"esnext",
21+
"dom"
22+
]
1823
},
19-
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "vite.config.js"],
24+
"include": [
25+
"src/**/*.ts",
26+
"src/**/*.d.ts",
27+
"src/**/*.tsx",
28+
"src/**/*.vue",
29+
"vite.config.js"
30+
],
2031
"exclude": []
2132
}

client/vite.config.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@ import { fileURLToPath, URL } from 'node:url'
22
import { defineConfig, loadEnv } from 'vite'
33
import vue from '@vitejs/plugin-vue'
44
import vueJsx from '@vitejs/plugin-vue-jsx'
5-
import vueDevTools from 'vite-plugin-vue-devtools'
65
import fs from 'fs'
76

87
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
98

10-
export default defineConfig(({ mode }) => {
9+
export default defineConfig(async ({ mode }) => {
1110
const env = loadEnv(mode, process.cwd(), '')
1211

12+
let devToolsPlugin = null
13+
if (mode === 'development') {
14+
const { default: vueDevTools } = await import('vite-plugin-vue-devtools')
15+
devToolsPlugin = vueDevTools()
16+
}
17+
1318
return {
1419
plugins: [
1520
vue(),
1621
vueJsx(),
17-
vueDevTools(),
22+
...(devToolsPlugin ? [devToolsPlugin] : []),
1823
],
1924
resolve: {
2025
alias: {
@@ -27,7 +32,10 @@ export default defineConfig(({ mode }) => {
2732
jsxInject: `import { h } from 'vue'`
2833
},
2934
define: {
30-
'process.env': env,
35+
'process.env': {
36+
VITE_SIGNAL_SERVER_URL: env.VITE_SIGNAL_SERVER_URL,
37+
VITE_API_SERVER_URL: env.VITE_API_SERVER_URL,
38+
},
3139
'process.package_version': JSON.stringify(packageJson.version),
3240
}
3341
}

0 commit comments

Comments
 (0)