get-convex / convex-js

TypeScript/JavaScript client library for Convex
https://docs.convex.dev
Apache License 2.0
68 stars 9 forks source link

[Suggestion] Don't Delete convex.json When Running npx convex dev #6

Open Luzefiru opened 6 months ago

Luzefiru commented 6 months ago

Background Information

I'm developing a project within a team wherein our React client consumes the Convex API. As of the moment, the onboarding process and development environment setup is quite cumbersome due to unintended(?) actions caused by npx convex dev.

We have a client/convex.json file that specifies the following information that is crucial to the functionality of the client side:

{
    "functions": "./src/_convex"
}

Running npx convex dev and going through the setup wizard deletes this file and then results in a [CONVEX Q(files:getFilesByDocumentId)] Could not find public function for 'files:getFilesByDocumentId'. Did you forget to run `npx convex dev` or `npx convex deploy`? error.

Demo

demo

The Suggestion

If it's possible, npx convex dev shouldn't delete these configuration files on directories without .env.local's Convex files. Or perhaps, the wizard can ask questions if there is an existing configuration files or if there are files to ignore during the initialization process.

Also, an npx convex dev --verbose flag would be nice to see explicit updates on any file changes.

xixixao commented 5 months ago

@Luzefiru that sounds like a bug. We'll look into it. Meanwhile make sure you are on the latest version of convex, as the issue might have already been fixed.