Skip to content
Open
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
32 changes: 32 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI
on: [push]
jobs:
Lint-and-type-check:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v6
- name: Create .env
run: cat .env.example > .env
- name: Install pnpm
uses: pnpm/action-setup@v6
- name: Install packages
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Type check
run: pnpm check

Build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v6
- name: Create .env
run: cat .env.example > .env
- name: Install pnpm
uses: pnpm/action-setup@v6
- name: Install packages
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check .",
"format": "prettier --write ."
"format": "prettier --write .",
"prepare": "svelte-kit sync"
},
"devDependencies": {
"@aws-sdk/client-s3": "^3.837.0",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form/ValidatedInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { LabelProps } from 'flowbite-svelte/Label.svelte';
import ValidatedLabel from './util/ValidatedLabel.svelte';
import ValidatedHelper from './util/ValidatedHelper.svelte';
import { ObjectSchema, type StringSchema, ValidationError } from 'yup';
import { type ObjectSchema, type StringSchema, ValidationError } from 'yup';

interface Props {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form/ValidatedInputGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ValidatedLabel from './util/ValidatedLabel.svelte';
import ValidatedHelper from './util/ValidatedHelper.svelte';
import type { ButtonGroupProps } from 'flowbite-svelte/ButtonGroup.svelte';
import { ObjectSchema, type StringSchema, ValidationError } from 'yup';
import { type ObjectSchema, type StringSchema, ValidationError } from 'yup';

interface Props {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form/ValidatedSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { SelectProps } from 'flowbite-svelte/Select.svelte';
import ValidatedLabel from './util/ValidatedLabel.svelte';
import ValidatedHelper from './util/ValidatedHelper.svelte';
import { ObjectSchema, type StringSchema, ValidationError } from 'yup';
import { type ObjectSchema, type StringSchema, ValidationError } from 'yup';

interface Props {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/form/ValidatedTextarea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { TextareaProps } from 'flowbite-svelte/Textarea.svelte';
import ValidatedLabel from './util/ValidatedLabel.svelte';
import ValidatedHelper from './util/ValidatedHelper.svelte';
import { ObjectSchema, type StringSchema, ValidationError } from 'yup';
import { type ObjectSchema, type StringSchema, ValidationError } from 'yup';

interface Props {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/models/basicModels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ISingleValue } from '$lib/types/basicTypes';
import mongoose, { Model } from 'mongoose';
import mongoose, { type Model } from 'mongoose';

export const singleValueSchema = new mongoose.Schema<ISingleValue>(
{},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/models/sessionModel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { User } from '$api/users/model';
import type { ISession } from '$lib/types/session';
import mongoose, { Model, Types } from 'mongoose';
import mongoose, { type Model, Types } from 'mongoose';

const sessionSchema = new mongoose.Schema<ISession & { _id: Buffer }>({
_id: { type: Buffer, required: true },
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/contact/validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { object, ObjectSchema, string } from 'yup';
import { object, type ObjectSchema, string } from 'yup';
import type { IContactUsMessage } from './types';

export const contactUsValidator: ObjectSchema<IContactUsMessage> = object({
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/page_data/announcement/validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { object, ObjectSchema, string } from 'yup';
import { object, type ObjectSchema, string } from 'yup';
import type { IAnnouncement } from './types';
import type { WithoutID } from '$lib/types/basicTypes';

Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/page_data/bellSchedule/validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WithoutID } from '$lib/types/basicTypes';
import { string, object, boolean, array, number, ObjectSchema } from 'yup';
import { string, object, boolean, array, number, type ObjectSchema } from 'yup';
import type { IBellSchedule, IBellScheduleDefaults, IBellScheduleOverride } from './types';
import { idArrayValidator, idValidator } from '$lib/validation/objectId';

Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/page_data/bulletinBoard/validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WithoutID } from '$lib/types/basicTypes';
import { object, ObjectSchema, string } from 'yup';
import { object, type ObjectSchema, string } from 'yup';
import type { IBulletinBoardNote } from './types';
import urlRegex from '$lib/validation/url';

Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/page_data/clubs/validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WithoutID } from '$lib/types/basicTypes';
import { object, ObjectSchema, string } from 'yup';
import { object, type ObjectSchema, string } from 'yup';
import type { IClub } from './types';

export const INSTAGRAM_REGEX = /^[a-zA-Z0-9._]*$/;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/page_data/usefulLinks/validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WithoutID } from '$lib/types/basicTypes';
import { string, object, array, ObjectSchema } from 'yup';
import { string, object, array, type ObjectSchema } from 'yup';
import type { ILinkCard } from './types';

export const linkCardLinkNameValidator = string().required().max(64).label('Name');
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/short_link/validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { object, ObjectSchema, string } from 'yup';
import { object, type ObjectSchema, string } from 'yup';
import type {
IShortLinkAdminUpdate,
IShortLinkCreate,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/v2/users/validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { object, number, ObjectSchema } from 'yup';
import { object, number, type ObjectSchema } from 'yup';
import type { IAdminUserUpdate } from './types';
import { Permission } from '$lib/auth/permissions';

Expand Down
22 changes: 22 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,26 @@ import { defineConfig } from 'vite';

export default defineConfig({
plugins: [enhancedImages(), sveltekit()],
build: {
rollupOptions: {
onwarn(warning) {
throw new Error(`[Werror] ${warning.message}`);
},
onLog(level, log, handler) {
if (level === 'warn') {
let isAllNodeModules = true;
if (log.ids && log.ids.length > 0) {
for (const id of log.ids) {
if (!id.includes('node_modules')) {
isAllNodeModules = false;
break;
}
}
}
if (!isAllNodeModules) throw new Error(`[Werror] ${log.message}`);
}
handler(level, log);
},
},
},
});