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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript to the frontend #331

Open
fabienheureux opened this issue Feb 2, 2021 · 6 comments
Open

Add TypeScript to the frontend #331

fabienheureux opened this issue Feb 2, 2021 · 6 comments
Labels

Comments

@fabienheureux
Copy link

fabienheureux commented Feb 2, 2021

馃憢

First of all thanks for this project, it seems nicely done (I did not have a lot of time to play with yet).

The move to typescript would be quite easy.
Would you be open to migrate to typescript for the frontend part ?
I could open a PR if you like.

Edit & TLDR: it won't be implemented soon, but I have written a comment below explaining how to add TypeScript to Wagtail-Pipit: #331 (comment)
Also: I forked Pipit to add some ideas of mine, and I added TS in the process. You can see this here: https://github.com/l-etabli/wagtail-debut

@fabienheureux
Copy link
Author

French updates aside, you can see a summary of the typescript update here: master...l-etabli:main
It is a very basic typescript implementation, relying mainly on default next.js types.
At this stage, it already helped me noticing a few errors in the code (like bad imports for example).

@marteinn
Copy link
Member

marteinn commented Feb 2, 2021

HI @fabienheureux, thanks for showing interest in Pipit and I hope it suits your needs, otherwise feedback are much welcome :)

Regarding Typescript, its a tricky subject for us, we have discussed it internally a few times at Fr枚jd (the agency that does most of the development of this boilerplate) but have so far decided to keep using JS, mainly because we feel that it complicates our types of project. Nothing is set in stone and we will continue to revisit this question in the future.

When it comes to the frontend/Next.js part of this project, we have a goal to port it to a create-next-app boilerplate, that way we can detach it from the Pipit and make it easier to switch for something else, like a typescript version. I think that will happen it the upcoming months.

So for now, lets keep this issue open as a reference to others that wish to use Typescript + Pipit.

If you have other ideas, issues is a good way to go, you can otherwise find us for discussion at the Wagtail Slack under channel #pipit

@fabienheureux
Copy link
Author

fabienheureux commented Feb 2, 2021

Thanks for your reply !

Moving the frontend out of the project could be a great idea !
I started forking the project with a few ideas in mind

  • Have the option to use gatsby instead of next (or no React framework at all)
  • Have the option to have a standard wagtail frontend without decoupled frontend
  • Have the option to have the django pattern library installed if no decoupled frontend is used
  • Have the option to have grapple installed. It was the main reason I forked Pipit: I will work in the following months on a grapple/next.js implementation, and I really liked your approach using cookiecutter.

About typescript, I usually use a very basic implementation and don't necessarily write my own types, but having all the TS ecosystem (autocompletion, typing, etc) help to maintain a better code quality in my opinion.

I will come to the wagtail channel in order to discuss these ideas...

@marteinn
Copy link
Member

marteinn commented Feb 6, 2021

I noticed that @fabienheureux previous link has stopped working, so I'm just posting a new link here to the new repo where anyone curious in using Typescript + Pipit can take a look and find inspiration: https://github.com/l-etabli/wagtail-debut

(And just to reiterate, we don't have a Typescript port in our roadmap, but its not too difficult to migrate to typescript)

@fabienheureux
Copy link
Author

fabienheureux commented Feb 6, 2021

Hi @marteinn, thanks for the link !
Yes in fact, as I am moving away of the initial repo, I decided to remove the "fork" reference from Pipit.
However, I will try to keep track of changes in Pipit and backport these in my fork.

For future reference, here is the approach I used to get TS in Pipit

@fabienheureux fabienheureux changed the title Move to typescript Add TypeScript to the frontend Feb 6, 2021
@marteinn
Copy link
Member

marteinn commented Feb 7, 2021

Thanks for clarifying @fabienheureux and for the awesome links!

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

No branches or pull requests

2 participants