From 70f721be7b4379e3cb2cd1a2b045cf5097c273e3 Mon Sep 17 00:00:00 2001 From: Nilesh Date: Fri, 23 Dec 2022 16:30:55 +0000 Subject: [PATCH] Remove Typescript, upgrade deps and switch to Vite --- .gitignore | 8 +- db/schema.sql | 47 + templates/index.html => index.html | 5 +- package-lock.json | 3493 ++++++------------------- package.json | 29 +- {static => public}/._book-cover-2.png | Bin {static => public}/._book-cover-3.png | Bin {static => public}/._book-cover-4.png | Bin {static => public}/._book-cover-5.png | Bin {static => public}/._book-cover-6.png | Bin {static => public}/._book-cover-7.png | Bin {static => public}/._book-cover.png | Bin {static => public}/._course.jpg | Bin {static => public}/._play-solid.svg | Bin {static => public}/book-cover-2.png | Bin {static => public}/book-cover-3.png | Bin {static => public}/book-cover-4.png | Bin {static => public}/book-cover-5.png | Bin {static => public}/book-cover-6.png | Bin {static => public}/book-cover-7.png | Bin {static => public}/book-cover.png | Bin {static => public}/course.jpg | Bin {static => public}/icons/appIcon.png | Bin {static => public}/icons/trayIcon.png | Bin {static => public}/map.html | 0 {static => public}/neutra.js | 0 {static => public}/play-solid.svg | 0 src/BookCard.svelte | 4 +- src/GenericCard.svelte | 4 +- src/Review.svelte | 4 +- src/TopicMasonryGrid.svelte | 4 +- src/VideoCard.svelte | 4 +- static/index.html | 86 - vite.config.js | 7 + 34 files changed, 896 insertions(+), 2799 deletions(-) create mode 100644 db/schema.sql rename templates/index.html => index.html (96%) rename {static => public}/._book-cover-2.png (100%) rename {static => public}/._book-cover-3.png (100%) rename {static => public}/._book-cover-4.png (100%) rename {static => public}/._book-cover-5.png (100%) rename {static => public}/._book-cover-6.png (100%) rename {static => public}/._book-cover-7.png (100%) rename {static => public}/._book-cover.png (100%) rename {static => public}/._course.jpg (100%) rename {static => public}/._play-solid.svg (100%) rename {static => public}/book-cover-2.png (100%) rename {static => public}/book-cover-3.png (100%) rename {static => public}/book-cover-4.png (100%) rename {static => public}/book-cover-5.png (100%) rename {static => public}/book-cover-6.png (100%) rename {static => public}/book-cover-7.png (100%) rename {static => public}/book-cover.png (100%) rename {static => public}/course.jpg (100%) rename {static => public}/icons/appIcon.png (100%) rename {static => public}/icons/trayIcon.png (100%) rename {static => public}/map.html (100%) rename {static => public}/neutra.js (100%) rename {static => public}/play-solid.svg (100%) delete mode 100644 static/index.html create mode 100644 vite.config.js diff --git a/.gitignore b/.gitignore index cac0874..48018d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ .DS_Store node_modules -static/bundle.css -static/bundle.js -static/bundle.js.map -static/alltopics.json +public/bundle.css +public/bundle.js +public/bundle.js.map +public/alltopics.json # Developer tools' files .lite_workspace.lua diff --git a/db/schema.sql b/db/schema.sql new file mode 100644 index 0000000..bf960da --- /dev/null +++ b/db/schema.sql @@ -0,0 +1,47 @@ +PRAGMA foreign_keys=OFF; + +CREATE TABLE topics ( + name VARCHAR(255) PRIMARY KEY, -- url-friendly slug + display_name VARCHAR(255), -- allow null, use name + parent_name VARCHAR(255), -- create a hierarchy with self-reference + sort_index INTEGER, -- used for sorting children of a parent + FOREIGN KEY (parent_name) REFERENCES topics(name) +); + +CREATE TABLE creators ( + id VARCHAR(255) PRIMARY KEY, + name VARCHAR(1024) NOT NULL, + image_url VARCHAR(1024), + bio TEXT, + occupation VARCHAR(255), + links TEXT +); + +CREATE TABLE items ( + id VARCHAR(255) PRIMARY KEY, -- uuid + name VARCHAR(1024) NOT NULL, + description VARCHAR(4096), -- in markdown + image_url VARCHAR(1024), + links TEXT NOT NULL, -- json array of {item_type, url, misc} + topics TEXT NOT NULL, -- json array of topic names + creators TEXT, -- json array of creator_ids + year varchar(32), + difficulty INTEGER, + cost TEXT, + rating INTEGER, -- scale of 1 to 100, divide by 10 if needed + tags TEXT +); + +CREATE TABLE reviews ( + item_id VARCHAR(255) NOT NULL, + by_item VARCHAR(255), + by_creator VARCHAR(255), + rating INTEGER, -- scale of 1 to 100, divide by 10 if needed + blurb TEXT, + url VARCHAR(1024), + PRIMARY KEY (item_id, by_item, by_creator), + FOREIGN KEY (item_id) REFERENCES items(id), + FOREIGN KEY (by_item) REFERENCES items(id), + FOREIGN KEY (by_creator) REFERENCES creators(id), + CHECK(by_item IS NOT NULL OR by_creator IS NOT NULL) -- one of the two must be present. Ideally both. +) \ No newline at end of file diff --git a/templates/index.html b/index.html similarity index 96% rename from templates/index.html rename to index.html index e13aefc..0e99674 100644 --- a/templates/index.html +++ b/index.html @@ -55,8 +55,9 @@ window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", e => e.matches ? darkmode() : lightmode()); - - + + + diff --git a/src/GenericCard.svelte b/src/GenericCard.svelte index ee74038..b24ceb4 100644 --- a/src/GenericCard.svelte +++ b/src/GenericCard.svelte @@ -1,5 +1,5 @@ - diff --git a/src/Review.svelte b/src/Review.svelte index 39cbffe..02f27cf 100644 --- a/src/Review.svelte +++ b/src/Review.svelte @@ -1,5 +1,5 @@ -