Compare commits
10 Commits
ab44e9d2e9
...
af33273f15
Author | SHA1 | Date |
---|---|---|
Carsten Kragelund | af33273f15 | |
Carsten Kragelund | 1f2ba0abed | |
Ethan Niser | 8f9ba2a3c5 | |
Ethan Niser | e1a8545f70 | |
Jesse Holden | 2661c9d37e | |
Ethan Niser | edd0d2a6f6 | |
Ethan Niser | 3ded011fcb | |
Ethan Niser | 2a2ca74bea | |
Ethan Niser | 88d690a7cc | |
Ethan Niser | fe1abe40e2 |
@ -0,0 +1,7 @@
|
||||
NODE_ENV=""
|
||||
LOG_LEVEL=""
|
||||
DATABASE_CONNECTION_TYPE=""
|
||||
DATABASE_URL=""
|
||||
DATABASE_AUTH_TOKEN=""
|
||||
GITHUB_CLIENT_ID=""
|
||||
GITHUB_CLIENT_SECRET=""
|
@ -1,55 +0,0 @@
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
const config = {
|
||||
root: true,
|
||||
parser: "@typescript-eslint/parser",
|
||||
plugins: ["isaacscript", "import"],
|
||||
extends: [
|
||||
"plugin:@typescript-eslint/recommended-type-checked",
|
||||
"plugin:@typescript-eslint/stylistic-type-checked",
|
||||
"plugin:prettier/recommended",
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
tsconfigRootDir: __dirname,
|
||||
project: [
|
||||
"./tsconfig.json",
|
||||
"./cli/tsconfig.eslint.json", // separate eslint config for the CLI since we want to lint and typecheck differently due to template files
|
||||
"./upgrade/tsconfig.json",
|
||||
"./www/tsconfig.json",
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
// Template files don't have reliable type information
|
||||
{
|
||||
files: ["./cli/template/**/*.{ts,tsx}"],
|
||||
extends: ["plugin:@typescript-eslint/disable-type-checked"],
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
// These off/not-configured-the-way-we-want lint rules we like & opt into
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" },
|
||||
],
|
||||
"@typescript-eslint/consistent-type-imports": [
|
||||
"error",
|
||||
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
|
||||
],
|
||||
"import/consistent-type-specifier-style": ["error", "prefer-inline"],
|
||||
|
||||
// For educational purposes we format our comments/jsdoc nicely
|
||||
"isaacscript/complete-sentences-jsdoc": "warn",
|
||||
"isaacscript/format-jsdoc-comments": "warn",
|
||||
|
||||
// These lint rules don't make sense for us but are enabled in the preset configs
|
||||
"@typescript-eslint/no-confusing-void-expression": "off",
|
||||
"@typescript-eslint/restrict-template-expressions": "off",
|
||||
|
||||
// This rule doesn't seem to be working properly
|
||||
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
@ -1,15 +1,27 @@
|
||||
# test
|
||||
# This project was created using `create-beth-app`
|
||||
|
||||
To install dependencies:
|
||||
## To open an issue: https://github.com/ethanniser/the-beth-stack
|
||||
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
## To discuss: https://discord.gg/Z3yUtMfkwa
|
||||
|
||||
To run:
|
||||
### To run locally:
|
||||
|
||||
```bash
|
||||
bun run index.ts
|
||||
```
|
||||
1. `bun install`
|
||||
2. create a new turso database with `turso db create <name>`
|
||||
3. get the database url with `turso db show --url <name>`
|
||||
4. get the auth token with `turso db tokens create <name>`
|
||||
5. (optional) create a new github developer app and get credentials
|
||||
6. copy `.env.example` to `.env`
|
||||
7. fill out all enviorment variables (refer to the config file to see schema)
|
||||
8. `bun db:push`
|
||||
9. `bun dev`
|
||||
|
||||
This project was created using `bun init` in bun v1.0.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
||||
### To deploy to fly.io
|
||||
|
||||
1. Install the [Fly CLI](https://fly.io/docs/hands-on/install-flyctl/)
|
||||
|
||||
2. Run `fly launch`
|
||||
|
||||
3. Run `fly secrets set <NAME>=<VALUE>` (probably want to set `NODE_ENV` to `"production"`)
|
||||
|
||||
4. Run `fly deploy`
|
||||
|
@ -0,0 +1 @@
|
||||
preload = ["bun-postcss-plugin"]
|
@ -1,17 +0,0 @@
|
||||
/** @typedef {import("prettier").Config} PrettierConfig */
|
||||
|
||||
/** @type { PrettierConfig | SortImportsConfig } */
|
||||
const config = {
|
||||
arrowParens: "always",
|
||||
printWidth: 80,
|
||||
singleQuote: false,
|
||||
semi: true,
|
||||
trailingComma: "all",
|
||||
tabWidth: 2,
|
||||
plugins: [
|
||||
"@ianvs/prettier-plugin-sort-imports",
|
||||
"prettier-plugin-tailwindcss",
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = config;
|
@ -1 +1 @@
|
||||
import "@total-typescript/ts-reset";
|
||||
import "@total-typescript/ts-reset";
|
||||
|
@ -1,28 +1,28 @@
|
||||
import { createClient } from "@libsql/client";
|
||||
import type { Config } from "@libsql/client";
|
||||
import { drizzle } from "drizzle-orm/libsql";
|
||||
import { config } from "../config";
|
||||
import * as schema from "./schema";
|
||||
|
||||
const { DATABASE_CONNECTION_TYPE } = config.env;
|
||||
|
||||
const options = (() => {
|
||||
switch (config.env.DATABASE_CONNECTION_TYPE) {
|
||||
case 'local' : return {
|
||||
url: 'file:local.sqlite',
|
||||
}
|
||||
case 'remote' : return {
|
||||
url: config.env.DATABASE_URL,
|
||||
authToken: config.env.DATABASE_AUTH_TOKEN!,
|
||||
}
|
||||
case 'local-replica' : return {
|
||||
url: 'file:local.sqlite',
|
||||
syncUrl: config.env.DATABASE_URL,
|
||||
authToken: config.env.DATABASE_AUTH_TOKEN!,
|
||||
}
|
||||
}
|
||||
})()
|
||||
const options = {
|
||||
local: { url: "file:local.sqlite" },
|
||||
remote: {
|
||||
url: config.env.DATABASE_URL,
|
||||
authToken: config.env.DATABASE_AUTH_TOKEN!,
|
||||
},
|
||||
"local-replica": {
|
||||
url: "file:local.sqlite",
|
||||
syncUrl: config.env.DATABASE_URL,
|
||||
authToken: config.env.DATABASE_AUTH_TOKEN!,
|
||||
},
|
||||
} satisfies Record<typeof DATABASE_CONNECTION_TYPE, Config>;
|
||||
|
||||
export const client = createClient(options);
|
||||
export const client = createClient(options[DATABASE_CONNECTION_TYPE]);
|
||||
|
||||
await client.sync();
|
||||
if (config.env.DATABASE_CONNECTION_TYPE === "local-replica") {
|
||||
await client.sync();
|
||||
}
|
||||
|
||||
export const db = drizzle(client, { schema, logger: true });
|
||||
|
@ -0,0 +1 @@
|
||||
@import "tailwindcss";
|
@ -1,8 +1,9 @@
|
||||
/// <reference types="lucia" />
|
||||
declare namespace Lucia {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
type Auth = import("../auth/index").Auth;
|
||||
type DatabaseUserAttributes = {
|
||||
handle: string;
|
||||
};
|
||||
type DatabaseSessionAttributes = {};
|
||||
type DatabaseSessionAttributes = object;
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
import transformerVariantGroup from "@unocss/transformer-variant-group";
|
||||
import { defineConfig, presetIcons, presetWebFonts, presetWind } from "unocss";
|
||||
|
||||
export default defineConfig({
|
||||
cli: {
|
||||
entry: {
|
||||
patterns: ["src/**/*.{ts,tsx}"],
|
||||
outFile: "public/dist/unocss.css",
|
||||
},
|
||||
},
|
||||
presets: [presetWind(), presetIcons(), presetWebFonts()],
|
||||
transformers: [transformerVariantGroup()],
|
||||
});
|
Loading…
Reference in New Issue