You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A watch mode is an interesting idea. Can you say more about how you'd expect to use it in practice? Are you in "rapid dev" mode and adding/removing packages and not wanting to re-run the generate command?
If it were added, I'd definitely prefer it be an explicit option like manage.py importmap_generate --watch. I think it could throw people off it the lock file were refreshed "magically" — just like with package.json/yarn.lock, if you simply ask for "react" without a version range (not saying that is a great practice) then a lockfile update could easily bump you to a new major version and break some stuff.
Depending on what you have in mind, I would guess that a manage.py importmap_add react command is probably related (and maybe importmap_remove)? Would function just like yarn add where you don't have to edit the importmap.toml by hand (error prone, have to look up the available versions manually, etc.) and it would update the lockfile automatically all in one command. Does that relate to what you're thinking?
Realized a little bit ago that I was the one who suggested "Automatically rebuild importmap.lock during runserver / on config modification" and I'm assuming that's what you were referring to! Sorry!
After having been away from it for a little bit (obviously!), I would definitely push for add/remove commands instead and think of it more along the lines of package.json/yarn.lock etc. Can't think of any package managers that have a "watch" mode and like I mentioned in the other comment, I'm not actually sure I want one here...
Anyway, I updated the list on the README (83ce7a6) and would definitely help with a PR for importmap_add!
Hey, first, awesome work!
I saw your todo list and would also like some kind of watch mode that keeps running and just rebuilds the .lock file in case of file changes (see e.g. here: https://stackoverflow.com/questions/6271719/reusing-django-code-auto-reload-functionality-for-custom-management-commands)
An alternative could be to have the template tag to refresh the .lock file IF in DEBUG mode (or any other flag set).
What do you think of that?
(I would love to do a PR for this)
The text was updated successfully, but these errors were encountered: