@myvillage/cli 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myvillage/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "MyVillageOS CLI for student game developers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -53,6 +53,7 @@ export async function loginCommand() {
53
53
 
54
54
  // Create a promise that resolves when we receive the OAuth callback
55
55
  const authResult = await new Promise((resolve, reject) => {
56
+ let timeout;
56
57
  const server = createServer(async (req, res) => {
57
58
  const url = new URL(req.url, `http://localhost:${config.callbackPort}`);
58
59
 
@@ -91,8 +92,9 @@ export async function loginCommand() {
91
92
  `);
92
93
  }
93
94
 
94
- // Close the server
95
+ // Close the server and clear timeout
95
96
  server.close();
97
+ clearTimeout(timeout);
96
98
 
97
99
  if (error) {
98
100
  reject(new Error(errorDescription || error));
@@ -131,7 +133,7 @@ export async function loginCommand() {
131
133
  });
132
134
 
133
135
  // Timeout after 5 minutes
134
- setTimeout(() => {
136
+ timeout = setTimeout(() => {
135
137
  server.close();
136
138
  reject(new Error('Authentication timed out. Please try again.'));
137
139
  }, 5 * 60 * 1000);