Skip to content
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

Alert about not loaded files in routes folder #480

Open
monolithed opened this issue Jun 13, 2023 · 5 comments
Open

Alert about not loaded files in routes folder #480

monolithed opened this issue Jun 13, 2023 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@monolithed
Copy link

monolithed commented Jun 13, 2023

First of all, I want to say thank you for your work!

It's a bit unclear from the logs why there are no routes when they actually exist.
I suggest adding a check for the presence of TS files, so that the reason for the issue can be understood immediately.

@javierbrea
Copy link
Member

Hi @monolithed , I suppose that you have no routes because you didn't configure TypeScript properly, so there is an error when trying to load them. I think that adding a check to infere the cause of the reason of any possible error in route files may not be possible, or at least it may not worth. Currently you can see warnings in the server logs, in the CLI, and even in the admin REST API when there are errors loading routes, so I think it could be enough to deduce why there are no routes loaded. In order to improve it, maybe the warning message could include a clearer notice informing that the routes in the file won't be loaded because of the error.

And maybe we can also add a link below the documentation TypeScript examples to the "Configuring TypeScript" chapter.

@javierbrea javierbrea added the documentation Improvements or additions to documentation label Jun 14, 2023
@monolithed
Copy link
Author

@javierbrea I created this issue due to my own inattentiveness. From the examples in the documentation, I got the impression that TypeScript support is built-in. That's not the case, and I realized that upon revisiting the documentation. Nevertheless, I believe this issue is relevant because there is no explanation in the logs for people who make the same mistake. What I mean is that the routing files exist, but the server acts as if they don't. Why not add information stating that the files exist, but an adapter needs to be included for the server to pull them?

@javierbrea
Copy link
Member

Hi again @monolithed , the problem is that the server doesn't look for .ts files until it is explicitly configured to do so, so, in fact, for it there are no route files... I suppose that it could search for ts files when typescript is disabled, and print a warning in that case, but in my opinion it would be too much "coupled"...what would happen if you have js files and one ts file? It would load the js files, but also print a warning about enabling TypeScript.

@monolithed
Copy link
Author

@javierbrea hi, I got it, what if you add this information about the possible absence of a TS adapter only to the --verbose log output?

@javierbrea
Copy link
Member

I'm not sure about that. As I said, searching only for .ts files is too much coupled to a specific usage. Maybe it could be implemented as a generic search for any type of not loaded files in the routes folder, and, in that case, add a warning about them. I suppose that it may be helpful in case you are trying to use TypeScript without enabling it, because you'll see that the files are not loaded, and it also may be helpful in any other case.

I'll let the issue opened and I'll rename it into "Add warning about not loaded files in routes folder", if you don't mind.

If you need this feature right now, you can implement it in a plugin or you could even implement it in the core and open a PR, that are always welcome 😃

@javierbrea javierbrea changed the title Check for the presence of TS files Add warning about not loaded files in routes folder Jun 25, 2023
@javierbrea javierbrea changed the title Add warning about not loaded files in routes folder Alert about not loaded files in routes folder Jun 25, 2023
@javierbrea javierbrea moved this to To do in Backlog May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: To do
Development

No branches or pull requests

2 participants