fix: --no-browser opening browser (#539)

The additional change [in
commander](007ab2b980)
caused an issue with the `--no-browser` option. Commander negates
boolean options with `--no` prefix -
https://www.npmjs.com/package/commander#other-option-types-negatable-boolean-and-booleanvalue


<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->

<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Fixes `--no-browser` option in `index.ts` to correctly prevent browser
opening by adjusting boolean logic.
> 
>   - **Behavior**:
> - Fixes `--no-browser` option in `index.ts` to prevent browser opening
by setting `noBrowser` to `!options.browser`.
>   - **Misc**:
> - Adds comment explaining Commander negation behavior for boolean
options.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for a1a3ba450d. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
Co-authored-by: Zai Shi <zaishi00@outlook.com>
This commit is contained in:
Shridhar Deshmukh 2025-03-13 17:17:28 +01:00 committed by GitHub
parent db4e2b0930
commit 496d3bcf88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,7 +55,9 @@ const typeFromArgs: string | undefined = options.js ? "js" : options.next ? "nex
const packageManagerFromArgs: string | undefined = options.npm ? "npm" : options.yarn ? "yarn" : options.pnpm ? "pnpm" : options.bun ? "bun" : undefined;
const isClient: boolean = options.client || false;
const isServer: boolean = options.server || false;
const noBrowser: boolean = options.noBrowser || false;
// Commander negates the boolean options with prefix `--no-`
// so `--no-browser` becomes `browser: false`
const noBrowser: boolean = !options.browser;
class UserError extends Error {
constructor(message: string) {