Skip to content

Commit

Permalink
chore: use bun.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nopdan committed Mar 8, 2024
1 parent 7c265c0 commit 4ede12b
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 1,581 deletions.
50 changes: 22 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,38 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

# 装 nodejs
- name: Install Node.js
uses: actions/setup-node@v3
# 安装 bun
- uses: oven-sh/setup-bun@v1
with:
node-version: latest
bun-version: latest

# 装 pnpm
- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
- name: Get bun store directory
id: bun-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
cd frontend
echo bun_cache_dir=$(bun pm cache) >> $GITHUB_OUTPUT
cd ..
- name: Setup pnpm cache
- name: Setup bun cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.bun-cache.outputs.bun_cache_dir }}
key: ${{ runner.os }}-bun-store-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ runner.os }}-bun-store-
- name: Build frontend
run: |
cd frontend
bun install
bun run build
cd ..
mv frontend/dist/* pkg/server/dist/
# 安装 go
- uses: actions/setup-go@v3
with:
go-version: ">=1.19.0"
go-version: ">=1.22.0"
check-latest: true

- name: Setup go cache
Expand All @@ -55,14 +57,6 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Build frontend
run: |
cd web
pnpm i
pnpm build
cd ..
mv web/dist/ internal/serve/
# 编译
- name: Build
run: |
Expand All @@ -89,7 +83,7 @@ jobs:
mv CHANGELOG.md bin/
# 上传到 Artifact
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: gosmq
path: ./bin/
27 changes: 21 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# .gitignore
.vscode*
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

build/*/
build/smq*
# Test binary, built with `go test -c`
*.test

*.zip
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

internal/serve/dist
# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

build/
pkg/server/dist/
12 changes: 4 additions & 8 deletions build/build.ps1 → build.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@

cd ../web
pnpm i
pnpm build
cd frontend
bun install
bun run build
cd ..
xcopy web\dist\ internal\serve\dist\ /E /Y
xcopy frontend\dist\ pkg\server\dist\ /E /Y

go mod tidy

Write-Output "编译 windows 版本"
go build -ldflags="-s -w" -o build/smq.exe

cd build

upx .\smq.exe
10 changes: 0 additions & 10 deletions build/dev.ps1

This file was deleted.

3 changes: 3 additions & 0 deletions frontend/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
Binary file added frontend/bun.lockb
Binary file not shown.
25 changes: 0 additions & 25 deletions frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,49 +23,24 @@ declare module '@vue/runtime-core' {
HandComp: typeof import('./src/components/Result/HandComp.vue')['default']
HandsDescription: typeof import('./src/components/Result/HandsDescription.vue')['default']
Input: typeof import('./src/components/Input.vue')['default']
Jisu: typeof import('./src/components/Jisu.vue')['default']
KeyHeatSorted: typeof import('./src/components/Result/KeyHeatSorted.vue')['default']
Main: typeof import('./src/components/Main.vue')['default']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
NDatePicker: typeof import('naive-ui')['NDatePicker']
NDescriptions: typeof import('naive-ui')['NDescriptions']
NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
NDivider: typeof import('naive-ui')['NDivider']
NDrawer: typeof import('naive-ui')['NDrawer']
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
NewText: typeof import('./src/components/NewText.vue')['default']
NFlex: typeof import('naive-ui')['NFlex']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
NGi: typeof import('naive-ui')['NGi']
NGrid: typeof import('naive-ui')['NGrid']
NH2: typeof import('naive-ui')['NH2']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
NInput: typeof import('naive-ui')['NInput']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutFooter: typeof import('naive-ui')['NLayoutFooter']
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NP: typeof import('naive-ui')['NP']
NRadio: typeof import('naive-ui')['NRadio']
NRadioButton: typeof import('naive-ui')['NRadioButton']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
NSelect: typeof import('naive-ui')['NSelect']
NSlider: typeof import('naive-ui')['NSlider']
NSpace: typeof import('naive-ui')['NSpace']
NSwitch: typeof import('naive-ui')['NSwitch']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag']
NText: typeof import('naive-ui')['NText']
NTimePicker: typeof import('naive-ui')['NTimePicker']
NTransfer: typeof import('naive-ui')['NTransfer']
NUpload: typeof import('naive-ui')['NUpload']
NUploadDragger: typeof import('naive-ui')['NUploadDragger']
Result: typeof import('./src/components/Result/Result.vue')['default']
Expand Down
Loading

0 comments on commit 4ede12b

Please sign in to comment.