-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
feat: new init template classic-typescript #5233
Conversation
✔️ [V2] 🔨 Explore the source changes: 40b6d51 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6101440266591500085b6086 😎 Browse the preview: https://deploy-preview-5233--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5233--docusaurus-2.netlify.app/ |
✔️ [V2] 🔨 Explore the source changes: f89d75c 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/610d1a4a599bc80008306915 😎 Browse the preview: https://deploy-preview-5233--docusaurus-2.netlify.app |
edd4c27
to
1262b59
Compare
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
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.
Thanks, that looks nice
In the future, I'd like the ability to avoid duplicating docs and share the same docs/blog for all themes. The FB variant can also be quite similar to the classic template + some tweaks (not sure which 😅).
So, we'll probably move away from using symlinks in the future and have a shared/docs folder, but in the meantime that looks fine
packages/docusaurus-init/templates/classic-typescript/src/types.d.ts
Outdated
Show resolved
Hide resolved
## Setup {#setup} | ||
|
||
Docusaurus supports writing and using TypeScript theme components. To start using TypeScript, add `@docusaurus/module-type-aliases` and some `@types` dependencies to your project: | ||
To start using TypeScript, add `@docusaurus/module-type-aliases` and some `@types` dependencies to your project: |
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.
do we need those deps in the init project as well? Does not seem mandatory
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 don't really know, I suspect yes. Users are very likely to run into these types sooner or later, although I don't think the react types are used in the init template...
Initially, I was just creating template that's exactly what would be like if the user follows this doc
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
I was wondering: wouldn't it be simpler to directly symlink the docs/blog folder instead of individual files? I'd like to have all templates (also fb/bootstrap) sharing the same docs/blog/sidebar config instead of copies that we have to keep in sync (and yes, it's not in sync currently 😅 ), your symlinks system + dereference can be a good fit. I think moving init template content outside of the |
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
That was just me playing it safe (because I'm a noob at this and can't guarantee it works). I would also argue that this creates a more straightforward directory structure, and makes room for template-unique pages in the future.
I tried a bit on this, but gave up because I suspect the FB template would require the copyright header in |
No I think we mostly want the same content everywhere, which is the basic 5min tutorial
Yes I don't want that too, but maybe only the sidebar can be duplicated in the FB template for now |
Didn't know that. It seems all the options are there actually😅 Previously I didn't have the base config properly installed. I've removed all compiler options now |
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
So should I create the |
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
I think we can merge this one first and improve later, this will be easier to review |
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
LGTM 👍 thanks |
Unfortunately seems NPM doesn't support symlinks: npm/npm#6703 We do need to make the FYI, |
Motivation
Users don't have to follow the documentation every time a new website is initialized to add Typescript support. Now the TS template is available via the
--typescript
flag on init.Also some minor refactors.
A downside is duplicated code between
classic
andclassic-template
folders. We can either use symlinks or copy the duplicated files fromclassic
instead ofclassic-typescript
—discussions welcomed.Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
The template itself builds successfully. The CLI works as intended by running