Skip to content

Commit

Permalink
feat: add support for lyrx
Browse files Browse the repository at this point in the history
lyrx can only be written
  • Loading branch information
KaiVolland committed Sep 16, 2024
1 parent 0bc94ca commit 2937a4e
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 163 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
with:
configFile: .commitlintrc.js
configFile: .commitlintrc.cjs
30 changes: 7 additions & 23 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,21 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache Node.js modules 💾
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Use bun
uses: oven-sh/setup-bun@v1

- name: Install dependencies ⏬
run: npm install
run: bun install

- name: Lint code 💄
run: npm run lint

- name: Build artifacts 🏗️
run: npm run build
run: bun run lint

- name: Test code ✅
run: npm run test
run: bun run test

- name: Build artifacts 🏗️
run: bun run build
29 changes: 29 additions & 0 deletions .github/workflows/on-push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test Push to main

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Use bun
uses: oven-sh/setup-bun@v1

- name: Install dependencies ⏬
run: bun install

- name: Lint code 💄
run: bun run lint

- name: Test code ✅
run: bun run test

- name: Build artifacts 🏗️
run: bun run build
46 changes: 0 additions & 46 deletions .github/workflows/on-push-master.yml

This file was deleted.

8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ jobs:
- name: Checkout sources 🔰
uses: actions/checkout@v4

- name: Setup Node.js 18 👷🏻
uses: actions/setup-node@v4
with:
node-version: 18
- name: Use bun
uses: oven-sh/setup-bun@v1

- name: Install dependencies ⏬
run: npm ci
run: bun install

- name: Release 🚀
uses: cycjimmy/[email protected]
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ dist
binaries

output-bulk
output.map
output.qml
output.sld
TEST_OUTPUT.*
60 changes: 11 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ between various formats for styling of geographic data.
## tl;dr

```
npx geostyler-cli --output new-qgis-style.qml my-existing.sld
bunx geostyler-cli --output new-qgis-style.qml my-existing.sld
```

## Requirements
Expand All @@ -15,7 +15,7 @@ npx geostyler-cli --output new-qgis-style.qml my-existing.sld

## Standalone application

