Skip to content

Commit 44b44ca

Browse files
ErickRodrCodesErick Rodriguez
andauthored
fix: normalize addOns argument for Windows PowerShell/Command Prompt … (#67)
This pull request proposes the following work: - it was detected that, in windows machines using PowerShell/Command Prompt, the arguments passed on the addOns argument was passed as a string with spaces, rather than an array. | Before | After | |:--:|:--:| | ![image](https://github.com/user-attachments/assets/dfc52d17-5b08-41d3-86b5-a82e927c0aac)|![image](https://github.com/user-attachments/assets/2f7c66f7-a6f4-40fa-bb40-c11c06e6406f)| However, this doesn't address the bug on #64 of TanStack forms not finishing its setup. Co-authored-by: Erick Rodriguez <[email protected]>
1 parent f6124a4 commit 44b44ca

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/options.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ import type { CliOptions, Options } from './types.js'
2323
export async function normalizeOptions(
2424
cliOptions: CliOptions,
2525
): Promise<Required<Options> | undefined> {
26+
// in some cases, if you use windows/powershell, the argument for addons
27+
// if sepparated by comma is not really passed as an array, but as a string
28+
// with spaces, We need to normalize this edge case.
29+
if (Array.isArray(cliOptions.addOns) && cliOptions.addOns.length === 1) {
30+
const parseSeparatedArgs = cliOptions.addOns[0].split(' ');
31+
if (parseSeparatedArgs.length > 1) {
32+
cliOptions.addOns = parseSeparatedArgs;
33+
}
34+
}
2635
if (cliOptions.projectName) {
2736
let typescript =
2837
cliOptions.template === 'typescript' ||

0 commit comments

Comments
 (0)