Compare commits
3 Commits
ff1334aa36
...
822ffc12df
Author | SHA1 | Date | |
---|---|---|---|
822ffc12df
|
|||
9d55b0d94b
|
|||
ec8ed588f5
|
18
bun.lock
18
bun.lock
@@ -8,11 +8,25 @@
|
|||||||
"@types/bun": "latest",
|
"@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": {
|
"packages/web": {
|
||||||
"name": "@fileone/web",
|
"name": "@fileone/web",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@convex-dev/workos": "^0.0.1",
|
"@convex-dev/workos": "^0.0.1",
|
||||||
|
"@fileone/convex": "workspace:*",
|
||||||
"@radix-ui/react-checkbox": "^1.3.3",
|
"@radix-ui/react-checkbox": "^1.3.3",
|
||||||
"@radix-ui/react-context-menu": "^2.2.16",
|
"@radix-ui/react-context-menu": "^2.2.16",
|
||||||
"@radix-ui/react-dialog": "^1.1.15",
|
"@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=="],
|
"@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"],
|
"@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=="],
|
"@floating-ui/core": ["@floating-ui/core@1.7.3", "", { "dependencies": { "@floating-ui/utils": "^0.2.10" } }, "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w=="],
|
||||||
|
@@ -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 { v } from "convex/values"
|
||||||
import { authenticatedMutation, authenticatedQuery } from "./functions"
|
import { authenticatedMutation, authenticatedQuery } from "./functions"
|
||||||
import type { DirectoryItem } from "./model/directories"
|
import type { DirectoryItem } from "./model/directories"
|
@@ -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 {
|
import type {
|
||||||
AuthenticatedMutationCtx,
|
AuthenticatedMutationCtx,
|
||||||
AuthenticatedQueryCtx,
|
AuthenticatedQueryCtx,
|
||||||
@@ -94,7 +95,7 @@ export async function create(
|
|||||||
userId: ctx.user._id,
|
userId: ctx.user._id,
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
path: parentDir ? `${parentDir.path}/${name}` : "/",
|
path: parentDir ? joinPath(parentDir.path, name) : PATH_SEPARATOR,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
12
packages/convex/package.json
Normal file
12
packages/convex/package.json
Normal 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
34
packages/path/.gitignore
vendored
Normal 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
15
packages/path/README.md
Normal 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
9
packages/path/index.ts
Normal 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)
|
||||||
|
}
|
8
packages/path/package.json
Normal file
8
packages/path/package.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "@fileone/path",
|
||||||
|
"module": "index.ts",
|
||||||
|
"type": "module",
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^5"
|
||||||
|
}
|
||||||
|
}
|
29
packages/path/tsconfig.json
Normal file
29
packages/path/tsconfig.json
Normal 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
|
||||||
|
}
|
||||||
|
}
|
@@ -10,6 +10,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@convex-dev/workos": "^0.0.1",
|
"@convex-dev/workos": "^0.0.1",
|
||||||
|
"@fileone/convex": "workspace:*",
|
||||||
"@radix-ui/react-checkbox": "^1.3.3",
|
"@radix-ui/react-checkbox": "^1.3.3",
|
||||||
"@radix-ui/react-context-menu": "^2.2.16",
|
"@radix-ui/react-context-menu": "^2.2.16",
|
||||||
"@radix-ui/react-dialog": "^1.1.15",
|
"@radix-ui/react-dialog": "^1.1.15",
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { api } from "@convex/_generated/api"
|
import { api } from "@fileone/convex/_generated/api"
|
||||||
import type { Id } from "@convex/_generated/dataModel"
|
import type { DirectoryItem } from "@fileone/convex/model/directories"
|
||||||
import type { DirectoryItem } from "@convex/model/directories"
|
|
||||||
import { useMutation } from "@tanstack/react-query"
|
import { useMutation } from "@tanstack/react-query"
|
||||||
import {
|
import {
|
||||||
type ColumnDef,
|
type ColumnDef,
|
||||||
|
@@ -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 } from "@tanstack/react-query"
|
||||||
import { useMutation as useConvexMutation } from "convex/react"
|
import { useMutation as useConvexMutation } from "convex/react"
|
||||||
import { useSetAtom } from "jotai"
|
import { useSetAtom } from "jotai"
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { atom } from "jotai"
|
import type { Id } from "@fileone/convex/_generated/dataModel"
|
||||||
import type { Id } from "@convex/_generated/dataModel"
|
|
||||||
import type {
|
import type {
|
||||||
DirectoryItem,
|
DirectoryItem,
|
||||||
DirectoryItemKind,
|
DirectoryItemKind,
|
||||||
} from "@convex/model/directories"
|
} from "@fileone/convex/model/directories"
|
||||||
|
import { atom } from "jotai"
|
||||||
|
|
||||||
export const contextMenuTargeItemAtom = atom<DirectoryItem | null>(null)
|
export const contextMenuTargeItemAtom = atom<DirectoryItem | null>(null)
|
||||||
export const optimisticDeletedItemsAtom = atom(
|
export const optimisticDeletedItemsAtom = atom(
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
|
import {
|
||||||
|
Code as ErrorCode,
|
||||||
|
isApplicationError,
|
||||||
|
} from "@fileone/convex/model/error"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { Code as ErrorCode, isApplicationError } from "@convex/model/error"
|
|
||||||
|
|
||||||
const ERROR_MESSAGE = {
|
const ERROR_MESSAGE = {
|
||||||
[ErrorCode.DirectoryExists]: "Directory already exists",
|
[ErrorCode.DirectoryExists]: "Directory already exists",
|
||||||
|
@@ -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 } from "@tanstack/react-query"
|
||||||
import { createFileRoute, useNavigate } from "@tanstack/react-router"
|
import { createFileRoute, useNavigate } from "@tanstack/react-router"
|
||||||
import { useConvexAuth, useMutation as useConvexMutation } from "convex/react"
|
import { useConvexAuth, useMutation as useConvexMutation } from "convex/react"
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*"],
|
"@/*": ["./src/*"]
|
||||||
"@convex/*": ["../../convex/*"]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Some stricter flags (disabled by default)
|
// Some stricter flags (disabled by default)
|
||||||
|
Reference in New Issue
Block a user