From 499a0ea289bdd35299b21264632099fcda9815b2 Mon Sep 17 00:00:00 2001
From: Clara
Date: Wed, 29 Jan 2025 11:34:04 +0100
Subject: [PATCH 01/56] change providerEndpouint to providername
---
api/src/db/schema.ts | 23 ++++++++++----
api/src/routes/auth.ts | 61 +++++++++++++++++++++++---------------
api/src/types/responses.ts | 26 ++++++++--------
3 files changed, 67 insertions(+), 43 deletions(-)
diff --git a/api/src/db/schema.ts b/api/src/db/schema.ts
index 81bfd596c..86d1f5a30 100644
--- a/api/src/db/schema.ts
+++ b/api/src/db/schema.ts
@@ -4,9 +4,10 @@ import { boolean, text, serial, pgTable as table, timestamp, integer, pgView } f
export const users = table('users', {
id: serial().primaryKey(),
name: text().notNull(),
+ displayName: text('display_name').notNull().unique(),
webId: text('web_id').notNull().unique(),
email: text('email').notNull().unique(),
- providerEndpoint: text('provider_endpoint').notNull(),
+ providerName: text('provider_name').notNull() // This is done so there is no import here. It crashes the drizzle:push command
})
export const usersRelations = relations(users, ({one}) => ({
@@ -18,23 +19,33 @@ export const posts = table('posts', {
content: text().notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
isPublic: boolean('is_public').notNull(),
- authorId: integer('author_id').notNull().references(() => users.id),
+ authorId: integer('author_id').notNull()
})
+export const postsRelations = relations(posts, ({ one }) => ({
+ author: one(users, {
+ fields: [posts.authorId],
+ references: [users.id]
+ })
+}))
+
+// Views
export const postsView = pgView('posts_view', {
id: serial().primaryKey(),
content: text().notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
isPublic: boolean('is_public').notNull(),
- authorId: integer('author_id').notNull().references(() => users.id),
- authorName: text("author_name").notNull(),
+ authorId: integer('author_id')
+ .notNull()
+ .references(() => users.id),
+ authorName: text('author_name').notNull(),
authorWebId: text('author_web_id').notNull().unique(),
- authorProviderEndpoint: text('author_provider_endpoint').notNull(),
+ authorProviderEndpoint: text('author_provider_endpoint').notNull()
}).as(sql`SELECT
posts.*,
users.name as author_name,
users.web_id as author_web_id,
- users.provider_endpoint as author_provider_endpoint
+ users.provider_name as author_provider_name
FROM posts
INNER JOIN users on posts.author_id = users.id
WHERE posts.is_public = true`)
diff --git a/api/src/routes/auth.ts b/api/src/routes/auth.ts
index 3732d7c30..10bb93239 100644
--- a/api/src/routes/auth.ts
+++ b/api/src/routes/auth.ts
@@ -1,14 +1,22 @@
-import { users } from "../db/schema"
-import ActivityPod from "../services/ActivityPod"
-import { type PodProviderSignInResponse, type SelectUsers, viablePodProviders, signinResponse, signUpBody, signinBody } from "../types"
-import { eq } from "drizzle-orm"
-import Elysia, { t } from "elysia"
-import { db } from ".."
-import setupPlugin from "./setup"
-import { getTokenObject } from "../services/jwt"
-import User from "../decorater/User"
+import { users } from '../db/schema'
+import ActivityPod from '../services/ActivityPod'
+import {
+ type PodProviderSignInResponse,
+ type SelectUsers,
+ signinResponse,
+ signUpBody,
+ signinBody,
+ viablePodProviders
+} from '../types'
+import { eq } from 'drizzle-orm'
+import Elysia, { t } from 'elysia'
+import { db } from '..'
+import setupPlugin from './setup'
+import { getTokenObject } from '../services/jwt'
+import User from '../decorater/User'
+import { HTTPError } from 'ky'
-const authPlugin = new Elysia({name: 'auth'})
+const authPlugin = new Elysia({ name: 'auth' })
.use(setupPlugin)
.post(
'/signin',
@@ -17,13 +25,13 @@ const authPlugin = new Elysia({name: 'auth'})
if (auth && (await jwt.verify(auth))) {
return error(204, "You're already logged in")
}
- const { username, password, providerEndpoint } = body
+ const { username, password, providerName } = body
let providerResponse: PodProviderSignInResponse
// try to signIn to the endpoint
try {
- providerResponse = await ActivityPod.signIn(providerEndpoint, username, password)
+ providerResponse = await ActivityPod.signIn(viablePodProviders[providerName], username, password)
} catch (e) {
console.error('Error while logging in to endpoint: ', e)
return error(400, "Endpoint didn't respond with a 200 status code")
@@ -43,9 +51,10 @@ const authPlugin = new Elysia({name: 'auth'})
.insert(users)
.values({
name: username as string,
+ displayName: username as string,
email: username as string,
webId: providerResponse.webId,
- providerEndpoint: providerEndpoint
+ providerName
})
.returning()
}
@@ -91,11 +100,11 @@ const authPlugin = new Elysia({name: 'auth'})
if (auth && (await jwt.verify(auth))) {
return "You're already logged in"
}
- const { username, password, email, providerEndpoint } = body
+ const { username, password, email, providerName } = body
// try to sign up the user with the current provider
try {
- const providerResponse = await ActivityPod.signup(providerEndpoint, username, password, email)
+ const providerResponse = await ActivityPod.signup(viablePodProviders[providerName], username, password, email)
let userResponse: SelectUsers[] = []
if (providerResponse.token === undefined) {
@@ -106,12 +115,16 @@ const authPlugin = new Elysia({name: 'auth'})
const user = await db.select().from(users).where(eq(users.webId, providerResponse.webId))
if (user.length === 0) {
// the user is not in the database yet, so we need to create a new user
- userResponse = await db.insert(users).values({
- name: username as string,
- email,
- webId: providerResponse.webId,
- providerEndpoint: providerEndpoint
- }).returning()
+ userResponse = await db
+ .insert(users)
+ .values({
+ name: username as string,
+ displayName: username as string,
+ email,
+ webId: providerResponse.webId,
+ providerName
+ })
+ .returning()
}
} catch (e) {
console.error('Error while checking if user is in the database: ', e)
@@ -124,8 +137,8 @@ const authPlugin = new Elysia({name: 'auth'})
user: userResponse[0]
}
}
- } catch (e: any) {
- if (e.name === 'HTTPError') {
+ } catch (e: unknown) {
+ if (e instanceof HTTPError) {
const errorJson = await e.response.json()
console.error('Error while signing up the user', errorJson)
return error(errorJson.code, errorJson.message)
@@ -140,7 +153,7 @@ const authPlugin = new Elysia({name: 'auth'})
response: {
200: signinResponse,
400: t.String(),
- 500: t.String(),
+ 500: t.String()
}
}
)
diff --git a/api/src/types/responses.ts b/api/src/types/responses.ts
index a8a0b5f5d..7f521c3a3 100644
--- a/api/src/types/responses.ts
+++ b/api/src/types/responses.ts
@@ -2,16 +2,16 @@ import { t, type Static } from 'elysia'
import { _selectUsers } from './db'
import { viablePodProviders } from './enums'
import { createSchemaFactory } from 'drizzle-typebox'
-import { posts, postsView, users } from '../db/schema'
+import { postsView, users } from '../db/schema'
-const {createSelectSchema} = createSchemaFactory({typeboxInstance: t})
+const { createSelectSchema } = createSchemaFactory({ typeboxInstance: t })
// Auth
// SignIn
export const signinBody = t.Object({
username: t.String(),
password: t.String(),
- providerEndpoint: viablePodProviders
+ providerName: viablePodProviders
})
export type SignInBody = Static
@@ -25,7 +25,7 @@ export const signUpBody = t.Object({
username: t.String(),
password: t.String(),
email: t.String(),
- providerEndpoint: viablePodProviders
+ providerName: viablePodProviders
})
export type SignUpBody = Static
@@ -35,14 +35,14 @@ export const selectUser = createSelectSchema(users)
// Posts
export const selectPost = createSelectSchema(postsView)
export type SelectPost = {
- id: number;
- content: string;
- isPublic: boolean;
- createdAt: string;
- authorId: number;
+ id: number
+ content: string
+ isPublic: boolean
+ createdAt: string
+ authorId: number
author: {
- id: number;
- name: string;
- webId: string;
- };
+ id: number
+ name: string
+ webId: string
+ }
}
From fada10b5ee85bb8db96df3ae7eb0c23cee0dbebb Mon Sep 17 00:00:00 2001
From: Clara
Date: Wed, 29 Jan 2025 11:46:14 +0100
Subject: [PATCH 02/56] change enum to contain names not endpoints
---
api/src/routes/auth.ts | 6 +++---
api/src/types/enums.ts | 14 +++++++++++---
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/api/src/routes/auth.ts b/api/src/routes/auth.ts
index 10bb93239..4222f5522 100644
--- a/api/src/routes/auth.ts
+++ b/api/src/routes/auth.ts
@@ -6,7 +6,7 @@ import {
signinResponse,
signUpBody,
signinBody,
- viablePodProviders
+ podProviderEndpoint
} from '../types'
import { eq } from 'drizzle-orm'
import Elysia, { t } from 'elysia'
@@ -31,7 +31,7 @@ const authPlugin = new Elysia({ name: 'auth' })
// try to signIn to the endpoint
try {
- providerResponse = await ActivityPod.signIn(viablePodProviders[providerName], username, password)
+ providerResponse = await ActivityPod.signIn(podProviderEndpoint[providerName], username, password)
} catch (e) {
console.error('Error while logging in to endpoint: ', e)
return error(400, "Endpoint didn't respond with a 200 status code")
@@ -104,7 +104,7 @@ const authPlugin = new Elysia({ name: 'auth' })
// try to sign up the user with the current provider
try {
- const providerResponse = await ActivityPod.signup(viablePodProviders[providerName], username, password, email)
+ const providerResponse = await ActivityPod.signup(podProviderEndpoint[providerName], username, password, email)
let userResponse: SelectUsers[] = []
if (providerResponse.token === undefined) {
diff --git a/api/src/types/enums.ts b/api/src/types/enums.ts
index 0e6fc1bb2..7446dbb89 100644
--- a/api/src/types/enums.ts
+++ b/api/src/types/enums.ts
@@ -1,5 +1,13 @@
import { t } from 'elysia'
-export const viablePodProviders = t.Enum({
- 'http://localhost:3000': 'http://localhost:3000'
-})
+export const vibaleProviderNames = ['memory.']
+
+export enum ViablePodProvider {
+ 'memory.' = 'memory.'
+}
+
+export const podProviderEndpoint: { [key in ViablePodProvider]: string } = {
+ 'memory.': 'http://localhost:3000'
+}
+
+export const viablePodProviders = t.Enum(ViablePodProvider)
From 117f692e828280de1f0782c3d4396048dbfc1f04 Mon Sep 17 00:00:00 2001
From: Clara
Date: Wed, 29 Jan 2025 11:46:56 +0100
Subject: [PATCH 03/56] change site to provider providerName instead of
endpoint
---
frontend/src/components/SignInForm.vue | 4 ++--
frontend/src/components/SignupForm.vue | 4 ++--
frontend/src/stores/authStore.ts | 20 ++++++++++----------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/frontend/src/components/SignInForm.vue b/frontend/src/components/SignInForm.vue
index 4a355dc59..284e6c9ec 100644
--- a/frontend/src/components/SignInForm.vue
+++ b/frontend/src/components/SignInForm.vue
@@ -1,14 +1,14 @@
@@ -23,7 +26,7 @@ const router = useRouter()
-
+
From e9aa891e9f4b259536a0f2663c29dd33df5ff755 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 11:51:06 +0100
Subject: [PATCH 46/56] feat: make apirequest work with new responses
---
frontend/src/controller/api.ts | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/frontend/src/controller/api.ts b/frontend/src/controller/api.ts
index 5b693ac60..6e9372855 100644
--- a/frontend/src/controller/api.ts
+++ b/frontend/src/controller/api.ts
@@ -1,7 +1,6 @@
import type {
CreatePost,
FollowersFollowedResponse,
- FollowUnfollowResponse,
SelectPost,
SelectQueryObject,
SignInBody,
@@ -176,11 +175,11 @@ export class ApiClient {
* @param {string} userId - id of the user to follow
* @returns {Promise} - response of the request
*/
- async followUser(userId: string): Promise> {
+ async followUser(userId: string): Promise> {
try {
- const response = await this.authRequest.post(`${this.baseUrl}/users/${userId}/follow`)
+ const response = await this.authRequest.post(`${this.baseUrl}/user/${userId}/follow`)
return {
- data: await response.text(),
+ data: await response.json(),
status: response.status
}
} catch (e) {
@@ -193,11 +192,11 @@ export class ApiClient {
* @param {string} userId - id of the user to unfollow
* @returns {Promise>}
*/
- async unfollowUser(userId: string): Promise> {
+ async unfollowUser(userId: string): Promise> {
try {
- const response = await this.authRequest.post(`${this.baseUrl}/users/${userId}/unfollow`)
+ const response = await this.authRequest.post(`${this.baseUrl}/user/${userId}/unfollow`)
return {
- data: await response.text(),
+ data: await response.json(),
status: response.status
}
} catch (e) {
@@ -211,7 +210,7 @@ export class ApiClient {
*/
async fetchFollowing(): Promise> {
try {
- const response = await this.authRequest.get(`${this.baseUrl}/users/following`)
+ const response = await this.authRequest.get(`${this.baseUrl}/user/following`)
return {
data: await response.json(),
status: response.status
@@ -227,7 +226,7 @@ export class ApiClient {
*/
async fetchFollowers(): Promise> {
try {
- const response = await this.authRequest.get(`${this.baseUrl}/users/followers`)
+ const response = await this.authRequest.get(`${this.baseUrl}/user/followers`)
return {
data: await response.json(),
status: response.status
From 8aa978a63f694d91b083f2c0c9b63f7faae6c300 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 11:54:19 +0100
Subject: [PATCH 47/56] feat: make it possible to follow user
---
frontend/src/components/PostList.vue | 6 ++++-
frontend/src/stores/userStore.ts | 39 +++++++++++++++++++++++++---
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/frontend/src/components/PostList.vue b/frontend/src/components/PostList.vue
index bb5cec914..829434ee6 100644
--- a/frontend/src/components/PostList.vue
+++ b/frontend/src/components/PostList.vue
@@ -2,8 +2,10 @@
import { usePostsStore } from '@/stores/postsStore'
import { DateTime } from 'luxon'
import MemoryButton from './MemoryButton.vue'
+import { useUserStore } from '@/stores/userStore'
const postsStore = usePostsStore()
+const userStore = useUserStore()
@@ -22,7 +24,9 @@ const postsStore = usePostsStore()
{{ DateTime.fromISO(post.createdAt).toRelative() }}
- Follow
+
+ Follow
+
{{ post.content }}
diff --git a/frontend/src/stores/userStore.ts b/frontend/src/stores/userStore.ts
index 3bcbfdae2..b62485c45 100644
--- a/frontend/src/stores/userStore.ts
+++ b/frontend/src/stores/userStore.ts
@@ -3,12 +3,15 @@ import { ApiClient } from '@/controller/api'
import { ResponseStatus } from '@/types'
import { defineStore } from 'pinia'
import { ref } from 'vue'
+import { useAuthStore } from './authStore'
+import { VsNotification } from 'vuesax-alpha'
/**
* Store handeling all things user related
*/
-export const useUserStore = defineStore('user', async () => {
+export const useUserStore = defineStore('user', () => {
const client = new ApiClient()
+ const authStore = useAuthStore()
// store vars
const following = ref([])
@@ -19,7 +22,22 @@ export const useUserStore = defineStore('user', async () => {
* @param userWebId - webId of the user to follow
*/
async function followUser(userWebId: string) {
- await client.followUser(userWebId)
+ const response = await client.followUser(userWebId)
+ if (response.status === ResponseStatus.OK) {
+ following.value.push(response.data)
+ VsNotification({
+ title: `You are now following ${response.data.name}`,
+ content: '',
+ color: 'success'
+ })
+ } else {
+ console.error('Error when following user: ', response.data)
+ VsNotification({
+ title: 'Error while following user',
+ content: response.data,
+ color: 'danger'
+ })
+ }
}
async function unfollowUser(userWebId: string) {
@@ -53,9 +71,21 @@ export const useUserStore = defineStore('user', async () => {
}
}
+ /**
+ * Check if the current user can follow the user
+ * @param {string} userWebId - webId of the user to check
+ * @returns {boolean} - true if the user can follow the user, false if not
+ */
+ function canFollow(userWebId: string): boolean {
+ // check if the user is the current user
+ if (userWebId === authStore.user?.webId) return false
+ // check if the user is already following the user
+ return following.value.find(user => user.webId === userWebId) === undefined
+ }
+
// Init
- await getFollowing()
- await getFollowers()
+ getFollowing()
+ getFollowers()
return {
following,
@@ -63,6 +93,7 @@ export const useUserStore = defineStore('user', async () => {
getFollowing,
getFollowers,
followUser,
+ canFollow,
unfollowUser
}
})
From 061d58a60f0df7fd789b24ef769286432467e2b7 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 11:54:32 +0100
Subject: [PATCH 48/56] code: remove unused import
---
frontend/src/main.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index d00c70b67..39227b087 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -2,7 +2,6 @@ import { createApp } from 'vue'
import { createPinia } from 'pinia'
import Vuesax from 'vuesax-alpha'
import VueSaxIcon from '@/components/VueSaxIcon.vue'
-import { VsxIcon } from 'vue-iconsax'
import App from './App.vue'
import router from './router'
From b2126fbec36d8e04970b8480bdf3fba63bc206d2 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:02:17 +0100
Subject: [PATCH 49/56] code: make scripts more descriptive
---
frontend/package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/frontend/package.json b/frontend/package.json
index 72a60d4fe..9a0b7cbab 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -10,7 +10,8 @@
"test:unit": "vitest",
"build-only": "vite build",
"type-check": "vue-tsc --build",
- "lint": "eslint . --fix",
+ "lint": "eslint .",
+ "lint:fix": "eslint . --fix",
"format": "prettier --write src/",
"sync": "cap sync",
"open:android": "cap open android",
From 541b9b1f769f5a5b5d7e8d3ab52660bcd1dcdc88 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:10:42 +0100
Subject: [PATCH 50/56] code: format file with prettier
---
frontend/src/assets/fonts/Butler/index.css | 78 ++++++++++++----------
1 file changed, 42 insertions(+), 36 deletions(-)
diff --git a/frontend/src/assets/fonts/Butler/index.css b/frontend/src/assets/fonts/Butler/index.css
index 28340bc18..18e3618cb 100644
--- a/frontend/src/assets/fonts/Butler/index.css
+++ b/frontend/src/assets/fonts/Butler/index.css
@@ -1,56 +1,62 @@
@font-face {
- font-family: 'Butler';
- src: url('Butler-UltraLight.woff2') format('woff2'),
- url('Butler-UltraLight.woff') format('woff');
- font-weight: 200;
- font-style: normal;
+ font-family: 'Butler';
+ src:
+ url('Butler-UltraLight.woff2') format('woff2'),
+ url('Butler-UltraLight.woff') format('woff');
+ font-weight: 200;
+ font-style: normal;
}
@font-face {
- font-family: 'Butler';
- src: url('Butler-Medium.woff2') format('woff2'),
- url('Butler-Medium.woff') format('woff');
- font-weight: 500;
- font-style: normal;
+ font-family: 'Butler';
+ src:
+ url('Butler-Medium.woff2') format('woff2'),
+ url('Butler-Medium.woff') format('woff');
+ font-weight: 500;
+ font-style: normal;
}
@font-face {
- font-family: 'Butler';
- src: url('Butler-Light.woff2') format('woff2'),
- url('Butler-Light.woff') format('woff');
- font-weight: 300;
- font-style: normal;
+ font-family: 'Butler';
+ src:
+ url('Butler-Light.woff2') format('woff2'),
+ url('Butler-Light.woff') format('woff');
+ font-weight: 300;
+ font-style: normal;
}
@font-face {
- font-family: 'Butler';
- src: url('Butler-Black.woff2') format('woff2'),
- url('Butler-Black.woff') format('woff');
- font-weight: 900;
- font-style: normal;
+ font-family: 'Butler';
+ src:
+ url('Butler-Black.woff2') format('woff2'),
+ url('Butler-Black.woff') format('woff');
+ font-weight: 900;
+ font-style: normal;
}
@font-face {
- font-family: 'Butler';
- src: url('Butler-Bold.woff2') format('woff2'),
- url('Butler-Bold.woff') format('woff');
- font-weight: bold;
- font-style: normal;
+ font-family: 'Butler';
+ src:
+ url('Butler-Bold.woff2') format('woff2'),
+ url('Butler-Bold.woff') format('woff');
+ font-weight: bold;
+ font-style: normal;
}
@font-face {
- font-family: 'Butler';
- src: url('Butler-ExtraBold.woff2') format('woff2'),
- url('Butler-ExtraBold.woff') format('woff');
- font-weight: 800;
- font-style: normal;
+ font-family: 'Butler';
+ src:
+ url('Butler-ExtraBold.woff2') format('woff2'),
+ url('Butler-ExtraBold.woff') format('woff');
+ font-weight: 800;
+ font-style: normal;
}
@font-face {
- font-family: 'Butler';
- src: url('Butler.woff2') format('woff2'),
- url('Butler.woff') format('woff');
- font-weight: normal;
- font-style: normal;
+ font-family: 'Butler';
+ src:
+ url('Butler.woff2') format('woff2'),
+ url('Butler.woff') format('woff');
+ font-weight: normal;
+ font-style: normal;
}
-
From 235bfcb30eab3ec402316bfda158dcf55f5de95c Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:15:29 +0100
Subject: [PATCH 51/56] feat: add action to test for eslint, prettier and test
compliance
---
.github/workflows/check.yml | 34 ++++++++++++++++++++++++++++++++++
api/package.json | 3 ++-
frontend/package.json | 1 +
3 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 .github/workflows/check.yml
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
new file mode 100644
index 000000000..617114dd6
--- /dev/null
+++ b/.github/workflows/check.yml
@@ -0,0 +1,34 @@
+name: checks
+
+on:
+ pull_request:
+ branches:
+ - master
+ - dev
+ push:
+ branches:
+ - master
+
+jobs:
+ linting:
+ name: linting
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: oven-sh/setup-bun@v2
+
+ # run eslint and prettier on the frontend and api
+ - run: bun install && bun lint && bun format --check
+ working-directory: ./frontend
+ - run: bun install && bunx eslint .
+ working-directory: ./api
+ testing:
+ name: testing
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: oven-sh/setup-bun@v2
+
+ # run tests on the api
+ - run: bun install && bun test
+ working-directory: ./api
diff --git a/api/package.json b/api/package.json
index 20c60a50d..d8d40b393 100644
--- a/api/package.json
+++ b/api/package.json
@@ -11,7 +11,8 @@
"drizzle:generate": "drizzle-kit generate",
"lint": "bunx eslint src",
"lint:fix": "bunx eslint --fix src",
- "format": "bunx prettier src --write"
+ "format": "bunx prettier src/ --write",
+ "format:check": "prettier --check src/"
},
"type": "module",
"devDependencies": {
diff --git a/frontend/package.json b/frontend/package.json
index 9a0b7cbab..c5a768a04 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -13,6 +13,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write src/",
+ "format:check": "prettier --check src/",
"sync": "cap sync",
"open:android": "cap open android",
"open:ios": "cap open ios"
From 04275c125d9f96d29c360bf5aed9a5a70eb5d7f9 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:27:27 +0100
Subject: [PATCH 52/56] fix: make scripts check all files in folder
---
api/package.json | 8 ++++----
frontend/package.json | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/api/package.json b/api/package.json
index d8d40b393..124430a80 100644
--- a/api/package.json
+++ b/api/package.json
@@ -9,10 +9,10 @@
"drizzle:push": "drizzle-kit push",
"drizzle:migrate": "drizzle-kit migrate",
"drizzle:generate": "drizzle-kit generate",
- "lint": "bunx eslint src",
- "lint:fix": "bunx eslint --fix src",
- "format": "bunx prettier src/ --write",
- "format:check": "prettier --check src/"
+ "lint": "bunx eslint .",
+ "lint:fix": "bunx eslint --fix .",
+ "format": "bunx prettier . --write",
+ "format:check": "prettier --check ."
},
"type": "module",
"devDependencies": {
diff --git a/frontend/package.json b/frontend/package.json
index c5a768a04..84e2d7d15 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -12,8 +12,8 @@
"type-check": "vue-tsc --build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
- "format": "prettier --write src/",
- "format:check": "prettier --check src/",
+ "format": "prettier --write .",
+ "format:check": "prettier --check .",
"sync": "cap sync",
"open:android": "cap open android",
"open:ios": "cap open ios"
From aba1bc052ca4bd15decd9ae0515766a93a85b0ee Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:28:01 +0100
Subject: [PATCH 53/56] fix: make eslint and prettier ignore build files
---
api/eslint.config.js | 4 ++++
frontend/.prettierignore | 2 ++
2 files changed, 6 insertions(+)
create mode 100644 frontend/.prettierignore
diff --git a/api/eslint.config.js b/api/eslint.config.js
index 309fdf527..5ea76bc09 100644
--- a/api/eslint.config.js
+++ b/api/eslint.config.js
@@ -8,6 +8,10 @@ export default [
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
+ {
+ name: 'app/files-to-ignore',
+ ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**', 'pm2.config.js']
+ },
{
rules: {
'no-unused-vars': ['off'],
diff --git a/frontend/.prettierignore b/frontend/.prettierignore
new file mode 100644
index 000000000..5cff45b98
--- /dev/null
+++ b/frontend/.prettierignore
@@ -0,0 +1,2 @@
+**/ios/**
+**/android/**
\ No newline at end of file
From 55a9c2cfdc45cd4162fa6d1cf14fe84fd192373e Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:28:12 +0100
Subject: [PATCH 54/56] code: run prettier
---
frontend/index.html | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/frontend/index.html b/frontend/index.html
index 9e5fc8f06..9d30802cd 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -1,9 +1,9 @@
-
+
-
-
-
+
+
+
Vite App
From fe0230e788a457d223e198fbca543ee8e1c93f03 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:28:32 +0100
Subject: [PATCH 55/56] fix: make action use the bun scripts
---
.github/workflows/check.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 617114dd6..90b782501 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -18,9 +18,9 @@ jobs:
- uses: oven-sh/setup-bun@v2
# run eslint and prettier on the frontend and api
- - run: bun install && bun lint && bun format --check
+ - run: bun install && bun lint && bun format:check
working-directory: ./frontend
- - run: bun install && bunx eslint .
+ - run: bun install && bunx format:check
working-directory: ./api
testing:
name: testing
From 5d16c124601278ebcd2e56d14ee5c4aa27606ad0 Mon Sep 17 00:00:00 2001
From: Clara
Date: Fri, 31 Jan 2025 12:29:18 +0100
Subject: [PATCH 56/56] fix: typo
---
.github/workflows/check.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 90b782501..465ac8e27 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -20,7 +20,7 @@ jobs:
# run eslint and prettier on the frontend and api
- run: bun install && bun lint && bun format:check
working-directory: ./frontend
- - run: bun install && bunx format:check
+ - run: bun install && bun format:check
working-directory: ./api
testing:
name: testing