Binaries are available for Linux, MacOS, and Windows on the
Binaries are available for Linux, MacOS, and Windows on the
[Releases](https://github.com/geostyler/geostyler-cli/releases) page.
Download the zip file for your operating system, unzip, navigate to the folder
and run the `geostyler` command:
Expand All @@ -26,50 +26,13 @@ geostyler-cli --output new-qgis-style.qml my-existing.sld

## Usage without installation ⚡

`Node.js` includes [npx](https://docs.npmjs.com/cli/v10/commands/npx), this
`Bun` includes [bunx](https://bun.sh/docs/cli/bunx), this
allows you to run commands from an npm package without having to install it.

```
npx geostyler-cli -s sld -t qgis -o output.qml input.sld
bunx geostyler-cli -s sld -t qgis -o output.qml input.sld
```

## Global installation

### Installation 💾

`Node.js` includes [npm](https://docs.npmjs.com/cli/v10/commands/npm) - the
JavaScript package manager. To install the `geostyler` command globally:

```
npm install -g geostyler-cli
```

You can then use the new `geostyler-cli` command, e.g.:

```
geostyler-cli -s sld -t qgis -o output.qml input.sld
```

To process a folder of files:

```
geostyler-cli -s sld -t qgis -o /outputdir /inputdir
```


### Update 🚀

```
npm update -g geostyler-cli
```

### Uninstalling 😔

```
npm uninstall -g geostyler-cli
```


## Syntax and examples

To convert a single file:
Expand Down Expand Up @@ -106,12 +69,12 @@ geostyler-cli -t sld testdata/point_simple.qml
* `-h` / `--help` Display the help and exit.
* `-o` / `--output` Output filename or directory. Required when the source is a directory.
For a file leave this empty to write to `stdout`. [string]
* `-s` / `--source` Source parser, either `mapbox`, `mapfile` or `map`,
* `-s` / `--source` Source parser, either `mapbox` (`maplibre`), `lyrx`, `mapfile` or `map`,
`sld` or `se` for SLD - the parser will read the version from the file,
and `qgis` or `qml` for QGIS QML files. If not given, it will be guessed from the extension of the input file.
and `qgis` (`qml`) for QGIS QML files. If not given, it will be guessed from the extension of the input file.
Mandatory if the the target is a directory.
* `-t` / `--target` Target parser, either `mapbox`, `sld` (for SLD 1.0), `se` (for SLD 1.1),
and `qgis` or `qml` for QGIS QML files. If not given, it will be guessed from
* `-t` / `--target` Target parser, either `mapbox` (`maplibre`), `sld` (for SLD 1.0), `se` (for SLD 1.1),
and `qgis` (`qml`) for QGIS QML files. If not given, it will be guessed from
the extension of the output file. Mapfiles are not currently supported as target.
Mandatory if the the target is a directory.
* `-v` / `--version` Display the version of the program.
Expand All @@ -121,10 +84,10 @@ Mandatory if the the target is a directory.
In your clone of the repo, in the root directory:

```bash
npm install # get dependencies
npm run build # build from possibly changed source
bun install # get dependencies
bun run build # build from possibly changed source
# now you can call your build like this:
npm start -- -s sld -t qgis -o output.qml testdata/point_simplepoint.sld
bun run start -- -s sld -t qgis -o output.qml testdata/point_simplepoint.sld
```

## <a name="funding"></a>Funding & financial sponsorship
Expand All @@ -133,4 +96,3 @@ Maintenance and further development of this code can be funded through the
[GeoStyler Open Collective](https://opencollective.com/geostyler). All contributions and
expenses can transparently be reviewed by anyone; you see what we use the donated money for.
Thank you for any financial support you give the GeoStyler project 💞

Binary file modified bun.lockb
Binary file not shown.
26 changes: 9 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "4.0.0",
"description": "",
"type": "module",
"main": "dist/src/index.js",
"main": "src/index.js",
"files": [
"dist"
],
"bin": {
"geostyler-cli": "dist/src/index.js"
"geostyler-cli": "src/index.js"
},
"scripts": {
"build": "bun run build-clean && bun run build-only",
Expand All @@ -26,14 +26,6 @@
"prepublishOnly": "bun run build",
"postpublish": "bun run package-binaries"
},
"pkg": {
"targets": [
"node18-linux-x64",
"node18-macos-x64",
"node18-win-x64"
],
"outputPath": "./binaries"
},
"repository": {
"type": "git",
"url": "git+https://github.com/geostyler/geostyler-cli.git"
Expand All @@ -51,31 +43,31 @@
},
"homepage": "https://github.com/geostyler/geostyler-cli#readme",
"engines": {
"node": ">=18.0.0",
"npm": ">=6.0.0"
"bun": ">=1.0.0",
"node": ">=20.0.0",
"npm": ">=10.0.0"
},
"devDependencies": {
"@commitlint/cli": "^17.6.5",
"@commitlint/config-conventional": "^17.6.5",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@terrestris/eslint-config-typescript": "^3.1.0",
"@types/gradient-string": "^1.1.2",
"@types/minimist": "^1.2.5",
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"adm-zip": "^0.5.10",
"eslint": "^8.39.0",
"pkg": "^5.8.1",
"rimraf": "^5.0.0",
"typescript": "^5.0.4"
},
"dependencies": {
"geostyler-lyrx-parser": "^1.0.0",
"geostyler-lyrx-parser": "^1.0.1",
"geostyler-mapbox-parser": "^6.0.0",
"geostyler-mapfile-parser": "^4.0.1",
"geostyler-openlayers-parser": "^5.0.0",
"geostyler-qgis-parser": "^3.0.0",
"geostyler-sld-parser": "^6.1.2",
"geostyler-style": "^9.1.0",
Expand Down
Loading

0 comments on commit 2937a4e

Please sign in to comment.