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

The TypeScript variant for the classic template is missing #5735

Closed
5 tasks done
ghost opened this issue Oct 18, 2021 · 4 comments · Fixed by #5797
Closed
5 tasks done

The TypeScript variant for the classic template is missing #5735

ghost opened this issue Oct 18, 2021 · 4 comments · Fixed by #5797
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: question This issue is a user error/misunderstanding.

Comments

@ghost
Copy link

ghost commented Oct 18, 2021

🐛 Bug Report

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io
  • I have read the console error message carefully (if applicable)

Description

Running npm init docusaurus@latest my-website classic --typescript produces the identical files as running the same script without the --typescript flag. It looks like the classic-typescript folder contains the same files as classic, which might be the cause.

Have you read the Contributing Guidelines on issues?

Yes.

Steps to reproduce

  1. Run npm init docusaurus@latest my-website classic.
  2. Run npm init docusaurus@latest my-website classic --typescript.
  3. Compare the files in the directories created by the two commands above.

Expected behavior

The project created by running the command with the --typescript flag should have TypeScript set up.

Actual behavior

The project created by running the command with the --typescript flag has the same setup as the one created without the --typescript flag.

Your environment

  • Docusaurus version used: 2.0.0-beta.7
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node.js 16.11.1, npm 8.1.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS 11.6

Reproducible demo

https://codesandbox.io/s/github/facebook/docusaurus/tree/main/examples/classic-typescript

@ghost ghost added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Oct 18, 2021
@Josh-Cena
Copy link
Collaborator

With the new npm init syntax you would need to use extra -- (https://docusaurus.io/docs/next/installation#scaffold-project-website):

npm init docusaurus@latest my-website classic -- --typescript

I know it's tricky because we didn't fix it in the versioned docs. We should

@ghost ghost closed this as completed Oct 18, 2021
@shirakaba
Copy link

shirakaba commented Oct 24, 2021

Using Docusaurus 2.0.0-beta.8, I actually provided the extra -- to forward options, but providing it was precisely what caused the failure:

# npm v6.14.7, node v16.1.0:
# ❌ This fails to produce the TypeScript template
npm init docusaurus@latest my-website classic -- --typescript

# npm v6.14.7, node v16.1.0
# ✅ This successfully produces the TypeScript template
npm init docusaurus@latest my-website classic --typescript

Comparing the npm v6 and npm v7 docs for npm init, it appears to be from npm v7 onwards that npm init requires passing -- for forwarding options.

As npm v6 comes with node v16, which is the "current" version of node at the time of writing and begins active long-term support from 26th Oct 2021, I feel the docs should reflect two sets of instructions: one for npm v7 and above, and another for versions below that.

@Josh-Cena
Copy link
Collaborator

Yes, @slorber just realized after the beta-8 release that there's an inconsistency between npm v6 and v7, but he's currently unavailable. Let's see what's the best solution to this.

@slorber
Copy link
Collaborator

slorber commented Oct 27, 2021

npm 6/7 issue will be fixed in #5797

@Josh-Cena Josh-Cena added closed: question This issue is a user error/misunderstanding. and removed status: needs triage This issue has not been triaged by maintainers labels Feb 19, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: question This issue is a user error/misunderstanding.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants