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

Change runtime to bun #405

Closed
wants to merge 3 commits into from
Closed
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
File renamed without changes.
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
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
dist
binaries

output-bulk
output.map
output.qml
output.sld
TEST_OUTPUT.*
85 changes: 21 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,31 @@
A command line interface for [GeoStyler](https://geostyler.org) to convert
between various formats for styling of geographic data.

## tl;dr
## Download and usage

```
npx geostyler-cli --output new-qgis-style.qml my-existing.sld
```
The recommended way to use the GeoStyler CLI is by downloading the binary for your OS.

## Requirements
- [Linux x64](https://github.com/geostyler/geostyler-cli/releases/latest/download/geostyler-cli-linux.zip)
- [Windows x64](https://github.com/geostyler/geostyler-cli/releases/latest/download/geostyler-cli-win.exe.zip)
- [MacOS x64](https://github.com/geostyler/geostyler-cli/releases/latest/download/geostyler-cli-macos-x64.zip)
- [MacOS arm64](https://github.com/geostyler/geostyler-cli/releases/latest/download/geostyler-cli-macos-arm64.zip)

`geostyler-cli` can either be run as a standalone application or installed using [Node.js](https://nodejs.org/).
You can also find the available versions in the assets section of the releases:

## Standalone application
https://github.com/geostyler/geostyler-cli/releases/latest

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:
Unzip the binary and simply run:

```sh
./geostyler-cli --help
```
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
allows you to run commands from an npm package without having to install it.
Alternatively you can use the GeoStyler CLI with [bun.sh](https://bun.sh/):

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

## 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 +64,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 +79,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
# now you can call your build like this:
npm start -- -s sld -t qgis -o output.qml testdata/point_simplepoint.sld
# install dependencies
bun install
# run the CLI
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 +91,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 added bun.lockb
Binary file not shown.
13 changes: 8 additions & 5 deletions package-binaries.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* eslint-disable no-console */
const fs = require('fs');
const path = require('path');
const AdmZip = require('adm-zip');

import fs from 'fs';
import AdmZip from 'adm-zip';

// Define the folder path and the list of file names
const folderPath = './binaries/';
const fileNames = ['geostyler-cli-win.exe', 'geostyler-cli-linux', 'geostyler-cli-macos'];
const fileNames = [
'geostyler-cli-win.exe',
'geostyler-cli-linux',
'geostyler-cli-macos-x64',
'geostyler-cli-macos-arm64'
];

function renameFile(oldPath, newPath) {
return new Promise((resolve, reject) => {
Expand Down
Loading
Loading