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

docs: use "npx create-docusaurus" for init #5797

Merged
merged 2 commits into from Oct 27, 2021
Merged

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Oct 27, 2021

Motivation

Fixes #5735 (comment)

npm init is currently annoying due to a change in how args are provided:

  • npm6 requires npm init docusaurus@latest my-website classic --typescript
  • npm7 requires npm init docusaurus@latest my-website classic -- --typescript

The following works with both npm versions:

npx create-docusaurus@latest my-website classic --typescript works reliably with npm 6 + more recent versions

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

local with npm 6+7

@slorber slorber added the pr: documentation This PR works on the website or other text documents in the repo. label Oct 27, 2021
@slorber slorber requested a review from lex111 as a code owner October 27, 2021 12:10
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 27, 2021
@netlify
Copy link

netlify bot commented Oct 27, 2021

✔️ [V2]

🔨 Explore the source changes: 9dc9879

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/617941d2d9b8c60008639354

😎 Browse the preview: https://deploy-preview-5797--docusaurus-2.netlify.app

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 66
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5797--docusaurus-2.netlify.app/

@github-actions
Copy link

Size Change: -342 B (0%)

Total Size: 847 kB

Filename Size Change
website/build/docs/index.html 46.1 kB -56 B (0%)
website/build/docs/installation/index.html 53.6 kB -286 B (-1%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 38 kB
website/build/assets/css/styles.********.css 93.8 kB
website/build/assets/js/main.********.js 425 kB
website/build/blog/2017/12/14/introducing-docusaurus/index.html 68.2 kB
website/build/blog/index.html 39 kB
website/build/index.html 31.6 kB
website/build/tests/docs/index.html 27.3 kB
website/build/tests/docs/standalone/index.html 23.8 kB

compressed-size-action

@Josh-Cena
Copy link
Collaborator

This is marginally better than npx @docusaurus/init@latest classic🧐

Should we at least inform the users of the possibility of npm init / yarn create? With tabs?

@slorber
Copy link
Collaborator Author

slorber commented Oct 27, 2021

This is marginally better than npx @docusaurus/init@latest classic🧐

It's the same, but also avoid renaming back create-docusaurus to @docusaurus/init

After Node 14 end of life things might become simpler and it's worth to keep that package name.

Should we at least inform the users of the possibility of npm init / yarn create? With tabs?

I'd like to, but there's an issue in npm2yarn: nebrelbug/npm-to-yarn#21

Also not sure tabs are the most convenient, considering we mention init command in some inline code blocks, it requires some doc rewrite to add tabs everywhere.


Also npm does not use latest but cached version so @latest is required, but only for npm.


For now I think npx is fine, we'll revisit this later.

@Josh-Cena
Copy link
Collaborator

Yeah, I'm aware of that issue, just not sure if we should not document it anywhere. I guess those who know the magic of create-* already will understand :P

@slorber
Copy link
Collaborator Author

slorber commented Oct 27, 2021

nobody complained with the old command so I'd rather keep the doc simple and restore it, until we have a proper way to reference the new commands in a simple way, without providing any warnings and additional walls of text

@Josh-Cena
Copy link
Collaborator

Makes sense. Normal users only use it a few times in their entire lives, so not a huge issue.

@slorber slorber merged commit ca5d70d into main Oct 27, 2021
@slorber slorber deleted the slorber/restore-npx-init branch October 27, 2021 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: documentation This PR works on the website or other text documents in the repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The TypeScript variant for the classic template is missing
3 participants