Skip to content

Commit

Permalink
fix: remove openlayers-parser
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVolland committed Sep 13, 2024
1 parent 49bbde1 commit 587bed8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
10 changes: 0 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 Down Expand Up @@ -68,15 +60,13 @@
"@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.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
18 changes: 1 addition & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import SLDParser from 'geostyler-sld-parser';
import QGISParser from 'geostyler-qgis-parser';
import OpenLayersParser from 'geostyler-openlayers-parser';
import MapfileParser from 'geostyler-mapfile-parser';
import MapboxParser from 'geostyler-mapbox-parser';
import ArcGISParser from 'geostyler-lyrx-parser';
Expand Down Expand Up @@ -62,8 +61,6 @@ const getParserFromFilename = (fileName: string): StyleParser | undefined => {
return undefined;
}
switch (fileEnding.toLowerCase()) {
case 'ol':
return new OpenLayersParser();
case 'lyrx':
return new ArcGISParser();
case 'mapbox':
Expand All @@ -85,9 +82,6 @@ const getExtensionFromFormat = (format: string): string => {
return '';
}
switch (format.toLowerCase()) {
case 'openlayers':
case 'ol':
return 'ts';
case 'mapfile':
return 'map';
case 'qgis':
Expand Down Expand Up @@ -161,17 +155,13 @@ function collectPaths(basePath: string, isFile: boolean): string[] {
}

async function writeFile(
sourceFile: string, sourceParser: Exclude<StyleParser, OpenLayersParser>,
sourceFile: string, sourceParser: StyleParser,
targetFile: string, targetParser: Exclude<StyleParser, ArcGISParser | MapfileParser> | undefined,
oraIndicator: Ora
) {
const inputFileData = await promises.readFile(sourceFile, 'utf-8');
const indicator = oraIndicator; // for linter.

if (sourceParser instanceof OpenLayersParser) {
throw new Error('OpenLayers is not supported as source.');
}

if (targetParser instanceof ArcGISParser || targetParser instanceof MapfileParser) {
throw new Error('ArcGIS (lyrx) and MapFile are not supported as target.');
}
Expand Down Expand Up @@ -215,12 +205,6 @@ async function writeFile(
console.log(writeUnsupportedProperties);
}
output = 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);
}
Expand Down

0 comments on commit 587bed8

Please sign in to comment.