Skip to content
Merged
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
13 changes: 0 additions & 13 deletions .eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.cjs

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install deps
run: pnpm install
- name: Lint + typecheck + build + test
run: pnpm lint && pnpm check && pnpm build && pnpm test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
test-results/
.netlify
repomix.config.json
.repomixignore
repomix-output.xml
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm test
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,39 @@

Web app to reduce the size of GeoJSON files.

## How This Tool Reduces GeoJSON

This tool reduces GeoJSON file sizes through two main techniques:

### 1. Coordinate Precision Truncation

Coordinates in GeoJSON files often have excessive decimal places (e.g., `1.123456789`). For most web mapping applications, 6 decimal places (~0.1 meters accuracy) is more than sufficient. This tool truncates coordinates to your specified precision, significantly reducing file size.

### 2. Property Filtering

GeoJSON features often contain many properties that aren't needed for display. You can select only the properties you need, removing unnecessary data.

## Developing

1. Install dependencies: `bun install`
1. Run: `bun run dev`
1. Install dependencies: `pnpm install`
2. Run dev server: `pnpm dev`
3. Run tests: `pnpm test`
4. Run checks: `pnpm check && pnpm lint`

## Building

To create a production version:

```bash
bun run build
```
pnpm build
```

## Testing

```bash
# Run tests once
pnpm test

# Watch mode
pnpm test:watch
```
Binary file removed bun.lockb
Binary file not shown.
47 changes: 47 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'build/',
'.svelte-kit/',
'dist/',
'node_modules/',
'.netlify/',
'test-results/',
'playwright-report/'
]
},
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
files: ['src/app.d.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off'
}
}
];
84 changes: 47 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
{
"name": "reducegeojson",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-netlify": "^2.0.8",
"@sveltejs/kit": "^1.20.4",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"bun-types": "^1.0.7",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.30.0",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2"
},
"type": "module",
"dependencies": {
"@turf/truncate": "^6.5.0",
"@types/geojson": "^7946.0.12"
}
"name": "reducegeojson",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"prepare": "husky"
},
"lint-staged": {
"*.{js,ts,svelte,css,md,json}": [
"prettier --write",
"eslint --fix"
]
},
"devDependencies": {
"@eslint/js": "^9.39.1",
"@sveltejs/adapter-netlify": "^5.2.4",
"@sveltejs/kit": "^2.20.3",
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.13.0",
"globals": "^15.14.0",
"husky": "^9.1.7",
"lint-staged": "^16.2.7",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"svelte": "^5.43.6",
"svelte-check": "^4.2.6",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.46.4",
"vite": "^7.2.2",
"vitest": "^2.1.8"
},
"type": "module",
"dependencies": {
"@turf/truncate": "^7.2.0",
"@types/geojson": "^7946.0.14"
}
}
12 changes: 0 additions & 12 deletions playwright.config.ts

This file was deleted.

Loading