1
0
forked from MTSR/mapserver

public/static cleanup

This commit is contained in:
BuckarooBanzay 2021-04-12 13:07:17 +02:00
parent 4eccd1edd6
commit 6639db1d2b
5 changed files with 9 additions and 28 deletions

View File

@ -13,11 +13,5 @@ jobs:
with:
go-version: '1.16'
- name: get
run: go get github.com/mjibson/esc
- name: generate
run: go generate
- name: test
run: go test ./...

View File

@ -17,4 +17,4 @@ jobs:
run: sudo npm i -g jshint
- name: jshint run
run: cd static/js && jshint
run: cd public/js && jshint

View File

@ -1,4 +1,3 @@
STATIC_VFS=vfs/static.go
OUT_DIR=output
VERSION=git-$(shell git rev-parse HEAD)
@ -14,9 +13,9 @@ BINARIES += $(OUT_DIR)/mapserver-windows-x86.exe
BINARIES += $(OUT_DIR)/mapserver-windows-x86-64.exe
BINARIES += $(OUT_DIR)/mapserver-linux-arm
JS_BUNDLE = static/js/bundle.js
JS_BUNDLE = public/js/bundle.js
all: $(STATIC_VFS) $(OUT_DIR)/mapserver-linux-x86_64
all: $(OUT_DIR)/mapserver-linux-x86_64
$(OUT_DIR):
mkdir $@
@ -25,22 +24,18 @@ fmt:
go fmt ./...
test: $(OUT_DIR)
go generate
go vet ./...
go test ./...
clean:
rm -rf $(STATIC_VFS) $(JS_BUNDLE) test-output
rm -rf $(JS_BUNDLE) test-output
rm -rf $(OUT_DIR)
jshint:
cd static/js && jshint .
cd public/js && jshint .
$(JS_BUNDLE):
cd static/js && rollup -c rollup.config.js
$(STATIC_VFS): $(JS_BUNDLE)
go generate
cd public/js && rollup -c rollup.config.js
$(OUT_DIR)/mapserver-linux-x86_64: $(OUT_DIR)
# native (linux x86_64)
@ -76,4 +71,4 @@ builder_image:
# build the docker image with all dependencies
$(MAKE) -C docker_builder build
release-all: $(STATIC_VFS) $(BINARIES)
release-all: $(BINARIES)

View File

@ -15,16 +15,12 @@ Ubuntu install: https://github.com/golang/go/wiki/Ubuntu
Generate the js bundle for the frontend:
```
cd static/js
cd public/js
rollup -c rollup.config.js
```
Generate the `mapserver` binary:
```bash
# generate the static web files
# this step embeds the generated js/css/html files for inclusion in the resulting binary
go generate
# build the binary for the current playtform
go build

View File

@ -50,16 +50,12 @@ pgsql_connection = host=localhost port=5432 user=postgres password=enter dbname=
pgsql_player_connection = host=localhost port=5432 user=postgres password=enter dbname=postgres
```
## Generate the static files (webserver vfs)
* Create the vfs (in `vfs/static.go`) with `go generate`
## Running the server
* Create a `mapserver.json` with `go run . -createconfig`
* Change the value `webdev` in the `mapserver.json` to `true`
* Start the server with `go run .` or with debug output: `go run . -debug`
* The web files in `static/` can now be changed on the fly without restarting the server
* The web files in `public/` can now be changed on the fly without restarting the server
# All platform build