Skip to content

Commit 823afa5

Browse files
committed
refactor: clean up comments and improve readability in Vite configuration, GitHub Actions workflow, and various source files
1 parent ebff9e4 commit 823afa5

File tree

5 files changed

+5
-17
lines changed

5 files changed

+5
-17
lines changed

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Publish dist to GitHub Pages (per-branch, no build)
33
on:
44
push:
55
branches:
6-
- '**' # все ветки
7-
delete: # опциональная очистка при удалении веток (см. второй job ниже)
6+
- '**'
7+
delete:
88

99
permissions:
1010
contents: write
@@ -22,7 +22,6 @@ jobs:
2222
id: vars
2323
run: |
2424
BRANCH="${GITHUB_REF_NAME}"
25-
# нормализуем: заменяем слеши и пробелы на '-', нижний регистр, фильтруем лишнее
2625
SLUG="$(printf '%s' "$BRANCH" \
2726
| tr '[:upper:]' '[:lower:]' \
2827
| sed -E 's#[/ ]+#-#g; s#[^a-z0-9._-]#-#g; s#-+#-#g; s#(^-|-$)##g')"
@@ -35,17 +34,15 @@ jobs:
3534
exit 1
3635
fi
3736
38-
# main --> корень gh-pages. ВАЖНО: clean=false, чтобы не снести подпапки других веток.
3937
- name: Deploy main to root
4038
if: steps.vars.outputs.slug == 'main'
4139
uses: JamesIves/github-pages-deploy-action@v4
4240
with:
4341
token: ${{ secrets.GITHUB_TOKEN }}
4442
branch: gh-pages
4543
folder: dist
46-
clean: false # не чистим весь корень, сохраняем подпапки других веток
44+
clean: false
4745

48-
# другие ветки --> gh-pages/<branch>
4946
- name: Deploy branch to subfolder
5047
if: steps.vars.outputs.slug != 'main'
5148
uses: JamesIves/github-pages-deploy-action@v4
@@ -54,4 +51,4 @@ jobs:
5451
branch: gh-pages
5552
folder: dist
5653
target-folder: ${{ steps.vars.outputs.slug }}
57-
clean: true # чистим ТОЛЬКО свою подпапку
54+
clean: true

src/components/Footer/Footer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const Footer = () => {
1414
const [skipRedirect, setSkipRedirect] = useState('ios');
1515
const [featuresType, setFeaturesType] = useState<'none' | 'required' | 'preferred'>('none');
1616

17-
// Состояния для features
1817
const [useSendTransaction, setUseSendTransaction] = useState(false);
1918
const [useSignData, setUseSignData] = useState(false);
2019
const [useSubscription, setUseSubscription] = useState(false);

src/main.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { createRoot } from 'react-dom/client';
66
import App from './App';
77
import './index.scss';
88

9-
// Загружаем eruda только в dev режиме
109
if (import.meta.env.DEV) {
1110
import('eruda').then(({ default: eruda }) => {
1211
eruda.init();

src/polyfills.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Гарантируем глобальный Buffer/alloc и др. методы в браузере
21
import { Buffer as BufferPolyfill } from 'buffer'
32
import process from 'process'
43

@@ -8,7 +7,6 @@ if (!g.Buffer || typeof g.Buffer.alloc !== 'function') {
87
g.Buffer = BufferPolyfill
98
}
109

11-
// если нужен process.env и т.п. (безопасно оставить)
1210
if (!g.process) {
1311
g.process = process
1412
}

vite.config.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,27 @@ import { copyFileSync } from 'node:fs'
77
import { resolve } from 'node:path'
88

99
function getBranch() {
10-
// 1) приоритет у BRANCH_NAME (если передан из CI)
1110
if (process.env.BRANCH_NAME) return process.env.BRANCH_NAME
1211

13-
// 2) локально берём из git
1412
try {
1513
let name = execSync('git rev-parse --abbrev-ref HEAD', {
1614
stdio: ['ignore', 'pipe', 'ignore'],
1715
}).toString().trim()
1816

19-
// если detached HEAD — подставим короткий SHA
2017
if (name === 'HEAD') {
2118
name = execSync('git rev-parse --short HEAD', {
2219
stdio: ['ignore', 'pipe', 'ignore'],
2320
}).toString().trim()
2421
}
2522
return name
2623
} catch {
27-
return 'main' // запасной вариант, если git недоступен
24+
return 'main'
2825
}
2926
}
3027

31-
// опционально: нормализуем под имя папки на Pages
3228
const slugify = (s: string) =>
3329
s.toLowerCase().replace(/[/\s]+/g, '-').replace(/[^a-z0-9._-]/g, '-')
3430

35-
// Плагин для создания 404.html для SPA на GitHub Pages
3631
function create404Plugin() {
3732
return {
3833
name: 'create-404-html',

0 commit comments

Comments
 (0)