Compare commits

..

5 Commits

Author SHA1 Message Date
github-actions[bot] 4dd34e99fd Bump version to 2.1.0 (#925)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action

---------

Co-authored-by: HarelM <3269297+HarelM@users.noreply.github.com>
Co-authored-by: Harel M <harel.mazor@gmail.com>
2024-08-29 20:22:26 +03:00
dependabot[bot] 3773acd5be Bump micromatch from 4.0.5 to 4.0.8 (#923)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5
to 4.0.8.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/micromatch/releases">micromatch's
releases</a>.</em></p>
<blockquote>
<h2>4.0.8</h2>
<p>Ultimate release that fixes both CVE-2024-4067 and CVE-2024-4068. We
consider the issues low-priority, so even if you see automated scanners
saying otherwise, don't be scared.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md">micromatch's
changelog</a>.</em></p>
<blockquote>
<h2>[4.0.8] - 2024-08-22</h2>
<ul>
<li>backported CVE-2024-4067 fix (from v4.0.6) over to 4.x branch</li>
</ul>
<h2>[4.0.7] - 2024-05-22</h2>
<ul>
<li>this is basically v4.0.5, with some README updates</li>
<li><strong>it is vulnerable to CVE-2024-4067</strong></li>
<li>Updated braces to v3.0.3 to avoid CVE-2024-4068</li>
<li>does NOT break API compatibility</li>
</ul>
<h2>[4.0.6] - 2024-05-21</h2>
<ul>
<li>Added <code>hasBraces</code> to check if a pattern contains
braces.</li>
<li>Fixes CVE-2024-4067</li>
<li><strong>BREAKS API COMPATIBILITY</strong></li>
<li>Should be labeled as a major release, but it's not.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/micromatch/micromatch/commit/8bd704ec0d9894693d35da425d827819916be920"><code>8bd704e</code></a>
4.0.8</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/a0e68416a44da10f3e4e30845ab95af4fd286d5a"><code>a0e6841</code></a>
run verb to generate README documentation</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/4ec288484f6e8cccf597ad3d43529c31d0f7a02a"><code>4ec2884</code></a>
Merge branch 'v4' into hauserkristof-feature/v4.0.8</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/03aa8052171e878897eee5d7bb2ae0ae83ec2ade"><code>03aa805</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/micromatch/issues/266">#266</a>
from hauserkristof/feature/v4.0.8</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/814f5f70efcd100ca9d29198867812a3d6ab91a8"><code>814f5f7</code></a>
lint</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/67fcce6a1077c2faf5ad0c5f998fa70202cc5dae"><code>67fcce6</code></a>
fix: CHANGELOG about braces &amp; CVE-2024-4068, v4.0.5</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/113f2e3fa7cb30b429eda7c4c38475a8e8ba1b30"><code>113f2e3</code></a>
fix: CVE numbers in CHANGELOG</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/d9dbd9a266686f44afb38da26fe016f96d1ec04f"><code>d9dbd9a</code></a>
feat: updated CHANGELOG</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/2ab13157f416679f54e3a32b1425e184bd16749e"><code>2ab1315</code></a>
fix: use actions/setup-node@v4</li>
<li><a
href="https://github.com/micromatch/micromatch/commit/1406ea38f3e24b29f4d4f46908d5cffcb3e6c4ce"><code>1406ea3</code></a>
feat: rework test to work on macos with node 10,12 and 14</li>
<li>Additional commits viewable in <a
href="https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=micromatch&package-manager=npm_and_yarn&previous-version=4.0.5&new-version=4.0.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/maplibre/maputnik/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 20:13:19 +03:00
Kevin Schaul 6887d70194 Make build scripts executable (#924)
Hopefully will fix CI issue merged in #922

cc @HarelM
2024-08-29 19:52:56 +03:00
Kevin Schaul 66c5a5c953 Update desktop build to pull from this repo (#922)
Previously the desktop build lived in a separate repo and had to
download a released version of the maputnik editor source code. Now that
both live in the same repo, the desktop version can simply run the
maputnik build command and use those generated files.

This commit also removes the ci-desktop workflow, which is not needed.
The regular ci workflow already built the desktop version (this commit
also fixes that build).

Fixes #919

If this works for you all, it would be lovely to create a new tag or
release on GitHub for two reasons:
1. So the latest binaries are easier to locate, and
2. So I can update my [submission to
homebrew](https://github.com/Homebrew/homebrew-core/commit/6e536ff007ef0bea5a3591af5678eb3152908cc9)
to make installation easier (for os x users at least)
2024-08-29 17:07:24 +03:00
Harel M 8184ac8393 Update geocoder to 1.6.0 (#920)
This is to update geocoder to latest version which now have types and is
fully modernized.
2024-08-21 08:56:59 +03:00
26 changed files with 349 additions and 201 deletions
+11
View File
@@ -0,0 +1,11 @@
## Launch Checklist
<!-- Thanks for the PR! Feel free to add or remove items from the checklist. -->
- [ ] Briefly describe the changes in this PR.
- [ ] Link to related issues.
- [ ] Include before/after visuals or gifs if this PR includes visual changes.
- [ ] Write tests for all new functionality.
- [ ] Add an entry to `CHANGELOG.md` under the `## main` section.
-52
View File
@@ -1,52 +0,0 @@
name: ci-desktop
on: [ push ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./desktop
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Make
run: make
- name: Test --help
run: ./bin/linux/maputnik --help
- name: Test --version
run: ./bin/linux/maputnik --version
- name: Get style
run: wget https://maputnik.github.io/osm-liberty/style.json
- name: Test --watch
run: ./bin/linux/maputnik --watch --file style.json & sleep 5; kill $!
- name: Artifacts/linux
uses: actions/upload-artifact@v3
with:
name: maputnik-linux
path: ./desktop/bin/linux/
- name: Artifacts/darwin
uses: actions/upload-artifact@v3
with:
name: maputnik-darwin
path: ./desktop/bin/darwin/
- name: Artifacts/windows
uses: actions/upload-artifact@v3
with:
name: maputnik-windows
path: ./desktop/bin/windows/
+12 -18
View File
@@ -54,45 +54,39 @@ jobs:
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- name: artifacts/maputnik - name: artifacts/maputnik
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v4
with: with:
name: maputnik name: maputnik
path: dist path: dist
# Build and upload desktop CLI artifacts # Build and upload desktop CLI artifacts
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v3 uses: actions/setup-go@v5
with: with:
go-version: ^1.19.x go-version: ^1.23.x
cache-dependency-path: desktop/go.sum
id: go id: go
- name: Check out code into the Go module directory - name: Build desktop artifacts
uses: actions/checkout@v4 run: npm run build-desktop
with:
repository: maputnik/desktop
ref: master
path: ./src/github.com/maputnik/desktop/
- name: Make
run: cd src/github.com/maputnik/desktop/ && make
- name: Artifacts/linux - name: Artifacts/linux
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v4
with: with:
name: maputnik-linux name: maputnik-linux
path: ./src/github.com/maputnik/desktop/bin/linux/ path: ./desktop/bin/linux/
- name: Artifacts/darwin - name: Artifacts/darwin
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v4
with: with:
name: maputnik-darwin name: maputnik-darwin
path: ./src/github.com/maputnik/desktop/bin/darwin/ path: ./desktop/bin/darwin/
- name: Artifacts/windows - name: Artifacts/windows
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v4
with: with:
name: maputnik-windows name: maputnik-windows
path: ./src/github.com/maputnik/desktop/bin/windows/ path: ./desktop/bin/windows/
e2e-tests: e2e-tests:
name: "E2E tests using ${{ matrix.browser }}" name: "E2E tests using ${{ matrix.browser }}"
@@ -0,0 +1,39 @@
name: Create bump version PR
on:
workflow_dispatch:
inputs:
version:
description: Version to change to.
required: true
type: string
jobs:
bump-version-pr:
name: Bump version PR
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Use Node.js from nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Bump version
run: |
npm version --commit-hooks false --git-tag-version false ${{ inputs.version }}
./build/bump-version-changelog.js ${{ inputs.version }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Bump version to ${{ inputs.version }}
branch: bump-version-to-${{ inputs.version }}
title: Bump version to ${{ inputs.version }}
+104
View File
@@ -0,0 +1,104 @@
name: Release
on:
push:
branches: [main]
workflow_dispatch:
jobs:
release-check:
name: Check if version changed
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Use Node.js from nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2
outputs:
publish: ${{ steps.check.outputs.changed }}
release:
name: Release
needs: release-check
if: ${{ needs.release-check.outputs.publish == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Use Node.js from nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
- name: Set up Go for desktop build
uses: actions/setup-go@v5
with:
go-version: ^1.23.x
cache-dependency-path: desktop/go.sum
id: go
- name: Get version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Install
run: npm ci
- name: Build
run: |
npm run build
npm run build-desktop
- name: Tag commit and push
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.package-version.outputs.current-version }}
- name: Create Archives
run: |
zip -r dist dist
zip -r desktop desktop/bin/
- name: Build Release Notes
id: release_notes
run: |
RELEASE_NOTES_PATH="${PWD}/release_notes.txt"
./build/release-notes.js > ${RELEASE_NOTES_PATH}
echo "release_notes=${RELEASE_NOTES_PATH}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
id: create_regular_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
bodyFile: ${{ steps.release_notes.outputs.release_notes }}
artifacts: "dist.zip,desktop.zip"
allowUpdates: true
draft: false
prerelease: false
+1 -1
View File
@@ -33,6 +33,6 @@ node_modules
public public
/errorShots /errorShots
/old /old
/build
/cypress/screenshots /cypress/screenshots
/dist/ /dist/
/desktop/version.go
+24
View File
@@ -0,0 +1,24 @@
## main
### ✨ Features and improvements
- _...Add new stuff here..._
### 🐞 Bug fixes
- _...Add new stuff here..._
## 2.1.0
### ✨ Features and improvements
- Add GitHub workflows for releasing new versions
- Update desktop build to pull from this repo (#922)
## 2.0.0
- Update MapLibre to version 4 (#872)
- Start continuous deployment of maputnik website
## 1.7.0
- See release notes at https://maputnik.github.io/blog/2020/04/23/release-v1.7.0
+10 -10
View File
@@ -70,16 +70,6 @@ npm run lint-css
npm run sort-styles npm run sort-styles
``` ```
Update the translation files (run this whenever touching user-facing strings).
After running, check your working copy for files and add/correct as needed.
```
npm run i18n:refresh
```
You can test the UI in different languages using the dropdown in the top menu
(Maputnik does not automatically localize based on browser language settings
at the moment).
## Tests ## Tests
For E2E testing we use [Cypress](https://www.cypress.io/) For E2E testing we use [Cypress](https://www.cypress.io/)
@@ -104,6 +94,16 @@ You can also see the tests as they run or select which suites to run by executin
npm run cy:open npm run cy:open
``` ```
## Release process
1. Review [`CHANGELOG.md`](/CHANGELOG.md)
- Double-check that all changes included in the release are appropriately documented.
- To-be-released changes should be under the "main" header.
- Commit any final changes to the changelog.
2. Run [Create bump version PR](https://github.com/maplibre/maputnik/actions/workflows/create-bump-version-pr.yml) by manual workflow dispatch and set the version number in the input. This will create a PR that changes the changelog and `package.json` file to review and merge.
3. Once merged, an automatic process will kick in and creates a GitHub release and uploads release assets.
## Sponsors ## Sponsors
Thanks to the supporters of the **[Kickstarter campaign](https://www.kickstarter.com/projects/174808720/maputnik-visual-map-editor-for-mapbox-gl)**. This project would not be possible without these commercial and individual sponsors. Thanks to the supporters of the **[Kickstarter campaign](https://www.kickstarter.com/projects/174808720/maputnik-visual-map-editor-for-mapbox-gl)**. This project would not be possible without these commercial and individual sponsors.
+11
View File
@@ -0,0 +1,11 @@
# Build Scripts
This folder holds common build scripts used by some of the Github workflows.
The scripts are borrowed from [maplibre/maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js/tree/bc70bc559cea5c987fa1b79fd44766cef68bbe28/build).
## Generate Release Notes
`bump-version-changelog.js` Used to update the changelog with the current notes, and set up a space for new notes
`release-notes.js` Used to generate release notes when releasing a new version
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env node
/**
* This script updates the changelog.md file with the version given in the arguments
* It replaces ## main with ## <version>
* Removes _...Add new stuff here..._
* And adds on top a ## main with add stuff here.
*
* Copied from maplibre/maplibre-gl-js
* https://github.com/maplibre/maplibre-gl-js/blob/bc70bc559cea5c987fa1b79fd44766cef68bbe28/build/release-notes.js
*/
import * as fs from 'fs';
const changelogPath = 'CHANGELOG.md';
let changelog = fs.readFileSync(changelogPath, 'utf8');
changelog = changelog.replace('## main', `## ${process.argv[2]}`);
changelog = changelog.replaceAll('- _...Add new stuff here..._\n', '');
changelog = `## main
### ✨ Features and improvements
- _...Add new stuff here..._
### 🐞 Bug fixes
- _...Add new stuff here..._
` + changelog;
fs.writeFileSync(changelogPath, changelog, 'utf8');
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env node
// Copied from maplibre/maplibre-gl-js
// https://github.com/maplibre/maplibre-gl-js/blob/bc70bc559cea5c987fa1b79fd44766cef68bbe28/build/release-notes.js
import * as fs from 'fs';
const changelogPath = 'CHANGELOG.md';
const changelog = fs.readFileSync(changelogPath, 'utf8');
/*
Parse the raw changelog text and split it into individual releases.
This regular expression:
- Matches lines starting with "## x.x.x".
- Groups the version number.
- Skips the (optional) release date.
- Groups the changelog content.
- Ends when another "## x.x.x" is found.
*/
const regex = /^## (\d+\.\d+\.\d+.*?)\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms;
let releaseNotes = [];
let match;
// eslint-disable-next-line no-cond-assign
while (match = regex.exec(changelog)) {
releaseNotes.push({
'version': match[1],
'changelog': match[2].trim(),
});
}
const latest = releaseNotes[0];
const previous = releaseNotes[1];
// Print the release notes template.
let header = 'Changes since previous version'
if (previous) {
header = `https://github.com/maplibre/maputnik
[Changes](https://github.com/maplibre/maputnik/compare/v${previous.version}...v${latest.version}) since [Maputnik v${previous.version}](https://github.com/maplibre/maputnik/releases/tag/v${previous.version})`
}
const templatedReleaseNotes = `${header}
${latest.changelog}
// eslint-disable-next-line eol-last
process.stdout.write(templatedReleaseNotes.trimEnd());
-12
View File
@@ -160,18 +160,6 @@ describe("modals", () => {
).shouldInclude({ "maputnik:thunderforest_access_token": apiKey }); ).shouldInclude({ "maputnik:thunderforest_access_token": apiKey });
}); });
it("stadia access token", () => {
let apiKey = "testing123";
when.setValue(
"modal:settings.maputnik:stadia_access_token",
apiKey
);
when.click("modal:settings.name");
then(
get.styleFromLocalStorage().then((style) => style.metadata)
).shouldInclude({ "maputnik:stadia_access_token": apiKey });
});
it("style renderer", () => { it("style renderer", () => {
cy.on("uncaught:exception", () => false); // this is due to the fact that this is an invalid style for openlayers cy.on("uncaught:exception", () => false); // this is due to the fact that this is an invalid style for openlayers
when.select("modal:settings.maputnik:renderer", "ol"); when.select("modal:settings.maputnik:renderer", "ol");
+16 -8
View File
@@ -1,21 +1,21 @@
SOURCEDIR=. SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go') SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
BINARY=maputnik BINARY=maputnik
EDITOR_VERSION ?= v1.7.0 DESKTOP_VERSION := 1.1.1
EDITOR_VERSION := $(shell node -p "require('../package.json').version")
GOPATH := $(if $(GOPATH),$(GOPATH),$(HOME)/go) GOPATH := $(if $(GOPATH),$(GOPATH),$(HOME)/go)
GOBIN := $(if $(GOBIN),$(GOBIN),$(HOME)/go/bin) GOBIN := $(if $(GOBIN),$(GOBIN),$(HOME)/go/bin)
all: $(BINARY) all: $(BINARY)
$(BINARY): $(GOBIN)/gox $(SOURCES) rice-box.go $(BINARY): $(GOBIN)/gox $(SOURCES) version.go rice-box.go
$(GOBIN)/gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}" $(GOBIN)/gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}"
editor/create_folder: # Copy the current release into ./editor/maputnik so it can be
# embedded in the binary
editor/pull_release:
mkdir -p editor mkdir -p editor
cp -r ../dist/* editor
editor/pull_release: editor/create_folder
# if the directory /home/runner/work/editor/editor/build/build exists, we assume that we are are running the makefile within the editor ci workflow
test -d /home/runner/work/editor/editor/build/build && echo "exists" && cd editor && cp -R /home/runner/work/editor/editor/build/build public/ || (echo "does not exist" && cd editor && rm -rf public && curl -L https://github.com/maputnik/editor/releases/download/$(EDITOR_VERSION)/public.zip --output public.zip && unzip public.zip && rm public.zip)
$(GOBIN)/gox: $(GOBIN)/gox:
go install github.com/mitchellh/gox@v1.0.1 go install github.com/mitchellh/gox@v1.0.1
@@ -23,9 +23,17 @@ $(GOBIN)/gox:
$(GOBIN)/rice: $(GOBIN)/rice:
go install github.com/GeertJohan/go.rice/rice@v1.0.3 go install github.com/GeertJohan/go.rice/rice@v1.0.3
# Embed the current version numbers 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
rice-box.go: $(GOBIN)/rice editor/pull_release rice-box.go: $(GOBIN)/rice editor/pull_release
$(GOBIN)/rice embed-go $(GOBIN)/rice embed-go
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf editor/public && rm -f rice-box.go && rm -rf bin rm -rf editor && rm -f rice-box.go && rm -rf bin
+7 -13
View File
@@ -1,18 +1,17 @@
# Maputnik Desktop [![GitHub CI status](https://github.com/maputnik/desktop/workflows/ci/badge.svg)](https://github.com/maputnik/desktop/actions?query=workflow%3Aci) # 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. A Golang based cross platform executable for integrating Maputnik locally.
This binary packages up the JavaScript and CSS bundle produced by [maputnik/editor](https://github.com/maputnik/desktop) This binary packages up the JavaScript and CSS bundle produced by maputnik
and embeds it in the program for easy distribution. It also allows and embeds it in the program for easy distribution. It also allows
exposing a local style file and work on it both in Maputnik and with your favorite exposing a local style file and work on it both in Maputnik and with your favorite
editor. editor.
Report issues on [maputnik/editor](https://github.com/maputnik/editor). Report issues on [maplibre/maputnik](https://github.com/maplibre/maputnik).
## Install ## Install
You can download a single binary for Linux, OSX or Windows from [the latest releases of **maputnik/editor**](https://github.com/maputnik/editor/releases/latest). 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).
### Usage ### Usage
@@ -63,16 +62,11 @@ maputnik --static ./localFolder
### Build ### Build
Clone the repository. Make sure you clone it into the correct directory `$GOPATH/src/github.com/maputnik`. From the root of the [maplibre/maputnik](https://github.com/maplibre/maputnik) project, install the deps and run the desktop-build command.
``` ```
git clone git@github.com:maputnik/desktop.git npm install
``` npm run build-desktop
Run `make` to install the 3rd party dependencies and build the `maputnik` binary embedding the editor.
```
make
``` ```
You should now find the `maputnik` binary in your `bin` directory. You should now find the `maputnik` binary in your `bin` directory.
+2 -2
View File
@@ -17,7 +17,7 @@ func main() {
app := cli.NewApp() app := cli.NewApp()
app.Name = "maputnik" app.Name = "maputnik"
app.Usage = "Server for integrating Maputnik locally" app.Usage = "Server for integrating Maputnik locally"
app.Version = "Editor: 1.7.0; Desktop: 1.1.0" app.Version = "Editor: " + EditorVersion + "; Desktop: " + DesktopVersion
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
@@ -40,7 +40,7 @@ func main() {
} }
app.Action = func(c *cli.Context) error { app.Action = func(c *cli.Context) error {
gui := http.FileServer(rice.MustFindBox("editor/public").HTTPBox()) gui := http.FileServer(rice.MustFindBox("editor").HTTPBox())
router := mux.NewRouter().StrictSlash(true) router := mux.NewRouter().StrictSlash(true)
+13 -12
View File
@@ -1,16 +1,16 @@
{ {
"name": "maputnik", "name": "maputnik",
"version": "2.0.0", "version": "2.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "maputnik", "name": "maputnik",
"version": "2.0.0", "version": "2.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@mapbox/mapbox-gl-rtl-text": "^0.2.3", "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@maplibre/maplibre-gl-geocoder": "^1.5.0", "@maplibre/maplibre-gl-geocoder": "^1.6.0",
"@maplibre/maplibre-gl-inspect": "^1.6.3", "@maplibre/maplibre-gl-inspect": "^1.6.3",
"@maplibre/maplibre-gl-style-spec": "^20.1.1", "@maplibre/maplibre-gl-style-spec": "^20.1.1",
"@mdi/js": "^7.4.47", "@mdi/js": "^7.4.47",
@@ -1626,20 +1626,21 @@
} }
}, },
"node_modules/@maplibre/maplibre-gl-geocoder": { "node_modules/@maplibre/maplibre-gl-geocoder": {
"version": "1.5.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-geocoder/-/maplibre-gl-geocoder-1.5.0.tgz", "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-geocoder/-/maplibre-gl-geocoder-1.6.0.tgz",
"integrity": "sha512-PsAbV7WFIOu5QYZne95FiXoV7AV1/6ULMjQxgInhZ5DdB0hDLjciQPegnyDgkzI8JfeqoUMZVS/MglZnSZYhyQ==", "integrity": "sha512-SU4cv1P+8ALZlGYLPNvlENadH4zzn8Lw5ajmhbmJgWdC/NzxGFS+u4TITSL8tjzhMFU4jepo42HvNmGtDJjFuQ==",
"dependencies": { "dependencies": {
"events": "^3.3.0",
"lodash.debounce": "^4.0.6", "lodash.debounce": "^4.0.6",
"subtag": "^0.5.0", "subtag": "^0.5.0",
"suggestions-list": "^0.0.2", "suggestions-list": "^0.0.2",
"xtend": "^4.0.1" "xtend": "^4.0.1"
}, },
"engines": { "engines": {
"node": ">=6" "node": ">=18"
}, },
"peerDependencies": { "peerDependencies": {
"maplibre-gl": ">=1.14.0" "maplibre-gl": ">=4.0.0"
} }
}, },
"node_modules/@maplibre/maplibre-gl-inspect": { "node_modules/@maplibre/maplibre-gl-inspect": {
@@ -7733,11 +7734,11 @@
} }
}, },
"node_modules/micromatch": { "node_modules/micromatch": {
"version": "4.0.5", "version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dependencies": { "dependencies": {
"braces": "^3.0.2", "braces": "^3.0.3",
"picomatch": "^2.3.1" "picomatch": "^2.3.1"
}, },
"engines": { "engines": {
+3 -2
View File
@@ -1,12 +1,13 @@
{ {
"name": "maputnik", "name": "maputnik",
"version": "2.0.0", "version": "2.1.0",
"description": "A MapLibre GL visual style editor", "description": "A MapLibre GL visual style editor",
"type": "module", "type": "module",
"main": "''", "main": "''",
"scripts": { "scripts": {
"start": "vite", "start": "vite",
"build": "tsc && vite build --base=/maputnik/", "build": "tsc && vite build --base=/maputnik/",
"build-desktop": "tsc && vite build --base=/ && cd desktop && make",
"i18n:refresh": "i18next 'src/**/*.{ts,tsx,js,jsx}'", "i18n:refresh": "i18next 'src/**/*.{ts,tsx,js,jsx}'",
"lint": "eslint ./src ./cypress --ext ts,tsx,js,jsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint ./src ./cypress --ext ts,tsx,js,jsx --report-unused-disable-directives --max-warnings 0",
"test": "cypress run", "test": "cypress run",
@@ -23,7 +24,7 @@
"homepage": "https://github.com/maplibre/maputnik#readme", "homepage": "https://github.com/maplibre/maputnik#readme",
"dependencies": { "dependencies": {
"@mapbox/mapbox-gl-rtl-text": "^0.2.3", "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@maplibre/maplibre-gl-geocoder": "^1.5.0", "@maplibre/maplibre-gl-geocoder": "^1.6.0",
"@maplibre/maplibre-gl-inspect": "^1.6.3", "@maplibre/maplibre-gl-inspect": "^1.6.3",
"@maplibre/maplibre-gl-style-spec": "^20.1.1", "@maplibre/maplibre-gl-style-spec": "^20.1.1",
"@mdi/js": "^7.4.47", "@mdi/js": "^7.4.47",
+2 -8
View File
@@ -18,15 +18,14 @@ type DocProps = {
'sdk-support'?: { 'sdk-support'?: {
[key: string]: typeof headers [key: string]: typeof headers
} }
docUrl?: string
} }
}; // & WithTranslation? };
export default class Doc extends React.Component<DocProps> { export default class Doc extends React.Component<DocProps> {
render () { render () {
const {fieldSpec} = this.props; const {fieldSpec} = this.props;
const {doc, values, docUrl} = fieldSpec; const {doc, values} = fieldSpec;
const sdkSupport = fieldSpec['sdk-support']; const sdkSupport = fieldSpec['sdk-support'];
const renderValues = ( const renderValues = (
@@ -86,11 +85,6 @@ export default class Doc extends React.Component<DocProps> {
</table> </table>
</div> </div>
} }
{docUrl &&
<div className="SpecDoc__learn-more">
<a href={docUrl} target="_blank" rel="noreferrer" onClick={() => console.log('Link clicked')}>Learn More (TODO i18n)</a>
</div>
}
</> </>
); );
} }
+4 -5
View File
@@ -11,8 +11,7 @@ import { HighlightedLayer, colorHighlightedLayer } from '../libs/highlight'
import 'maplibre-gl/dist/maplibre-gl.css' import 'maplibre-gl/dist/maplibre-gl.css'
import '../maplibregl.css' import '../maplibregl.css'
import '../libs/maplibre-rtl' import '../libs/maplibre-rtl'
//@ts-ignore import MaplibreGeocoder, { MaplibreGeocoderApi, MaplibreGeocoderApiConfig } from '@maplibre/maplibre-gl-geocoder';
import MaplibreGeocoder from '@maplibre/maplibre-gl-geocoder';
import '@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css'; import '@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css';
import { withTranslation, WithTranslation } from 'react-i18next' import { withTranslation, WithTranslation } from 'react-i18next'
@@ -222,7 +221,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
initGeocoder(map: Map) { initGeocoder(map: Map) {
const geocoderConfig = { const geocoderConfig = {
forwardGeocode: async (config:{query: string, limit: number, language: string[]}) => { forwardGeocode: async (config: MaplibreGeocoderApiConfig) => {
const features = []; const features = [];
try { try {
const request = `https://nominatim.openstreetmap.org/search?q=${config.query}&format=geojson&polygon_geojson=1&addressdetails=1`; const request = `https://nominatim.openstreetmap.org/search?q=${config.query}&format=geojson&polygon_geojson=1&addressdetails=1`;
@@ -255,8 +254,8 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
return { return {
features features
}; };
} },
}; } as unknown as MaplibreGeocoderApi;
const geocoder = new MaplibreGeocoder(geocoderConfig, { const geocoder = new MaplibreGeocoder(geocoderConfig, {
placeholder: this.props.t("Search"), placeholder: this.props.t("Search"),
maplibregl: MapLibreGl, maplibregl: MapLibreGl,
-6
View File
@@ -130,12 +130,6 @@ class ModalExportInternal extends React.Component<ModalExportInternalProps> {
value={(this.props.mapStyle.metadata || {} as any)['maputnik:thunderforest_access_token']} value={(this.props.mapStyle.metadata || {} as any)['maputnik:thunderforest_access_token']}
onChange={this.changeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")} onChange={this.changeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")}
/> />
<FieldString
label={fsa.maputnik.stadia_access_token.label}
fieldSpec={fsa.maputnik.stadia_access_token}
value={(this.props.mapStyle.metadata || {} as any)['maputnik:stadia_access_token']}
onChange={this.changeMetadataProperty.bind(this, "maputnik:stadia_access_token")}
/>
</div> </div>
<div className="maputnik-modal-export-buttons"> <div className="maputnik-modal-export-buttons">
-8
View File
@@ -156,14 +156,6 @@ class ModalSettingsInternal extends React.Component<ModalSettingsInternalProps>
onChange={onChangeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")} onChange={onChangeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")}
/> />
<FieldString
label={fsa.maputnik.stadia_access_token.label}
fieldSpec={fsa.maputnik.stadia_access_token}
data-wd-key="modal:settings.maputnik:stadia_access_token"
value={metadata['maputnik:stadia_access_token']}
onChange={onChangeMetadataProperty.bind(this, "maputnik:stadia_access_token")}
/>
<FieldArray <FieldArray
label={t("Center")} label={t("Center")}
fieldSpec={latest.$root.center} fieldSpec={latest.$root.center}
+3 -10
View File
@@ -4,22 +4,15 @@ const spec = (t: TFunction) => ({
maputnik: { maputnik: {
maptiler_access_token: { maptiler_access_token: {
label: t("MapTiler Access Token"), label: t("MapTiler Access Token"),
doc: t("Public access token for MapTiler Cloud."), doc: t("Public access token for MapTiler Cloud.")
docUrl: "https://docs.maptiler.com/cloud/api/authentication-key/"
}, },
thunderforest_access_token: { thunderforest_access_token: {
label: t("Thunderforest Access Token"), label: t("Thunderforest Access Token"),
doc: t("Public access token for Thunderforest services."), doc: t("Public access token for Thunderforest services.")
docUrl: "https://www.thunderforest.com/docs/apikeys/",
},
stadia_access_token: {
label: t("Stadia Maps API Key"),
doc: t("API key for Stadia Maps."),
docUrl: "https://docs.stadiamaps.com/authentication/",
}, },
style_renderer: { style_renderer: {
label: t("Style Renderer"), label: t("Style Renderer"),
doc: t("Choose the default Maputnik renderer for this style.") doc: t("Choose the default Maputnik renderer for this style."),
}, },
} }
}) })
+6 -24
View File
@@ -55,6 +55,10 @@ function indexOfLayer(layers: LayerSpecification[], layerId: string) {
} }
function getAccessToken(sourceName: string, mapStyle: StyleSpecification, opts: {allowFallback?: boolean}) { function getAccessToken(sourceName: string, mapStyle: StyleSpecification, opts: {allowFallback?: boolean}) {
if(sourceName === "thunderforest_transport" || sourceName === "thunderforest_outdoors") {
sourceName = "thunderforest"
}
const metadata = mapStyle.metadata || {} as any; const metadata = mapStyle.metadata || {} as any;
let accessToken = metadata[`maputnik:${sourceName}_access_token`] let accessToken = metadata[`maputnik:${sourceName}_access_token`]
@@ -70,38 +74,18 @@ function replaceSourceAccessToken(mapStyle: StyleSpecification, sourceName: stri
if(!source) return mapStyle if(!source) return mapStyle
if(!("url" in source) || !source.url) return mapStyle if(!("url" in source) || !source.url) return mapStyle
let authSourceName = sourceName const accessToken = getAccessToken(sourceName, mapStyle, opts)
if(sourceName === "thunderforest_transport" || sourceName === "thunderforest_outdoors") {
authSourceName = "thunderforest"
}
else if (("url" in source) && source.url?.match(/\.stadiamaps\.com/)) {
// The code currently usually assumes openmaptiles == MapTiler,
// so we need to check the source URL.
authSourceName = "stadia"
}
const accessToken = getAccessToken(authSourceName, mapStyle, opts)
if(!accessToken) { if(!accessToken) {
// Early exit. // Early exit.
return mapStyle; return mapStyle;
} }
let sourceUrl: string
if (authSourceName == "stadia") {
// Stadia Maps does not always require an API key,
// so there is no placeholder in our styles.
// We append it at the end of the URL when exporting if necessary.
sourceUrl = `${source.url}?api_key=${accessToken}`
} else {
sourceUrl = source.url.replace('{key}', accessToken)
}
const changedSources = { const changedSources = {
...mapStyle.sources, ...mapStyle.sources,
[sourceName]: { [sourceName]: {
...source, ...source,
url: sourceUrl url: source.url.replace('{key}', accessToken)
} }
} }
const changedStyle = { const changedStyle = {
@@ -136,8 +120,6 @@ function stripAccessTokens(mapStyle: StyleSpecification) {
...mapStyle.metadata as any ...mapStyle.metadata as any
}; };
delete changedMetadata['maputnik:openmaptiles_access_token']; delete changedMetadata['maputnik:openmaptiles_access_token'];
delete changedMetadata['maputnik:thunderforest_access_token'];
delete changedMetadata['maputnik:stadia_access_token'];
return { return {
...mapStyle, ...mapStyle,
metadata: changedMetadata metadata: changedMetadata
+1 -3
View File
@@ -82,7 +82,7 @@
"Close modal": "סגירת חלונית", "Close modal": "סגירת חלונית",
"Debug": "דיבאג", "Debug": "דיבאג",
"Options": "אפשרויות", "Options": "אפשרויות",
"<0>Open in OSM</0> Opens the current view on openstreetmap.org": "<0>פתיחה ב-OSM</0> - פתיחה של התצוגה הנוכחית ב- openstreetmap.org", "<0>Open in OSM</0> &mdash; Opens the current view on openstreetmap.org": "<0>פתיחה ב-OSM</0> - פתיחה של התצוגה הנוכחית ב- openstreetmap.org",
"Export Style": "ייצוא של הסטייל", "Export Style": "ייצוא של הסטייל",
"Download Style": "הורדה של הסטייל", "Download Style": "הורדה של הסטייל",
"Download a JSON style to your computer.": "הורדה של הסטייל למחשב", "Download a JSON style to your computer.": "הורדה של הסטייל למחשב",
@@ -179,8 +179,6 @@
"Public access token for MapTiler Cloud.": "Public access token for MapTiler Cloud.", "Public access token for MapTiler Cloud.": "Public access token for MapTiler Cloud.",
"Thunderforest Access Token": "Thunderforest Access Token", "Thunderforest Access Token": "Thunderforest Access Token",
"Public access token for Thunderforest services.": "Public access token for Thunderforest services.", "Public access token for Thunderforest services.": "Public access token for Thunderforest services.",
"Stadia Maps API Key": "Stadia Maps API Key",
"API key for Stadia Maps.": "API key for Stadia Maps",
"Style Renderer": "צייר הסטייל", "Style Renderer": "צייר הסטייל",
"Choose the default Maputnik renderer for this style.": "בחירת צייר ברירת המחדל של מפוטניק עבור הסטייל הזה" "Choose the default Maputnik renderer for this style.": "בחירת צייר ברירת המחדל של מפוטניק עבור הסטייל הזה"
} }
+1 -3
View File
@@ -82,7 +82,7 @@
"Close modal": "モーダルを閉じる", "Close modal": "モーダルを閉じる",
"Debug": "デバッグ", "Debug": "デバッグ",
"Options": "設定", "Options": "設定",
"<0>Open in OSM</0> Opens the current view on openstreetmap.org": "現在のビューを <0>openstreetmap.org で開く</0>", "<0>Open in OSM</0> &mdash; Opens the current view on openstreetmap.org": "現在のビューを <0>openstreetmap.org で開く</0>",
"Export Style": "スタイルをエクスポート", "Export Style": "スタイルをエクスポート",
"Download Style": "スタイルをダウンロード", "Download Style": "スタイルをダウンロード",
"Download a JSON style to your computer.": "パソコンにJSONスタイルをダウンロードします。", "Download a JSON style to your computer.": "パソコンにJSONスタイルをダウンロードします。",
@@ -179,8 +179,6 @@
"Public access token for MapTiler Cloud.": "MapTiler Cloud の公開用アクセストークン", "Public access token for MapTiler Cloud.": "MapTiler Cloud の公開用アクセストークン",
"Thunderforest Access Token": "Thunderforest アクセストークン", "Thunderforest Access Token": "Thunderforest アクセストークン",
"Public access token for Thunderforest services.": "Thunderforest サービスの公開用アクセストークン", "Public access token for Thunderforest services.": "Thunderforest サービスの公開用アクセストークン",
"Stadia Maps API Key": "Stadia Maps API キー",
"API key for Stadia Maps.": "Stadia Maps の API キー",
"Style Renderer": "スタイルレンダラ", "Style Renderer": "スタイルレンダラ",
"Choose the default Maputnik renderer for this style.": "このスタイルのデフォルトの Maputnik レンダラを選択してください", "Choose the default Maputnik renderer for this style.": "このスタイルのデフォルトの Maputnik レンダラを選択してください",
"Layer options": "レイヤー設定", "Layer options": "レイヤー設定",
+1 -3
View File
@@ -82,6 +82,7 @@
"Close modal": "关闭模态框", "Close modal": "关闭模态框",
"Debug": "调试", "Debug": "调试",
"Options": "选项", "Options": "选项",
"<0>Open in OSM</0> — Opens the current view on openstreetmap.org": "在 openstreetmap.org 打开当前视图",
"Export Style": "导出样式", "Export Style": "导出样式",
"Download Style": "下载样式", "Download Style": "下载样式",
"Download a JSON style to your computer.": "将JSON样式下载到您的电脑。", "Download a JSON style to your computer.": "将JSON样式下载到您的电脑。",
@@ -178,11 +179,8 @@
"Public access token for MapTiler Cloud.": "MapTiler Cloud 的公共访问令牌。", "Public access token for MapTiler Cloud.": "MapTiler Cloud 的公共访问令牌。",
"Thunderforest Access Token": "Thunderforest 访问令牌", "Thunderforest Access Token": "Thunderforest 访问令牌",
"Public access token for Thunderforest services.": "Thunderforest 服务的公共访问令牌。", "Public access token for Thunderforest services.": "Thunderforest 服务的公共访问令牌。",
"Stadia Maps API Key": "Stadia Maps API 密钥",
"API key for Stadia Maps.": "Stadia Maps 的 API 密钥",
"Style Renderer": "样式渲染器", "Style Renderer": "样式渲染器",
"Choose the default Maputnik renderer for this style.": "为这种样式选择默认的Maputnik渲染器。", "Choose the default Maputnik renderer for this style.": "为这种样式选择默认的Maputnik渲染器。",
"<0>Open in OSM</0> — Opens the current view on openstreetmap.org": "在 openstreetmap.org 打开当前视图",
"Layer options": "图层选项", "Layer options": "图层选项",
"Paint properties": "绘制属性", "Paint properties": "绘制属性",
"Layout properties": "布局属性", "Layout properties": "布局属性",