mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
- fixes https://github.com/stack-auth/stack-auth/issues/530
Adding [commander](https://github.com/tj/commander.js) to parse CLI
arguments and options. Commander auto generates a help section based on
configured options.
Both `npx @stackframe/init-stack` and `npx @stacframe/init-stack --next`
both should initialize auth in working directory
```bash
➜ init-stack git:(dev) ✗ node dist/index.js --version
2.7.25
➜ init-stack git:(dev) ✗ node dist/index.js --help
Usage: @stackframe/init-stack [project-path] [options]
Stack Auth Initialization Tool
Arguments:
project-path Path to your project
Options:
-V, --version output the version number
--dry-run Run without making any changes
--neon Use Neon database
--js Initialize for JavaScript project
--next Initialize for Next.js project
--npm Use npm as package manager
--yarn Use yarn as package manager
--pnpm Use pnpm as package manager
--bun Use bun as package manager
--client Initialize client-side only
--server Initialize server-side only
--no-browser Don't open browser for environment variable setup
-h, --help display help for command
For more information, please visit https://docs.stack-auth.com/getting-started/setup
```
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Replaces manual CLI argument parsing with `commander` in `init-stack`,
simplifying code and auto-generating help text.
>
> - **Behavior**:
> - Replaces manual CLI argument parsing with `commander` in `index.ts`.
> - Automatically generates help and version output using `commander`.
> - Supports options like `--dry-run`, `--neon`, `--js`, `--next`,
`--npm`, `--yarn`, `--pnpm`, `--bun`, `--client`, `--server`,
`--no-browser`.
> - **Dependencies**:
> - Adds `commander` as a dependency in `package.json` and
`packages/init-stack/package.json`.
> - **Code Cleanup**:
> - Removes manual argument parsing logic from `index.ts`.
> - Simplifies `main()` function by using `commander` to handle 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 4d4e2a8324. 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>
53 lines
3.4 KiB
JSON
53 lines
3.4 KiB
JSON
{
|
|
"name": "@stackframe/init-stack",
|
|
"version": "2.7.26",
|
|
"description": "The setup wizard for Stack. https://stack-auth.com",
|
|
"main": "dist/index.js",
|
|
"type": "module",
|
|
"bin": "./dist/index.js",
|
|
"scripts": {
|
|
"clean": "rimraf test-run-output && rimraf node_modules && rimraf dist",
|
|
"build": "tsup",
|
|
"dev": "tsup --watch",
|
|
"lint": "eslint --ext .tsx,.ts .",
|
|
"typecheck": "tsc --noEmit",
|
|
"init-stack": "node dist/index.js",
|
|
"init-stack:local": "STACK_NEXT_INSTALL_PACKAGE_NAME_OVERRIDE=../../stack STACK_JS_INSTALL_PACKAGE_NAME_OVERRIDE=../../js node dist/index.js",
|
|
"test-run": "pnpm run build && pnpm run test-run-js && pnpm run test-run-node && pnpm run test-run-next && pnpm run test-run-neon && pnpm run test-run-no-browser",
|
|
"test-run:manual": "pnpm run build && pnpm run test-run-js:manual && pnpm run test-run-node:manual && pnpm run test-run-next:manual && pnpm run test-run-neon:manual",
|
|
"ensure-neon": "grep -q '\"@neondatabase/serverless\"' ./test-run-output/package.json && echo 'Initialized Neon successfully!'",
|
|
"test-run-neon": "pnpm run test-run-node --neon && pnpm run ensure-neon",
|
|
"test-run-neon:manual": "pnpm run test-run-node:manual --neon && pnpm run ensure-neon",
|
|
"test-run-no-browser": "rimraf test-run-output && mkdir test-run-output && cd test-run-output && npm init --init-author-name example-author --init-license UNLICENSED --init-author-url http://example.com --init-module test-run-output --init-version 1.0.0 -y && cd .. && STACK_DISABLE_INTERACTIVE=true pnpm run init-stack:local test-run-output --js --server --npm --no-browser",
|
|
"test-run-node:manual": "rimraf test-run-output && mkdir test-run-output && cd test-run-output && npm init && cd .. && pnpm run init-stack:local test-run-output",
|
|
"test-run-node": "rimraf test-run-output && mkdir test-run-output && cd test-run-output && npm init --init-author-name example-author --init-license UNLICENSED --init-author-url http://example.com --init-module test-run-output --init-version 1.0.0 -y && cd .. && STACK_DISABLE_INTERACTIVE=true pnpm run init-stack:local test-run-output --js --server --npm",
|
|
"test-run-js:manual": "rimraf test-run-output && npx -y sv create test-run-output --no-install && pnpm run init-stack:local test-run-output",
|
|
"test-run-js": "rimraf test-run-output && npx -y sv create test-run-output --template minimal --types ts --no-add-ons --no-install && STACK_DISABLE_INTERACTIVE=true pnpm run init-stack:local test-run-output --js --client --npm",
|
|
"test-run-next:manual": "rimraf test-run-output && npx -y create-next-app@latest test-run-output && pnpm run init-stack:local test-run-output",
|
|
"test-run-next": "rimraf test-run-output && npx -y create-next-app@latest test-run-output --app --ts --no-src-dir --tailwind --use-npm --eslint --import-alias '##@#/*' --turbopack && STACK_DISABLE_INTERACTIVE=true pnpm run init-stack:local test-run-output"
|
|
},
|
|
"files": [
|
|
"README.md",
|
|
"dist",
|
|
"CHANGELOG.md",
|
|
"LICENSE"
|
|
],
|
|
"homepage": "https://stack-auth.com",
|
|
"keywords": [],
|
|
"author": "",
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"@stackframe/stack-shared": "workspace:*",
|
|
"commander": "^13.1.0",
|
|
"inquirer": "^9.2.19",
|
|
"open": "^10.1.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/inquirer": "^9.0.7",
|
|
"@types/node": "^22.13.5",
|
|
"rimraf": "^6.0.1",
|
|
"tsup": "^8.4.0",
|
|
"typescript": "^5.7.3"
|
|
}
|
|
}
|