-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic saving of types in files when the schema is changed #29
base: master
Are you sure you want to change the base?
Conversation
…es on creat/update/delete of collections, fields or relations Add a hook saving types in files List files to save to in an environment va factorize data gathering between the admin module and the hook closed maltejur#27
Example with Directus env var (may be faster but fuzzy log) Example with nodemon (more readable but may be slower) Add sample env.GENERATE_TYPES_SYNCED_TS_FILES to the dev project
Also adds a disclaimer to the generated types files maltejur#27
Hi, this looks great, thanks already! I am currently not at home, so it may take some days/a week until I can review this. |
No hurry, i'm using my fork with some other fixes meanwhile |
d5b7db6
to
f79e32e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have gone ahead and reformatted your pull request with prettier, that way we don't have stuff like using tabs for indentation in one place and spaces in a different one. Before submitting any new changes, could you also run prettier . -w
first?
Another thing, when testing your changes with yarn dev:project
, I am getting the following error when visiting the Directus interface:
When I disable the extension through the following change, it works flawlessly again
--- a/dev.sh
+++ b/dev.sh
@@ -35,9 +35,6 @@ fi
echo "-> Building and linking extension"
-(cd .. && yarn directus-extension link ./dev/extensions)
-(cd .. && yarn dev &)
-
echo
echo "-> Starting dev server"
echo " You can log in with:"
Could you try to figure out what is causing this?
@@ -40,3 +46,4 @@ echo " pw: admin" | |||
echo | |||
|
|||
yarn directus start | |||
# yarn dev:nodemon # using nodemon produces more readable log than EXTENSIONS_AUTO_RELOAD="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use nodemon then
import generateOasTypes from "../../lib/generate-types/oas"; | ||
import languages from "../lib/languages"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason you turned these into relative imports?
This PR required some refacto
getCollections
in 2 layers to be usable with data from a module (api) and from a hook (services)Out of scope (IMHO)
Remaining non blocking problem:
nodemon
orEXTENSIONS_AUTO_RELOAD="true"
, please tell me your feeling!Hoping you'll have time for a review,
Thank you for your work!