@alinsafawi/aegis-auth 0.1.3 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +63 -36
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23840,48 +23840,75 @@ async function runInit() {
23840
23840
  `);
23841
23841
  }
23842
23842
  printSection(mode === "new" ? `STEP 2 of ${STEPS.length} \u25B8 PROJECT \u2713 \u25B8 APP` : `STEP 1 of ${STEPS.length - 1} \u25B8 APP`);
23843
- const app = await promptApp(projectName);
23843
+ let app = await promptApp(projectName);
23844
23844
  printSection(mode === "new" ? `STEP 3 of ${STEPS.length} \u25B8 PROJECT \u2713 APP \u2713 \u25B8 ROLES` : `STEP 2 \u25B8 APP \u2713 \u25B8 ROLES`);
23845
- const roles = await promptRoles();
23845
+ let roles = await promptRoles();
23846
23846
  printSection(mode === "new" ? `STEP 4 of ${STEPS.length} \u25B8 ... ROLES \u2713 \u25B8 FEATURES` : `STEP 3 \u25B8 ROLES \u2713 \u25B8 FEATURES`);
23847
- const features = await promptFeatures(Object.keys(roles));
23847
+ let features = await promptFeatures(Object.keys(roles));
23848
23848
  printSection(mode === "new" ? `STEP 5 of ${STEPS.length} \u25B8 ... FEATURES \u2713 \u25B8 INFRA` : `STEP 4 \u25B8 FEATURES \u2713 \u25B8 INFRA`);
23849
- const infra = await promptInfrastructure();
23849
+ let infra = await promptInfrastructure();
23850
23850
  printSection(mode === "new" ? `STEP 6 of ${STEPS.length} \u25B8 ... INFRA \u2713 \u25B8 STYLE` : `STEP 5 \u25B8 INFRA \u2713 \u25B8 STYLE`);
23851
- const style = await promptStyle();
23852
- printSection("REVIEW \xB7 Everything that's about to happen");
23853
- console.log(` ${import_chalk8.default.bold("Configuration")}
23851
+ let style = await promptStyle();
23852
+ let isDry = false;
23853
+ while (true) {
23854
+ printSection("REVIEW \xB7 Everything that's about to happen");
23855
+ console.log(` ${import_chalk8.default.bold("Configuration")}
23854
23856
  `);
23855
- console.log(` App ${import_chalk8.default.cyan(app.appName)}`);
23856
- console.log(` Cookie prefix ${import_chalk8.default.cyan(app.cookiePrefix)}`);
23857
- console.log(` Session ${import_chalk8.default.cyan(app.sessionDuration / 3600 + " hours")}`);
23858
- if (mode === "new") {
23859
- console.log(` Language ${import_chalk8.default.cyan(language)}`);
23860
- console.log(` Package manager ${import_chalk8.default.cyan(packageManager)}`);
23861
- console.log(` Database ${import_chalk8.default.cyan(database)}`);
23862
- }
23863
- console.log();
23864
- console.log(` ${import_chalk8.default.bold("Roles")}`);
23865
- for (const [id, role] of Object.entries(roles)) {
23866
- console.log(` ${import_chalk8.default.dim("\xB7")} ${import_chalk8.default.magentaBright(id)} ${import_chalk8.default.dim("\u2192")} ${role.prismaModel} ${import_chalk8.default.dim("(")}${role.loginField}${import_chalk8.default.dim(")")}`);
23867
- }
23868
- console.log();
23869
- const onFeatures = Object.entries(features).filter(([k, v]) => v === true && ["twoFactor", "emailVerification", "passwordReset", "accountLockout", "apiKeys", "auditLog", "sessionTracking"].includes(k)).map(([k]) => k);
23870
- console.log(` ${import_chalk8.default.bold("Features")} ${onFeatures.map((f) => import_chalk8.default.cyan(f)).join(import_chalk8.default.dim(" \xB7 "))}`);
23871
- console.log();
23872
- const confirm4 = await p7.select({
23873
- message: "Proceed?",
23874
- options: [
23875
- { value: "go", label: mode === "new" ? "Create project" : "Create files" },
23876
- { value: "dry", label: "Dry run \u2014 show me what will be created without writing" },
23877
- { value: "no", label: "Cancel" }
23878
- ]
23879
- });
23880
- if (p7.isCancel(confirm4) || confirm4 === "no") {
23881
- p7.cancel("Cancelled.");
23882
- process.exit(0);
23857
+ console.log(` App ${import_chalk8.default.cyan(app.appName)}`);
23858
+ console.log(` Cookie prefix ${import_chalk8.default.cyan(app.cookiePrefix)}`);
23859
+ console.log(` Session ${import_chalk8.default.cyan(app.sessionDuration / 3600 + " hours")}`);
23860
+ if (mode === "new") {
23861
+ console.log(` Language ${import_chalk8.default.cyan(language)}`);
23862
+ console.log(` Package manager ${import_chalk8.default.cyan(packageManager)}`);
23863
+ console.log(` Database ${import_chalk8.default.cyan(database)}`);
23864
+ }
23865
+ console.log();
23866
+ console.log(` ${import_chalk8.default.bold("Roles")}`);
23867
+ for (const [id, role] of Object.entries(roles)) {
23868
+ console.log(` ${import_chalk8.default.dim("\xB7")} ${import_chalk8.default.magentaBright(id)} ${import_chalk8.default.dim("\u2192")} ${role.prismaModel} ${import_chalk8.default.dim("(")}${role.loginField}${import_chalk8.default.dim(")")}`);
23869
+ }
23870
+ console.log();
23871
+ const onFeatures = Object.entries(features).filter(([k, v]) => v === true && ["twoFactor", "emailVerification", "passwordReset", "accountLockout", "apiKeys", "auditLog", "sessionTracking"].includes(k)).map(([k]) => k);
23872
+ console.log(` ${import_chalk8.default.bold("Features")} ${onFeatures.map((f) => import_chalk8.default.cyan(f)).join(import_chalk8.default.dim(" \xB7 "))}`);
23873
+ console.log();
23874
+ const action = await p7.select({
23875
+ message: "Proceed?",
23876
+ options: [
23877
+ { value: "go", label: mode === "new" ? "Create project" : "Create files" },
23878
+ { value: "dry", label: "Dry run \u2014 show me what will be created without writing" },
23879
+ { value: "edit", label: "Edit a section" },
23880
+ { value: "no", label: "Cancel" }
23881
+ ]
23882
+ });
23883
+ if (p7.isCancel(action) || action === "no") {
23884
+ p7.cancel("Cancelled.");
23885
+ process.exit(0);
23886
+ }
23887
+ if (action === "edit") {
23888
+ const section = await p7.select({
23889
+ message: "Which section would you like to change?",
23890
+ options: [
23891
+ { value: "app", label: "App identity (name, cookie prefix, session duration)" },
23892
+ { value: "roles", label: "Roles" },
23893
+ { value: "features", label: "Features" },
23894
+ { value: "infra", label: "Infrastructure (SMTP, rate limiting)" },
23895
+ { value: "style", label: "Style (primary colour, logo)" }
23896
+ ]
23897
+ });
23898
+ if (p7.isCancel(section)) {
23899
+ p7.cancel("Cancelled.");
23900
+ process.exit(0);
23901
+ }
23902
+ if (section === "app") app = await promptApp(projectName);
23903
+ if (section === "roles") roles = await promptRoles();
23904
+ if (section === "features") features = await promptFeatures(Object.keys(roles));
23905
+ if (section === "infra") infra = await promptInfrastructure();
23906
+ if (section === "style") style = await promptStyle();
23907
+ continue;
23908
+ }
23909
+ isDry = action === "dry";
23910
+ break;
23883
23911
  }
23884
- const isDry = confirm4 === "dry";
23885
23912
  printSection(mode === "new" ? `BUILDING ${projectName}` : "INSTALLING");
23886
23913
  const spin = p7.spinner();
23887
23914
  async function writeFile(relPath, content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alinsafawi/aegis-auth",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "The shield your Next.js app deserves — full-stack auth in minutes",
5
5
  "bin": {
6
6
  "aegis-auth": "dist/index.js"