diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a82749a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,13 @@ +{ + "printWidth": 150, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "bracketSpacing": false, + "jsxBracketSameLine": false, + "arrowParens": "avoid", + "requirePragma": false, + "insertPragma": false +} diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index f097ede..5dee0a3 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -4,8 +4,8 @@ pipeline: build: image: node commands: - - yarn - - yarn run build + - yarn + - yarn run build archive: image: joseluisq/drone-archive @@ -27,4 +27,4 @@ pipeline: files: ./summer-ui.tar.gz when: event: - - tag + - tag diff --git a/src/api/api.ts b/src/api/api.ts index 0dbc6ec..95c54f8 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -1,4 +1,4 @@ -import { loginStore, type LoginStore } from "../stores/login"; +import {loginStore, type LoginStore} from "../stores/login"; export function URL() { return import.meta.env.VITE_API_URL; @@ -20,7 +20,7 @@ export async function sendSessionRequest(path: string, opt: RequestInit) { // Create jwt refresh request let refHead = new Headers(); setLoginHeaders(headers, true); - let y = await sendApiRequest("/v1/marigold/auth/refresh", { method: "POST", headers: refHead }); + let y = await sendApiRequest("/v1/marigold/auth/refresh", {method: "POST", headers: refHead}); // Success if (y.status === 200) { diff --git a/src/api/login.ts b/src/api/login.ts index daf7046..aa99297 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -1,4 +1,4 @@ -import { sendSessionRequest } from "./api"; +import {sendSessionRequest} from "./api"; export async function postLogin(data: object, token?: string) { let headers = new Headers(); @@ -6,12 +6,12 @@ export async function postLogin(data: object, token?: string) { headers.set("Content-Type", "application/json"); if (token !== undefined) headers.set("Authorization", "Bearer " + token); - let z = await sendSessionRequest("/v1/marigold/auth/login", { method: "POST", headers, body: JSON.stringify(data) }); + let z = await sendSessionRequest("/v1/marigold/auth/login", {method: "POST", headers, body: JSON.stringify(data)}); return await z.json(); } export async function getUser(id: string | number) { - let z = await sendSessionRequest("/v1/marigold/user/" + id, { method: "GET" }); + let z = await sendSessionRequest("/v1/marigold/user/" + id, {method: "GET"}); if (z.status != 200) throw new Error("Request failed"); return await z.json(); } diff --git a/src/api/oauth.ts b/src/api/oauth.ts index 21fd278..dc6d135 100644 --- a/src/api/oauth.ts +++ b/src/api/oauth.ts @@ -1,13 +1,13 @@ -import { sendApiRequest, sendSessionRequest } from "./api"; +import {sendApiRequest, sendSessionRequest} from "./api"; export async function getOAuthApp(id: string) { - let z = await sendSessionRequest("/v1/marigold/app/" + id, { method: "GET" }); + let z = await sendSessionRequest("/v1/marigold/app/" + id, {method: "GET"}); if (z.status != 200) throw new Error("Request failed"); return await z.json(); } export async function getOAuthScopes() { - let z = await sendApiRequest("/v1/marigold/scopes", { method: "GET" }); + let z = await sendApiRequest("/v1/marigold/scopes", {method: "GET"}); if (z.status != 200) throw new Error("Request failed"); return await z.json(); } diff --git a/src/assets/material-symbols.scss b/src/assets/material-symbols.scss index 72f5c3d..683f649 100644 --- a/src/assets/material-symbols.scss +++ b/src/assets/material-symbols.scss @@ -1,13 +1,13 @@ /* fallback */ @font-face { - font-family: 'Material Symbols Outlined'; + font-family: "Material Symbols Outlined"; font-style: normal; font-weight: 400; - src: url(~/assets/material-symbols.woff2) format('woff2'); + src: url(~/assets/material-symbols.woff2) format("woff2"); } @mixin mso { - font-family: 'Material Symbols Outlined'; + font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 24px; @@ -18,6 +18,6 @@ white-space: nowrap; word-wrap: normal; direction: ltr; - -moz-font-feature-settings: 'liga'; + -moz-font-feature-settings: "liga"; -moz-osx-font-smoothing: grayscale; -} \ No newline at end of file +} diff --git a/src/main.ts b/src/main.ts index 01b3af1..1ef5cbc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,8 @@ -import './app.scss' -import App from './App.svelte' +import "./app.scss"; +import App from "./App.svelte"; const app = new App({ - target: document.getElementById('app') -}) + target: document.getElementById("app"), +}); -export default app +export default app; diff --git a/src/stores/login.ts b/src/stores/login.ts index c35a0c7..61ee61f 100644 --- a/src/stores/login.ts +++ b/src/stores/login.ts @@ -1,4 +1,4 @@ -import { writable } from "svelte/store"; +import {writable} from "svelte/store"; export interface LoginStore { access: string; @@ -12,7 +12,7 @@ export const loginStore = writable( } catch (_) { return null; } - })() + })(), ); -loginStore.subscribe((value) => localStorage.setItem("login-session", JSON.stringify(value))); +loginStore.subscribe(value => localStorage.setItem("login-session", JSON.stringify(value))); diff --git a/svelte.config.js b/svelte.config.js index 3630bb3..7714a51 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,7 +1,7 @@ -import sveltePreprocess from 'svelte-preprocess' +import sveltePreprocess from "svelte-preprocess"; export default { // Consult https://github.com/sveltejs/svelte-preprocess // for more information about preprocessors - preprocess: sveltePreprocess() -} + preprocess: sveltePreprocess(), +}; diff --git a/tsconfig.json b/tsconfig.json index fdb62fb..785b32a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "module": "ESNext", "resolveJsonModule": true, "baseUrl": "./src", - "paths": { "~/*": ["./*"] }, + "paths": {"~/*": ["./*"]}, /** * Typecheck JS in `.svelte` and `.js` files by default. * Disable checkJs if you'd like to use dynamic types in JS. @@ -18,5 +18,5 @@ "isolatedModules": true }, "include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte", "src/**/*.mjs"], - "references": [{ "path": "./tsconfig.node.json" }] + "references": [{"path": "./tsconfig.node.json"}] } diff --git a/vite.config.ts b/vite.config.ts index 3901474..45dc014 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,7 @@ -import { defineConfig } from "vite"; -import { svelte } from "@sveltejs/vite-plugin-svelte"; +import {defineConfig} from "vite"; +import {svelte} from "@sveltejs/vite-plugin-svelte"; import sveltePreprocess from "svelte-preprocess"; -import { resolve as pathResolve } from "path"; +import {resolve as pathResolve} from "path"; // https://vitejs.dev/config/ export default defineConfig({ @@ -16,7 +16,7 @@ export default defineConfig({ }), }), ], - optimizeDeps: { exclude: ["svelte-navigator"] }, + optimizeDeps: {exclude: ["svelte-navigator"]}, resolve: { alias: { "~": pathResolve(__dirname, "src"),