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

#475 Add warnings to terminal for possible route conflicts. #539

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nhc
Copy link

@nhc nhc commented Jul 23, 2022

Hi All.

I'm new to Deno and Fresh so please go easy on me ! This is my first attempt and contributing to this project. As it is quite new I was not able to find a comprehensive guide to contributing (I could help with that too if there are plans?) so I might have got quite a bit wrong. For example I've not written any tests.

This is my first attempt at solving issue/475 and I might have completely missed the point completely.

I'm looking for feedback and help on how to improve what I've done.

What it does do

  • in a function called routeWarnings in dev/mod.ts it looks at all the routes from the manifest
  • if there is a dynamic route and a static route in the same directory it adds them to a list
  • thenconsole.logs in red the following message from the list we've built up.

Screenshot 2022-07-23 at 21 09 39

  • if there are conflicts in a number of places it lists these out

I realise some things will need changing and improving (like I've used any as a type on line 153)

(totals: any, p) => ({ ...totals, [p.dir]: (totals[p.dir] || 0) + 1 }),

But I was hoping for some feedback in terms of if I'm in the right direction etc?

Also I have these questions

  1. Why is there no .gitignore ?
  2. Are there any plans or style guide / design system for the docs ?
  3. Is there a contributors guide that I'm missing?
  4. Why is my prettier working differently ? It has formatted a few exisiting things differently? Dont we need a prettier config file in the root of Fresh?

Thank you all feedback welcomed.

@deno-deploy deno-deploy bot had a problem deploying to Preview July 23, 2022 20:20 Failure
Copy link
Contributor

@xstevenyung xstevenyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some feedback. Note that I'm not the maintainer, so take those with a pinch of salt

Edit: I just saw your questions, I'm going to reply at the best of my limited knowledge:

Why is there no .gitignore ?

There is none as Fresh doesn't generate bundled code and Deno doesn't install dependencies in a node_modules. And I guess no files needed to be ignored.

Are there any plans or style guide / design system for the docs ?

There is (cf. #498)

Is there a contributors guide that I'm missing?

Not yet, one is in the work (cf. #465)

Why is my prettier working differently ? It has formatted a few exisiting things differently? Dont we need a prettier config file in the root of Fresh?

Deno comes with a custom deno fmt (similar to prettier, but with a different default, for more info). VSCode should pick it up automatically, but you might need to disable your prettier in this workspace.

www/fresh.gen.ts Outdated Show resolved Hide resolved
src/dev/deps.ts Outdated Show resolved Hide resolved
src/dev/mod.ts Outdated Show resolved Hide resolved
console.log(
`%cCheck ${errorsList} for potential routing issues.
You may have dynamic and static routes overwriting each other.
Please check the documentation for more information. http://localhost:8000/docs/getting-started/dynamic-routes`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are pointing to your localhost:8000 here, replace it with the Fresh website.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But when they are developing it will always be running locally here in the terminal?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this is a link to the documentation, not on your local project

src/dev/mod.ts Outdated
`%cCheck ${errorsList} for potential routing issues.
You may have dynamic and static routes overwriting each other.
Please check the documentation for more information. http://localhost:8000/docs/getting-started/dynamic-routes`,
"color: red; font-weight: bold"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of a personal opinion, but I don't think this message should display in red, as it's more a warning. Might need confirmation from the project maintenainer though

@nhc
Copy link
Author

nhc commented Jul 24, 2022

@xstevenyung - Thank you so much for taking the time to answer my questions. I will fix this up some more. Makes a lot of sense about custom formatter etc, it just didnt cross my mind.

console.log(
`%cCheck ${errorsList} for potential routing issues.
You may have dynamic and static routes overwriting each other.
Please check the documentation for more information. http://localhost:8000/docs/getting-started/dynamic-routes`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this is a link to the documentation, not on your local project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants