Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitavoloboev committed Jul 31, 2023
1 parent 15d4ef2 commit 2d4c6cc
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 38 deletions.
41 changes: 41 additions & 0 deletions app/vite.config.ts
@@ -0,0 +1,41 @@
import solid from "solid-start/vite"
import { defineConfig } from "vite"
import devtools from "solid-devtools/vite"
import cloudflare from "solid-start-cloudflare-pages"

// TODO: ssr: false because with it createResource doesn't log to client
// because callbacks happen on server
// something to fix for later
// ideally the landing page is SSR'd
// with true, the logs are sent to client
export default defineConfig({
plugins: [
solid({ ssr: false, adapter: cloudflare({}) }),
devtools({
/* additional options */
autoname: true, // e.g. enable autoname
locator: {
targetIDE: "vscode-insiders",
componentLocation: true,
jsxLocation: true,
},
}),
],
clearScreen: false,
// tauri expects a fixed port, fail if that port is not available
server: {
port: 3000,
strictPort: true,
},
// to make use of `TAURI_DEBUG` and other env variables
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
envPrefix: ["VITE_", "TAURI_"],
build: {
// Tauri supports es2021
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
// don't minify for debug builds
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_DEBUG,
},
})
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -5,7 +5,7 @@
"seed-update": "cd seed && git pull",
"dev-setup": "pnpm run seed-clone",
"test": "vitest",
"app:dev": "cd app && pnpm run watch",
"app:dev": "cd app && pnpm tauri:dev",
"web:dev": "cd website && solid-start dev",
"web:build": "cd website && solid-start build",
"web:start": "cd website && solid-start start",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions readme.md
@@ -1,6 +1,6 @@
# Learn Anything

Explanation of project's goals is [here](https://wiki.nikiv.dev/ideas/learn-anything).
Explanation of project's high level goals is [here](https://wiki.nikiv.dev/ideas/learn-anything).

Current focus is on making [Tauri app](#run-tauri-app) working. Essentially an app like [Obsidian](https://obsidian.md/).

Expand All @@ -25,10 +25,10 @@ Ask questions on [Discord](https://discord.com/invite/bxtD8x6aNF) if interested
- [resolvers](api/grafbase/resolvers) - [edge resolvers](https://grafbase.com/docs/edge-gateway/resolvers) are server functions exposed with GraphQL
- [schema.graphql](api/grafbase/schema.graphql) - [Grafbase's config](https://grafbase.com/docs/config)
- [server](api/server) - temporary [hono](https://hono.dev/) server until grafbase supports public resolvers
- [app](app) - desktop app
- [app](app) - desktop app in Tauri/Solid
- [lib](lib) - shared utility functions
- [test](test) - test cases (useful for itereating quickly)
- [website](website) - learn-anything.xyz website code
- [website](website) - learn-anything.xyz website code in Solid
- [components](website/components) - solid components
- [routes](app/packages/website/routes) - routes defined using file system

Expand All @@ -51,6 +51,8 @@ pnpm dev-setup
Moving code from [Electron version](https://github.com/learn-anything/electron-version).

Check [tasks](#tasks).

### Useful DevTools panel

In the app you get after running `pnpm app:dev`, you will see DevTools panel in bottom right corner. It contains a list of useful actions you can run to aid you.
Expand Down
28 changes: 1 addition & 27 deletions run.ts
@@ -1,30 +1,4 @@
import { getSeedFolderPath } from "lib/test/helpers"
import { setupTinybaseStore } from "lib/tinybase/tinybase"
import { addMarkdownFileAsTopic, markdownFilePaths } from "lib/wiki/wiki"
import { Persister } from "tinybase/cjs"

// implies `dev-setup` was ran and seed folder is present at root
// uses seed/wiki/nikita folder to load all .md files from it into tinybase
async function main() {
const tinybase = setupTinybaseStore({ persist: true }) as Persister
const store = tinybase.getStore()
await tinybase.load()
await tinybase.startAutoSave()

const wikiPath = getSeedFolderPath("nikita")
const filePaths = await markdownFilePaths(wikiPath)
// console.log(filePaths, "file paths")

// TODO: below breaks on adding links, result is 0 links added
// when it should be 80,000+ links added
store.startTransaction()
await Promise.all(
filePaths.map(async (filePath) => {
await addMarkdownFileAsTopic(filePath, store)
}),
)
store.finishTransaction()
}
async function main() {}

main().catch((err) => {
console.error(err)
Expand Down
7 changes: 0 additions & 7 deletions vite.config.ts

This file was deleted.

0 comments on commit 2d4c6cc

Please sign in to comment.