forked from mlogclub/bbs-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·61 lines (47 loc) · 1.14 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
### 构建要求
### 1. go >= 1.13
### 2. node >= 8
baseDir=`echo $PWD`
serverDir=`echo $baseDir/server`
siteDir=`echo $baseDir/site`
distDir=`echo $baseDir/dist`
# go version
# go env
# echo $baseDir
# echo $serverDir
# echo $siteDir
funcBuildServer() {
echo 'server module building...'
export GOPROXY=https://goproxy.cn
cd $serverDir
go mod download
go build
echo 'server module building...finished'
}
funcBuildSite() {
echo 'site module building...'
cd $siteDir
npm install --registry=https://registry.npm.taobao.org
npm run build
echo 'site module building...finished'
}
funcTouchDir() {
if [ ! -d "$1" ]; then
mkdir -p $1
fi
}
funcCleanBuild() {
rm -rf $distDir/*
funcTouchDir $distDir/server
funcTouchDir $distDir/site
cp $serverDir/bbs-go $distDir/server/
cp -r $siteDir/.nuxt $distDir/site/
cp -r $siteDir/static $distDir/site/
cp -r $siteDir/nuxt.config.js $distDir/site/
cp -r $siteDir/package.json $distDir/site/
}
funcBuildServer
funcBuildSite
funcCleanBuild
echo 'done!!!'