bluwy/create-vite-extra

CLI: Not getting asked variant in Deno on Windows

drewbitt opened this issue · 2 comments

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

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:

create-vite-extra/index.js

Lines 358 to 359 in f5ce6c9

type: (framework) =>
framework && framework.variants ? 'select' : null,

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:

create-vite-extra/index.js

Lines 349 to 355 in f5ce6c9

choices: FRAMEWORKS.map((framework) => {
const frameworkColor = framework.color
return {
title: frameworkColor(framework.display || framework.name),
value: framework
}
})

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

Closing this due to inactivity for now