Commit 6bf092a
init script: fix stack client app options , add --on-question, remove --agent-mode
<!--
Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md
-->
<!-- RECURSEML_SUMMARY:START -->
## High-level PR Summary
This PR enhances the initialization script for Stack Auth by adding
support for `projectId` and `publishableClientKey` (pck) parameters when
initializing a Next.js client application. The changes include: 1)
Adding logic to pass these parameters from environment variables or
directly from arguments to the Next.js client configuration, 2) Updating
the layout template to use the client-side Stack app instead of the
server-side app in the provider component, and 3) Improving Bun lock
file detection by checking for both `bun.lockb` and `bun.lock` formats.
These changes ensure proper configuration of Next.js client applications
with the required Stack Auth credentials.
⏱️ Estimated Review Time: 5-15 minutes
<details>
<summary>💡 Review Order Suggestion</summary>
| Order | File Path |
|-------|-----------|
| 1 | `packages/init-stack/src/index.ts` |
</details>
<!-- RECURSEML_SUMMARY:END -->
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Enhances Stack Auth init script with `projectId` and
`publishableClientKey` support, updates Next.js layout, and improves Bun
detection.
>
> - **Behavior**:
> - Adds `projectId` and `publishableClientKey` support to Next.js
client configuration in `index.ts`.
> - Updates layout template to use client-side Stack app in
`getUpdatedLayout()`.
> - Improves Bun lock file detection in `promptPackageManager()`.
> - **Options**:
> - Introduces `--on-question` option to control interactive prompts in
`index.ts`.
> - **Scripts**:
> - Standardizes test scripts to use `--on-question error` in
`package.json`.
>
> <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 67a98f5. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
----
<!-- ELLIPSIS_HIDDEN -->
<!-- RECURSEML_ANALYSIS:START -->
## Review by RecurseML
_🔍 Review performed on
[7a0bf86..0b443e4](stack-auth/stack-auth@7a0bf86...0b443e460f653209cc237cdcec8ccca6a9a8f604)_
✨ No bugs found, your code is sparkling clean
<details>
<summary>✅ Files analyzed, no issues (1)</summary>
• `packages/init-stack/src/index.ts`
</details>
[](https://discord.gg/n3SsVDAW6U)
<!-- RECURSEML_ANALYSIS:END -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added a new --on-question option to control interactive prompt
behavior; client-oriented layout generation now emits client-side config
(public env keys supported).
* **Bug Fixes**
* Improved Bun detection (recognizes both lockfile variants) and
clearer, mode-aware guidance for ambiguous project/package-manager
detection.
* **Chores**
* Test/init scripts updated to use --on-question error for deterministic
non-interactive runs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>1 parent e256be8 commit 6bf092a
2 files changed
Lines changed: 84 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
27 | 72 | | |
28 | 73 | | |
29 | 74 | | |
| |||
46 | 91 | | |
47 | 92 | | |
48 | 93 | | |
49 | | - | |
| 94 | + | |
50 | 95 | | |
51 | 96 | | |
52 | 97 | | |
| |||
64 | 109 | | |
65 | 110 | | |
66 | 111 | | |
67 | | - | |
| 112 | + | |
| 113 | + | |
68 | 114 | | |
69 | 115 | | |
70 | 116 | | |
71 | 117 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | 118 | | |
80 | 119 | | |
81 | 120 | | |
| |||
436 | 475 | | |
437 | 476 | | |
438 | 477 | | |
439 | | - | |
| 478 | + | |
440 | 479 | | |
441 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
442 | 484 | | |
443 | 485 | | |
444 | 486 | | |
| |||
625 | 667 | | |
626 | 668 | | |
627 | 669 | | |
628 | | - | |
| 670 | + | |
629 | 671 | | |
630 | 672 | | |
631 | 673 | | |
632 | | - | |
| 674 | + | |
633 | 675 | | |
634 | 676 | | |
635 | 677 | | |
636 | 678 | | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
637 | 689 | | |
638 | 690 | | |
639 | 691 | | |
| |||
643 | 695 | | |
644 | 696 | | |
645 | 697 | | |
646 | | - | |
| 698 | + | |
647 | 699 | | |
648 | 700 | | |
649 | 701 | | |
| |||
741 | 793 | | |
742 | 794 | | |
743 | 795 | | |
744 | | - | |
| 796 | + | |
745 | 797 | | |
746 | 798 | | |
747 | 799 | | |
| |||
759 | 811 | | |
760 | 812 | | |
761 | 813 | | |
762 | | - | |
763 | | - | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
764 | 817 | | |
765 | 818 | | |
766 | 819 | | |
| |||
816 | 869 | | |
817 | 870 | | |
818 | 871 | | |
819 | | - | |
| 872 | + | |
820 | 873 | | |
821 | 874 | | |
822 | 875 | | |
| |||
843 | 896 | | |
844 | 897 | | |
845 | 898 | | |
846 | | - | |
| 899 | + | |
847 | 900 | | |
848 | 901 | | |
849 | 902 | | |
| |||
899 | 952 | | |
900 | 953 | | |
901 | 954 | | |
902 | | - | |
903 | | - | |
| 955 | + | |
| 956 | + | |
904 | 957 | | |
905 | 958 | | |
906 | 959 | | |
| |||
932 | 985 | | |
933 | 986 | | |
934 | 987 | | |
935 | | - | |
| 988 | + | |
936 | 989 | | |
937 | 990 | | |
938 | 991 | | |
| |||
944 | 997 | | |
945 | 998 | | |
946 | 999 | | |
947 | | - | |
948 | | - | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
949 | 1003 | | |
950 | 1004 | | |
951 | 1005 | | |
| |||
0 commit comments