convex-js
convex-js copied to clipboard
`npx convex dev --local` flag is ignored if not first time
We need to decide whether --local is
- a flag you can use with
convexdev and some other commands to conveniently switch without needing to run a separate --config command. In the extreme,convex import --local,convex run --local, etc. all work and immediately provision you a local deployment if you don't have one. - a flag only used with
--config - a flag only used with
--configor when --config is implied for initial setup as a synonym for --dev-deployment=local. This makesnpx convex dev --localwork if it's the first time running, but not work the second time. - nothing, it's deprecated, it says "use --dev-deployment=local"
3 is what works today, but --local is not disallowed in other situations: it just silently doesn't work.
The way to switch to a local deployment today is convex --configure which starts you all over choosing your team again, or typing out npx convex dev --configure=existing --team thomasballinger --project just-a-counter-app --dev-deployment local. This sucks! This is what --local and --cloud were for: quickly saying "yeah I'm obv not changing the project, I just want a local deployment!" Changing between prod and preview and local and dev should be easier than changing which project a repo is associated with.
The interactive convex dev --configure doesn't tell you if you have an existing cloud or locally-available local deployment, that or a convex deployments command might be a good start. We can also use a way to specify which deployment to do things other than dev with: only dev modifies the .env.local file to permanently point to a different deployment, but convex export --local would not be expected to do this. Today things like export just work on the current dev deployment by default.
It's reasonable to have multiple local deployments, importing data from this local deployment and exporting it to this other one. This isn't doable at all, you can't do it with a quick --local=this-one flag and you can't even permanently switching from one to the other; only a single local deployment is addressable.