chapa-cli 0.2.0 → 0.2.1
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/dist/index.js +5 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -314,14 +314,8 @@ function deleteConfig() {
|
|
|
314
314
|
|
|
315
315
|
// src/login.ts
|
|
316
316
|
import { randomUUID } from "crypto";
|
|
317
|
-
import { exec } from "child_process";
|
|
318
317
|
var POLL_INTERVAL_MS = 2e3;
|
|
319
318
|
var MAX_POLL_ATTEMPTS = 150;
|
|
320
|
-
function openBrowser(url) {
|
|
321
|
-
const cmd = process.platform === "win32" ? `start "" "${url}"` : process.platform === "darwin" ? `open "${url}"` : `xdg-open "${url}"`;
|
|
322
|
-
exec(cmd, () => {
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
319
|
function sleep(ms) {
|
|
326
320
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
327
321
|
}
|
|
@@ -329,11 +323,12 @@ async function login(serverUrl) {
|
|
|
329
323
|
const baseUrl = serverUrl.replace(/\/+$/, "");
|
|
330
324
|
const sessionId = randomUUID();
|
|
331
325
|
const authorizeUrl = `${baseUrl}/cli/authorize?session=${sessionId}`;
|
|
332
|
-
console.log("
|
|
333
|
-
console.log(`
|
|
326
|
+
console.log("\nOpen this URL in a browser where your personal GitHub account is logged in:");
|
|
327
|
+
console.log(`
|
|
334
328
|
${authorizeUrl}
|
|
335
329
|
`);
|
|
336
|
-
|
|
330
|
+
console.log("Tip: If your default browser has your work (EMU) account,");
|
|
331
|
+
console.log(" use a different browser or an incognito/private window.\n");
|
|
337
332
|
console.log("Waiting for approval...");
|
|
338
333
|
for (let i = 0; i < MAX_POLL_ATTEMPTS; i++) {
|
|
339
334
|
await sleep(POLL_INTERVAL_MS);
|
|
@@ -368,7 +363,7 @@ Logged in as ${data.handle}!`);
|
|
|
368
363
|
}
|
|
369
364
|
|
|
370
365
|
// src/index.ts
|
|
371
|
-
var VERSION = true ? "0.2.
|
|
366
|
+
var VERSION = true ? "0.2.1" : "0.0.0-dev";
|
|
372
367
|
var HELP_TEXT = `chapa-cli v${VERSION}
|
|
373
368
|
|
|
374
369
|
Merge GitHub EMU (Enterprise Managed User) contributions into your Chapa badge.
|