Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add project managment; Change python api [WIP]
Tomas Valentab001cd13f588
diff --git a/.eslintrc.js b/.eslintrc.jsindex 1d9362293..cdcc994fa 100644--- a/.eslintrc.js+++ b/.eslintrc.js@@ -1,6 +1,6 @@module.exports = {extends: ['next'],- ignorePatterns: ['src/db/supabase.ts'],+ ignorePatterns: ['db/supabase.ts'],rules: {'@next/next/no-html-link-for-pages': 'off','react/jsx-key': 'off',diff --git a/.vercelignore b/.vercelignorenew file mode 100644index 000000000..9b0f4ff50--- /dev/null+++ b/.vercelignore@@ -0,0 +1 @@+api-service\ No newline at end of filediff --git a/README.md b/README.mdindex 4ae44294b..a5f8b8b6a 100644--- a/README.md+++ b/README.md@@ -2,13 +2,17 @@## Development```sh-yarn vercel+yarn dev```-## Code deployment-https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/-- Only enterprise-- Normal workers have 500 script/account limit-- Worker size 1 MB/5 MB (Paid)-- Computation limits:-- https://developers.cloudflare.com/workers/platform/limits/+- repo GA env vars+- vercel new env vars+- local python deps+- test cloud run deploy+- test local dev+- exec/js vs api service route -> connect?+- python env vars .env+- cloud run env vars+- notify deploy+dev flow+- python flask prod run+- python\ No newline at end of filediff --git a/api-service/.dockerignore b/api-service/.dockerignorenew file mode 100644index 000000000..3e4bdd9fb--- /dev/null+++ b/api-service/.dockerignore@@ -0,0 +1,7 @@+Dockerfile+README.md+*.pyc+*.pyo+*.pyd+__pycache__+.pytest_cachediff --git a/api-service/.gitignore b/api-service/.gitignorenew file mode 100644index 000000000..bee8a64b7--- /dev/null+++ b/api-service/.gitignore@@ -0,0 +1 @@+__pycache__diff --git a/api-service/Dockerfile b/api-service/Dockerfileindex d0be3b561..0e111bfb0 100644--- a/api-service/Dockerfile+++ b/api-service/Dockerfile@@ -1,27 +1,21 @@-# syntax=docker/dockerfile:1.4-FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder+# Use the official lightweight Python image.+# https://hub.docker.com/_/python+FROM python:3.10-slim-WORKDIR /app+# Allow statements and log messages to immediately appear in the Knative logs+ENV PYTHONUNBUFFERED True-COPY requirements.txt /app-RUN --mount=type=cache,target=/root/.cache/pip \- pip3 install -r requirements.txt+# Copy local code to the container image.+ENV APP_HOME /app+WORKDIR $APP_HOME+COPY . ./-COPY . /app+# Install production dependencies.+RUN pip install --no-cache-dir -r requirements.txt-ENTRYPOINT ["python3"]-CMD ["app.py"]--FROM builder as dev-envs--RUN <<EOF-apk update-apk add git-EOF--RUN <<EOF-addgroup -S docker-adduser -S --shell /bin/bash --ingroup docker vscode-EOF-# install Docker tools (cli, buildx, compose)-COPY --from=gloursdocker/docker / /+# Run the web service on container startup. Here we use the gunicorn+# webserver, with one worker process and 8 threads.+# For environments with multiple CPU cores, increase the number of workers+# to be equal to the cores available.+# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.+CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:appdiff --git a/api-service/app.py b/api-service/app.pyindex b09f41b1b..cc7978ed9 100644--- a/api-service/app.py+++ b/api-service/app.py@@ -1,10 +1,22 @@-from flask import Flask+import os+from dbk_aicode.base import generate_req_handler+from flask import Flask, requestapp = Flask(__name__)[email protected]('/generate')-def hello():- return "Hello World!"-if __name__ == '__main__':- app.run(host='0.0.0.0', port=8000)[email protected]("/generate", methods = ['POST'])+def generate():+ body = request.json++ project_id = body['projectId']+ blocks = body['blocks']+ method = body['method']++ final_prompt, js_code = generate_req_handler(project_id=project_id, blocks=blocks, method=method)++ return { 'code': js_code.strip('`').strip(), 'prompt': final_prompt }+++if __name__ == "__main__":+ app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))diff --git a/api-service/requirements.txt b/api-service/requirements.txtindex 0fdaeba26..c57393f91 100644--- a/api-service/requirements.txt+++ b/api-service/requirements.txt@@ -1,3 +1,5 @@simplejson==3.18.3python-dotenv==1.0.0dbk-aicode==0.1.0+Flask==2.2.3+gunicorn==20.1.0\ No newline at end of filediff --git a/api-service/routes/generate.py b/api-service/routes/generate.pydeleted file mode 100644index a40539218..000000000--- a/api-service/routes/generate.py+++ /dev/null@@ -1,32 +0,0 @@-# https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/python--import simplejson-from http.server import BaseHTTPRequestHandler--from dbk_aicode.base import generate_req_handler---class handler(BaseHTTPRequestHandler):- def do_POST(self):- self.data_string = self.rfile.read(int(self.headers['Content-Length']))- data = simplejson.loads(self.data_string)-- project_id = data['projectId']- blocks = data['blocks']- method = data['method']-- final_prompt, js_code = generate_req_handler(- project_id=project_id, blocks=blocks, method=method)-- self.send_response(200)- self.send_header('Content-Type', 'application/json')- self.end_headers()- self.wfile.write(- simplejson.dumps(- {- 'code': js_code.strip('`').strip(),- 'prompt': final_prompt,- }- ).encode()- )- returndiff --git a/components/Button.tsx b/components/Button.tsxindex 76dd89d75..0123224ab 100644--- a/components/Button.tsx+++ b/components/Button.tsx@@ -4,7 +4,7 @@ import {ReactNode,} from 'react'-import Text from 'src/components/Text'+import Text from 'components/Text'export enum Variant {Full,diff --git a/components/Editor/AddBlockButton.tsx b/components/Editor/AddBlockButton.tsxindex 39c7df14c..b122aa5fb 100644--- a/components/Editor/AddBlockButton.tsx+++ b/components/Editor/AddBlockButton.tsx@@ -2,13 +2,13 @@ import clsx from 'clsx'import { Plus } from 'lucide-react'import { nanoid } from 'nanoid'-import { Block } from 'src/state/store'+import { Block } from 'state/store'export interface Props {addBlock: (block: Block) => void}-export default function AddBlockButton({ addBlock }: Props) {+function AddBlockButton({ addBlock }: Props) {return (<buttononMouseDown={() => addBlock({@@ -32,3 +32,5 @@ export default function AddBlockButton({ addBlock }: Props) {</button>)}++export default AddBlockButtondiff --git a/components/Editor/BlockEditor.tsx b/components/Editor/BlockEditor.tsxindex 4b239e010..256effd64 100644--- a/components/Editor/BlockEditor.tsx+++ b/components/Editor/BlockEditor.tsx@@ -8,8 +8,8 @@ import {} from 'react'import TextareaAutosize from 'react-textarea-autosize'-import Text from 'src/components/Text'-import { Block } from 'src/state/store'+import Text from 'components/Text'+import { Block } from 'state/store'export interface Props {onChange: (block: Block) => void@@ -20,7 +20,7 @@ export interface Props {onFocus: () => void}-export default function BlockEditor({+function BlockEditor({onChange,onDelete,block,@@ -169,3 +169,5 @@ export default function BlockEditor({</div>)}++export default BlockEditordiff --git a/components/Editor/ConnectionLine.tsx b/components/Editor/ConnectionLine.tsxindex b8ccec837..302e80a74 100644--- a/components/Editor/ConnectionLine.tsx+++ b/components/Editor/ConnectionLine.tsx@@ -2,8 +2,10 @@ export interface Props {className: string}-export default function ConnectionLine({ className }: Props) {+function ConnectionLine({ className }: Props) {return (<div className={`${className} border-l my-2 rounded border-slate-200`} />)}++export default ConnectionLinediff --git a/components/Editor/Logs.tsx b/components/Editor/Logs.tsxindex b85f5c45e..fa50aa1c6 100644--- a/components/Editor/Logs.tsx+++ b/components/Editor/Logs.tsx@@ -1,12 +1,14 @@-import { Log } from '.';+import { Log } from '.'export interface Props {logs: Log[]}-export default function Logs({ logs }: Props) {+function Logs({ logs }: Props) {return (<div></div>)}++export default Logsdiff --git a/components/Editor/index.tsx b/components/Editor/index.tsxindex ab891b2f2..7d8b16e0c 100644--- a/components/Editor/index.tsx+++ b/components/Editor/index.tsx@@ -4,9 +4,9 @@ import { Fragment, useState } from 'react'import Hotkeys from 'react-hot-keys'import { projects } from '@prisma/client'-import { State, Block, methods, Method } from 'src/state/store'-import { getStoreContext } from 'src/state/StoreProvider'-import Select from 'src/components/Select'+import { State, Block, methods, Method } from 'state/store'+import { getStoreContext } from 'state/StoreProvider'+import Select from 'components/Select'import { nanoid } from 'nanoid'import Button from 'components/Button'import Text from 'components/Text'@@ -53,7 +53,7 @@ async function handlePostGenerate(url: string, { arg }: {}).then(r => r.json())}-export default function Editor({ project }: Props) {+function Editor({ project }: Props) {const useStore = getStoreContext()const deployment = useLatestDeployment(project)@@ -161,7 +161,7 @@ export default function Editor({ project }: Props) {addBlock(block)setTimeout(() => setFocusedBlock({ index: blocks.length }), 0)}} />- <div className="fixed right-3 top-12">+ <div className="fixed right-3 top-14"><Buttontext="Deploy"onClick={deploy}@@ -172,3 +172,5 @@ export default function Editor({ project }: Props) {</Hotkeys>)}++export default Editordiff --git a/components/Header/Navigation/HeaderLink.tsx b/components/Header/Navigation/HeaderLink.tsxnew file mode 100644index 000000000..1ea99840c--- /dev/null+++ b/components/Header/Navigation/HeaderLink.tsx@@ -0,0 +1,40 @@+import clsx from 'clsx'+import { UrlObject } from 'url'++import TitleLink from 'components/TitleLink'++export interface Props {+ active: boolean+ title: string+ href: UrlObject | string+ shallow?: boolean+}++function HeaderLink({+ active,+ title,+ href,+ shallow,+}: Props) {+ return (+ <div className="relative flex flex-col">+ <TitleLink+ active={active}+ className="px-1 py-3"+ href={href}+ size={TitleLink.size.S2}+ title={title}+ wrapperClassName="w-full justify-center flex"+ shallow={shallow}+ />+ <div+ className={clsx('absolute bottom-0 -mb-px w-full border-b', {+ 'border-transparent': !active,+ 'border-green-800': active,+ })}+ ></div>+ </div>+ )+}++export default HeaderLinkdiff --git a/components/Header/Navigation/index.tsx b/components/Header/Navigation/index.tsxnew file mode 100644index 000000000..5776ca855--- /dev/null+++ b/components/Header/Navigation/index.tsx@@ -0,0 +1,43 @@+import { ChevronRight } from 'lucide-react'+import { useRouter } from 'next/router'++import HeaderLink from './HeaderLink'+import { projects } from '@prisma/client'++export interface Props {+ project?: projects+}++function Navigation({ project }: Props) {+ const router = useRouter()++ return (+ <div className="flex items-center space-x-2">+ <HeaderLink+ active={router.pathname === '/'}+ href="/"+ title="Projects"+ />+ {project && (+ <>+ <ChevronRight+ className="items-center text-slate-200"+ size="16px"+ />+ <HeaderLink+ active={router.pathname === '/[projectID]'}+ href={{+ pathname: '/[projectID]',+ query: {+ projectID: project.id,+ },+ }}+ title={project.name || project.id}+ />+ </>+ )}+ </div>+ )+}++export default Navigation\ No newline at end of filediff --git a/components/Header/index.tsx b/components/Header/index.tsxindex cdda7871f..2d3603a33 100644--- a/components/Header/index.tsx+++ b/components/Header/index.tsx@@ -1,25 +1,29 @@import Link from 'next/link'import { useUser } from '@supabase/auth-helpers-react'+import { projects } from '@prisma/client'-import UserPortrait from 'src/components/UserPortrait'+import UserPortrait from 'components/UserPortrait'++import Navigation from './Navigation'export interface Props {+ project?: projects}-function Header({ }: Props) {+function Header({ project }: Props) {const user = useUser()return (<div className="- flex- items-center- justify-end- border-b- bg-white- border-slate-200- px-3- py-1.5- ">+ flex+ items-center+ justify-between+ border-b+ bg-white+ border-slate-200+ px-3+ ">+ <Navigation project={project} /><div className="flexitems-center@@ -37,4 +41,4 @@ function Header({ }: Props) {)}-export default Header\ No newline at end of file+export default Headerdiff --git a/components/Input.tsx b/components/Input.tsxindex ccbbf1cb7..31181ff74 100644--- a/components/Input.tsx+++ b/components/Input.tsx@@ -18,7 +18,7 @@ export interface Props {required?: boolean}-export default function Input({+function Input({value,required,pattern,@@ -81,3 +81,5 @@ export default function Input({</div>)}++export default Inputdiff --git a/components/ItemList/Item.tsx b/components/ItemList/Item.tsxindex 718bc5ba2..15e432226 100644--- a/components/ItemList/Item.tsx+++ b/components/ItemList/Item.tsx@@ -16,6 +16,7 @@ export interface ItemSetup {icon?: React.ReactNodepath: stringtype: string+ url: string}export interface Props {@@ -68,7 +69,7 @@ function Item({ item, deleteItem }: Props) {href={{pathname: item.path,query: {- id: item.id,+ projectID: item.id,},}}>@@ -95,24 +96,18 @@ function Item({ item, deleteItem }: Props) {<divclassName="flex flex-col">- <Text- className="text-slate-600 transition-all group-hover:text-green-800"- size={Text.size.S2}- text={item.title}- />- <div className="flex space-x-1 text-slate-300 transition-all group-hover:text-slate-400">+ <div className="flex space-x-2 items-center"><Text- size={Text.size.S3}- text={item.type}- />- <Text- size={Text.size.S3}- text="-"+ className="text-slate-600 transition-all group-hover:text-green-800"+ size={Text.size.S2}+ text={item.title}/>+ </div>+ <div className="flex space-x-1 text-slate-300 transition-all group-hover:text-slate-400"><Text+ className="text-slate-300 transition-all group-hover:text-slate-400"size={Text.size.S3}- text={item.created_at.toLocaleString()}- suppressHydrationWarning+ text={item.url}/></div></div>diff --git a/components/Select/SelectValue.tsx b/components/Select/SelectValue.tsxindex 8b8c51272..b6bba9ad6 100644--- a/components/Select/SelectValue.tsx+++ b/components/Select/SelectValue.tsx@@ -1,6 +1,6 @@import { Check as CheckIcon } from 'lucide-react'-import Text from 'src/components/Text'+import Text from 'components/Text'import clsx from 'clsx'export interface Value {diff --git a/components/Select/index.tsx b/components/Select/index.tsxindex 5f1d42534..4cc2209a4 100644--- a/components/Select/index.tsx+++ b/components/Select/index.tsx@@ -7,7 +7,7 @@ import { useOnClickOutside } from 'usehooks-ts'import clsx from 'clsx'import { ChevronDown as ChevronDownIcon } from 'lucide-react'-import Text from 'src/components/Text'+import Text from 'components/Text'import SelectValue, { Value } from './SelectValue'diff --git a/components/TitleLink.tsx b/components/TitleLink.tsxindex 2c31ca092..ed6a49fcc 100644--- a/components/TitleLink.tsx+++ b/components/TitleLink.tsx@@ -3,7 +3,7 @@ import Link from 'next/link'import { ReactNode } from 'react'import { UrlObject } from 'url'-import Text, { Size } from 'src/components/Text'+import Text, { Size } from 'components/Text'export interface Props {className?: stringdiff --git a/hooks/useLatestDeployment.tsx b/hooks/useLatestDeployment.tsxindex dd2389bb6..ff5f3295b 100644--- a/hooks/useLatestDeployment.tsx+++ b/hooks/useLatestDeployment.tsx@@ -9,24 +9,24 @@ export function useLatestDeployment(project: projects) {const [deployment, setDeployment] = useState<deployments>()const client = useSupabaseClient<Database>()- useEffect(function subscribe() {- const sub = client.channel('any')- .on('postgres_changes',- {- event: 'UPDATE',- schema: 'public',- table: deploymentsTable- filter: `project_id=eq.${project.id}`,- }, payload => {- console.log('Change received!', payload)- setDeployment(payload.new)- })- .subscribe()+ // useEffect(function subscribe() {+ // const sub = client.channel('any')+ // .on('postgres_changes',+ // {+ // event: 'UPDATE',+ // schema: 'public',+ // table: deploymentsTable+ // filter: `project_id=eq.${project.id}`,+ // }, payload => {+ // console.log('Change received!', payload)+ // setDeployment(payload.new)+ // })+ // .subscribe()- return () => {- sub.unsubscribe()- }- }, [deployment, client])+ // return () => {+ // sub.unsubscribe()+ // }+ // }, [client])return deployment}diff --git a/package.json b/package.jsonindex c719340d4..25944b331 100644--- a/package.json+++ b/package.json@@ -3,9 +3,9 @@"version": "0.1.0","private": true,"scripts": {- "dev": "next dev",- "vercel": "vercel dev",+ "dev": "npx concurrently \"next dev\" \"flask --app api-service/app.py --debug run\"","build": "next build",+ "install:api": "cd api-service && pip3 install -r requirements.txt","start": "next start","lint": "next lint","lint:fix": "next lint --fix",@@ -23,6 +23,7 @@"@types/randomcolor": "^0.5.7","clsx": "^1.2.1","express": "^4.18.2",+ "human-id": "^4.0.0","immer": "^9.0.19","lucide-react": "^0.122.0","nanoid": "^4.0.1",@@ -43,8 +44,8 @@"@types/node": "^18.14.6","@types/react": "^18.0.28","@types/react-dom": "^18.0.11",- "@vercel/node": "^2.9.10","autoprefixer": "^10.4.13",+ "concurrently": "^7.6.0","cssnano": "^5.1.15","eslint": "^8.35.0","eslint-config-next": "^13.2.3",@@ -59,4 +60,4 @@"typescript": "^4.9.5","vercel": "^28.16.12"}-}\ No newline at end of file+}diff --git a/pages/[projectID].tsx b/pages/[projectID].tsxindex bef6e6ccd..fd3dea8b4 100644--- a/pages/[projectID].tsx+++ b/pages/[projectID].tsx@@ -7,7 +7,6 @@ import { prisma, projects } from 'db/prisma'import Editor from 'components/Editor'import { StoreProvider } from 'state/StoreProvider'import { Database } from 'db/supabase'-import { inspect } from 'util'interface PathProps extends ParsedUrlQuery {projectID: string@@ -58,9 +57,6 @@ export const getServerSideProps: GetServerSideProps<Props, PathProps> = async (c},})--- console.log(inspect(user, { depth: null }))const project = user?.users_teams.flatMap(t => t.teams.projects)diff --git a/pages/_app.tsx b/pages/_app.tsxindex fc29d62c9..0fd1148ac 100644--- a/pages/_app.tsx+++ b/pages/_app.tsx@@ -7,10 +7,11 @@ import { useRouter } from 'next/router'import clsx from 'clsx'import { Toaster } from 'sonner'-import 'src/styles/global.css'+import 'styles/global.css'-import Header from 'src/components/Header'-import { Database } from 'src/db/supabase'+import Header from 'components/Header'+import { Database } from 'db/supabase'+import { projects } from '@prisma/client'const inter = Inter({subsets: ['latin'],@@ -22,7 +23,7 @@ const jetBrains = JetBrains_Mono({variable: '--font-jet-brains',})-export default function App({ Component, pageProps }: AppProps<{ initialSession: Session }>) {+function App({ Component, pageProps }: AppProps<{ initialSession: Session, project?: projects }>) {const router = useRouter()const [supabaseClient] = useState(() => createBrowserSupabaseClient<Database>())@@ -46,7 +47,7 @@ export default function App({ Component, pageProps }: AppProps<{ initialSession:initialSession={pageProps.initialSession}>{!isSignIn && !isSignUp &&- <Header />+ <Header project={pageProps.project} />}<Toaster /><Component {...pageProps} />@@ -54,3 +55,5 @@ export default function App({ Component, pageProps }: AppProps<{ initialSession:</main>)}++export default Appdiff --git a/pages/api/exec/js.ts b/pages/api/exec/js.tsindex 5740936a9..77fea98f4 100644--- a/pages/api/exec/js.ts+++ b/pages/api/exec/js.ts@@ -1,16 +1,31 @@+import { NextApiRequest, NextApiResponse } from 'next'+// Just a hack so express is available when running evalconst express = require('express')console.log(express.name)-async function handler(req, res) {+async function postExecJS(req: NextApiRequest, res: NextApiResponse) {const { code } = req.bodytry {-const output = await eval(code)res.status(200).json({ message: output })- } catch (err) {+ } catch (err: any) {res.status(500).json({ message: err.message })}}-module.exports = handler+async function handler(+ req: NextApiRequest,+ res: NextApiResponse,+) {+ if (req.method === 'POST') {+ await postExecJS(req, res)+ return+ }++ res.setHeader('Allow', 'POST')+ res.status(405).json({ statusCode: 405, message: 'Method Not Allowed' })+ return+}++export default handlerdiff --git a/pages/api/project.ts b/pages/api/project.tsnew file mode 100644index 000000000..1eaebd54f--- /dev/null+++ b/pages/api/project.ts@@ -0,0 +1,151 @@+import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'+import { NextApiRequest, NextApiResponse } from 'next'++import { prisma } from 'db/prisma'++export interface PostProjectBody {+ id: string+}++async function postProject(req: NextApiRequest, res: NextApiResponse) {+ const {+ id,+ } = req.body as PostProjectBody++ try {+ const supabase = createServerSupabaseClient({ req, res })+ const { data: { session } } = await supabase.auth.getSession()+ if (!session) {+ return res.status(401).json({+ error: 'not_authenticated',+ description: 'The user does not have an active session or is not authenticated',+ })+ }++ const user = await prisma.auth_users.findUnique({+ where: {+ id: session.user.id,+ },+ include: {+ users_teams: {+ include: {+ teams: true,+ }+ }+ },+ })+ if (!user) {+ return res.status(401).json({+ error: 'invalid_user',+ })+ }++ const defaultTeam = user.users_teams.find(t => t.teams.is_default)+ if (!defaultTeam) {+ return res.status(401).json({+ error: 'invalid_default_team',+ })+ }++ const project = await prisma.projects.create({+ data: {+ id,+ teams: {+ connect: {+ id: defaultTeam.teams.id,+ },+ },+ name: id,+ },+ select: {+ created_at: false,+ id: true,+ }+ })++ res.status(200).json(project)+ } catch (err: any) {+ console.error(err)+ res.status(500).json({ statusCode: 500, message: err.message })+ }+}++async function deleteProject(req: NextApiRequest, res: NextApiResponse) {+ const { id } = req.body as PostProjectBody++ try {+ const supabase = createServerSupabaseClient({ req, res })+ const { data: { session } } = await supabase.auth.getSession()+ if (!session) {+ return res.status(401).json({+ error: 'not_authenticated',+ description: 'The user does not have an active session or is not authenticated',+ })+ }++ const project = await prisma.projects.findFirst({+ where: {+ AND: [+ {+ id: {+ equals: id,+ }+ },+ {+ teams: {+ users_teams: {+ some: {+ user_id: {+ equals: session.user.id,+ },+ },+ },+ },+ },+ ],+ },+ })++ if (!project) {+ res.status(404).json({})+ return+ }++ await prisma.deployments.deleteMany({+ where: {+ project_id: project.id,+ },+ })++ await prisma.projects.delete({+ where: {+ id,+ },+ })++ res.status(200).json({})+ } catch (err: any) {+ console.error(err)+ res.status(500).json({ statusCode: 500, message: err.message })+ }+}++async function handler(+ req: NextApiRequest,+ res: NextApiResponse,+) {+ if (req.method === 'POST') {+ await postProject(req, res)+ return+ }+ if (req.method === 'DELETE') {+ await deleteProject(req, res)+ return+ }++ res.setHeader('Allow', 'POST')+ res.status(405).json({ statusCode: 405, message: 'Method Not Allowed' })+ return+}++export default handler\ No newline at end of filediff --git a/pages/index.tsx b/pages/index.tsxindex 54185b335..1ae2f54c5 100644--- a/pages/index.tsx+++ b/pages/index.tsx@@ -1,15 +1,14 @@import type { GetServerSideProps } from 'next'+import useSWRMutation from 'swr/mutation'import { LayoutGrid, Plus } from 'lucide-react'import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'import { useRouter } from 'next/router'-import { useSupabaseClient } from '@supabase/auth-helpers-react'import ItemList from 'components/ItemList'import Text from 'components/Text'import { prisma, projects } from 'db/prisma'import Button from 'components/Button'-import { deploymentsTable, projectsTable } from 'db/tables'-import { Database } from 'db/supabase'+import { getProjectURL } from 'utils/getProjectURL'export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {const supabase = createServerSupabaseClient(ctx)@@ -81,6 +80,21 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {}}+interface DeleteProjectBody {+ id: string+}++async function handleDeleteProject(url: string, { arg }: { arg: DeleteProjectBody }) {+ return await fetch(url, {+ method: 'DELETE',+ body: JSON.stringify(arg),++ headers: {+ 'Content-Type': 'application/json',+ },+ }).then(r => r.json())+}+interface Props {projects: projects[]}@@ -88,14 +102,14 @@ interface Props {function Home({ projects }: Props) {const router = useRouter()- const client = useSupabaseClient<Database>()+ const {+ trigger: deleteProject,+ } = useSWRMutation('/api/project', handleDeleteProject)async function handleDelete(id: string) {- await client.from(deploymentsTable).delete().eq('project_id', id)- await client.from(projectsTable).delete().eq('id', id)+ await deleteProject({ id })router.replace(router.asPath)}-return (<divclassName="@@ -143,8 +157,9 @@ function Home({ projects }: Props) {deleteItem={handleDelete}items={projects.map(i => ({...i,- title: i.name || i.id,- path: '/[id]',+ title: i.name,+ url: getProjectURL(i.id),+ path: '/[projectID]',type: 'Project',icon: <LayoutGrid size="22px" strokeWidth="1.7" />,}))}diff --git a/pages/new.tsx b/pages/new.tsxindex 0708fc97f..d5d9d7be3 100644--- a/pages/new.tsx+++ b/pages/new.tsx@@ -5,21 +5,37 @@ import {LayoutGrid,} from 'lucide-react'import { useRouter } from 'next/router'-import { useSupabaseClient } from '@supabase/auth-helpers-react'-import { nanoid } from 'nanoid'+import humanId from 'human-id'+import useSWRMutation from 'swr/mutation'import Text from 'components/Text'import Input from 'components/Input'import Button from 'components/Button'import SpinnerIcon from 'components/Spinner'-import { projectsTable } from 'db/tables'-import { Database } from 'db/supabase'const re = /[^a-zA-Z0-9\-]/-export default function NewProject() {+interface PostProjectBody {+ id: string+}++async function handlePostProject(url: string, { arg }: { arg: PostProjectBody }) {+ return await fetch(url, {+ method: 'POST',+ body: JSON.stringify(arg),++ headers: {+ 'Content-Type': 'application/json',+ },+ }).then(r => r.json())+}++function NewProject() {const [isCreating, setIsCreating] = useState(false)- const [projectID, setProjectID] = useState(() => nanoid())+ const [projectID, setProjectID] = useState(() => humanId({+ separator: '-',+ capitalize: false,+ }))const trimmedID = projectID.trim()const validatedID = re.test(trimmedID)@@ -28,8 +44,9 @@ export default function NewProject() {const router = useRouter()-- const client = useSupabaseClient<Database>()+ const {+ trigger: createProject,+ } = useSWRMutation('/api/project', handlePostProject)async function handleCreateProject() {setErr(undefined)@@ -48,10 +65,12 @@ export default function NewProject() {}try {- const res = await client.from(projectsTable).insert({ id: trimmedID })+ const project = await createProject({+ id: trimmedID+ })- if (res.error) {- setErr(res.statusText)+ if (project && 'statusCode' in project) {+ setErr(`Project with name "${trimmedID}" already exists`)setIsCreating(false)return}@@ -147,3 +166,5 @@ export default function NewProject() {</div>)}++export default NewProjectdiff --git a/pages/settings.tsx b/pages/settings.tsxindex fda87ea46..c0cb39fa3 100644--- a/pages/settings.tsx+++ b/pages/settings.tsx@@ -4,9 +4,9 @@ import { GetServerSideProps } from 'next'import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'import { useSupabaseClient, useUser } from '@supabase/auth-helpers-react'-import Button from 'src/components/Button'-import Text from 'src/components/Text'-import { Database } from 'src/db/supabase'+import Button from 'components/Button'+import Text from 'components/Text'+import { Database } from 'db/supabase'export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {const supabase = createServerSupabaseClient<Database>(ctx)diff --git a/state/store.ts b/state/store.tsindex aab644511..dc8801f23 100644--- a/state/store.ts+++ b/state/store.ts@@ -2,11 +2,11 @@ import { create } from 'zustand'import { immer } from 'zustand/middleware/immer'import { persist } from 'zustand/middleware'import { SupabaseClient } from '@supabase/supabase-js'-import { api_deployments } from '@prisma/client'-import { apiDeploymentsTable } from 'src/db/tables'-import { Database } from 'src/db/supabase'+import { Database } from 'db/supabase'import { nanoid } from 'nanoid'+import { projects } from '@prisma/client'+import { projectsTable } from 'db/tables'export interface Tool {name: string@@ -45,8 +45,8 @@ const defaultState: Pick<State, 'blocks' | 'method'> = {method: Method.POST,}-export function createStore(deployment?: api_deployments, client?: SupabaseClient<Database>) {- const state = (deployment?.data as any).state as Pick<State, 'blocks' | 'method'> || defaultState+export function createStore(project?: projects, client?: SupabaseClient<Database>) {+ const state = (project?.data as any)?.state as Pick<State, 'blocks' | 'method'> || defaultStateif (state.blocks.length === 0) {state.blocks.push(defaultBlock)@@ -81,19 +81,19 @@ export function createStore(deployment?: api_deployments, client?: SupabaseClienconst persistent = persist(immerStore, {name: 'supabase-storage',partialize: (state) => state,- storage: client && deployment ? {+ storage: client && project ? {getItem: async (name) => {// We retrieve the data on the serverreturn null},removeItem: async () => {- const res = await client.from(apiDeploymentsTable).update({ data: {} }).eq('id', deployment.id).single()+ const res = await client.from(projectsTable).update({ data: {} }).eq('id', project.id).single()if (res.error) {throw res.error}},setItem: async (name, value) => {- const res = await client.from(apiDeploymentsTable).update({ data: value as any }).eq('id', deployment.id).single()+ const res = await client.from(projectsTable).update({ data: value as any }).eq('id', project.id)if (res.error) {throw res.error}diff --git a/tailwind.config.js b/tailwind.config.jsindex 12a741800..990e6e095 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -1,9 +1,7 @@const { fontFamily } = require('tailwindcss/defaultTheme')module.exports = {- content: [- 'src/**/*.{js,ts,jsx,tsx,css}',- ],+ content: ['./components/**/*.{js,ts,jsx,tsx,css}', './pages/**/*.{js,ts,jsx,tsx,css}', './styles/**/*.{js,ts,jsx,tsx,css}'],darkMode: 'class',theme: {extend: {diff --git a/utils/getProjectURL.ts b/utils/getProjectURL.tsnew file mode 100644index 000000000..3d698639e--- /dev/null+++ b/utils/getProjectURL.ts@@ -0,0 +1,3 @@+export function getProjectURL(projectID: string) {+ return `${projectID}.api.usedevbook.com`+}diff --git a/yarn.lock b/yarn.lockindex 9019b43c7..7414ee7c8 100644--- a/yarn.lock+++ b/yarn.lock@@ -1993,7 +1993,7 @@resolved "https://registry.yarnpkg.com/@vercel/node-bridge/-/node-bridge-3.1.14.tgz#992b8715ca8537a190ff58aa828aca679290da0b"integrity sha512-TAbo0rwBenmWywcEup+5lZgr6ILPPq55P33JRX+oJJuTxYib0NqVj47gEvLTxaj3MoJFgp0iDlC9A0uAf4ykxQ==-"@vercel/[email protected]", "@vercel/node@^2.9.10":+"@vercel/[email protected]":version "2.9.10"resolved "https://registry.yarnpkg.com/@vercel/node/-/node-2.9.10.tgz#9342178ec89846130ed0e62d4fb40870a06830ab"integrity sha512-rpl0dkJVQpPgIPvAG2hIuxwIIUoxRFqGwMVqqsp6r9sr2Y03q+t2UtPSGOyBRpE+0JdYV2GzcRcgiPQi3Udi7w==@@ -2671,6 +2671,15 @@ [email protected]:resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1"integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==+cliui@^8.0.1:+ version "8.0.1"+ resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"+ integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==+ dependencies:+ string-width "^4.2.0"+ strip-ansi "^6.0.1"+ wrap-ansi "^7.0.0"+clone-response@^1.0.2:version "1.0.3"resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.3.tgz#af2032aa47816399cf5f0a1d0db902f517abb8c3"@@ -2747,6 +2756,21 @@ [email protected]:resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==+concurrently@^7.6.0:+ version "7.6.0"+ resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.6.0.tgz#531a6f5f30cf616f355a4afb8f8fcb2bba65a49a"+ integrity sha512-BKtRgvcJGeZ4XttiDiNcFiRlxoAeZOseqUvyYRUp/Vtd+9p1ULmeoSqGsDA+2ivdeDFpqrJvGvmI+StKfKl5hw==+ dependencies:+ chalk "^4.1.0"+ date-fns "^2.29.1"+ lodash "^4.17.21"+ rxjs "^7.0.0"+ shell-quote "^1.7.3"+ spawn-command "^0.0.2-1"+ supports-color "^8.1.0"+ tree-kill "^1.2.2"+ yargs "^17.3.1"+console-control-strings@^1.0.0, console-control-strings@^1.1.0:version "1.1.0"resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"@@ -2952,6 +2976,11 @@ data-uri-to-buffer@^4.0.0:resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==+date-fns@^2.29.1:+ version "2.29.3"+ resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"+ integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==+deasync@^0.1.0:version "0.1.28"resolved "https://registry.yarnpkg.com/deasync/-/deasync-0.1.28.tgz#9b447b79b3f822432f0ab6a8614c0062808b5ad2"@@ -4244,6 +4273,11 @@ gensync@^1.0.0-beta.2:resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==+get-caller-file@^2.0.5:+ version "2.0.5"+ resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"+ integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==+get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0:version "1.2.0"resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.0.tgz#7ad1dc0535f3a2904bba075772763e5051f6d05f"@@ -4585,6 +4619,11 @@ https-proxy-agent@5, https-proxy-agent@^5.0.0:agent-base "6"debug "4"+human-id@^4.0.0:+ version "4.0.0"+ resolved "https://registry.yarnpkg.com/human-id/-/human-id-4.0.0.tgz#827426125ffd7d8e290b1f1a62a09bca61e2d169"+ integrity sha512-pui0xZRgeAlaRt0I9r8N2pNlbNmluvn71EfjKRpM7jOpZbuHe5mm76r67gcprjw/Nd+GpvB9C3OlTbh7ZKLg7A==+human-signals@^2.1.0:version "2.1.0"resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"@@ -7027,6 +7066,11 @@ remark-rehype@^9.0.0:mdast-util-to-hast "^11.0.0"unified "^10.0.0"+require-directory@^2.1.1:+ version "2.1.1"+ resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"+ integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==+require-from-string@^2.0.2:version "2.0.2"resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"@@ -7132,7 +7176,7 @@ run-parallel@^1.1.9:dependencies:queue-microtask "^1.2.2"-rxjs@^7.5.5:+rxjs@^7.0.0, rxjs@^7.5.5:version "7.8.0"resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4"integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==@@ -7250,6 +7294,11 @@ shebang-regex@^3.0.0:resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==+shell-quote@^1.7.3:+ version "1.8.0"+ resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.0.tgz#20d078d0eaf71d54f43bd2ba14a1b5b9bfa5c8ba"+ integrity sha512-QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ==+side-channel@^1.0.4:version "1.0.4"resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"@@ -7343,6 +7392,11 @@ space-separated-tokens@^2.0.0:resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz#1ecd9d2350a3844572c3f4a312bceb018348859f"integrity sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==+spawn-command@^0.0.2-1:+ version "0.0.2-1"+ resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"+ integrity sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==+ssri@^8.0.1:version "8.0.1"resolved "https://registry.yarnpkg.com/ssri/-/ssri-8.0.1.tgz#638e4e439e2ffbd2cd289776d5ca457c4f51a2af"@@ -7377,7 +7431,7 @@ string-hash@^1.1.1:resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"integrity sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==-"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.3:+"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:version "4.2.3"resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==@@ -7519,6 +7573,13 @@ supports-color@^7.1.0:dependencies:has-flag "^4.0.0"+supports-color@^8.1.0:+ version "8.1.1"+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"+ integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==+ dependencies:+ has-flag "^4.0.0"+supports-preserve-symlinks-flag@^1.0.0:version "1.0.0"resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"@@ -7686,6 +7747,11 @@ tr46@~0.0.3:resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==+tree-kill@^1.2.2:+ version "1.2.2"+ resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"+ integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==+trough@^2.0.0:version "2.1.0"resolved "https://registry.yarnpkg.com/trough/-/trough-2.1.0.tgz#0f7b511a4fde65a46f18477ab38849b22c554876"@@ -8261,6 +8327,11 @@ xtend@^4.0.2, xtend@~4.0.1:resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==+y18n@^5.0.5:+ version "5.0.8"+ resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"+ integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==+yaeti@^0.0.6:version "0.0.6"resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577"@@ -8286,6 +8357,24 @@ yaml@^2.1.1:resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.1.tgz#3014bf0482dcd15147aa8e56109ce8632cd60ce4"integrity sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==+yargs-parser@^21.1.1:+ version "21.1.1"+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"+ integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==++yargs@^17.3.1:+ version "17.7.1"+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.1.tgz#34a77645201d1a8fc5213ace787c220eabbd0967"+ integrity sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==+ dependencies:+ cliui "^8.0.1"+ escalade "^3.1.1"+ get-caller-file "^2.0.5"+ require-directory "^2.1.1"+ string-width "^4.2.3"+ y18n "^5.0.5"+ yargs-parser "^21.1.1"+version "3.1.1"resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"