Skip to content

Commit

Permalink
Netlify SSR (#288)
Browse files Browse the repository at this point in the history
* Setup the Netlify SSR adapter

* Setup builders in an attempt to fix images

* Bootstrap Drizzle and Turso

* Uploading and reading the csv upload all works in Astro!

* Add ability to post feelings entries to Bluesky

* Add more type checking

* Swap to Astro assets

* Bump up packages

* Move all images into Astro's asset setup

* Get Tweet embeds working again

Thanks Elon, you dick

* Set the cover image correctly

* Update last.fm and goodreads images to be resized on their CDNs

* Setup the daylio route to build the site with auth

* Get links working in the Bluesky posts

* Just gonna have to ignore linting issues

* Fix the build
  • Loading branch information
eligundry authored Jul 6, 2023
1 parent 49be7ca commit 2395fdc
Show file tree
Hide file tree
Showing 121 changed files with 10,331 additions and 2,488 deletions.
6 changes: 6 additions & 0 deletions astro/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
"sourceType": "module"
},
"rules": {}
},
{
"files": ["*.mdx"],
"rules": {
"null-null": "off"
}
}
]
}
25 changes: 15 additions & 10 deletions astro/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { defineConfig } from 'astro/config'

import { defineConfig, sharpImageService } from 'astro/config'
import tailwind from '@astrojs/tailwind'

// https://astro.build/config
import mdx from '@astrojs/mdx'
import mdxConfig from './src/lib/markdown.mjs'

// https://astro.build/config
import image from '@astrojs/image'

// https://astro.build/config
import preact from '@astrojs/preact'

Expand All @@ -18,17 +13,30 @@ import partytown from '@astrojs/partytown'
// https://github.com/danielroe/fontaine
import fontaine from 'astro-fontaine'

// https://astro.build/config
import netlify from '@astrojs/netlify/functions'

// https://astro.build/config
export default defineConfig({
output: 'hybrid',
adapter: netlify({
builders: true,
}),
experimental: {
assets: true,
},
image: {
service: sharpImageService(),
},
markdown: {
syntaxHighlight: 'prism',
},
vite: {
ssr: {
external: ['better-sqlite3'],
noExternal: [
'@astro-community/astro-embed-twitter',
'@astro-community/astro-embed-youtube',
'@atproto/api',
'@react-hookz/web',
'chartjs-adapter-date-fns',
'react-icons',
Expand All @@ -38,9 +46,6 @@ export default defineConfig({
integrations: [
tailwind(),
mdx(mdxConfig),
image({
serviceEntryPoint: '@astrojs/image/sharp',
}),
preact({
compat: true,
}),
Expand Down
25 changes: 25 additions & 0 deletions astro/migrations/0000_tan_magik.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CREATE TABLE `daylio_activities` (
`activity` text PRIMARY KEY NOT NULL,
`private` integer DEFAULT 0,
`createdAt` integer DEFAULT (cast(strftime('%s', 'now') as int)),
`updatedAt` integer DEFAULT (cast(strftime('%s', 'now') as int))
);
--> statement-breakpoint
CREATE TABLE `daylio_entries` (
`time` integer PRIMARY KEY NOT NULL,
`createdAt` integer DEFAULT (cast(strftime('%s', 'now') as int)),
`updatedAt` integer DEFAULT (cast(strftime('%s', 'now') as int)),
`publishedAt` integer,
`mood` text NOT NULL,
`notes` blob
);
--> statement-breakpoint
CREATE TABLE `daylio_entry_activities` (
`time` integer NOT NULL,
`activity` text NOT NULL,
`createdAt` integer DEFAULT (cast(strftime('%s', 'now') as int)),
`updatedAt` integer DEFAULT (cast(strftime('%s', 'now') as int)),
PRIMARY KEY(`activity`, `time`),
FOREIGN KEY (`time`) REFERENCES `daylio_entries`(`time`) ON UPDATE cascade ON DELETE cascade,
FOREIGN KEY (`activity`) REFERENCES `daylio_activities`(`activity`) ON UPDATE cascade ON DELETE cascade
);
177 changes: 177 additions & 0 deletions astro/migrations/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"version": "5",
"dialect": "sqlite",
"id": "f55e3f27-9fec-4e21-9977-3447586e52f9",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"daylio_activities": {
"name": "daylio_activities",
"columns": {
"activity": {
"name": "activity",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"private": {
"name": "private",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"createdAt": {
"name": "createdAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(cast(strftime('%s', 'now') as int))"
},
"updatedAt": {
"name": "updatedAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(cast(strftime('%s', 'now') as int))"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {}
},
"daylio_entries": {
"name": "daylio_entries",
"columns": {
"time": {
"name": "time",
"type": "integer",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(cast(strftime('%s', 'now') as int))"
},
"updatedAt": {
"name": "updatedAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(cast(strftime('%s', 'now') as int))"
},
"publishedAt": {
"name": "publishedAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"mood": {
"name": "mood",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"notes": {
"name": "notes",
"type": "blob",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {}
},
"daylio_entry_activities": {
"name": "daylio_entry_activities",
"columns": {
"time": {
"name": "time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"activity": {
"name": "activity",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(cast(strftime('%s', 'now') as int))"
},
"updatedAt": {
"name": "updatedAt",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "(cast(strftime('%s', 'now') as int))"
}
},
"indexes": {},
"foreignKeys": {
"daylio_entry_activities_time_daylio_entries_time_fk": {
"name": "daylio_entry_activities_time_daylio_entries_time_fk",
"tableFrom": "daylio_entry_activities",
"tableTo": "daylio_entries",
"columnsFrom": [
"time"
],
"columnsTo": [
"time"
],
"onDelete": "cascade",
"onUpdate": "cascade"
},
"daylio_entry_activities_activity_daylio_activities_activity_fk": {
"name": "daylio_entry_activities_activity_daylio_activities_activity_fk",
"tableFrom": "daylio_entry_activities",
"tableTo": "daylio_activities",
"columnsFrom": [
"activity"
],
"columnsTo": [
"activity"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {
"daylio_entry_activities_time_activity_pk": {
"columns": [
"activity",
"time"
]
}
}
}
},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}
13 changes: 13 additions & 0 deletions astro/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "5",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "5",
"when": 1688443246383,
"tag": "0000_tan_magik",
"breakpoints": true
}
]
}
Loading

0 comments on commit 2395fdc

Please sign in to comment.