oauth-init 0.4.0 → 0.6.0

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9355,7 +9355,63 @@ GITHUB_CLIENT_SECRET=${client_secret}
9355
9355
  });
9356
9356
  }
9357
9357
  if (appType === "oauth-app") {
9358
- R2.warning("FUCK YOU");
9358
+ R2.step("Step 1: Create OAuth App on GitHub");
9359
+ const oauthAppUrl = "https://github.com/settings/applications/new";
9360
+ R2.message(`Opening: ${oauthAppUrl}`);
9361
+ await open_default(oauthAppUrl);
9362
+ Ve(`1. Fill Application Name and Homepage URL
9363
+ 2. Enter Authorization callback URL: ` + callbackUrl + `
9364
+ 3. Click 'Register application'`, "Action Required");
9365
+ const brandDone = await Ze({
9366
+ message: "Press Enter once you've created the OAuth App (or type 'skip' if done previously)"
9367
+ });
9368
+ if (Ct(brandDone))
9369
+ return Ne("Setup aborted.");
9370
+ R2.step("Step 2: Save credentials");
9371
+ const clientId = await Ze({
9372
+ message: "Paste your Client ID:",
9373
+ placeholder: "Iv1.xxx"
9374
+ });
9375
+ if (Ct(clientId))
9376
+ return Ne("Setup aborted.");
9377
+ const clientSecret = await He({
9378
+ message: "Paste your Client Secret:"
9379
+ });
9380
+ if (Ct(clientSecret))
9381
+ return Ne("Setup aborted.");
9382
+ const saveOption = await Je({
9383
+ message: "Where do you want to save the credentials?",
9384
+ options: [
9385
+ {
9386
+ label: ".env",
9387
+ value: "dot-env"
9388
+ },
9389
+ {
9390
+ label: ".env.local",
9391
+ value: "dot-env-dot-local"
9392
+ },
9393
+ {
9394
+ label: ".json",
9395
+ value: "json"
9396
+ },
9397
+ {
9398
+ label: "print to the console",
9399
+ value: "print"
9400
+ }
9401
+ ]
9402
+ });
9403
+ const envPath = saveOption === "dot-env" ? ".env" : ".env.local";
9404
+ const newEnvContent = `GITHUB_CLIENT_ID=${clientId}
9405
+ GITHUB_CLIENT_SECRET=${clientSecret}`;
9406
+ try {
9407
+ await access(envPath);
9408
+ const existingContent = await readFile(envPath, "utf-8");
9409
+ await writeFile(envPath, existingContent + `
9410
+ ` + newEnvContent);
9411
+ } catch {
9412
+ await writeFile(envPath, newEnvContent);
9413
+ }
9414
+ R2.success("GitHub OAuth App credentials saved!");
9359
9415
  }
9360
9416
  }
9361
9417
  }
@@ -9388,10 +9444,7 @@ async function main() {
9388
9444
  }
9389
9445
  const orchestrator = new Orchestrator(projectName).setupOAuthServices(oauthToSetup);
9390
9446
  }
9391
- program.name("oauth-init").description("Set up OAuth providers for your project").version("0.1.0");
9392
- program.command("check").description("Check if your project is ready for npm publish").action(checkNpmReadiness);
9393
- program.action(main);
9394
- program.parse();
9447
+ main();
9395
9448
  export {
9396
9449
  GoogleAuthProvider
9397
9450
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth-init",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "CLI for setting up OAuth providers for your project",
5
5
  "license": "MIT",
6
6
  "type": "module",