Skip to content

Commit

Permalink
Formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
addisonbeck committed Sep 26, 2023
1 parent c698038 commit 46f583d
Show file tree
Hide file tree
Showing 80 changed files with 774 additions and 805 deletions.
18 changes: 9 additions & 9 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:svelte/recommended",
"prettier",
"plugin:storybook/recommended",
"plugin:storybook/recommended",
"plugin:storybook/recommended",
"plugin:storybook/recommended"
],
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier',
'plugin:storybook/recommended',
'plugin:storybook/recommended',
'plugin:storybook/recommended',
'plugin:storybook/recommended'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
Expand Down
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: "weekly"
interval: 'weekly'
38 changes: 19 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Build & Deploy
on:
push:
branches: [ "main" ]
branches: ['main']
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- name: deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_KEY_PRI }}
source: dist/*
target: ${{ secrets.DEPLOY_PATH }}
strip_components: 1
overwrite: true
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- name: deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_KEY_PRI }}
source: dist/*
target: ${{ secrets.DEPLOY_PATH }}
strip_components: 1
overwrite: true
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const config: StorybookConfig = {
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'storybook-addon-themes',
'storybook-addon-themes'
],
framework: {
name: '@storybook/sveltekit',
Expand Down
18 changes: 9 additions & 9 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import type { Preview } from '@storybook/svelte';
import '../src/lib/components/layout.css';

const preview: Preview = {
parameters: {
themes: {
default: 'light',
list: [
{ name: 'light', class: 'light', color: '#ffffff' },
{ name: 'dark', class: 'dark', color: '#000000' }
],
},
},
parameters: {
themes: {
default: 'light',
list: [
{ name: 'light', class: 'light', color: '#ffffff' },
{ name: 'dark', class: 'dark', color: '#000000' }
]
}
}
};

export default preview;
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@
# Personal Website

Welcome! This is the codebase and deployment pipeline that run [addisonbeck.com](https://addisonbeck.com). It's written using SvelteKit and is configured to generate a static website.



113 changes: 56 additions & 57 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,58 @@
{
"name": "website",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"dev:addison": "vite dev --config ./vite.config.dev.ts --host",
"build": "vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"test:integration": "playwright test",
"test:unit": "vitest",
"storybook": "storybook dev",
"storybook:addison": "storybook dev -p 6006 --https --ssl-cert ./addisonbeck.dev.crt --ssl-key ./addisonbeck.dev.key --no-open",
"build-storybook": "storybook build"
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@storybook/addon-essentials": "^7.4.2",
"@storybook/addon-interactions": "^7.4.0",
"@storybook/addon-links": "^7.4.0",
"@storybook/blocks": "^7.4.2",
"@storybook/svelte": "^7.4.2",
"@storybook/sveltekit": "^7.4.0",
"@storybook/testing-library": "^0.2.0",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.25.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "*",
"eslint-plugin-storybook": "^0.6.13",
"eslint-plugin-svelte": "^2.33.1",
"prettier": "*",
"prettier-plugin-svelte": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.4.0",
"storybook-addon-themes": "^6.1.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2",
"vitest": "^0.34.4",
"@codemirror/lang-json": "^6.0.1"
},
"type": "module",
"dependencies": {
"html2canvas": "^1.4.1",
"jspdf": "^2.5.1",
"svelte-codemirror-editor": "^1.1.0"
}
"name": "website",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"dev:addison": "vite dev --config ./vite.config.dev.ts --host",
"build": "vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --write . && eslint . --fix",
"test:integration": "playwright test",
"test:unit": "vitest",
"storybook": "storybook dev",
"storybook:addison": "storybook dev -p 6006 --https --ssl-cert ./addisonbeck.dev.crt --ssl-key ./addisonbeck.dev.key --no-open",
"build-storybook": "storybook build"
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@storybook/addon-essentials": "^7.4.2",
"@storybook/addon-interactions": "^7.4.0",
"@storybook/addon-links": "^7.4.0",
"@storybook/blocks": "^7.4.2",
"@storybook/svelte": "^7.4.2",
"@storybook/sveltekit": "^7.4.0",
"@storybook/testing-library": "^0.2.0",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.25.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "*",
"eslint-plugin-storybook": "^0.6.13",
"eslint-plugin-svelte": "^2.33.1",
"prettier": "*",
"prettier-plugin-svelte": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.4.0",
"storybook-addon-themes": "^6.1.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2",
"vitest": "^0.34.4",
"@codemirror/lang-json": "^6.0.1"
},
"type": "module",
"dependencies": {
"html2canvas": "^1.4.1",
"jspdf": "^2.5.1",
"svelte-codemirror-editor": "^1.1.0"
}
}
63 changes: 35 additions & 28 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="%sveltekit.assets%/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="%sveltekit.assets%/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="%sveltekit.assets%/favicon-16x16.png">
<link rel="manifest" href="%sveltekit.assets%/site.webmanifest">
<link rel="apple-touch-icon" sizes="180x180" href="%sveltekit.assets%/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="%sveltekit.assets%/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="%sveltekit.assets%/favicon-16x16.png" />
<link rel="manifest" href="%sveltekit.assets%/site.webmanifest" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
Expand All @@ -16,32 +16,39 @@
</html>

<script>
const preference = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
const preference = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';

function setDarkMode(dark, preference) {
if (dark) {
preference !== "dark" ? localStorage.setItem('theme', 'dark') : localStorage.removeItem('theme');
document.documentElement.classList.add('dark');
} else if (!dark) {
preference !== "light" ? localStorage.setItem('theme', 'light') : localStorage.removeItem('theme');
document.documentElement.classList.remove('dark');
}
};
function setDarkMode(dark, preference) {
if (dark) {
preference !== 'dark'
? localStorage.setItem('theme', 'dark')
: localStorage.removeItem('theme');
document.documentElement.classList.add('dark');
} else if (!dark) {
preference !== 'light'
? localStorage.setItem('theme', 'light')
: localStorage.removeItem('theme');
document.documentElement.classList.remove('dark');
}
}

function getIsDark() {
return localStorage.getItem('theme') === "dark" || (!('theme' in localStorage) && preference === 'dark')
}
function getIsDark() {
return (
localStorage.getItem('theme') === 'dark' ||
(!('theme' in localStorage) && preference === 'dark')
);
}

function toggleTheme() {
console.log("toggling!");
setDarkMode(!getIsDark(), preference);
}
function toggleTheme() {
console.log('toggling!');
setDarkMode(!getIsDark(), preference);
}

if (getIsDark()) {
setDarkMode(true, preference);
} else {
setDarkMode(false, preference);
}
if (getIsDark()) {
setDarkMode(true, preference);
} else {
setDarkMode(false, preference);
}

document.getElementById("themeToggle").addEventListener('click', toggleTheme);
document.getElementById('themeToggle').addEventListener('click', toggleTheme);
</script>
9 changes: 4 additions & 5 deletions src/lib/components/About.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import type { Meta, StoryObj } from '@storybook/svelte';
import About from './About.svelte';

const meta = {
title: 'Components/About',
component: About,
tags: ['autodocs'],
title: 'Components/About',
component: About,
tags: ['autodocs']
} satisfies Meta<About>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
};
export const Default: Story = {};
9 changes: 4 additions & 5 deletions src/lib/components/BlobEditor.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import type { Meta, StoryObj } from '@storybook/svelte';
import BlobEditor from './BlobEditor.svelte';

const meta = {
title: 'Controls/Editor/Blob Editor',
component: BlobEditor,
tags: ['autodocs'],
title: 'Controls/Editor/Blob Editor',
component: BlobEditor,
tags: ['autodocs']
} satisfies Meta<BlobEditor>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
};
export const Default: Story = {};
15 changes: 7 additions & 8 deletions src/lib/components/Button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ import type { Meta, StoryObj } from '@storybook/svelte';
import Button from './Button.svelte';

const meta = {
title: 'Controls/Button',
component: Button,
tags: ['autodocs'],
title: 'Controls/Button',
component: Button,
tags: ['autodocs']
} satisfies Meta<Button>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
};
export const Default: Story = {};

export const Round: Story = {
args: {
type: "round"
}
args: {
type: 'round'
}
};
Loading

0 comments on commit 46f583d

Please sign in to comment.