Compare commits

...

3 Commits

Author SHA1 Message Date
822ffc12df refactor: use path util 2025-09-16 23:18:53 +00:00
9d55b0d94b feat: new path util package 2025-09-16 23:17:19 +00:00
ec8ed588f5 refactor: move convex into packages 2025-09-16 23:17:01 +00:00
27 changed files with 143 additions and 15 deletions

View File

@@ -8,11 +8,25 @@
"@types/bun": "latest",
},
},
"packages/convex": {
"name": "@fileone/convex",
"peerDependencies": {
"convex": "^1.27.0",
"typescript": "^5",
},
},
"packages/path": {
"name": "@fileone/path",
"peerDependencies": {
"typescript": "^5",
},
},
"packages/web": {
"name": "@fileone/web",
"version": "0.1.0",
"dependencies": {
"@convex-dev/workos": "^0.0.1",
"@fileone/convex": "workspace:*",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-context-menu": "^2.2.16",
"@radix-ui/react-dialog": "^1.1.15",
@@ -180,6 +194,10 @@
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.4", "", { "os": "win32", "cpu": "x64" }, "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ=="],
"@fileone/convex": ["@fileone/convex@workspace:packages/convex"],
"@fileone/path": ["@fileone/path@workspace:packages/path"],
"@fileone/web": ["@fileone/web@workspace:packages/web"],
"@floating-ui/core": ["@floating-ui/core@1.7.3", "", { "dependencies": { "@floating-ui/utils": "^0.2.10" } }, "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w=="],

View File

@@ -1,4 +1,4 @@
import type { Id } from "@convex/_generated/dataModel"
import type { Id } from "@fileone/convex/_generated/dataModel"
import { v } from "convex/values"
import { authenticatedMutation, authenticatedQuery } from "./functions"
import type { DirectoryItem } from "./model/directories"

View File

@@ -1,4 +1,5 @@
import type { Doc, Id } from "@convex/_generated/dataModel"
import type { Doc, Id } from "@fileone/convex/_generated/dataModel"
import { joinPath, PATH_SEPARATOR } from "@fileone/path"
import type {
AuthenticatedMutationCtx,
AuthenticatedQueryCtx,
@@ -94,7 +95,7 @@ export async function create(
userId: ctx.user._id,
createdAt: now,
updatedAt: now,
path: parentDir ? `${parentDir.path}/${name}` : "/",
path: parentDir ? joinPath(parentDir.path, name) : PATH_SEPARATOR,
})
}

View File

@@ -0,0 +1,12 @@
{
"name": "@fileone/convex",
"module": "index.ts",
"type": "module",
"dependencies": {
"@fileone/path": "workspace:*"
},
"peerDependencies": {
"typescript": "^5",
"convex": "^1.27.0"
}
}

34
packages/path/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules
# output
out
dist
*.tgz
# code coverage
coverage
*.lcov
# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# caches
.eslintcache
.cache
*.tsbuildinfo
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

15
packages/path/README.md Normal file
View File

@@ -0,0 +1,15 @@
# @fileone/path
To install dependencies:
```bash
bun install
```
To run:
```bash
bun run index.ts
```
This project was created using `bun init` in bun v1.2.22. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.

9
packages/path/index.ts Normal file
View File

@@ -0,0 +1,9 @@
export const PATH_SEPARATOR = "/"
export function baseName(path: string): string {
return path.split(PATH_SEPARATOR).pop() ?? ""
}
export function joinPath(...paths: string[]): string {
return paths.join(PATH_SEPARATOR)
}

View File

@@ -0,0 +1,8 @@
{
"name": "@fileone/path",
"module": "index.ts",
"type": "module",
"peerDependencies": {
"typescript": "^5"
}
}

View File

@@ -0,0 +1,29 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}

View File

@@ -10,6 +10,7 @@
},
"dependencies": {
"@convex-dev/workos": "^0.0.1",
"@fileone/convex": "workspace:*",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-context-menu": "^2.2.16",
"@radix-ui/react-dialog": "^1.1.15",
@@ -42,4 +43,4 @@
"@types/react": "^19",
"@types/react-dom": "^19"
}
}
}

View File

@@ -1,6 +1,5 @@
import { api } from "@convex/_generated/api"
import type { Id } from "@convex/_generated/dataModel"
import type { DirectoryItem } from "@convex/model/directories"
import { api } from "@fileone/convex/_generated/api"
import type { DirectoryItem } from "@fileone/convex/model/directories"
import { useMutation } from "@tanstack/react-query"
import {
type ColumnDef,

View File

@@ -1,4 +1,4 @@
import { api } from "@convex/_generated/api"
import { api } from "@fileone/convex/_generated/api"
import { useMutation } from "@tanstack/react-query"
import { useMutation as useConvexMutation } from "convex/react"
import { useSetAtom } from "jotai"

View File

@@ -1,9 +1,9 @@
import { atom } from "jotai"
import type { Id } from "@convex/_generated/dataModel"
import type { Id } from "@fileone/convex/_generated/dataModel"
import type {
DirectoryItem,
DirectoryItemKind,
} from "@convex/model/directories"
} from "@fileone/convex/model/directories"
import { atom } from "jotai"
export const contextMenuTargeItemAtom = atom<DirectoryItem | null>(null)
export const optimisticDeletedItemsAtom = atom(

View File

@@ -1,5 +1,8 @@
import {
Code as ErrorCode,
isApplicationError,
} from "@fileone/convex/model/error"
import { toast } from "sonner"
import { Code as ErrorCode, isApplicationError } from "@convex/model/error"
const ERROR_MESSAGE = {
[ErrorCode.DirectoryExists]: "Directory already exists",

View File

@@ -1,4 +1,4 @@
import { api } from "@convex/_generated/api"
import { api } from "@fileone/convex/_generated/api"
import { useMutation } from "@tanstack/react-query"
import { createFileRoute, useNavigate } from "@tanstack/react-router"
import { useConvexAuth, useMutation as useConvexMutation } from "convex/react"

View File

@@ -23,8 +23,7 @@
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@convex/*": ["../../convex/*"]
"@/*": ["./src/*"]
},
// Some stricter flags (disabled by default)