bluwy / create-vite-extra

Extra Vite templates
MIT License
370 stars 55 forks source link

CLI: Not getting asked variant in Deno on Windows #36

Closed drewbitt closed 11 months ago

drewbitt commented 12 months ago

Problem

deno run -A npm:create-vite-extra

 deno run -A npm:create-vite-extra
√ Project name: ... 1
√ Select a template: » deno-react

Scaffolding project in E:\GithubE\1...

Done. Now run:

  cd 1
  deno task dev

I am not getting asked the variant, and it is generating jsx files.

I can run this in pnpm:

√ Project name: ... vite-project
√ Select a template: » deno-react
√ Select a variant: » TypeScript

I get asked the variant and it generates .tsx files

This does not happen when running in WSL on Windows, where I correctly get asked the variant.

Versions

Deno: 1.36.4 OS: Windows 10 Terminal: Powershell in Windows Terminal v1.17.11461.0

bluwy commented 12 months ago

Hmm this is really specific and strange. I don't see anything to could affect Windows specifically.

I don't have a Windows machine at hand, could you help debug this with some hints below?

When deciding whether to "Select a variant", it's handled here:

https://github.com/bluwy/create-vite-extra/blob/f5ce6c9160055ce8727f8e4b06e130d0e72b44f2/index.js#L358-L359

null means "skip this choice" which seems to be what's it's hitting here. Maybe you can console.log(framework) and see what it gives?

The framework object should also come from this choices value here: https://github.com/bluwy/create-vite-extra/blob/f5ce6c9160055ce8727f8e4b06e130d0e72b44f2/index.js#L349-L355

We're also using the prompts package here for the questions, perhaps it's related to how it decides when to log/skip the question: https://github.com/terkelg/prompts/blob/7c167091b852ed68bd7fa77c71fc50022200f61d/lib/index.js#L28-L36

Also since you mention that it only happens with Deno, maybe it's a bug there too.

bluwy commented 11 months ago

Closing this due to inactivity for now