Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use same version number for web and desktop #932

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ public

# IDE
.vscode/
.idea/
.idea/

# Window metadata files
/desktop/winres/winres.json
/desktop/*.syso
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### ✨ Features and improvements
- Add german translation
- Use same version number for web and desktop versions
- _...Add new stuff here..._

### 🐞 Bug fixes
Expand Down
17 changes: 11 additions & 6 deletions desktop/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
BINARY=maputnik
DESKTOP_VERSION := 1.1.1
EDITOR_VERSION := $(shell node -p "require('../package.json').version")
VERSION := $(shell node -p "require('../package.json').version")
GOPATH := $(if $(GOPATH),$(GOPATH),$(HOME)/go)
GOBIN := $(if $(GOBIN),$(GOBIN),$(HOME)/go/bin)

all: $(BINARY)

$(BINARY): $(GOBIN)/gox $(SOURCES) version.go rice-box.go
$(BINARY): $(GOBIN)/gox $(GOBIN)/go-winres $(SOURCES) version.go rice-box.go winres/winres.json
$(GOBIN)/go-winres make --product-version=$(VERSION)
$(GOBIN)/gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}"

winres/winres.json: winres/winres_template.json
sed 's/{{.Version}}/$(VERSION)/g' winres/winres_template.json > $@

$(GOBIN)/go-winres:
go install github.com/tc-hib/go-winres@latest

# Copy the current release into ./editor/maputnik so it can be
# embedded in the binary
editor/pull_release:
Expand All @@ -23,13 +29,12 @@ $(GOBIN)/gox:
$(GOBIN)/rice:
go install github.com/GeertJohan/go.rice/[email protected]

# Embed the current version numbers in the executable by writing version.go
# Embed the current version number in the executable by writing version.go
.PHONY: version.go
version.go:
@echo "// DO NOT EDIT: Autogenerated by Makefile\n" > version.go
@echo "package main\n" >> version.go
@echo "const DesktopVersion = \"$(DESKTOP_VERSION)\"" >> version.go
@echo "const EditorVersion = \"$(EDITOR_VERSION)\"" >> version.go
@echo "const Version = \"$(VERSION)\"" >> version.go

rice-box.go: $(GOBIN)/rice editor/pull_release
$(GOBIN)/rice embed-go
Expand Down
17 changes: 9 additions & 8 deletions desktop/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Maputnik Desktop [![GitHub CI status](https://github.com/maplibre/maputnik/workflows/ci/badge.svg)][github-action-ci]

---

A Golang based cross platform executable for integrating Maputnik locally.
Expand All @@ -11,7 +12,7 @@ Report issues on [maplibre/maputnik](https://github.com/maplibre/maputnik).

## Install

You can download a single binary for Linux, OSX or Windows from [the latest releases of **maplibre/maputnik**](https://github.com/maplibre/maputnik/editor/releases/latest).
You can download a zip file containing desktop binaries for Linux, OSX and Windows from [the latest releases of **maplibre/maputnik**](https://github.com/maplibre/maputnik/releases/latest).

### Usage

Expand Down Expand Up @@ -53,12 +54,12 @@ maputnik --static ./localFolder

`maputnik` exposes the configured styles via a HTTP API.

| Method | Description
|---------------------------------|---------------------------------------
| `GET /styles` | List the ID of all configured style files
| `GET /styles/{filename}` | Get contents of a single style file
| `PUT /styles/{filename}` | Update contents of a style file
| `WEBSOCKET /ws` | Listen to change events for the configured style files
| Method | Description |
| ------------------------ | ------------------------------------------------------ |
| `GET /styles` | List the ID of all configured style files |
| `GET /styles/{filename}` | Get contents of a single style file |
| `PUT /styles/{filename}` | Update contents of a style file |
| `WEBSOCKET /ws` | Listen to change events for the configured style files |

### Build

Expand All @@ -69,4 +70,4 @@ npm install
npm run build-desktop
```

You should now find the `maputnik` binary in your `bin` directory.
You should now find the `maputnik` binary in your `desktop/bin` directory.
2 changes: 1 addition & 1 deletion desktop/maputnik.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {
app := cli.NewApp()
app.Name = "maputnik"
app.Usage = "Server for integrating Maputnik locally"
app.Version = "Editor: " + EditorVersion + "; Desktop: " + DesktopVersion
app.Version = Version

app.Flags = []cli.Flag{
&cli.StringFlag{
Expand Down
60 changes: 60 additions & 0 deletions desktop/winres/winres_template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"RT_GROUP_ICON": {
"APP": {
"0000": [
"../../src/img/maputnik.png"
]
}
},
"RT_MANIFEST": {
"#1": {
"0409": {
"identity": {
"name": "Maputnik",
"version": "{{.Version}}"
},
"description": "A MapLibre GL visual style editor",
"minimum-os": "win7",
"execution-level": "as invoker",
"ui-access": false,
"auto-elevate": false,
"dpi-awareness": "system",
"disable-theming": false,
"disable-window-filtering": false,
"high-resolution-scrolling-aware": false,
"ultra-high-resolution-scrolling-aware": false,
"long-path-aware": false,
"printer-driver-isolation": false,
"gdi-scaling": false,
"segment-heap": false,
"use-common-controls-v6": false
}
}
},
"RT_VERSION": {
"#1": {
"0000": {
"fixed": {
"file_version": "{{.Version}}",
"product_version": "{{.Version}}"
},
"info": {
"0409": {
"Comments": "https://github.com/maplibre/maputnik",
"CompanyName": "Maputnik",
"FileDescription": "A MapLibre GL visual style editor",
"FileVersion": "{{.Version}}",
"InternalName": "Maputnik",
"LegalCopyright": "MIT License",
"LegalTrademarks": "",
"OriginalFilename": "Maputnik.exe",
"PrivateBuild": "",
"ProductName": "Maputnik",
"ProductVersion": "{{.Version}}",
"SpecialBuild": ""
}
}
}
}
}
}
Loading