Skip to content

Commit

Permalink
feat(web): add a very basic sveltekit web skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
espimarisa committed Feb 17, 2024
1 parent af3ab92 commit 109b40e
Show file tree
Hide file tree
Showing 26 changed files with 201 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
Binary file modified bun.lockb
Binary file not shown.
5 changes: 0 additions & 5 deletions bunfig.toml

This file was deleted.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@
"build": "bun run --env-file .env turbo run build",
"check": "tsc --noEmit",
"dev:bot": "bun run --env-file .env turbo run dev --filter=@espimarisa/hibiki-bot --filter=@espimarisa/hibiki-db",
"dev:web": "bun run --env-file .env -- turbo run dev --filter=@espimarisa/hibiki-web --filter=@espimarisa/hibiki-db",
"format": "prettier --write .",
"lint": "bun run --env-file .env turbo run lint",
"start": "bun run --env-file .env turbo run start",
"start:bot": "bun run --env-file .env turbo run start --filter=@espimarisa/hibiki-bot --filter=@espimarisa/hibiki-db",
"start:web": "bun run --env-file .env -- turbo run start --filter=@espimarisa/hibiki-web --filter=@espimarisa/hibiki-db",
"test": "bun run --env-file .env turbo run test"
},
"dependencies": {
"tslib": "^2.6.2"
},
"devDependencies": {
"@espimarisa/eslint-config": "^4.2.4",
"@types/bun": "^1.0.5",
Expand All @@ -44,6 +49,7 @@
"prettier": "^3.2.5",
"prettier-plugin-pkg": "^0.18.1",
"prettier-plugin-sh": "^0.14.0",
"prettier-plugin-svelte": "^3.2.1",
"turbo": "^1.12.3",
"typescript": "^5.3.3"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/bot/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
2 changes: 2 additions & 0 deletions packages/bot/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
2 changes: 2 additions & 0 deletions packages/db/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
2 changes: 2 additions & 0 deletions packages/db/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
2 changes: 2 additions & 0 deletions packages/shared/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
2 changes: 2 additions & 0 deletions packages/shared/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
4 changes: 4 additions & 0 deletions packages/web/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
build/
.svelte-kit/
25 changes: 25 additions & 0 deletions packages/web/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["../../.eslintrc.cjs"],
ignorePatterns: [".eslintrc.cjs", "vite.config.ts"],

parser: "@typescript-eslint/parser",
parserOptions: {
// project: "./tsconfig.json",
extraFileExtensions: [".svelte"],
},

overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
},
rules: {
// Broken
"no-inner-declarations": 0,
},
},
],
};
9 changes: 9 additions & 0 deletions packages/web/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules/
dist/
build/
out/
.svelte-kit/
.routify/
package-lock.json
pnpm-lock.yaml
yarn.lock
16 changes: 16 additions & 0 deletions packages/web/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"plugins": ["prettier-plugin-svelte", "prettier-plugin-sh", "prettier-plugin-pkg"],
"arrowParens": "always",
"bracketSameLine": true,
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "ignore",
"proseWrap": "preserve",
"quoteProps": "consistent",
"trailingComma": "all",
"printWidth": 140,
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"useTabs": false
}
42 changes: 42 additions & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@espimarisa/hibiki-web",
"version": "2.0.0-alpha",
"type": "module",
"description": "",
"repository": {
"type": "git",
"url": "git+https://github.com/espimarisa/hibiki.git"
},
"homepage": "https://github.com/espimarisa/hibiki#readme",
"bugs": {
"url": "https://github.com/espimarisa/hibiki/issues"
},
"author": "Espi Marisa <[email protected]> (https://espi.me)",
"license": "zlib",
"private": true,
"scripts": {
"build": "bun run clean && svelte-kit sync && bunx --bun vite build",
"check": "svelte-kit sync && svelte-check --ignore 'dist' --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"clean": "rimraf .svelte-kit",
"dev": "svelte-kit sync && bunx --bun vite dev",
"lint": "prettier --c . && eslint .",
"preview": "bunx --bun vite preview",
"start": "NODE_ENV=production bun build/index.js",
"test": "bun run check && pnpm lint"
},
"dependencies": {
"svelte-adapter-bun": "^0.5.1"
},
"devDependencies": {
"@sveltejs/kit": "^1.25.0",
"eslint": "^8.49.0",
"eslint-plugin-svelte": "^2.33.1",
"postcss": "^8.4.29",
"sass": "^1.67.0",
"svelte": "^4.2.0",
"svelte-check": "^3.5.1",
"svelte-eslint-parser": "^0.33.0",
"vite": "^4.4.9"
}
}
13 changes: 13 additions & 0 deletions packages/web/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
12 changes: 12 additions & 0 deletions packages/web/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.png" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
2 changes: 2 additions & 0 deletions packages/web/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// place files you want to import through the `$lib` alias in this folder.
console.log("h");
5 changes: 5 additions & 0 deletions packages/web/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>Welcome to SvelteKit</h1>
<p>
Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a>
to read the documentation
</p>
1 change: 1 addition & 0 deletions packages/web/src/scss/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Variables
Binary file added packages/web/static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions packages/web/svelte.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { vitePreprocess } from "@sveltejs/kit/vite";
import adapter from "svelte-adapter-bun";

/** @type {import("@sveltejs/kit").Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
preprocess: [vitePreprocess({})],

kit: {
alias: {
$web: "./src",
},

adapter: adapter(),
},
};

export default config;
8 changes: 8 additions & 0 deletions packages/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": ["./.svelte-kit/tsconfig.json", "../../tsconfig.json"],
"include": ["./src/**/*"],

"compilerOptions": {
"verbatimModuleSyntax": false
}
}
22 changes: 22 additions & 0 deletions packages/web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import path from "node:path";

// __dirname replacement in ESM
const pathDirname = path.dirname(Bun.fileURLToPath(new URL(import.meta.url)));
const ROOT_DIRECTORY = path.join(pathDirname, "../../");

/** @type {import("vite").defineConfig} */
export default defineConfig({
plugins: [sveltekit()],
envDir: ROOT_DIRECTORY,

css: {
preprocessorOptions: {
scss: {
quietDeps: true,
additionalData: '@use "src/scss/variables.scss" as *;',
},
},
},
});
4 changes: 2 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"pipeline": {
"build": {
"dependsOn": ["db:generate", "^build"],
"outputs": []
"outputs": ["./build/**"]
},
"deploy": {
"dependsOn": ["build"]
},
"dev": {
"dependsOn": ["db:generate", "db:push"],
"dependsOn": ["db:generate", "db:push", "deploy"],
"cache": false,
"persistent": true
},
Expand Down

0 comments on commit 109b40e

Please sign in to comment.