mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-02-09 13:47:17 +02:00
Cleaned up the build script
No more commented out code, and the finished product actually runs now. Also updated the readme to reflect the new build rules.
This commit is contained in:
parent
f3da424820
commit
89031c1bab
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,3 +7,5 @@ conf.json
|
||||
*.exe
|
||||
build/
|
||||
npm-debug.log
|
||||
ui/package-lock.json
|
||||
build/
|
||||
|
66
Makefile
66
Makefile
@ -1,29 +1,49 @@
|
||||
# Build tool for Factorio Server Manager
|
||||
#
|
||||
|
||||
NODE_ENV:=production
|
||||
|
||||
build:
|
||||
# make sure this project is located within GOPATH, I.E. $GOPATH/src/factorio-server-manager
|
||||
#TODO add support for a mac build maybe?
|
||||
UNAME := $(shell uname)
|
||||
ifeq ($(UNAME), Linux)
|
||||
release := build/factorio-server-manager-linux.zip
|
||||
else
|
||||
release := build/factorio-server-manager-windows.zip
|
||||
endif
|
||||
|
||||
# Build Linux release
|
||||
mkdir build
|
||||
GOOS=linux GOARCH=amd64 go build -o factorio-server-manager/factorio-server-manager factorio-server-manager/src
|
||||
# ui/node_modules/webpack/bin/webpack.js ui/webpack.config.js app/bundle.js --progress --profile --colors
|
||||
cp -r app/ factorio-server-manager/
|
||||
cp conf.json.example factorio-server-manager/conf.json
|
||||
zip -r build/factorio-server-manager-linux-x64.zip factorio-server-manager
|
||||
rm -rf factorio-server-manager
|
||||
# Build Windows release
|
||||
GOOS=windows GOARCH=386 go build -o factorio-server-manager/factorio-server-manager.exe factorio-server-manager/src
|
||||
cp -r app/ factorio-server-manager/
|
||||
cp conf.json.example factorio-server-manager/conf.json
|
||||
zip -r build/factorio-server-manager-windows.zip factorio-server-manager
|
||||
rm -rf factorio-server-manager
|
||||
build: $(release)
|
||||
|
||||
dev:
|
||||
mkdir dev
|
||||
GOOS=linux GOARCH=amd64 go build -o factorio-server-linux/factorio-server-manager factorio-server-manager/src
|
||||
cp -r app/ dev/
|
||||
cp conf.json.example dev/conf.json
|
||||
mv factorio-server-linux/factorio-server-manager dev/factorio-server-manager
|
||||
$(shell mkdir -p build)
|
||||
build/factorio-server-manager-%.zip: app/bundle.js factorio-server-manager-%
|
||||
@echo "Packaging Build - $@"
|
||||
@cp -r app/ factorio-server-manager/
|
||||
@cp conf.json.example factorio-server-manager/conf.json
|
||||
@zip -r $@ factorio-server-manager > /dev/null
|
||||
@rm -r factorio-server-manager
|
||||
|
||||
app/bundle.js:
|
||||
@echo "Building Frontend"
|
||||
@cd ui && npm install && npm run build
|
||||
|
||||
factorio-server-manager-linux: godeps
|
||||
@echo "Building Backend - Linux"
|
||||
@GOPATH="${GOPATH}:${PDW}"
|
||||
@mkdir -p factorio-server-manager
|
||||
@GOOS=linux GOARCH=amd64 go build -o factorio-server-manager/factorio-server-manager ./src
|
||||
|
||||
factorio-server-manager-windows: godeps
|
||||
@echo "Building Backend - Windows"
|
||||
@GOPATH="${GOPATH}:${PDW}"
|
||||
@mkdir -p factorio-server-manager
|
||||
@GOOS=windows GOARCH=386 go build -o factorio-server-manager/factorio-server-manager.exe ./src
|
||||
|
||||
godeps:
|
||||
@echo "Installing Packages"
|
||||
@cat gopkglist | xargs go get
|
||||
|
||||
gen_release: build/factorio-server-manager-linux.zip build/factorio-server-manager-windows.zip
|
||||
@echo "Done"
|
||||
|
||||
clean:
|
||||
@echo "Cleaning"
|
||||
@rm -r build/
|
||||
@rm app/bundle.js
|
||||
|
24
README.md
24
README.md
@ -87,19 +87,23 @@ All api actions are accessible with the /api route. The frontend is accessible
|
||||
+ Go 1.6
|
||||
+ NodeJS 4.2.6
|
||||
|
||||
#### Building the Go backend
|
||||
Go Application which manages the Factorio server.
|
||||
|
||||
API requests for managing the Factorio server are sent to /api.
|
||||
|
||||
The frontend code is served by a HTTP file server running on /.
|
||||
#### Building Releases
|
||||
Creates a release zip for windows and linux: (this will install the dependencies listed in gopkgdeps)
|
||||
```
|
||||
git clone https://github.com/MajorMJR/factorio-server-manager.git
|
||||
cd factorio-server-manager
|
||||
make build
|
||||
make gen_release
|
||||
```
|
||||
|
||||
#### Building the React frontend
|
||||
#### Building a Testing Binary:
|
||||
```
|
||||
git clone https://github.com/MajorMJR/factorio-server-manager.git
|
||||
cd factorio-server-manager
|
||||
make
|
||||
./factorio-server-manager/factorio-server-manager
|
||||
```
|
||||
|
||||
#### Building the React Frontend alone
|
||||
Frontend is built using React and the AdminLTE CSS framework. See app/dist/ for AdminLTE included files and license.
|
||||
|
||||
The root of the UI application is served at app/index.html. Run the npm build script and the Go application during development to get live rebuilding of the UI code.
|
||||
@ -108,9 +112,7 @@ All necessary CSS and Javascript files are included for running the UI.
|
||||
|
||||
Transpiled bundle.js application is output to app/bundle.js, 'npm run build' script starts webpack to build the React application for development.
|
||||
```
|
||||
cd ui/
|
||||
npm install
|
||||
npm run build
|
||||
make app/bundle.js
|
||||
```
|
||||
|
||||
### Building for Windows
|
||||
|
Loading…
x
Reference in New Issue
Block a user