Skip to content

Commit bac1a6f

Browse files
committed
adding extras
1 parent fecbd6f commit bac1a6f

File tree

7 files changed

+369
-51
lines changed

7 files changed

+369
-51
lines changed

.github/workflows/deploy.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow one concurrent deployment
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# Single deploy job since we're just deploying
25+
deploy:
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Set up Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
cache: "npm"
38+
- name: Install dependencies
39+
run: npm ci
40+
- name: Build
41+
run: npm run build
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
# Upload dist folder
48+
path: "./dist"
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

README.md

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,8 @@
1-
# Svelte + Vite
1+
# World of Wikipedia
22

3-
This template should help get you started developing with Svelte in Vite.
3+
Wikipedia pages on top of OpenStreetMap!
44

5-
## Recommended IDE Setup
5+
This is a study in making as slick an experience as possible with no servers, just a static github page serving (at most) a 26Mb database, and getting map tiles from OpenStreetMap.
66

7-
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
7+
The geodata is retrieved in [this notebook](./geodata_curation/geodata_curation.ipynb)) and overlaid in front of OpenStreetMap/LeafJS, using a Svelte/Vite app for interactions and ngeohash and LokiJS for efficient queries.
88

9-
## Need an official Svelte framework?
10-
11-
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
12-
13-
## Technical considerations
14-
15-
**Why use this over SvelteKit?**
16-
17-
- It brings its own routing solution which might not be preferable for some users.
18-
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
19-
20-
This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
21-
22-
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.
23-
24-
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
25-
26-
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information.
27-
28-
**Why include `.vscode/extensions.json`?**
29-
30-
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project.
31-
32-
**Why enable `checkJs` in the JS template?**
33-
34-
It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate. This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of JavaScript, it is trivial to change the configuration.
35-
36-
**Why is HMR not preserving my local component state?**
37-
38-
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/sveltejs/svelte-hmr/tree/master/packages/svelte-hmr#preservation-of-local-state).
39-
40-
If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR.
41-
42-
```js
43-
// store.js
44-
// An extremely simple external store
45-
import { writable } from 'svelte/store'
46-
export default writable(0)
47-
```

geodata_curation/geodata_curation.ipynb

Lines changed: 307 additions & 0 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "events_map",
2+
"name": "world_of_wikipedia",
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",

src/lib/Map.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@
192192
let displayClass = marker.displayClass;
193193
let pane = marker.displayClass;
194194
if (hoveredMarker === marker) {
195-
console.log("hovered");
196195
displayClass = "full";
197196
pane = "selected";
198197
}

src/lib/geodata.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ export async function getGeoEntriesInBounds({minLat, maxLat, minLon, maxLon}) {
156156
}
157157

158158
if (geohashes_1.length > 3) {
159-
if (!ingestedFiles.includes("_geodata/geo3_unique.csv.gz")) {
159+
if (!ingestedFiles.includes("geodata/geo3_unique.csv.gz")) {
160160
// Use consistent path format
161-
const fileUrl = "_geodata/geo3_unique.csv.gz";
161+
const fileUrl = "geodata/geo3_unique.csv.gz";
162162
try {
163163
const rows = await loadCsvGzFile(fileUrl);
164164
addLatLonToRows(rows);
@@ -182,14 +182,14 @@ export async function getGeoEntriesInBounds({minLat, maxLat, minLon, maxLon}) {
182182
} else {
183183
// Download and ingest any new geohash files that haven't been processed yet
184184
// Use consistent path format without leading dot or slash
185-
const needDownload = geohashes_1.filter(g => !ingestedFiles.includes(`_geodata/${g}.csv.gz`));
185+
const needDownload = geohashes_1.filter(g => !ingestedFiles.includes(`geodata/${g}.csv.gz`));
186186

187187
if (needDownload.length > 0) {
188188
// needDownload all rows first before doing a single bulk insert
189189

190190
// Load all files in parallel but collect results before inserting
191191
const loadResults = await Promise.all(needDownload.map(async (g) => {
192-
const url = `_geodata/${g}.csv.gz`;
192+
const url = `geodata/${g}.csv.gz`;
193193
try {
194194
const rows = await loadCsvGzFile(url);
195195
ingestedFiles.push(url);

0 commit comments

Comments
 (0)