Skip to content

Commit

Permalink
fix: init project doesn't replace stage (#3554)
Browse files Browse the repository at this point in the history
* fix: init project doesn't replace stage

* feat: allow for a global reset on Lazy
  • Loading branch information
justindra committed Dec 12, 2023
1 parent df52482 commit 7d2f92b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-olives-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sst": patch
---

Calling init project does not replace stage if it was called previously
2 changes: 1 addition & 1 deletion packages/sst/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ export async function initProject(globals: GlobalOptions) {

const config = await Promise.resolve(sstConfig.config(globals));
const stage =
process.env.SST_STAGE ||
globals.stage ||
config.stage ||
process.env.SST_STAGE ||
(await usePersonalStage(out)) ||
(await promptPersonalStage(out));
// Set stage to SST_STAGE so that if SST spawned processes are aware
Expand Down
2 changes: 1 addition & 1 deletion packages/sst/src/util/lazy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function lazy<T>(callback: () => T) {
let result: T;

return () => {
if (!loaded) {
if (!loaded || process.env.SST_RESET_LAZY) {
result = callback();
loaded = true;
}
Expand Down

0 comments on commit 7d2f92b

Please sign in to comment.