diff --git a/.github/workflows/on-push-main.yml b/.github/workflows/on-push-main.yml index 1528654..715a068 100644 --- a/.github/workflows/on-push-main.yml +++ b/.github/workflows/on-push-main.yml @@ -1,4 +1,4 @@ -name: Test Push to Master +name: Test Push to main on: push: diff --git a/README.md b/README.md index 170c222..11bf183 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ For a file leave this empty to write to `stdout`. [string] `sld` or `se` for SLD - the parser will read the version from the 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` (`maplibre`), `ol`, `sld` (for SLD 1.0), `se` (for SLD 1.1), +* `-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. diff --git a/src/index.ts b/src/index.ts index ff0c715..01f26f2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -207,12 +207,6 @@ async function writeFile( console.log(writeUnsupportedProperties); } output = typeof writeOutput === 'object' ? JSON.stringify(writeOutput, undefined, 2) : writeOutput; - if (targetParser instanceof OpenLayersParser) { - output = JSON.stringify(readOutput, undefined, 2); - if (!output) { - throw new Error('OpenLayers style could not be converted to JSON.'); - } - } } else { output = JSON.stringify(readOutput, undefined, 2); } @@ -268,7 +262,7 @@ async function main() { // Check source path arg. if (!sourcePath) { indicator.fail('No input file or folder specified.'); - return; + return Promise.reject('No input file or folder specified.'); } // Check source exists, is a dir or a file ? @@ -280,12 +274,11 @@ async function main() { // Try to define type of target (file or dir). // Assume the target is the same as the source let targetIsFile = sourceIsFile; - const outputExists = existsSync(outputPath); // Dir to file is not possible if (!sourceIsFile && targetIsFile) { indicator.fail('The source is a directory, so the target must be directory, too.'); - return; + return Promise.reject('The source is a directory, so the target must be directory, too.'); } // Get source and target parser. @@ -294,7 +287,7 @@ async function main() { const targetParser = targetFormat && getParserFromFormat(targetFormat) || getParserFromFilename(outputPath); if (!sourceParser) { indicator.fail('No sourceparser was specified.'); - return; + return Promise.reject('No sourceparser was specified.'); } if (!targetParser) { indicator.info('No targetparser was specified. Output will be a GeoStyler object.');