authverse 1.1.6 → 1.1.7-beta.2

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.cjs CHANGED
@@ -1040,10 +1040,10 @@ var initAnswer = async () => {
1040
1040
  };
1041
1041
 
1042
1042
  // index.ts
1043
- var import_fs23 = require("fs");
1043
+ var import_fs31 = require("fs");
1044
1044
 
1045
1045
  // cli/oauth.ts
1046
- var import_chalk12 = __toESM(require("chalk"), 1);
1046
+ var import_chalk20 = __toESM(require("chalk"), 1);
1047
1047
 
1048
1048
  // oauth/googleNext.ts
1049
1049
  var import_chalk8 = __toESM(require("chalk"), 1);
@@ -1134,7 +1134,7 @@ GOOGLE_CLIENT_SECRET=
1134
1134
  }
1135
1135
  const componentTemplate = import_path8.default.resolve(
1136
1136
  __dirname,
1137
- "./template/components/GoogleProviders.tsx"
1137
+ "./template/components/GoogleOAuthButton.tsx"
1138
1138
  );
1139
1139
  const componentsDir = import_path8.default.join(
1140
1140
  projectDir,
@@ -1145,7 +1145,7 @@ GOOGLE_CLIENT_SECRET=
1145
1145
  if (!import_fs8.default.existsSync(componentsDir)) {
1146
1146
  import_fs8.default.mkdirSync(componentsDir, { recursive: true });
1147
1147
  }
1148
- const componentDest = import_path8.default.join(componentsDir, "GoogleProviders.tsx");
1148
+ const componentDest = import_path8.default.join(componentsDir, "GoogleOAuthButton.tsx");
1149
1149
  if (import_fs8.default.existsSync(componentTemplate)) {
1150
1150
  import_fs8.default.copyFileSync(componentTemplate, componentDest);
1151
1151
  }
@@ -1235,66 +1235,919 @@ ${socialProvidersBlock}`
1235
1235
  envPath,
1236
1236
  `
1237
1237
 
1238
- # GitHub OAuth
1239
- GITHUB_CLIENT_ID=
1240
- GITHUB_CLIENT_SECRET=
1238
+ # GitHub OAuth
1239
+ GITHUB_CLIENT_ID=
1240
+ GITHUB_CLIENT_SECRET=
1241
+ `
1242
+ );
1243
+ }
1244
+ }
1245
+ const componentTemplate = import_path9.default.resolve(
1246
+ __dirname,
1247
+ "./template/components/GithubOAuthButton.tsx"
1248
+ );
1249
+ const componentsDir = import_path9.default.join(
1250
+ projectDir,
1251
+ folder,
1252
+ "components",
1253
+ "authverse"
1254
+ );
1255
+ if (!import_fs9.default.existsSync(componentsDir)) {
1256
+ import_fs9.default.mkdirSync(componentsDir, { recursive: true });
1257
+ }
1258
+ const componentDest = import_path9.default.join(componentsDir, "GithubOAuthButton.tsx");
1259
+ if (import_fs9.default.existsSync(componentTemplate)) {
1260
+ import_fs9.default.copyFileSync(componentTemplate, componentDest);
1261
+ }
1262
+ console.log(import_chalk9.default.green("GitHub provider added & merged successfully"));
1263
+ } catch (error) {
1264
+ console.log(import_chalk9.default.red("githubRun error:"), error);
1265
+ }
1266
+ };
1267
+
1268
+ // oauth/googleTanstackState.ts
1269
+ var import_chalk10 = __toESM(require("chalk"), 1);
1270
+ var import_fs10 = __toESM(require("fs"), 1);
1271
+ var import_path10 = __toESM(require("path"), 1);
1272
+ var import_url9 = require("url");
1273
+ var import_meta9 = {};
1274
+ var googleTanstackState = async () => {
1275
+ try {
1276
+ const __filename = (0, import_url9.fileURLToPath)(import_meta9.url);
1277
+ const __dirname = import_path10.default.dirname(__filename);
1278
+ const projectDir = process.cwd();
1279
+ const srcPath = import_path10.default.join(projectDir, "src");
1280
+ const authFilePath = import_path10.default.join(srcPath, "lib", "auth.ts");
1281
+ if (!import_fs10.default.existsSync(authFilePath)) {
1282
+ console.log(import_chalk10.default.red("auth.ts file not found"));
1283
+ return;
1284
+ }
1285
+ let content = import_fs10.default.readFileSync(authFilePath, "utf8");
1286
+ if (!content.includes("betterAuth({")) {
1287
+ console.log(import_chalk10.default.red("betterAuth({}) block not found"));
1288
+ return;
1289
+ }
1290
+ if (content.includes("socialProviders") && content.includes("google:")) {
1291
+ console.log(import_chalk10.default.yellow("Google provider already exists"));
1292
+ return;
1293
+ }
1294
+ const googleProviderEntry = `
1295
+ google: {
1296
+ clientId: process.env.GOOGLE_CLIENT_ID as string,
1297
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
1298
+ },`;
1299
+ if (content.includes("socialProviders: {")) {
1300
+ const start = content.indexOf("socialProviders: {");
1301
+ let braceCount = 0;
1302
+ let insertPos = -1;
1303
+ for (let i = start; i < content.length; i++) {
1304
+ if (content[i] === "{") braceCount++;
1305
+ if (content[i] === "}") {
1306
+ braceCount--;
1307
+ if (braceCount === 0) {
1308
+ insertPos = i;
1309
+ break;
1310
+ }
1311
+ }
1312
+ }
1313
+ if (insertPos === -1) {
1314
+ console.log(import_chalk10.default.red("Failed to parse socialProviders block"));
1315
+ return;
1316
+ }
1317
+ content = content.slice(0, insertPos) + googleProviderEntry + "\n " + content.slice(insertPos);
1318
+ } else {
1319
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1320
+ if (!databaseRegex.test(content)) {
1321
+ console.log(
1322
+ import_chalk10.default.red(
1323
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1324
+ )
1325
+ );
1326
+ return;
1327
+ }
1328
+ const socialProvidersBlock = `
1329
+ socialProviders: {
1330
+ ${googleProviderEntry}
1331
+ },`;
1332
+ content = content.replace(
1333
+ databaseRegex,
1334
+ (match) => `${match}
1335
+ ${socialProvidersBlock}`
1336
+ );
1337
+ }
1338
+ import_fs10.default.writeFileSync(authFilePath, content, "utf8");
1339
+ const envPath = import_path10.default.join(projectDir, ".env");
1340
+ if (import_fs10.default.existsSync(envPath)) {
1341
+ const envContent = import_fs10.default.readFileSync(envPath, "utf8");
1342
+ if (!envContent.includes("GOOGLE_CLIENT_ID")) {
1343
+ import_fs10.default.appendFileSync(
1344
+ envPath,
1345
+ `
1346
+
1347
+ # Google OAuth
1348
+ GOOGLE_CLIENT_ID=
1349
+ GOOGLE_CLIENT_SECRET=
1350
+ `
1351
+ );
1352
+ }
1353
+ }
1354
+ const componentTemplate = import_path10.default.resolve(
1355
+ __dirname,
1356
+ "./template/TanstackState/components/GoogleOAuthButton.tsx"
1357
+ );
1358
+ const componentsDir = import_path10.default.join(srcPath, "components", "authverse");
1359
+ if (!import_fs10.default.existsSync(componentsDir)) {
1360
+ import_fs10.default.mkdirSync(componentsDir, { recursive: true });
1361
+ }
1362
+ const componentDest = import_path10.default.join(componentsDir, "GoogleOAuthButton.tsx");
1363
+ if (import_fs10.default.existsSync(componentTemplate)) {
1364
+ import_fs10.default.copyFileSync(componentTemplate, componentDest);
1365
+ }
1366
+ console.log(import_chalk10.default.green("Google provider added & merged successfully"));
1367
+ } catch (error) {
1368
+ console.log(import_chalk10.default.red("googleRunTanstackState error:"), error);
1369
+ }
1370
+ };
1371
+
1372
+ // oauth/githubTanstackState.ts
1373
+ var import_chalk11 = __toESM(require("chalk"), 1);
1374
+ var import_fs11 = __toESM(require("fs"), 1);
1375
+ var import_path11 = __toESM(require("path"), 1);
1376
+ var import_url10 = require("url");
1377
+ var import_meta10 = {};
1378
+ var githubTanstackState = async () => {
1379
+ try {
1380
+ const __filename = (0, import_url10.fileURLToPath)(import_meta10.url);
1381
+ const __dirname = import_path11.default.dirname(__filename);
1382
+ const projectDir = process.cwd();
1383
+ const srcPath = import_path11.default.join(projectDir, "src");
1384
+ const authFilePath = import_path11.default.join(srcPath, "lib", "auth.ts");
1385
+ if (!import_fs11.default.existsSync(authFilePath)) {
1386
+ console.log(import_chalk11.default.red("auth.ts file not found"));
1387
+ return;
1388
+ }
1389
+ let content = import_fs11.default.readFileSync(authFilePath, "utf8");
1390
+ if (!content.includes("betterAuth({")) {
1391
+ console.log(import_chalk11.default.red("betterAuth({}) block not found"));
1392
+ return;
1393
+ }
1394
+ if (content.includes("socialProviders") && content.includes("github:")) {
1395
+ console.log(import_chalk11.default.yellow("Github provider already exists"));
1396
+ return;
1397
+ }
1398
+ const githubProviderEntry = `
1399
+ github: {
1400
+ clientId: process.env.GITHUB_CLIENT_ID as string,
1401
+ clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
1402
+ },`;
1403
+ if (content.includes("socialProviders: {")) {
1404
+ const start = content.indexOf("socialProviders: {");
1405
+ let braceCount = 0;
1406
+ let insertPos = -1;
1407
+ for (let i = start; i < content.length; i++) {
1408
+ if (content[i] === "{") braceCount++;
1409
+ if (content[i] === "}") {
1410
+ braceCount--;
1411
+ if (braceCount === 0) {
1412
+ insertPos = i;
1413
+ break;
1414
+ }
1415
+ }
1416
+ }
1417
+ if (insertPos === -1) {
1418
+ console.log(import_chalk11.default.red("Failed to parse socialProviders block"));
1419
+ return;
1420
+ }
1421
+ content = content.slice(0, insertPos) + githubProviderEntry + "\n " + content.slice(insertPos);
1422
+ } else {
1423
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1424
+ if (!databaseRegex.test(content)) {
1425
+ console.log(
1426
+ import_chalk11.default.red(
1427
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1428
+ )
1429
+ );
1430
+ return;
1431
+ }
1432
+ const socialProvidersBlock = `
1433
+ socialProviders: {
1434
+ ${githubProviderEntry}
1435
+ },`;
1436
+ content = content.replace(
1437
+ databaseRegex,
1438
+ (match) => `${match}
1439
+ ${socialProvidersBlock}`
1440
+ );
1441
+ }
1442
+ import_fs11.default.writeFileSync(authFilePath, content, "utf8");
1443
+ const envPath = import_path11.default.join(projectDir, ".env");
1444
+ if (import_fs11.default.existsSync(envPath)) {
1445
+ const envContent = import_fs11.default.readFileSync(envPath, "utf8");
1446
+ if (!envContent.includes("GITHUB_CLIENT_ID")) {
1447
+ import_fs11.default.appendFileSync(
1448
+ envPath,
1449
+ `
1450
+
1451
+ # Github OAuth
1452
+ GITHUB_CLIENT_ID=
1453
+ GITHUB_CLIENT_SECRET=
1454
+ `
1455
+ );
1456
+ }
1457
+ }
1458
+ const componentTemplate = import_path11.default.resolve(
1459
+ __dirname,
1460
+ "./template/TanstackState/components/GithubOAuthButton.tsx"
1461
+ );
1462
+ const componentsDir = import_path11.default.join(srcPath, "components", "authverse");
1463
+ if (!import_fs11.default.existsSync(componentsDir)) {
1464
+ import_fs11.default.mkdirSync(componentsDir, { recursive: true });
1465
+ }
1466
+ const componentDest = import_path11.default.join(componentsDir, "GithubOAuthButton.tsx");
1467
+ if (import_fs11.default.existsSync(componentTemplate)) {
1468
+ import_fs11.default.copyFileSync(componentTemplate, componentDest);
1469
+ }
1470
+ console.log(import_chalk11.default.green("Github provider added & merged successfully"));
1471
+ } catch (error) {
1472
+ console.log(import_chalk11.default.red("githubRunTanstackState error:"), error);
1473
+ }
1474
+ };
1475
+
1476
+ // oauth/facebookNext.ts
1477
+ var import_chalk12 = __toESM(require("chalk"), 1);
1478
+ var import_fs12 = __toESM(require("fs"), 1);
1479
+ var import_path12 = __toESM(require("path"), 1);
1480
+ var import_url11 = require("url");
1481
+ var import_meta11 = {};
1482
+ var facebookNext = async () => {
1483
+ try {
1484
+ const __filename = (0, import_url11.fileURLToPath)(import_meta11.url);
1485
+ const __dirname = import_path12.default.dirname(__filename);
1486
+ const projectDir = process.cwd();
1487
+ const srcPath = import_path12.default.join(projectDir, "src");
1488
+ const folder = import_fs12.default.existsSync(srcPath) ? "src" : "";
1489
+ const authFilePath = import_path12.default.join(projectDir, folder, "lib", "auth.ts");
1490
+ if (!import_fs12.default.existsSync(authFilePath)) {
1491
+ console.log(import_chalk12.default.red("auth.ts file not found"));
1492
+ return;
1493
+ }
1494
+ let content = import_fs12.default.readFileSync(authFilePath, "utf8");
1495
+ if (!content.includes("betterAuth({")) {
1496
+ console.log(import_chalk12.default.red("betterAuth({}) block not found"));
1497
+ return;
1498
+ }
1499
+ if (content.includes("socialProviders") && content.includes("facebook:")) {
1500
+ console.log(import_chalk12.default.yellow("Facebook provider already exists"));
1501
+ return;
1502
+ }
1503
+ const facebookProviderEntry = `
1504
+ facebook: {
1505
+ clientId: process.env.FACEBOOK_CLIENT_ID as string,
1506
+ clientSecret: process.env.FACEBOOK_CLIENT_SECRET as string,
1507
+ },`;
1508
+ if (content.includes("socialProviders: {")) {
1509
+ const start = content.indexOf("socialProviders: {");
1510
+ let braceCount = 0;
1511
+ let insertPos = -1;
1512
+ for (let i = start; i < content.length; i++) {
1513
+ if (content[i] === "{") braceCount++;
1514
+ if (content[i] === "}") {
1515
+ braceCount--;
1516
+ if (braceCount === 0) {
1517
+ insertPos = i;
1518
+ break;
1519
+ }
1520
+ }
1521
+ }
1522
+ if (insertPos === -1) {
1523
+ console.log(import_chalk12.default.red("Failed to parse socialProviders block"));
1524
+ return;
1525
+ }
1526
+ content = content.slice(0, insertPos) + facebookProviderEntry + "\n " + content.slice(insertPos);
1527
+ } else {
1528
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1529
+ if (!databaseRegex.test(content)) {
1530
+ console.log(
1531
+ import_chalk12.default.red(
1532
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1533
+ )
1534
+ );
1535
+ return;
1536
+ }
1537
+ const socialProvidersBlock = `
1538
+ socialProviders: {
1539
+ ${facebookProviderEntry}
1540
+ },`;
1541
+ content = content.replace(
1542
+ databaseRegex,
1543
+ (match) => `${match}
1544
+ ${socialProvidersBlock}`
1545
+ );
1546
+ }
1547
+ import_fs12.default.writeFileSync(authFilePath, content, "utf8");
1548
+ const envPath = import_path12.default.join(projectDir, ".env");
1549
+ if (import_fs12.default.existsSync(envPath)) {
1550
+ const envContent = import_fs12.default.readFileSync(envPath, "utf8");
1551
+ if (!envContent.includes("FACEBOOK_CLIENT_ID")) {
1552
+ import_fs12.default.appendFileSync(
1553
+ envPath,
1554
+ `
1555
+
1556
+ # Facebook OAuth
1557
+ FACEBOOK_CLIENT_ID=
1558
+ FACEBOOK_CLIENT_SECRET=
1559
+ `
1560
+ );
1561
+ }
1562
+ }
1563
+ const componentTemplate = import_path12.default.resolve(
1564
+ __dirname,
1565
+ "./template/components/FacebookOAuthButton.tsx"
1566
+ );
1567
+ const componentsDir = import_path12.default.join(
1568
+ projectDir,
1569
+ folder,
1570
+ "components",
1571
+ "authverse"
1572
+ );
1573
+ if (!import_fs12.default.existsSync(componentsDir)) {
1574
+ import_fs12.default.mkdirSync(componentsDir, { recursive: true });
1575
+ }
1576
+ const componentDest = import_path12.default.join(componentsDir, "FacebookOAuthButton.tsx");
1577
+ if (import_fs12.default.existsSync(componentTemplate)) {
1578
+ import_fs12.default.copyFileSync(componentTemplate, componentDest);
1579
+ }
1580
+ console.log(import_chalk12.default.green("Facebook provider added & merged successfully"));
1581
+ } catch (error) {
1582
+ console.log(import_chalk12.default.red("facebookRun error:"), error);
1583
+ }
1584
+ };
1585
+
1586
+ // oauth/facebookTanstackState.ts
1587
+ var import_chalk13 = __toESM(require("chalk"), 1);
1588
+ var import_fs13 = __toESM(require("fs"), 1);
1589
+ var import_path13 = __toESM(require("path"), 1);
1590
+ var import_url12 = require("url");
1591
+ var import_meta12 = {};
1592
+ var facebookTanstackState = async () => {
1593
+ try {
1594
+ const __filename = (0, import_url12.fileURLToPath)(import_meta12.url);
1595
+ const __dirname = import_path13.default.dirname(__filename);
1596
+ const projectDir = process.cwd();
1597
+ const srcPath = import_path13.default.join(projectDir, "src");
1598
+ const authFilePath = import_path13.default.join(srcPath, "lib", "auth.ts");
1599
+ if (!import_fs13.default.existsSync(authFilePath)) {
1600
+ console.log(import_chalk13.default.red("auth.ts file not found"));
1601
+ return;
1602
+ }
1603
+ let content = import_fs13.default.readFileSync(authFilePath, "utf8");
1604
+ if (!content.includes("betterAuth({")) {
1605
+ console.log(import_chalk13.default.red("betterAuth({}) block not found"));
1606
+ return;
1607
+ }
1608
+ if (content.includes("socialProviders") && content.includes("facebook:")) {
1609
+ console.log(import_chalk13.default.yellow("Facebook provider already exists"));
1610
+ return;
1611
+ }
1612
+ const facebookProviderEntry = `
1613
+ facebook: {
1614
+ clientId: process.env.FACEBOOK_CLIENT_ID as string,
1615
+ clientSecret: process.env.FACEBOOK_CLIENT_SECRET as string,
1616
+ },`;
1617
+ if (content.includes("socialProviders: {")) {
1618
+ const start = content.indexOf("socialProviders: {");
1619
+ let braceCount = 0;
1620
+ let insertPos = -1;
1621
+ for (let i = start; i < content.length; i++) {
1622
+ if (content[i] === "{") braceCount++;
1623
+ if (content[i] === "}") {
1624
+ braceCount--;
1625
+ if (braceCount === 0) {
1626
+ insertPos = i;
1627
+ break;
1628
+ }
1629
+ }
1630
+ }
1631
+ if (insertPos === -1) {
1632
+ console.log(import_chalk13.default.red("Failed to parse socialProviders block"));
1633
+ return;
1634
+ }
1635
+ content = content.slice(0, insertPos) + facebookProviderEntry + "\n " + content.slice(insertPos);
1636
+ } else {
1637
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1638
+ if (!databaseRegex.test(content)) {
1639
+ console.log(
1640
+ import_chalk13.default.red(
1641
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1642
+ )
1643
+ );
1644
+ return;
1645
+ }
1646
+ const socialProvidersBlock = `
1647
+ socialProviders: {
1648
+ ${facebookProviderEntry}
1649
+ },`;
1650
+ content = content.replace(
1651
+ databaseRegex,
1652
+ (match) => `${match}
1653
+ ${socialProvidersBlock}`
1654
+ );
1655
+ }
1656
+ import_fs13.default.writeFileSync(authFilePath, content, "utf8");
1657
+ const envPath = import_path13.default.join(projectDir, ".env");
1658
+ if (import_fs13.default.existsSync(envPath)) {
1659
+ const envContent = import_fs13.default.readFileSync(envPath, "utf8");
1660
+ if (!envContent.includes("FACEBOOK_CLIENT_ID")) {
1661
+ import_fs13.default.appendFileSync(
1662
+ envPath,
1663
+ `
1664
+
1665
+ # Facebook OAuth
1666
+ FACEBOOK_CLIENT_ID=
1667
+ FACEBOOK_CLIENT_SECRET=
1668
+ `
1669
+ );
1670
+ }
1671
+ }
1672
+ const componentTemplate = import_path13.default.resolve(
1673
+ __dirname,
1674
+ "./template/TanstackState/components/FacebookOAuthButton.tsx"
1675
+ );
1676
+ const componentsDir = import_path13.default.join(srcPath, "components", "authverse");
1677
+ if (!import_fs13.default.existsSync(componentsDir)) {
1678
+ import_fs13.default.mkdirSync(componentsDir, { recursive: true });
1679
+ }
1680
+ const componentDest = import_path13.default.join(componentsDir, "FacebookOAuthButton.tsx");
1681
+ if (import_fs13.default.existsSync(componentTemplate)) {
1682
+ import_fs13.default.copyFileSync(componentTemplate, componentDest);
1683
+ }
1684
+ console.log(import_chalk13.default.green("Facebook provider added & merged successfully"));
1685
+ } catch (error) {
1686
+ console.log(import_chalk13.default.red("facebookRunTanstackState error:"), error);
1687
+ }
1688
+ };
1689
+
1690
+ // oauth/LinkedInNext.ts
1691
+ var import_chalk14 = __toESM(require("chalk"), 1);
1692
+ var import_fs14 = __toESM(require("fs"), 1);
1693
+ var import_path14 = __toESM(require("path"), 1);
1694
+ var import_url13 = require("url");
1695
+ var import_meta13 = {};
1696
+ var LinkedInNext = async () => {
1697
+ try {
1698
+ const __filename = (0, import_url13.fileURLToPath)(import_meta13.url);
1699
+ const __dirname = import_path14.default.dirname(__filename);
1700
+ const projectDir = process.cwd();
1701
+ const srcPath = import_path14.default.join(projectDir, "src");
1702
+ const folder = import_fs14.default.existsSync(srcPath) ? "src" : "";
1703
+ const authFilePath = import_path14.default.join(projectDir, folder, "lib", "auth.ts");
1704
+ if (!import_fs14.default.existsSync(authFilePath)) {
1705
+ console.log(import_chalk14.default.red("auth.ts file not found"));
1706
+ return;
1707
+ }
1708
+ let content = import_fs14.default.readFileSync(authFilePath, "utf8");
1709
+ if (!content.includes("betterAuth({")) {
1710
+ console.log(import_chalk14.default.red("betterAuth({}) block not found"));
1711
+ return;
1712
+ }
1713
+ if (content.includes("socialProviders") && content.includes("LinkedIn:")) {
1714
+ console.log(import_chalk14.default.yellow("LinkedIn provider already exists"));
1715
+ return;
1716
+ }
1717
+ const LinkedInProviderEntry = `
1718
+ LinkedIn: {
1719
+ clientId: process.env.LINKEDIN_CLIENT_ID as string,
1720
+ clientSecret: process.env.LINKEDIN_CLIENT_SECRET as string,
1721
+ },`;
1722
+ if (content.includes("socialProviders: {")) {
1723
+ const start = content.indexOf("socialProviders: {");
1724
+ let braceCount = 0;
1725
+ let insertPos = -1;
1726
+ for (let i = start; i < content.length; i++) {
1727
+ if (content[i] === "{") braceCount++;
1728
+ if (content[i] === "}") {
1729
+ braceCount--;
1730
+ if (braceCount === 0) {
1731
+ insertPos = i;
1732
+ break;
1733
+ }
1734
+ }
1735
+ }
1736
+ if (insertPos === -1) {
1737
+ console.log(import_chalk14.default.red("Failed to parse socialProviders block"));
1738
+ return;
1739
+ }
1740
+ content = content.slice(0, insertPos) + LinkedInProviderEntry + "\n " + content.slice(insertPos);
1741
+ } else {
1742
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1743
+ if (!databaseRegex.test(content)) {
1744
+ console.log(
1745
+ import_chalk14.default.red(
1746
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1747
+ )
1748
+ );
1749
+ return;
1750
+ }
1751
+ const socialProvidersBlock = `
1752
+ socialProviders: {
1753
+ ${LinkedInProviderEntry}
1754
+ },`;
1755
+ content = content.replace(
1756
+ databaseRegex,
1757
+ (match) => `${match}
1758
+ ${socialProvidersBlock}`
1759
+ );
1760
+ }
1761
+ import_fs14.default.writeFileSync(authFilePath, content, "utf8");
1762
+ const envPath = import_path14.default.join(projectDir, ".env");
1763
+ if (import_fs14.default.existsSync(envPath)) {
1764
+ const envContent = import_fs14.default.readFileSync(envPath, "utf8");
1765
+ if (!envContent.includes("LINKEDIN_CLIENT_ID")) {
1766
+ import_fs14.default.appendFileSync(
1767
+ envPath,
1768
+ `
1769
+
1770
+ # LinkedIn OAuth
1771
+ LINKEDIN_CLIENT_ID=
1772
+ LINKEDIN_CLIENT_SECRET=
1773
+ `
1774
+ );
1775
+ }
1776
+ }
1777
+ const componentTemplate = import_path14.default.resolve(
1778
+ __dirname,
1779
+ "./template/components/LinkedInOAuthButton.tsx"
1780
+ );
1781
+ const componentsDir = import_path14.default.join(
1782
+ projectDir,
1783
+ folder,
1784
+ "components",
1785
+ "authverse"
1786
+ );
1787
+ if (!import_fs14.default.existsSync(componentsDir)) {
1788
+ import_fs14.default.mkdirSync(componentsDir, { recursive: true });
1789
+ }
1790
+ const componentDest = import_path14.default.join(componentsDir, "LinkedInOAuthButton.tsx");
1791
+ if (import_fs14.default.existsSync(componentTemplate)) {
1792
+ import_fs14.default.copyFileSync(componentTemplate, componentDest);
1793
+ }
1794
+ console.log(import_chalk14.default.green("LinkedIn provider added & merged successfully"));
1795
+ } catch (error) {
1796
+ console.log(import_chalk14.default.red("LinkedIn error:"), error);
1797
+ }
1798
+ };
1799
+
1800
+ // oauth/LinkedInTanstackState.ts
1801
+ var import_chalk15 = __toESM(require("chalk"), 1);
1802
+ var import_fs15 = __toESM(require("fs"), 1);
1803
+ var import_path15 = __toESM(require("path"), 1);
1804
+ var import_url14 = require("url");
1805
+ var import_meta14 = {};
1806
+ var LinkedInTanstackState = async () => {
1807
+ try {
1808
+ const __filename = (0, import_url14.fileURLToPath)(import_meta14.url);
1809
+ const __dirname = import_path15.default.dirname(__filename);
1810
+ const projectDir = process.cwd();
1811
+ const srcPath = import_path15.default.join(projectDir, "src");
1812
+ const authFilePath = import_path15.default.join(srcPath, "lib", "auth.ts");
1813
+ if (!import_fs15.default.existsSync(authFilePath)) {
1814
+ console.log(import_chalk15.default.red("auth.ts file not found"));
1815
+ return;
1816
+ }
1817
+ let content = import_fs15.default.readFileSync(authFilePath, "utf8");
1818
+ if (!content.includes("betterAuth({")) {
1819
+ console.log(import_chalk15.default.red("betterAuth({}) block not found"));
1820
+ return;
1821
+ }
1822
+ if (content.includes("socialProviders") && content.includes("linkedin:")) {
1823
+ console.log(import_chalk15.default.yellow("LinkedIn provider already exists"));
1824
+ return;
1825
+ }
1826
+ const LinkedInProviderEntry = `
1827
+ LinkedIn: {
1828
+ clientId: process.env.LINKEDIN_CLIENT_ID as string,
1829
+ clientSecret: process.env.LINKEDIN_CLIENT_SECRET as string,
1830
+ },`;
1831
+ if (content.includes("socialProviders: {")) {
1832
+ const start = content.indexOf("socialProviders: {");
1833
+ let braceCount = 0;
1834
+ let insertPos = -1;
1835
+ for (let i = start; i < content.length; i++) {
1836
+ if (content[i] === "{") braceCount++;
1837
+ if (content[i] === "}") {
1838
+ braceCount--;
1839
+ if (braceCount === 0) {
1840
+ insertPos = i;
1841
+ break;
1842
+ }
1843
+ }
1844
+ }
1845
+ if (insertPos === -1) {
1846
+ console.log(import_chalk15.default.red("Failed to parse socialProviders block"));
1847
+ return;
1848
+ }
1849
+ content = content.slice(0, insertPos) + LinkedInProviderEntry + "\n " + content.slice(insertPos);
1850
+ } else {
1851
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1852
+ if (!databaseRegex.test(content)) {
1853
+ console.log(
1854
+ import_chalk15.default.red(
1855
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1856
+ )
1857
+ );
1858
+ return;
1859
+ }
1860
+ const socialProvidersBlock = `
1861
+ socialProviders: {
1862
+ ${LinkedInProviderEntry}
1863
+ },`;
1864
+ content = content.replace(
1865
+ databaseRegex,
1866
+ (match) => `${match}
1867
+ ${socialProvidersBlock}`
1868
+ );
1869
+ }
1870
+ import_fs15.default.writeFileSync(authFilePath, content, "utf8");
1871
+ const envPath = import_path15.default.join(projectDir, ".env");
1872
+ if (import_fs15.default.existsSync(envPath)) {
1873
+ const envContent = import_fs15.default.readFileSync(envPath, "utf8");
1874
+ if (!envContent.includes("LINKEDIN_CLIENT_ID")) {
1875
+ import_fs15.default.appendFileSync(
1876
+ envPath,
1877
+ `
1878
+
1879
+ # LinkedIn OAuth
1880
+ LINKEDIN_CLIENT_ID=
1881
+ LINKEDIN_CLIENT_SECRET=
1882
+ `
1883
+ );
1884
+ }
1885
+ }
1886
+ const componentTemplate = import_path15.default.resolve(
1887
+ __dirname,
1888
+ "./template/TanstackState/components/LinkedInOAuthButton.tsx"
1889
+ );
1890
+ const componentsDir = import_path15.default.join(srcPath, "components", "authverse");
1891
+ if (!import_fs15.default.existsSync(componentsDir)) {
1892
+ import_fs15.default.mkdirSync(componentsDir, { recursive: true });
1893
+ }
1894
+ const componentDest = import_path15.default.join(componentsDir, "LinkedInOAuthButton.tsx");
1895
+ if (import_fs15.default.existsSync(componentTemplate)) {
1896
+ import_fs15.default.copyFileSync(componentTemplate, componentDest);
1897
+ }
1898
+ console.log(import_chalk15.default.green("LinkedIn provider added & merged successfully"));
1899
+ } catch (error) {
1900
+ console.log(import_chalk15.default.red("LinkedInTanstackState error:"), error);
1901
+ }
1902
+ };
1903
+
1904
+ // oauth/twitterNext.ts
1905
+ var import_chalk16 = __toESM(require("chalk"), 1);
1906
+ var import_fs16 = __toESM(require("fs"), 1);
1907
+ var import_path16 = __toESM(require("path"), 1);
1908
+ var import_url15 = require("url");
1909
+ var import_meta15 = {};
1910
+ var twitterNext = async () => {
1911
+ try {
1912
+ const __filename = (0, import_url15.fileURLToPath)(import_meta15.url);
1913
+ const __dirname = import_path16.default.dirname(__filename);
1914
+ const projectDir = process.cwd();
1915
+ const srcPath = import_path16.default.join(projectDir, "src");
1916
+ const folder = import_fs16.default.existsSync(srcPath) ? "src" : "";
1917
+ const authFilePath = import_path16.default.join(projectDir, folder, "lib", "auth.ts");
1918
+ if (!import_fs16.default.existsSync(authFilePath)) {
1919
+ console.log(import_chalk16.default.red("auth.ts file not found"));
1920
+ return;
1921
+ }
1922
+ let content = import_fs16.default.readFileSync(authFilePath, "utf8");
1923
+ if (!content.includes("betterAuth({")) {
1924
+ console.log(import_chalk16.default.red("betterAuth({}) block not found"));
1925
+ return;
1926
+ }
1927
+ if (content.includes("socialProviders") && content.includes("twitter:")) {
1928
+ console.log(import_chalk16.default.yellow("twitter provider already exists"));
1929
+ return;
1930
+ }
1931
+ const twitterProviderEntry = `
1932
+ twitter: {
1933
+ clientId: process.env.TWITTER_CLIENT_ID as string,
1934
+ clientSecret: process.env.TWITTER_CLIENT_SECRET as string,
1935
+ },`;
1936
+ if (content.includes("socialProviders: {")) {
1937
+ const start = content.indexOf("socialProviders: {");
1938
+ let braceCount = 0;
1939
+ let insertPos = -1;
1940
+ for (let i = start; i < content.length; i++) {
1941
+ if (content[i] === "{") braceCount++;
1942
+ if (content[i] === "}") {
1943
+ braceCount--;
1944
+ if (braceCount === 0) {
1945
+ insertPos = i;
1946
+ break;
1947
+ }
1948
+ }
1949
+ }
1950
+ if (insertPos === -1) {
1951
+ console.log(import_chalk16.default.red("Failed to parse socialProviders block"));
1952
+ return;
1953
+ }
1954
+ content = content.slice(0, insertPos) + twitterProviderEntry + "\n " + content.slice(insertPos);
1955
+ } else {
1956
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1957
+ if (!databaseRegex.test(content)) {
1958
+ console.log(
1959
+ import_chalk16.default.red(
1960
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1961
+ )
1962
+ );
1963
+ return;
1964
+ }
1965
+ const socialProvidersBlock = `
1966
+ socialProviders: {
1967
+ ${twitterProviderEntry}
1968
+ },`;
1969
+ content = content.replace(
1970
+ databaseRegex,
1971
+ (match) => `${match}
1972
+ ${socialProvidersBlock}`
1973
+ );
1974
+ }
1975
+ import_fs16.default.writeFileSync(authFilePath, content, "utf8");
1976
+ const envPath = import_path16.default.join(projectDir, ".env");
1977
+ if (import_fs16.default.existsSync(envPath)) {
1978
+ const envContent = import_fs16.default.readFileSync(envPath, "utf8");
1979
+ if (!envContent.includes("TWITTER_CLIENT_ID")) {
1980
+ import_fs16.default.appendFileSync(
1981
+ envPath,
1982
+ `
1983
+
1984
+ # Twitter OAuth
1985
+ TWITTER_CLIENT_ID=
1986
+ TWITTER_CLIENT_SECRET=
1987
+ `
1988
+ );
1989
+ }
1990
+ }
1991
+ const componentTemplate = import_path16.default.resolve(
1992
+ __dirname,
1993
+ "./template/components/twitterOAuthButton.tsx"
1994
+ );
1995
+ const componentsDir = import_path16.default.join(
1996
+ projectDir,
1997
+ folder,
1998
+ "components",
1999
+ "authverse"
2000
+ );
2001
+ if (!import_fs16.default.existsSync(componentsDir)) {
2002
+ import_fs16.default.mkdirSync(componentsDir, { recursive: true });
2003
+ }
2004
+ const componentDest = import_path16.default.join(componentsDir, "twitterOAuthButton.tsx");
2005
+ if (import_fs16.default.existsSync(componentTemplate)) {
2006
+ import_fs16.default.copyFileSync(componentTemplate, componentDest);
2007
+ }
2008
+ console.log(import_chalk16.default.green("twitter provider added & merged successfully"));
2009
+ } catch (error) {
2010
+ console.log(import_chalk16.default.red("twitter error:"), error);
2011
+ }
2012
+ };
2013
+
2014
+ // oauth/twitterTanstackState.ts
2015
+ var import_chalk17 = __toESM(require("chalk"), 1);
2016
+ var import_fs17 = __toESM(require("fs"), 1);
2017
+ var import_path17 = __toESM(require("path"), 1);
2018
+ var import_url16 = require("url");
2019
+ var import_meta16 = {};
2020
+ var twitterTanstackState = async () => {
2021
+ try {
2022
+ const __filename = (0, import_url16.fileURLToPath)(import_meta16.url);
2023
+ const __dirname = import_path17.default.dirname(__filename);
2024
+ const projectDir = process.cwd();
2025
+ const srcPath = import_path17.default.join(projectDir, "src");
2026
+ const authFilePath = import_path17.default.join(srcPath, "lib", "auth.ts");
2027
+ if (!import_fs17.default.existsSync(authFilePath)) {
2028
+ console.log(import_chalk17.default.red("auth.ts file not found"));
2029
+ return;
2030
+ }
2031
+ let content = import_fs17.default.readFileSync(authFilePath, "utf8");
2032
+ if (!content.includes("betterAuth({")) {
2033
+ console.log(import_chalk17.default.red("betterAuth({}) block not found"));
2034
+ return;
2035
+ }
2036
+ if (content.includes("socialProviders") && content.includes("twitter:")) {
2037
+ console.log(import_chalk17.default.yellow("twitter provider already exists"));
2038
+ return;
2039
+ }
2040
+ const twitterProviderEntry = `
2041
+ twitter: {
2042
+ clientId: process.env.TWITTER_CLIENT_ID as string,
2043
+ clientSecret: process.env.TWITTER_CLIENT_SECRET as string,
2044
+ },`;
2045
+ if (content.includes("socialProviders: {")) {
2046
+ const start = content.indexOf("socialProviders: {");
2047
+ let braceCount = 0;
2048
+ let insertPos = -1;
2049
+ for (let i = start; i < content.length; i++) {
2050
+ if (content[i] === "{") braceCount++;
2051
+ if (content[i] === "}") {
2052
+ braceCount--;
2053
+ if (braceCount === 0) {
2054
+ insertPos = i;
2055
+ break;
2056
+ }
2057
+ }
2058
+ }
2059
+ if (insertPos === -1) {
2060
+ console.log(import_chalk17.default.red("Failed to parse socialProviders block"));
2061
+ return;
2062
+ }
2063
+ content = content.slice(0, insertPos) + twitterProviderEntry + "\n " + content.slice(insertPos);
2064
+ } else {
2065
+ const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
2066
+ if (!databaseRegex.test(content)) {
2067
+ console.log(
2068
+ import_chalk17.default.red(
2069
+ "Could not find database adapter (prismaAdapter or drizzleAdapter)"
2070
+ )
2071
+ );
2072
+ return;
2073
+ }
2074
+ const socialProvidersBlock = `
2075
+ socialProviders: {
2076
+ ${twitterProviderEntry}
2077
+ },`;
2078
+ content = content.replace(
2079
+ databaseRegex,
2080
+ (match) => `${match}
2081
+ ${socialProvidersBlock}`
2082
+ );
2083
+ }
2084
+ import_fs17.default.writeFileSync(authFilePath, content, "utf8");
2085
+ const envPath = import_path17.default.join(projectDir, ".env");
2086
+ if (import_fs17.default.existsSync(envPath)) {
2087
+ const envContent = import_fs17.default.readFileSync(envPath, "utf8");
2088
+ if (!envContent.includes("TWITTER_CLIENT_ID")) {
2089
+ import_fs17.default.appendFileSync(
2090
+ envPath,
2091
+ `
2092
+
2093
+ # twitter OAuth
2094
+ TWITTER_CLIENT_ID=
2095
+ TWITTER_CLIENT_SECRET=
1241
2096
  `
1242
2097
  );
1243
2098
  }
1244
2099
  }
1245
- const componentTemplate = import_path9.default.resolve(
2100
+ const componentTemplate = import_path17.default.resolve(
1246
2101
  __dirname,
1247
- "./template/components/GithubProviders.tsx"
1248
- );
1249
- const componentsDir = import_path9.default.join(
1250
- projectDir,
1251
- folder,
1252
- "components",
1253
- "authverse"
2102
+ "./template/TanstackState/components/twitterOAuthButton.tsx"
1254
2103
  );
1255
- if (!import_fs9.default.existsSync(componentsDir)) {
1256
- import_fs9.default.mkdirSync(componentsDir, { recursive: true });
2104
+ const componentsDir = import_path17.default.join(srcPath, "components", "authverse");
2105
+ if (!import_fs17.default.existsSync(componentsDir)) {
2106
+ import_fs17.default.mkdirSync(componentsDir, { recursive: true });
1257
2107
  }
1258
- const componentDest = import_path9.default.join(componentsDir, "GithubProviders.tsx");
1259
- if (import_fs9.default.existsSync(componentTemplate)) {
1260
- import_fs9.default.copyFileSync(componentTemplate, componentDest);
2108
+ const componentDest = import_path17.default.join(componentsDir, "twitterOAuthButton.tsx");
2109
+ if (import_fs17.default.existsSync(componentTemplate)) {
2110
+ import_fs17.default.copyFileSync(componentTemplate, componentDest);
1261
2111
  }
1262
- console.log(import_chalk9.default.green("GitHub provider added & merged successfully"));
2112
+ console.log(import_chalk17.default.green("twitter provider added & merged successfully"));
1263
2113
  } catch (error) {
1264
- console.log(import_chalk9.default.red("githubRun error:"), error);
2114
+ console.log(import_chalk17.default.red("twitter tanstack state error:"), error);
1265
2115
  }
1266
2116
  };
1267
2117
 
1268
- // oauth/googleTanstackState.ts
1269
- var import_chalk10 = __toESM(require("chalk"), 1);
1270
- var import_fs10 = __toESM(require("fs"), 1);
1271
- var import_path10 = __toESM(require("path"), 1);
1272
- var import_url9 = require("url");
1273
- var import_meta9 = {};
1274
- var googleTanstackState = async () => {
2118
+ // oauth/AppleNext.ts
2119
+ var import_chalk18 = __toESM(require("chalk"), 1);
2120
+ var import_fs18 = __toESM(require("fs"), 1);
2121
+ var import_path18 = __toESM(require("path"), 1);
2122
+ var import_url17 = require("url");
2123
+ var import_meta17 = {};
2124
+ var AppleNext = async () => {
1275
2125
  try {
1276
- const __filename = (0, import_url9.fileURLToPath)(import_meta9.url);
1277
- const __dirname = import_path10.default.dirname(__filename);
2126
+ const __filename = (0, import_url17.fileURLToPath)(import_meta17.url);
2127
+ const __dirname = import_path18.default.dirname(__filename);
1278
2128
  const projectDir = process.cwd();
1279
- const srcPath = import_path10.default.join(projectDir, "src");
1280
- const authFilePath = import_path10.default.join(srcPath, "lib", "auth.ts");
1281
- if (!import_fs10.default.existsSync(authFilePath)) {
1282
- console.log(import_chalk10.default.red("auth.ts file not found"));
2129
+ const srcPath = import_path18.default.join(projectDir, "src");
2130
+ const folder = import_fs18.default.existsSync(srcPath) ? "src" : "";
2131
+ const authFilePath = import_path18.default.join(projectDir, folder, "lib", "auth.ts");
2132
+ if (!import_fs18.default.existsSync(authFilePath)) {
2133
+ console.log(import_chalk18.default.red("auth.ts file not found"));
1283
2134
  return;
1284
2135
  }
1285
- let content = import_fs10.default.readFileSync(authFilePath, "utf8");
2136
+ let content = import_fs18.default.readFileSync(authFilePath, "utf8");
1286
2137
  if (!content.includes("betterAuth({")) {
1287
- console.log(import_chalk10.default.red("betterAuth({}) block not found"));
2138
+ console.log(import_chalk18.default.red("betterAuth({}) block not found"));
1288
2139
  return;
1289
2140
  }
1290
- if (content.includes("socialProviders") && content.includes("google:")) {
1291
- console.log(import_chalk10.default.yellow("Google provider already exists"));
2141
+ if (content.includes("socialProviders") && content.includes("apple:")) {
2142
+ console.log(import_chalk18.default.yellow("Apple provider already exists"));
1292
2143
  return;
1293
2144
  }
1294
- const googleProviderEntry = `
1295
- google: {
1296
- clientId: process.env.GOOGLE_CLIENT_ID as string,
1297
- clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
2145
+ const appleProviderEntry = `
2146
+ apple: {
2147
+ clientId: process.env.APPLE_CLIENT_ID as string,
2148
+ clientSecret: process.env.APPLE_CLIENT_SECRET as string,
2149
+ // Important for native iOS: Use the app's bundle ID here, not the service ID
2150
+ appBundleIdentifier: process.env.APPLE_BUNDLE_ID,
1298
2151
  },`;
1299
2152
  if (content.includes("socialProviders: {")) {
1300
2153
  const start = content.indexOf("socialProviders: {");
@@ -1311,15 +2164,15 @@ var googleTanstackState = async () => {
1311
2164
  }
1312
2165
  }
1313
2166
  if (insertPos === -1) {
1314
- console.log(import_chalk10.default.red("Failed to parse socialProviders block"));
2167
+ console.log(import_chalk18.default.red("Failed to parse socialProviders block"));
1315
2168
  return;
1316
2169
  }
1317
- content = content.slice(0, insertPos) + googleProviderEntry + "\n " + content.slice(insertPos);
2170
+ content = content.slice(0, insertPos) + appleProviderEntry + "\n " + content.slice(insertPos);
1318
2171
  } else {
1319
2172
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1320
2173
  if (!databaseRegex.test(content)) {
1321
2174
  console.log(
1322
- import_chalk10.default.red(
2175
+ import_chalk18.default.red(
1323
2176
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1324
2177
  )
1325
2178
  );
@@ -1327,7 +2180,7 @@ var googleTanstackState = async () => {
1327
2180
  }
1328
2181
  const socialProvidersBlock = `
1329
2182
  socialProviders: {
1330
- ${googleProviderEntry}
2183
+ ${appleProviderEntry}
1331
2184
  },`;
1332
2185
  content = content.replace(
1333
2186
  databaseRegex,
@@ -1335,70 +2188,92 @@ ${googleProviderEntry}
1335
2188
  ${socialProvidersBlock}`
1336
2189
  );
1337
2190
  }
1338
- import_fs10.default.writeFileSync(authFilePath, content, "utf8");
1339
- const envPath = import_path10.default.join(projectDir, ".env");
1340
- if (import_fs10.default.existsSync(envPath)) {
1341
- const envContent = import_fs10.default.readFileSync(envPath, "utf8");
1342
- if (!envContent.includes("GOOGLE_CLIENT_ID")) {
1343
- import_fs10.default.appendFileSync(
2191
+ if (content.includes("trustedOrigins: [")) {
2192
+ if (!content.includes("https://appleid.apple.com")) {
2193
+ content = content.replace(
2194
+ "trustedOrigins: [",
2195
+ 'trustedOrigins: ["https://appleid.apple.com", '
2196
+ );
2197
+ }
2198
+ } else {
2199
+ const betterAuthMatch = content.match(/betterAuth\(\{/);
2200
+ if (betterAuthMatch) {
2201
+ const insertPos = betterAuthMatch.index + betterAuthMatch[0].length;
2202
+ content = content.slice(0, insertPos) + '\n trustedOrigins: ["https://appleid.apple.com"],' + content.slice(insertPos);
2203
+ }
2204
+ }
2205
+ import_fs18.default.writeFileSync(authFilePath, content, "utf8");
2206
+ const envPath = import_path18.default.join(projectDir, ".env");
2207
+ if (import_fs18.default.existsSync(envPath)) {
2208
+ const envContent = import_fs18.default.readFileSync(envPath, "utf8");
2209
+ if (!envContent.includes("APPLE_CLIENT_ID")) {
2210
+ import_fs18.default.appendFileSync(
1344
2211
  envPath,
1345
2212
  `
1346
2213
 
1347
- # Google OAuth
1348
- GOOGLE_CLIENT_ID=
1349
- GOOGLE_CLIENT_SECRET=
2214
+ # Apple OAuth
2215
+ APPLE_CLIENT_ID=
2216
+ APPLE_CLIENT_SECRET=
2217
+ APPLE_BUNDLE_ID=
1350
2218
  `
1351
2219
  );
1352
2220
  }
1353
2221
  }
1354
- const componentTemplate = import_path10.default.resolve(
2222
+ const componentTemplate = import_path18.default.resolve(
1355
2223
  __dirname,
1356
- "./template/TanstackState/components/GoogleProviders.tsx"
2224
+ "./template/components/AppleOAuthButton.tsx"
1357
2225
  );
1358
- const componentsDir = import_path10.default.join(srcPath, "components", "authverse");
1359
- if (!import_fs10.default.existsSync(componentsDir)) {
1360
- import_fs10.default.mkdirSync(componentsDir, { recursive: true });
2226
+ const componentsDir = import_path18.default.join(
2227
+ projectDir,
2228
+ folder,
2229
+ "components",
2230
+ "authverse"
2231
+ );
2232
+ if (!import_fs18.default.existsSync(componentsDir)) {
2233
+ import_fs18.default.mkdirSync(componentsDir, { recursive: true });
1361
2234
  }
1362
- const componentDest = import_path10.default.join(componentsDir, "GoogleProviders.tsx");
1363
- if (import_fs10.default.existsSync(componentTemplate)) {
1364
- import_fs10.default.copyFileSync(componentTemplate, componentDest);
2235
+ const componentDest = import_path18.default.join(componentsDir, "AppleOAuthButton.tsx");
2236
+ if (import_fs18.default.existsSync(componentTemplate)) {
2237
+ import_fs18.default.copyFileSync(componentTemplate, componentDest);
1365
2238
  }
1366
- console.log(import_chalk10.default.green("Google provider added & merged successfully"));
2239
+ console.log(import_chalk18.default.green("Apple provider added & merged successfully"));
1367
2240
  } catch (error) {
1368
- console.log(import_chalk10.default.red("googleRunTanstackState error:"), error);
2241
+ console.log(import_chalk18.default.red("apple next error:"), error);
1369
2242
  }
1370
2243
  };
1371
2244
 
1372
- // oauth/githubTanstackState.ts
1373
- var import_chalk11 = __toESM(require("chalk"), 1);
1374
- var import_fs11 = __toESM(require("fs"), 1);
1375
- var import_path11 = __toESM(require("path"), 1);
1376
- var import_url10 = require("url");
1377
- var import_meta10 = {};
1378
- var githubTanstackState = async () => {
2245
+ // oauth/AppleTanstackState.ts
2246
+ var import_chalk19 = __toESM(require("chalk"), 1);
2247
+ var import_fs19 = __toESM(require("fs"), 1);
2248
+ var import_path19 = __toESM(require("path"), 1);
2249
+ var import_url18 = require("url");
2250
+ var import_meta18 = {};
2251
+ var AppleTanstackState = async () => {
1379
2252
  try {
1380
- const __filename = (0, import_url10.fileURLToPath)(import_meta10.url);
1381
- const __dirname = import_path11.default.dirname(__filename);
2253
+ const __filename = (0, import_url18.fileURLToPath)(import_meta18.url);
2254
+ const __dirname = import_path19.default.dirname(__filename);
1382
2255
  const projectDir = process.cwd();
1383
- const srcPath = import_path11.default.join(projectDir, "src");
1384
- const authFilePath = import_path11.default.join(srcPath, "lib", "auth.ts");
1385
- if (!import_fs11.default.existsSync(authFilePath)) {
1386
- console.log(import_chalk11.default.red("auth.ts file not found"));
2256
+ const srcPath = import_path19.default.join(projectDir, "src");
2257
+ const authFilePath = import_path19.default.join(srcPath, "lib", "auth.ts");
2258
+ if (!import_fs19.default.existsSync(authFilePath)) {
2259
+ console.log(import_chalk19.default.red("auth.ts file not found"));
1387
2260
  return;
1388
2261
  }
1389
- let content = import_fs11.default.readFileSync(authFilePath, "utf8");
2262
+ let content = import_fs19.default.readFileSync(authFilePath, "utf8");
1390
2263
  if (!content.includes("betterAuth({")) {
1391
- console.log(import_chalk11.default.red("betterAuth({}) block not found"));
2264
+ console.log(import_chalk19.default.red("betterAuth({}) block not found"));
1392
2265
  return;
1393
2266
  }
1394
- if (content.includes("socialProviders") && content.includes("github:")) {
1395
- console.log(import_chalk11.default.yellow("Github provider already exists"));
2267
+ if (content.includes("socialProviders") && content.includes("apple:")) {
2268
+ console.log(import_chalk19.default.yellow("Apple provider already exists"));
1396
2269
  return;
1397
2270
  }
1398
- const githubProviderEntry = `
1399
- github: {
1400
- clientId: process.env.GITHUB_CLIENT_ID as string,
1401
- clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
2271
+ const appleProviderEntry = `
2272
+ apple: {
2273
+ clientId: process.env.APPLE_CLIENT_ID as string,
2274
+ clientSecret: process.env.APPLE_CLIENT_SECRET as string,
2275
+ // Important for native iOS: Use the app's bundle ID here, not the service ID
2276
+ appBundleIdentifier: process.env.APPLE_BUNDLE_ID,
1402
2277
  },`;
1403
2278
  if (content.includes("socialProviders: {")) {
1404
2279
  const start = content.indexOf("socialProviders: {");
@@ -1415,15 +2290,15 @@ var githubTanstackState = async () => {
1415
2290
  }
1416
2291
  }
1417
2292
  if (insertPos === -1) {
1418
- console.log(import_chalk11.default.red("Failed to parse socialProviders block"));
2293
+ console.log(import_chalk19.default.red("Failed to parse socialProviders block"));
1419
2294
  return;
1420
2295
  }
1421
- content = content.slice(0, insertPos) + githubProviderEntry + "\n " + content.slice(insertPos);
2296
+ content = content.slice(0, insertPos) + appleProviderEntry + "\n " + content.slice(insertPos);
1422
2297
  } else {
1423
2298
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1424
2299
  if (!databaseRegex.test(content)) {
1425
2300
  console.log(
1426
- import_chalk11.default.red(
2301
+ import_chalk19.default.red(
1427
2302
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1428
2303
  )
1429
2304
  );
@@ -1431,7 +2306,7 @@ var githubTanstackState = async () => {
1431
2306
  }
1432
2307
  const socialProvidersBlock = `
1433
2308
  socialProviders: {
1434
- ${githubProviderEntry}
2309
+ ${appleProviderEntry}
1435
2310
  },`;
1436
2311
  content = content.replace(
1437
2312
  databaseRegex,
@@ -1439,37 +2314,52 @@ ${githubProviderEntry}
1439
2314
  ${socialProvidersBlock}`
1440
2315
  );
1441
2316
  }
1442
- import_fs11.default.writeFileSync(authFilePath, content, "utf8");
1443
- const envPath = import_path11.default.join(projectDir, ".env");
1444
- if (import_fs11.default.existsSync(envPath)) {
1445
- const envContent = import_fs11.default.readFileSync(envPath, "utf8");
1446
- if (!envContent.includes("GITHUB_CLIENT_ID")) {
1447
- import_fs11.default.appendFileSync(
2317
+ if (content.includes("trustedOrigins: [")) {
2318
+ if (!content.includes("https://appleid.apple.com")) {
2319
+ content = content.replace(
2320
+ "trustedOrigins: [",
2321
+ 'trustedOrigins: ["https://appleid.apple.com", '
2322
+ );
2323
+ }
2324
+ } else {
2325
+ const betterAuthMatch = content.match(/betterAuth\(\{/);
2326
+ if (betterAuthMatch) {
2327
+ const insertPos = betterAuthMatch.index + betterAuthMatch[0].length;
2328
+ content = content.slice(0, insertPos) + '\n trustedOrigins: ["https://appleid.apple.com"],' + content.slice(insertPos);
2329
+ }
2330
+ }
2331
+ import_fs19.default.writeFileSync(authFilePath, content, "utf8");
2332
+ const envPath = import_path19.default.join(projectDir, ".env");
2333
+ if (import_fs19.default.existsSync(envPath)) {
2334
+ const envContent = import_fs19.default.readFileSync(envPath, "utf8");
2335
+ if (!envContent.includes("APPLE_CLIENT_ID")) {
2336
+ import_fs19.default.appendFileSync(
1448
2337
  envPath,
1449
2338
  `
1450
2339
 
1451
- # Github OAuth
1452
- GITHUB_CLIENT_ID=
1453
- GITHUB_CLIENT_SECRET=
2340
+ # Apple OAuth
2341
+ APPLE_CLIENT_ID=
2342
+ APPLE_CLIENT_SECRET=
2343
+ APPLE_BUNDLE_ID=
1454
2344
  `
1455
2345
  );
1456
2346
  }
1457
2347
  }
1458
- const componentTemplate = import_path11.default.resolve(
2348
+ const componentTemplate = import_path19.default.resolve(
1459
2349
  __dirname,
1460
- "./template/TanstackState/components/GithubProviders.tsx"
2350
+ "./template/TanstackState/components/AppleOAuthButton.tsx"
1461
2351
  );
1462
- const componentsDir = import_path11.default.join(srcPath, "components", "authverse");
1463
- if (!import_fs11.default.existsSync(componentsDir)) {
1464
- import_fs11.default.mkdirSync(componentsDir, { recursive: true });
2352
+ const componentsDir = import_path19.default.join(srcPath, "components", "authverse");
2353
+ if (!import_fs19.default.existsSync(componentsDir)) {
2354
+ import_fs19.default.mkdirSync(componentsDir, { recursive: true });
1465
2355
  }
1466
- const componentDest = import_path11.default.join(componentsDir, "GithubProviders.tsx");
1467
- if (import_fs11.default.existsSync(componentTemplate)) {
1468
- import_fs11.default.copyFileSync(componentTemplate, componentDest);
2356
+ const componentDest = import_path19.default.join(componentsDir, "AppleOAuthButton.tsx");
2357
+ if (import_fs19.default.existsSync(componentTemplate)) {
2358
+ import_fs19.default.copyFileSync(componentTemplate, componentDest);
1469
2359
  }
1470
- console.log(import_chalk11.default.green("Github provider added & merged successfully"));
2360
+ console.log(import_chalk19.default.green("Apple provider added & merged successfully"));
1471
2361
  } catch (error) {
1472
- console.log(import_chalk11.default.red("githubRunTanstackState error:"), error);
2362
+ console.log(import_chalk19.default.red("apple tanstack state error:"), error);
1473
2363
  }
1474
2364
  };
1475
2365
 
@@ -1478,7 +2368,7 @@ var Oauth = async ({ oauth }) => {
1478
2368
  try {
1479
2369
  const { framework, error } = await getFramework();
1480
2370
  if (error) {
1481
- console.log(import_chalk12.default.red(error));
2371
+ console.log(import_chalk20.default.red(error));
1482
2372
  return;
1483
2373
  }
1484
2374
  if (framework === "Next js" && oauth == "google") {
@@ -1491,364 +2381,384 @@ var Oauth = async ({ oauth }) => {
1491
2381
  } else if (framework === "tanstack state" && oauth == "github") {
1492
2382
  await githubTanstackState();
1493
2383
  }
1494
- if (oauth !== "google" && oauth !== "github") {
1495
- console.log(import_chalk12.default.red("Invalid oauth provider"));
2384
+ if (framework === "Next js" && oauth == "facebook") {
2385
+ await facebookNext();
2386
+ } else if (framework === "tanstack state" && oauth == "facebook") {
2387
+ await facebookTanstackState();
2388
+ }
2389
+ if (framework === "Next js" && oauth === "LinkedIn") {
2390
+ await LinkedInNext();
2391
+ } else if (framework === "tanstack state" && oauth === "LinkedIn") {
2392
+ await LinkedInTanstackState();
2393
+ }
2394
+ if (framework === "Next js" && oauth === "twitter") {
2395
+ await twitterNext();
2396
+ } else if (framework === "tanstack state" && oauth === "twitter") {
2397
+ await twitterTanstackState();
2398
+ }
2399
+ if (framework === "Next js" && oauth === "apple") {
2400
+ await AppleNext();
2401
+ } else if (framework === "tanstack state" && oauth === "apple") {
2402
+ await AppleTanstackState();
2403
+ }
2404
+ if (oauth !== "google" && oauth !== "github" && oauth !== "facebook" && oauth !== "LinkedIn" && oauth !== "twitter" && oauth !== "apple") {
2405
+ console.log(import_chalk20.default.red("Invalid oauth provider"));
1496
2406
  return;
1497
2407
  }
1498
2408
  } catch (error) {
1499
- console.log(import_chalk12.default.red("Error adding oauth:"), error);
2409
+ console.log(import_chalk20.default.red("Error adding oauth:"), error);
1500
2410
  }
1501
2411
  };
1502
2412
 
1503
2413
  // script/forgetNext.ts
1504
- var import_chalk20 = __toESM(require("chalk"), 1);
1505
- var import_path19 = __toESM(require("path"), 1);
1506
- var import_url17 = require("url");
1507
- var import_fs19 = __toESM(require("fs"), 1);
2414
+ var import_chalk28 = __toESM(require("chalk"), 1);
2415
+ var import_path27 = __toESM(require("path"), 1);
2416
+ var import_url25 = require("url");
2417
+ var import_fs27 = __toESM(require("fs"), 1);
1508
2418
 
1509
2419
  // cli/email.ts
1510
- var import_path18 = __toESM(require("path"), 1);
1511
- var import_fs18 = __toESM(require("fs"), 1);
2420
+ var import_path26 = __toESM(require("path"), 1);
2421
+ var import_fs26 = __toESM(require("fs"), 1);
1512
2422
  var import_inquirer4 = __toESM(require("inquirer"), 1);
1513
2423
 
1514
2424
  // email/gmailRun.ts
1515
- var import_chalk13 = __toESM(require("chalk"), 1);
1516
- var import_path12 = __toESM(require("path"), 1);
1517
- var import_fs12 = __toESM(require("fs"), 1);
1518
- var import_url11 = require("url");
1519
- var import_meta11 = {};
2425
+ var import_chalk21 = __toESM(require("chalk"), 1);
2426
+ var import_path20 = __toESM(require("path"), 1);
2427
+ var import_fs20 = __toESM(require("fs"), 1);
2428
+ var import_url19 = require("url");
2429
+ var import_meta19 = {};
1520
2430
  var gmailRun = async () => {
1521
2431
  try {
1522
2432
  const projectDir = process.cwd();
1523
- const packageJsonPath = import_path12.default.join(projectDir, "package.json");
1524
- const packageJson2 = JSON.parse(import_fs12.default.readFileSync(packageJsonPath, "utf-8"));
1525
- const srcFolder = import_fs12.default.existsSync(import_path12.default.join(projectDir, "src")) ? "src" : "";
1526
- const __filename = (0, import_url11.fileURLToPath)(import_meta11.url);
1527
- const __dirname = import_path12.default.dirname(__filename);
2433
+ const packageJsonPath = import_path20.default.join(projectDir, "package.json");
2434
+ const packageJson2 = JSON.parse(import_fs20.default.readFileSync(packageJsonPath, "utf-8"));
2435
+ const srcFolder = import_fs20.default.existsSync(import_path20.default.join(projectDir, "src")) ? "src" : "";
2436
+ const __filename = (0, import_url19.fileURLToPath)(import_meta19.url);
2437
+ const __dirname = import_path20.default.dirname(__filename);
1528
2438
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
1529
- console.log(import_chalk13.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2439
+ console.log(import_chalk21.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
1530
2440
  packageManager("nodemailer");
1531
2441
  packageManager("@types/nodemailer", true);
1532
2442
  }
1533
2443
  if (!packageJson2.dependencies?.["@react-email/components"]) {
1534
- console.log(import_chalk13.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2444
+ console.log(import_chalk21.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
1535
2445
  packageManager("@react-email/components");
1536
2446
  }
1537
- const envPath = import_path12.default.join(projectDir, ".env");
1538
- const envContent = import_fs12.default.readFileSync(envPath, "utf8");
2447
+ const envPath = import_path20.default.join(projectDir, ".env");
2448
+ const envContent = import_fs20.default.readFileSync(envPath, "utf8");
1539
2449
  if (!envContent.includes("GMAIL_HOST") && !envContent.includes("GMAIL_PORT") && !envContent.includes("GMAIL_SERVICE") && !envContent.includes("GMAIL_MAIL") && !envContent.includes("GMAIL_NAME") && !envContent.includes("GMAIL_PASSWORD")) {
1540
- import_fs12.default.appendFileSync(envPath, `
2450
+ import_fs20.default.appendFileSync(envPath, `
1541
2451
 
1542
2452
  # Gmail API Key for sending emails`);
1543
- import_fs12.default.appendFileSync(envPath, `
2453
+ import_fs20.default.appendFileSync(envPath, `
1544
2454
  GMAIL_HOST=`);
1545
- import_fs12.default.appendFileSync(envPath, `
2455
+ import_fs20.default.appendFileSync(envPath, `
1546
2456
  GMAIL_PORT=`);
1547
- import_fs12.default.appendFileSync(envPath, `
2457
+ import_fs20.default.appendFileSync(envPath, `
1548
2458
  GMAIL_SERVICE=`);
1549
- import_fs12.default.appendFileSync(envPath, `
2459
+ import_fs20.default.appendFileSync(envPath, `
1550
2460
  GMAIL_MAIL=`);
1551
- import_fs12.default.appendFileSync(envPath, `
2461
+ import_fs20.default.appendFileSync(envPath, `
1552
2462
  GMAIL_NAME=`);
1553
- import_fs12.default.appendFileSync(envPath, `
2463
+ import_fs20.default.appendFileSync(envPath, `
1554
2464
  GMAIL_PASSWORD=`);
1555
2465
  }
1556
- const templatePath = import_path12.default.resolve(
2466
+ const templatePath = import_path20.default.resolve(
1557
2467
  __dirname,
1558
2468
  "./template/email/emailGmail.ts"
1559
2469
  );
1560
- const libPath = import_path12.default.join(projectDir, srcFolder, "lib");
1561
- if (!import_fs12.default.existsSync(libPath)) {
1562
- import_fs12.default.mkdirSync(libPath, { recursive: true });
2470
+ const libPath = import_path20.default.join(projectDir, srcFolder, "lib");
2471
+ if (!import_fs20.default.existsSync(libPath)) {
2472
+ import_fs20.default.mkdirSync(libPath, { recursive: true });
1563
2473
  }
1564
- const libDestinationPath = import_path12.default.join(libPath, "email.ts");
1565
- import_fs12.default.copyFileSync(templatePath, libDestinationPath);
2474
+ const libDestinationPath = import_path20.default.join(libPath, "email.ts");
2475
+ import_fs20.default.copyFileSync(templatePath, libDestinationPath);
1566
2476
  } catch (error) {
1567
- console.log(import_chalk13.default.red(error));
2477
+ console.log(import_chalk21.default.red(error));
1568
2478
  }
1569
2479
  };
1570
2480
 
1571
2481
  // email/gmailRunTanstackState.ts
1572
- var import_chalk14 = __toESM(require("chalk"), 1);
1573
- var import_path13 = __toESM(require("path"), 1);
1574
- var import_fs13 = __toESM(require("fs"), 1);
1575
- var import_url12 = require("url");
1576
- var import_meta12 = {};
2482
+ var import_chalk22 = __toESM(require("chalk"), 1);
2483
+ var import_path21 = __toESM(require("path"), 1);
2484
+ var import_fs21 = __toESM(require("fs"), 1);
2485
+ var import_url20 = require("url");
2486
+ var import_meta20 = {};
1577
2487
  var gmailRunTanstackState = async () => {
1578
2488
  try {
1579
2489
  const projectDir = process.cwd();
1580
- const packageJsonPath = import_path13.default.join(projectDir, "package.json");
1581
- const packageJson2 = JSON.parse(import_fs13.default.readFileSync(packageJsonPath, "utf-8"));
1582
- const __filename = (0, import_url12.fileURLToPath)(import_meta12.url);
1583
- const __dirname = import_path13.default.dirname(__filename);
2490
+ const packageJsonPath = import_path21.default.join(projectDir, "package.json");
2491
+ const packageJson2 = JSON.parse(import_fs21.default.readFileSync(packageJsonPath, "utf-8"));
2492
+ const __filename = (0, import_url20.fileURLToPath)(import_meta20.url);
2493
+ const __dirname = import_path21.default.dirname(__filename);
1584
2494
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
1585
- console.log(import_chalk14.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2495
+ console.log(import_chalk22.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
1586
2496
  packageManager("nodemailer");
1587
2497
  packageManager("@types/nodemailer", true);
1588
2498
  }
1589
2499
  if (!packageJson2.dependencies?.["@react-email/components"]) {
1590
- console.log(import_chalk14.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2500
+ console.log(import_chalk22.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
1591
2501
  packageManager("@react-email/components");
1592
2502
  }
1593
- const envPath = import_path13.default.join(projectDir, ".env");
1594
- const envContent = import_fs13.default.readFileSync(envPath, "utf8");
2503
+ const envPath = import_path21.default.join(projectDir, ".env");
2504
+ const envContent = import_fs21.default.readFileSync(envPath, "utf8");
1595
2505
  if (!envContent.includes("GMAIL_HOST") && !envContent.includes("GMAIL_PORT") && !envContent.includes("GMAIL_SERVICE") && !envContent.includes("GMAIL_MAIL") && !envContent.includes("GMAIL_NAME") && !envContent.includes("GMAIL_PASSWORD")) {
1596
- import_fs13.default.appendFileSync(envPath, `
2506
+ import_fs21.default.appendFileSync(envPath, `
1597
2507
 
1598
2508
  # Gmail API Key for sending emails`);
1599
- import_fs13.default.appendFileSync(envPath, `
2509
+ import_fs21.default.appendFileSync(envPath, `
1600
2510
  GMAIL_HOST=`);
1601
- import_fs13.default.appendFileSync(envPath, `
2511
+ import_fs21.default.appendFileSync(envPath, `
1602
2512
  GMAIL_PORT=`);
1603
- import_fs13.default.appendFileSync(envPath, `
2513
+ import_fs21.default.appendFileSync(envPath, `
1604
2514
  GMAIL_SERVICE=`);
1605
- import_fs13.default.appendFileSync(envPath, `
2515
+ import_fs21.default.appendFileSync(envPath, `
1606
2516
  GMAIL_MAIL=`);
1607
- import_fs13.default.appendFileSync(envPath, `
2517
+ import_fs21.default.appendFileSync(envPath, `
1608
2518
  GMAIL_NAME=`);
1609
- import_fs13.default.appendFileSync(envPath, `
2519
+ import_fs21.default.appendFileSync(envPath, `
1610
2520
  GMAIL_PASSWORD=`);
1611
2521
  }
1612
- const templatePath = import_path13.default.resolve(
2522
+ const templatePath = import_path21.default.resolve(
1613
2523
  __dirname,
1614
2524
  "./template/email/emailGmail.ts"
1615
2525
  );
1616
- const libPath = import_path13.default.join(projectDir, "src", "lib");
1617
- if (!import_fs13.default.existsSync(libPath)) {
1618
- import_fs13.default.mkdirSync(libPath, { recursive: true });
2526
+ const libPath = import_path21.default.join(projectDir, "src", "lib");
2527
+ if (!import_fs21.default.existsSync(libPath)) {
2528
+ import_fs21.default.mkdirSync(libPath, { recursive: true });
1619
2529
  }
1620
- const libDestinationPath = import_path13.default.join(libPath, "email.ts");
1621
- import_fs13.default.copyFileSync(templatePath, libDestinationPath);
2530
+ const libDestinationPath = import_path21.default.join(libPath, "email.ts");
2531
+ import_fs21.default.copyFileSync(templatePath, libDestinationPath);
1622
2532
  } catch (error) {
1623
- console.log(import_chalk14.default.red(error));
2533
+ console.log(import_chalk22.default.red(error));
1624
2534
  }
1625
2535
  };
1626
2536
 
1627
2537
  // email/awsSesRun.ts
1628
- var import_chalk15 = __toESM(require("chalk"), 1);
1629
- var import_path14 = __toESM(require("path"), 1);
1630
- var import_fs14 = __toESM(require("fs"), 1);
1631
- var import_url13 = require("url");
1632
- var import_meta13 = {};
2538
+ var import_chalk23 = __toESM(require("chalk"), 1);
2539
+ var import_path22 = __toESM(require("path"), 1);
2540
+ var import_fs22 = __toESM(require("fs"), 1);
2541
+ var import_url21 = require("url");
2542
+ var import_meta21 = {};
1633
2543
  var awsSesRun = async () => {
1634
2544
  try {
1635
2545
  const projectDir = process.cwd();
1636
- const packageJsonPath = import_path14.default.join(projectDir, "package.json");
1637
- const packageJson2 = JSON.parse(import_fs14.default.readFileSync(packageJsonPath, "utf-8"));
1638
- const srcFolder = import_fs14.default.existsSync(import_path14.default.join(projectDir, "src")) ? "src" : "";
1639
- const __filename = (0, import_url13.fileURLToPath)(import_meta13.url);
1640
- const __dirname = import_path14.default.dirname(__filename);
2546
+ const packageJsonPath = import_path22.default.join(projectDir, "package.json");
2547
+ const packageJson2 = JSON.parse(import_fs22.default.readFileSync(packageJsonPath, "utf-8"));
2548
+ const srcFolder = import_fs22.default.existsSync(import_path22.default.join(projectDir, "src")) ? "src" : "";
2549
+ const __filename = (0, import_url21.fileURLToPath)(import_meta21.url);
2550
+ const __dirname = import_path22.default.dirname(__filename);
1641
2551
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
1642
- console.log(import_chalk15.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2552
+ console.log(import_chalk23.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
1643
2553
  packageManager("nodemailer");
1644
2554
  packageManager("@types/nodemailer", true);
1645
2555
  }
1646
2556
  if (!packageJson2.dependencies?.["@react-email/components"]) {
1647
- console.log(import_chalk15.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2557
+ console.log(import_chalk23.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
1648
2558
  packageManager("@react-email/components");
1649
2559
  }
1650
- const envPath = import_path14.default.join(projectDir, ".env");
1651
- const envContent = import_fs14.default.readFileSync(envPath, "utf8");
2560
+ const envPath = import_path22.default.join(projectDir, ".env");
2561
+ const envContent = import_fs22.default.readFileSync(envPath, "utf8");
1652
2562
  if (!envContent.includes("AWS_SES_HOST") && !envContent.includes("AWS_SES_PORT") && !envContent.includes("AWS_SES_SERVICE") && !envContent.includes("AWS_SES_USER") && !envContent.includes("AWS_SES_PASS") && !envContent.includes("AWS_SES_FROM")) {
1653
- import_fs14.default.appendFileSync(envPath, `
2563
+ import_fs22.default.appendFileSync(envPath, `
1654
2564
 
1655
2565
  # AWS SES API Key for sending emails`);
1656
- import_fs14.default.appendFileSync(envPath, `
2566
+ import_fs22.default.appendFileSync(envPath, `
1657
2567
  AWS_SES_HOST=`);
1658
- import_fs14.default.appendFileSync(envPath, `
2568
+ import_fs22.default.appendFileSync(envPath, `
1659
2569
  AWS_SES_PORT=`);
1660
- import_fs14.default.appendFileSync(envPath, `
2570
+ import_fs22.default.appendFileSync(envPath, `
1661
2571
  AWS_SES_SERVICE=`);
1662
- import_fs14.default.appendFileSync(envPath, `
2572
+ import_fs22.default.appendFileSync(envPath, `
1663
2573
  AWS_SES_USER=`);
1664
- import_fs14.default.appendFileSync(envPath, `
2574
+ import_fs22.default.appendFileSync(envPath, `
1665
2575
  AWS_SES_PASS=`);
1666
- import_fs14.default.appendFileSync(envPath, `
2576
+ import_fs22.default.appendFileSync(envPath, `
1667
2577
  AWS_SES_FROM=`);
1668
2578
  }
1669
- const templatePath = import_path14.default.resolve(
2579
+ const templatePath = import_path22.default.resolve(
1670
2580
  __dirname,
1671
2581
  "./template/email/emailAwsSes.ts"
1672
2582
  );
1673
- const libPath = import_path14.default.join(projectDir, srcFolder, "lib");
1674
- if (!import_fs14.default.existsSync(libPath)) {
1675
- import_fs14.default.mkdirSync(libPath, { recursive: true });
2583
+ const libPath = import_path22.default.join(projectDir, srcFolder, "lib");
2584
+ if (!import_fs22.default.existsSync(libPath)) {
2585
+ import_fs22.default.mkdirSync(libPath, { recursive: true });
1676
2586
  }
1677
- const libDestinationPath = import_path14.default.join(libPath, "email.ts");
1678
- import_fs14.default.copyFileSync(templatePath, libDestinationPath);
2587
+ const libDestinationPath = import_path22.default.join(libPath, "email.ts");
2588
+ import_fs22.default.copyFileSync(templatePath, libDestinationPath);
1679
2589
  } catch (error) {
1680
- console.log(import_chalk15.default.red(error));
2590
+ console.log(import_chalk23.default.red(error));
1681
2591
  }
1682
2592
  };
1683
2593
 
1684
2594
  // email/awsSesRunTanstackState.ts
1685
- var import_chalk16 = __toESM(require("chalk"), 1);
1686
- var import_path15 = __toESM(require("path"), 1);
1687
- var import_fs15 = __toESM(require("fs"), 1);
1688
- var import_url14 = require("url");
1689
- var import_meta14 = {};
2595
+ var import_chalk24 = __toESM(require("chalk"), 1);
2596
+ var import_path23 = __toESM(require("path"), 1);
2597
+ var import_fs23 = __toESM(require("fs"), 1);
2598
+ var import_url22 = require("url");
2599
+ var import_meta22 = {};
1690
2600
  var awsSesRunTanstackState = async () => {
1691
2601
  try {
1692
2602
  const projectDir = process.cwd();
1693
- const packageJsonPath = import_path15.default.join(projectDir, "package.json");
1694
- const packageJson2 = JSON.parse(import_fs15.default.readFileSync(packageJsonPath, "utf-8"));
1695
- const __filename = (0, import_url14.fileURLToPath)(import_meta14.url);
1696
- const __dirname = import_path15.default.dirname(__filename);
2603
+ const packageJsonPath = import_path23.default.join(projectDir, "package.json");
2604
+ const packageJson2 = JSON.parse(import_fs23.default.readFileSync(packageJsonPath, "utf-8"));
2605
+ const __filename = (0, import_url22.fileURLToPath)(import_meta22.url);
2606
+ const __dirname = import_path23.default.dirname(__filename);
1697
2607
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
1698
- console.log(import_chalk16.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2608
+ console.log(import_chalk24.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
1699
2609
  packageManager("nodemailer");
1700
2610
  packageManager("@types/nodemailer", true);
1701
2611
  }
1702
2612
  if (!packageJson2.dependencies?.["@react-email/components"]) {
1703
- console.log(import_chalk16.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2613
+ console.log(import_chalk24.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
1704
2614
  packageManager("@react-email/components");
1705
2615
  }
1706
- const envPath = import_path15.default.join(projectDir, ".env");
1707
- const envContent = import_fs15.default.readFileSync(envPath, "utf8");
2616
+ const envPath = import_path23.default.join(projectDir, ".env");
2617
+ const envContent = import_fs23.default.readFileSync(envPath, "utf8");
1708
2618
  if (!envContent.includes("AWS_SES_HOST") && !envContent.includes("AWS_SES_PORT") && !envContent.includes("AWS_SES_SERVICE") && !envContent.includes("AWS_SES_USER") && !envContent.includes("AWS_SES_PASS") && !envContent.includes("AWS_SES_FROM")) {
1709
- import_fs15.default.appendFileSync(envPath, `
2619
+ import_fs23.default.appendFileSync(envPath, `
1710
2620
 
1711
2621
  # AWS SES API Key for sending emails`);
1712
- import_fs15.default.appendFileSync(envPath, `
2622
+ import_fs23.default.appendFileSync(envPath, `
1713
2623
  AWS_SES_HOST=`);
1714
- import_fs15.default.appendFileSync(envPath, `
2624
+ import_fs23.default.appendFileSync(envPath, `
1715
2625
  AWS_SES_PORT=`);
1716
- import_fs15.default.appendFileSync(envPath, `
2626
+ import_fs23.default.appendFileSync(envPath, `
1717
2627
  AWS_SES_SERVICE=`);
1718
- import_fs15.default.appendFileSync(envPath, `
2628
+ import_fs23.default.appendFileSync(envPath, `
1719
2629
  AWS_SES_USER=`);
1720
- import_fs15.default.appendFileSync(envPath, `
2630
+ import_fs23.default.appendFileSync(envPath, `
1721
2631
  AWS_SES_PASS=`);
1722
- import_fs15.default.appendFileSync(envPath, `
2632
+ import_fs23.default.appendFileSync(envPath, `
1723
2633
  AWS_SES_FROM=`);
1724
2634
  }
1725
- const templatePath = import_path15.default.resolve(
2635
+ const templatePath = import_path23.default.resolve(
1726
2636
  __dirname,
1727
2637
  "./template/email/emailAwsSes.ts"
1728
2638
  );
1729
- const libPath = import_path15.default.join(projectDir, "src", "lib");
1730
- if (!import_fs15.default.existsSync(libPath)) {
1731
- import_fs15.default.mkdirSync(libPath, { recursive: true });
2639
+ const libPath = import_path23.default.join(projectDir, "src", "lib");
2640
+ if (!import_fs23.default.existsSync(libPath)) {
2641
+ import_fs23.default.mkdirSync(libPath, { recursive: true });
1732
2642
  }
1733
- const libDestinationPath = import_path15.default.join(libPath, "email.ts");
1734
- import_fs15.default.copyFileSync(templatePath, libDestinationPath);
2643
+ const libDestinationPath = import_path23.default.join(libPath, "email.ts");
2644
+ import_fs23.default.copyFileSync(templatePath, libDestinationPath);
1735
2645
  } catch (error) {
1736
- console.log(import_chalk16.default.red(error));
2646
+ console.log(import_chalk24.default.red(error));
1737
2647
  }
1738
2648
  };
1739
2649
 
1740
2650
  // email/resendRun.ts
1741
- var import_chalk17 = __toESM(require("chalk"), 1);
1742
- var import_path16 = __toESM(require("path"), 1);
1743
- var import_fs16 = __toESM(require("fs"), 1);
1744
- var import_url15 = require("url");
1745
- var import_meta15 = {};
2651
+ var import_chalk25 = __toESM(require("chalk"), 1);
2652
+ var import_path24 = __toESM(require("path"), 1);
2653
+ var import_fs24 = __toESM(require("fs"), 1);
2654
+ var import_url23 = require("url");
2655
+ var import_meta23 = {};
1746
2656
  var resendRun = async () => {
1747
2657
  try {
1748
2658
  const projectDir = process.cwd();
1749
- const packageJsonPath = import_path16.default.join(projectDir, "package.json");
1750
- const packageJson2 = JSON.parse(import_fs16.default.readFileSync(packageJsonPath, "utf-8"));
1751
- const srcFolder = import_fs16.default.existsSync(import_path16.default.join(projectDir, "src")) ? "src" : "";
1752
- const __filename = (0, import_url15.fileURLToPath)(import_meta15.url);
1753
- const __dirname = import_path16.default.dirname(__filename);
2659
+ const packageJsonPath = import_path24.default.join(projectDir, "package.json");
2660
+ const packageJson2 = JSON.parse(import_fs24.default.readFileSync(packageJsonPath, "utf-8"));
2661
+ const srcFolder = import_fs24.default.existsSync(import_path24.default.join(projectDir, "src")) ? "src" : "";
2662
+ const __filename = (0, import_url23.fileURLToPath)(import_meta23.url);
2663
+ const __dirname = import_path24.default.dirname(__filename);
1754
2664
  if (!packageJson2.dependencies?.resend) {
1755
- console.log(import_chalk17.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
2665
+ console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
1756
2666
  packageManager("resend");
1757
2667
  }
1758
2668
  if (!packageJson2.dependencies?.["@react-email/components"]) {
1759
- console.log(import_chalk17.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2669
+ console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
1760
2670
  packageManager("@react-email/components");
1761
2671
  }
1762
- const envPath = import_path16.default.join(projectDir, ".env");
1763
- const envContent = import_fs16.default.readFileSync(envPath, "utf8");
2672
+ const envPath = import_path24.default.join(projectDir, ".env");
2673
+ const envContent = import_fs24.default.readFileSync(envPath, "utf8");
1764
2674
  if (!envContent.includes("RESEND_API_KEY") && !envContent.includes("EMAIL_SENDER_NAME") && !envContent.includes("EMAIL_SENDER_ADDRESS")) {
1765
- import_fs16.default.appendFileSync(envPath, `
2675
+ import_fs24.default.appendFileSync(envPath, `
1766
2676
 
1767
2677
  # Resend API Key for sending emails`);
1768
- import_fs16.default.appendFileSync(envPath, `
2678
+ import_fs24.default.appendFileSync(envPath, `
1769
2679
  RESEND_API_KEY=`);
1770
- import_fs16.default.appendFileSync(envPath, `
2680
+ import_fs24.default.appendFileSync(envPath, `
1771
2681
  EMAIL_SENDER_NAME=Your Name`);
1772
- import_fs16.default.appendFileSync(envPath, `
2682
+ import_fs24.default.appendFileSync(envPath, `
1773
2683
  EMAIL_SENDER_ADDRESS=`);
1774
2684
  }
1775
- const templatePath = import_path16.default.resolve(
2685
+ const templatePath = import_path24.default.resolve(
1776
2686
  __dirname,
1777
2687
  "./template/email/emailResend.ts"
1778
2688
  );
1779
- const libPath = import_path16.default.join(projectDir, srcFolder, "lib");
1780
- if (!import_fs16.default.existsSync(libPath)) {
1781
- import_fs16.default.mkdirSync(libPath, { recursive: true });
2689
+ const libPath = import_path24.default.join(projectDir, srcFolder, "lib");
2690
+ if (!import_fs24.default.existsSync(libPath)) {
2691
+ import_fs24.default.mkdirSync(libPath, { recursive: true });
1782
2692
  }
1783
- const libDestinationPath = import_path16.default.join(libPath, "email.ts");
1784
- import_fs16.default.copyFileSync(templatePath, libDestinationPath);
2693
+ const libDestinationPath = import_path24.default.join(libPath, "email.ts");
2694
+ import_fs24.default.copyFileSync(templatePath, libDestinationPath);
1785
2695
  } catch (error) {
1786
- console.log(import_chalk17.default.red(error));
2696
+ console.log(import_chalk25.default.red(error));
1787
2697
  }
1788
2698
  };
1789
2699
 
1790
2700
  // email/resendRunTanstackState.ts
1791
- var import_chalk18 = __toESM(require("chalk"), 1);
1792
- var import_path17 = __toESM(require("path"), 1);
1793
- var import_fs17 = __toESM(require("fs"), 1);
1794
- var import_url16 = require("url");
1795
- var import_meta16 = {};
2701
+ var import_chalk26 = __toESM(require("chalk"), 1);
2702
+ var import_path25 = __toESM(require("path"), 1);
2703
+ var import_fs25 = __toESM(require("fs"), 1);
2704
+ var import_url24 = require("url");
2705
+ var import_meta24 = {};
1796
2706
  var resendRunTanstackState = async () => {
1797
2707
  try {
1798
2708
  const projectDir = process.cwd();
1799
- const packageJsonPath = import_path17.default.join(projectDir, "package.json");
1800
- const packageJson2 = JSON.parse(import_fs17.default.readFileSync(packageJsonPath, "utf-8"));
1801
- const __filename = (0, import_url16.fileURLToPath)(import_meta16.url);
1802
- const __dirname = import_path17.default.dirname(__filename);
2709
+ const packageJsonPath = import_path25.default.join(projectDir, "package.json");
2710
+ const packageJson2 = JSON.parse(import_fs25.default.readFileSync(packageJsonPath, "utf-8"));
2711
+ const __filename = (0, import_url24.fileURLToPath)(import_meta24.url);
2712
+ const __dirname = import_path25.default.dirname(__filename);
1803
2713
  if (!packageJson2.dependencies?.resend) {
1804
- console.log(import_chalk18.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
2714
+ console.log(import_chalk26.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
1805
2715
  packageManager("resend");
1806
2716
  }
1807
2717
  if (!packageJson2.dependencies?.["@react-email/components"]) {
1808
- console.log(import_chalk18.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2718
+ console.log(import_chalk26.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
1809
2719
  packageManager("@react-email/components");
1810
2720
  }
1811
- const envPath = import_path17.default.join(projectDir, ".env");
1812
- const envContent = import_fs17.default.readFileSync(envPath, "utf8");
2721
+ const envPath = import_path25.default.join(projectDir, ".env");
2722
+ const envContent = import_fs25.default.readFileSync(envPath, "utf8");
1813
2723
  if (!envContent.includes("RESEND_API_KEY") && !envContent.includes("EMAIL_SENDER_NAME") && !envContent.includes("EMAIL_SENDER_ADDRESS")) {
1814
- import_fs17.default.appendFileSync(envPath, `
2724
+ import_fs25.default.appendFileSync(envPath, `
1815
2725
 
1816
2726
  # Resend API Key for sending emails`);
1817
- import_fs17.default.appendFileSync(envPath, `
2727
+ import_fs25.default.appendFileSync(envPath, `
1818
2728
  RESEND_API_KEY=`);
1819
- import_fs17.default.appendFileSync(envPath, `
2729
+ import_fs25.default.appendFileSync(envPath, `
1820
2730
  EMAIL_SENDER_NAME=Your Name`);
1821
- import_fs17.default.appendFileSync(envPath, `
2731
+ import_fs25.default.appendFileSync(envPath, `
1822
2732
  EMAIL_SENDER_ADDRESS=`);
1823
2733
  }
1824
- const templatePath = import_path17.default.resolve(
2734
+ const templatePath = import_path25.default.resolve(
1825
2735
  __dirname,
1826
2736
  "./template/email/emailResend.ts"
1827
2737
  );
1828
- const libPath = import_path17.default.join(projectDir, "src", "lib");
1829
- if (!import_fs17.default.existsSync(libPath)) {
1830
- import_fs17.default.mkdirSync(libPath, { recursive: true });
2738
+ const libPath = import_path25.default.join(projectDir, "src", "lib");
2739
+ if (!import_fs25.default.existsSync(libPath)) {
2740
+ import_fs25.default.mkdirSync(libPath, { recursive: true });
1831
2741
  }
1832
- const libDestinationPath = import_path17.default.join(libPath, "email.ts");
1833
- import_fs17.default.copyFileSync(templatePath, libDestinationPath);
2742
+ const libDestinationPath = import_path25.default.join(libPath, "email.ts");
2743
+ import_fs25.default.copyFileSync(templatePath, libDestinationPath);
1834
2744
  } catch (error) {
1835
- console.log(import_chalk18.default.red(error));
2745
+ console.log(import_chalk26.default.red(error));
1836
2746
  }
1837
2747
  };
1838
2748
 
1839
2749
  // cli/email.ts
1840
- var import_chalk19 = __toESM(require("chalk"), 1);
2750
+ var import_chalk27 = __toESM(require("chalk"), 1);
1841
2751
  var email = async () => {
1842
2752
  const projectDir = process.cwd();
1843
2753
  const { framework, error } = await getFramework();
1844
2754
  if (error) {
1845
- console.log(import_chalk19.default.red(error));
2755
+ console.log(import_chalk27.default.red(error));
1846
2756
  return;
1847
2757
  }
1848
2758
  if (framework === "Next js") {
1849
- const srcFolder = import_fs18.default.existsSync(import_path18.default.join(projectDir, "src")) ? "src" : "";
1850
- const emailPath = import_path18.default.join(projectDir, srcFolder, "lib", "email.ts");
1851
- if (import_fs18.default.existsSync(emailPath)) {
2759
+ const srcFolder = import_fs26.default.existsSync(import_path26.default.join(projectDir, "src")) ? "src" : "";
2760
+ const emailPath = import_path26.default.join(projectDir, srcFolder, "lib", "email.ts");
2761
+ if (import_fs26.default.existsSync(emailPath)) {
1852
2762
  const answers2 = await import_inquirer4.default.prompt([
1853
2763
  {
1854
2764
  type: "confirm",
@@ -1863,12 +2773,12 @@ var email = async () => {
1863
2773
  }
1864
2774
  }
1865
2775
  if (framework === "tanstack state") {
1866
- const srcFolderTanstackState = import_path18.default.join(projectDir, "src");
1867
- const libPathTanstackState = import_path18.default.join(
2776
+ const srcFolderTanstackState = import_path26.default.join(projectDir, "src");
2777
+ const libPathTanstackState = import_path26.default.join(
1868
2778
  srcFolderTanstackState,
1869
2779
  "lib/email.ts"
1870
2780
  );
1871
- if (import_fs18.default.existsSync(libPathTanstackState)) {
2781
+ if (import_fs26.default.existsSync(libPathTanstackState)) {
1872
2782
  const answers2 = await import_inquirer4.default.prompt([
1873
2783
  {
1874
2784
  type: "confirm",
@@ -1911,24 +2821,24 @@ var email = async () => {
1911
2821
  };
1912
2822
 
1913
2823
  // script/forgetNext.ts
1914
- var import_meta17 = {};
2824
+ var import_meta25 = {};
1915
2825
  var forgetNext = async () => {
1916
2826
  try {
1917
2827
  const projectDir = process.cwd();
1918
- const __filename = (0, import_url17.fileURLToPath)(import_meta17.url);
1919
- const __dirname = import_path19.default.dirname(__filename);
1920
- const srcPath = import_path19.default.join(projectDir, "src");
1921
- const folder = import_fs19.default.existsSync(srcPath) ? "src" : "";
1922
- const emailFilePath = import_path19.default.join(projectDir, folder, "lib", "email.ts");
1923
- if (!import_fs19.default.existsSync(emailFilePath)) {
2828
+ const __filename = (0, import_url25.fileURLToPath)(import_meta25.url);
2829
+ const __dirname = import_path27.default.dirname(__filename);
2830
+ const srcPath = import_path27.default.join(projectDir, "src");
2831
+ const folder = import_fs27.default.existsSync(srcPath) ? "src" : "";
2832
+ const emailFilePath = import_path27.default.join(projectDir, folder, "lib", "email.ts");
2833
+ if (!import_fs27.default.existsSync(emailFilePath)) {
1924
2834
  await email();
1925
2835
  }
1926
- const authFilePath = import_path19.default.join(projectDir, folder, "lib", "auth.ts");
1927
- if (!import_fs19.default.existsSync(authFilePath)) {
1928
- console.log(import_chalk20.default.red("auth.ts file not found."));
2836
+ const authFilePath = import_path27.default.join(projectDir, folder, "lib", "auth.ts");
2837
+ if (!import_fs27.default.existsSync(authFilePath)) {
2838
+ console.log(import_chalk28.default.red("auth.ts file not found."));
1929
2839
  return;
1930
2840
  }
1931
- let content = import_fs19.default.readFileSync(authFilePath, "utf8");
2841
+ let content = import_fs27.default.readFileSync(authFilePath, "utf8");
1932
2842
  const codeAdded = ` sendResetPassword: async ({ user, url, token }) => {
1933
2843
  await sendEmail({
1934
2844
  email: user.email!,
@@ -1972,7 +2882,7 @@ var forgetNext = async () => {
1972
2882
  content = before + `
1973
2883
  ${codeAdded}` + after;
1974
2884
  }
1975
- import_fs19.default.writeFileSync(authFilePath, content, "utf8");
2885
+ import_fs27.default.writeFileSync(authFilePath, content, "utf8");
1976
2886
  if (!content.includes("import { sendEmail }")) {
1977
2887
  const lastImportIndex = content.lastIndexOf("import");
1978
2888
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
@@ -1982,129 +2892,129 @@ var forgetNext = async () => {
1982
2892
  import { sendEmail } from "./email";
1983
2893
  `;
1984
2894
  content = beforeImports + newImports + afterImports;
1985
- import_fs19.default.writeFileSync(authFilePath, content, "utf8");
2895
+ import_fs27.default.writeFileSync(authFilePath, content, "utf8");
1986
2896
  }
1987
- const componentPath = import_path19.default.resolve(
2897
+ const componentPath = import_path27.default.resolve(
1988
2898
  __dirname,
1989
2899
  "./template/email/reset-password.tsx"
1990
2900
  );
1991
- const destinationPath = import_path19.default.join(
2901
+ const destinationPath = import_path27.default.join(
1992
2902
  projectDir,
1993
2903
  folder,
1994
2904
  "components",
1995
2905
  "email"
1996
2906
  );
1997
- if (!import_fs19.default.existsSync(destinationPath)) {
1998
- import_fs19.default.mkdirSync(destinationPath, { recursive: true });
2907
+ if (!import_fs27.default.existsSync(destinationPath)) {
2908
+ import_fs27.default.mkdirSync(destinationPath, { recursive: true });
1999
2909
  }
2000
- const emailDestinationPath = import_path19.default.join(
2910
+ const emailDestinationPath = import_path27.default.join(
2001
2911
  destinationPath,
2002
2912
  "reset-password.tsx"
2003
2913
  );
2004
- if (import_fs19.default.existsSync(componentPath)) {
2005
- import_fs19.default.copyFileSync(componentPath, emailDestinationPath);
2914
+ if (import_fs27.default.existsSync(componentPath)) {
2915
+ import_fs27.default.copyFileSync(componentPath, emailDestinationPath);
2006
2916
  }
2007
- const forgetComponentPath = import_path19.default.resolve(
2917
+ const forgetComponentPath = import_path27.default.resolve(
2008
2918
  __dirname,
2009
2919
  "./template/components/ForgetComponent.tsx"
2010
2920
  );
2011
- const componentsDestinationPath = import_path19.default.join(
2921
+ const componentsDestinationPath = import_path27.default.join(
2012
2922
  projectDir,
2013
2923
  folder,
2014
2924
  "components",
2015
2925
  "authverse"
2016
2926
  );
2017
- if (!import_fs19.default.existsSync(componentsDestinationPath)) {
2018
- import_fs19.default.mkdirSync(componentsDestinationPath, { recursive: true });
2927
+ if (!import_fs27.default.existsSync(componentsDestinationPath)) {
2928
+ import_fs27.default.mkdirSync(componentsDestinationPath, { recursive: true });
2019
2929
  }
2020
- const forgetDestinationPath = import_path19.default.join(
2930
+ const forgetDestinationPath = import_path27.default.join(
2021
2931
  componentsDestinationPath,
2022
2932
  "ForgetComponent.tsx"
2023
2933
  );
2024
- if (import_fs19.default.existsSync(forgetComponentPath)) {
2025
- import_fs19.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
2934
+ if (import_fs27.default.existsSync(forgetComponentPath)) {
2935
+ import_fs27.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
2026
2936
  }
2027
- const resetComponentPath = import_path19.default.resolve(
2937
+ const resetComponentPath = import_path27.default.resolve(
2028
2938
  __dirname,
2029
2939
  "./template/components/ResetComponent.tsx"
2030
2940
  );
2031
- const resetDestinationPath = import_path19.default.join(
2941
+ const resetDestinationPath = import_path27.default.join(
2032
2942
  componentsDestinationPath,
2033
2943
  "ResetComponent.tsx"
2034
2944
  );
2035
- if (import_fs19.default.existsSync(resetComponentPath)) {
2036
- import_fs19.default.copyFileSync(resetComponentPath, resetDestinationPath);
2945
+ if (import_fs27.default.existsSync(resetComponentPath)) {
2946
+ import_fs27.default.copyFileSync(resetComponentPath, resetDestinationPath);
2037
2947
  }
2038
- const authTemplatePath = import_path19.default.resolve(
2948
+ const authTemplatePath = import_path27.default.resolve(
2039
2949
  __dirname,
2040
2950
  "./template/app-auth-uiDesign"
2041
2951
  );
2042
- const appDestinationPath = import_path19.default.join(projectDir, folder, "app", "auth");
2043
- if (!import_fs19.default.existsSync(appDestinationPath)) {
2044
- import_fs19.default.mkdirSync(appDestinationPath, { recursive: true });
2952
+ const appDestinationPath = import_path27.default.join(projectDir, folder, "app", "auth");
2953
+ if (!import_fs27.default.existsSync(appDestinationPath)) {
2954
+ import_fs27.default.mkdirSync(appDestinationPath, { recursive: true });
2045
2955
  }
2046
- const forgetDestinationDir = import_path19.default.join(appDestinationPath, "forget");
2047
- if (!import_fs19.default.existsSync(forgetDestinationDir)) {
2048
- import_fs19.default.mkdirSync(forgetDestinationDir, { recursive: true });
2956
+ const forgetDestinationDir = import_path27.default.join(appDestinationPath, "forget");
2957
+ if (!import_fs27.default.existsSync(forgetDestinationDir)) {
2958
+ import_fs27.default.mkdirSync(forgetDestinationDir, { recursive: true });
2049
2959
  }
2050
- const forgetPageDestinationPath = import_path19.default.join(
2960
+ const forgetPageDestinationPath = import_path27.default.join(
2051
2961
  forgetDestinationDir,
2052
2962
  "page.tsx"
2053
2963
  );
2054
- import_fs19.default.copyFileSync(
2964
+ import_fs27.default.copyFileSync(
2055
2965
  `${authTemplatePath}/forget/page.tsx`,
2056
2966
  forgetPageDestinationPath
2057
2967
  );
2058
- const resetDestinationDir = import_path19.default.join(
2968
+ const resetDestinationDir = import_path27.default.join(
2059
2969
  appDestinationPath,
2060
2970
  "reset-password"
2061
2971
  );
2062
- if (!import_fs19.default.existsSync(resetDestinationDir)) {
2063
- import_fs19.default.mkdirSync(resetDestinationDir, { recursive: true });
2972
+ if (!import_fs27.default.existsSync(resetDestinationDir)) {
2973
+ import_fs27.default.mkdirSync(resetDestinationDir, { recursive: true });
2064
2974
  }
2065
- const resetPageDestinationPath = import_path19.default.join(
2975
+ const resetPageDestinationPath = import_path27.default.join(
2066
2976
  resetDestinationDir,
2067
2977
  "page.tsx"
2068
2978
  );
2069
- import_fs19.default.copyFileSync(
2979
+ import_fs27.default.copyFileSync(
2070
2980
  `${authTemplatePath}/reset-password/page.tsx`,
2071
2981
  resetPageDestinationPath
2072
2982
  );
2073
2983
  console.log(
2074
- import_chalk20.default.green("Successfully added forget and reset-password pages")
2984
+ import_chalk28.default.green("Successfully added forget and reset-password pages")
2075
2985
  );
2076
2986
  } else {
2077
2987
  console.log(
2078
- import_chalk20.default.red("Could not find emailAndPassword configuration in auth.ts")
2988
+ import_chalk28.default.red("Could not find emailAndPassword configuration in auth.ts")
2079
2989
  );
2080
2990
  }
2081
2991
  } catch (error) {
2082
- console.log(import_chalk20.default.red("Error adding sendResetPassword:"), error);
2992
+ console.log(import_chalk28.default.red("Error adding sendResetPassword:"), error);
2083
2993
  }
2084
2994
  };
2085
2995
 
2086
2996
  // script/forgetTanstack.ts
2087
- var import_chalk21 = __toESM(require("chalk"), 1);
2088
- var import_path20 = __toESM(require("path"), 1);
2089
- var import_url18 = require("url");
2090
- var import_fs20 = __toESM(require("fs"), 1);
2091
- var import_meta18 = {};
2997
+ var import_chalk29 = __toESM(require("chalk"), 1);
2998
+ var import_path28 = __toESM(require("path"), 1);
2999
+ var import_url26 = require("url");
3000
+ var import_fs28 = __toESM(require("fs"), 1);
3001
+ var import_meta26 = {};
2092
3002
  var forgetTanstack = async () => {
2093
3003
  try {
2094
3004
  const projectDir = process.cwd();
2095
- const __filename = (0, import_url18.fileURLToPath)(import_meta18.url);
2096
- const __dirname = import_path20.default.dirname(__filename);
2097
- const srcPath = import_path20.default.join(projectDir, "src");
2098
- const emailFilePath = import_path20.default.join(srcPath, "lib", "email.ts");
2099
- if (!import_fs20.default.existsSync(emailFilePath)) {
3005
+ const __filename = (0, import_url26.fileURLToPath)(import_meta26.url);
3006
+ const __dirname = import_path28.default.dirname(__filename);
3007
+ const srcPath = import_path28.default.join(projectDir, "src");
3008
+ const emailFilePath = import_path28.default.join(srcPath, "lib", "email.ts");
3009
+ if (!import_fs28.default.existsSync(emailFilePath)) {
2100
3010
  await email();
2101
3011
  }
2102
- const authFilePath = import_path20.default.join(srcPath, "lib", "auth.ts");
2103
- if (!import_fs20.default.existsSync(authFilePath)) {
2104
- console.log(import_chalk21.default.red("auth.ts file not found."));
3012
+ const authFilePath = import_path28.default.join(srcPath, "lib", "auth.ts");
3013
+ if (!import_fs28.default.existsSync(authFilePath)) {
3014
+ console.log(import_chalk29.default.red("auth.ts file not found."));
2105
3015
  return;
2106
3016
  }
2107
- let content = import_fs20.default.readFileSync(authFilePath, "utf8");
3017
+ let content = import_fs28.default.readFileSync(authFilePath, "utf8");
2108
3018
  const codeAdded = `sendResetPassword: async ({ user, url, token }) => {
2109
3019
  await sendEmail({
2110
3020
  email: user.email!,
@@ -2148,7 +3058,7 @@ var forgetTanstack = async () => {
2148
3058
  content = before + `
2149
3059
  ${codeAdded}` + after;
2150
3060
  }
2151
- import_fs20.default.writeFileSync(authFilePath, content, "utf8");
3061
+ import_fs28.default.writeFileSync(authFilePath, content, "utf8");
2152
3062
  if (!content.includes("import { sendEmail }")) {
2153
3063
  const lastImportIndex = content.lastIndexOf("import");
2154
3064
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
@@ -2158,96 +3068,96 @@ var forgetTanstack = async () => {
2158
3068
  import { sendEmail } from "./email";
2159
3069
  `;
2160
3070
  content = beforeImports + newImports + afterImports;
2161
- import_fs20.default.writeFileSync(authFilePath, content, "utf8");
3071
+ import_fs28.default.writeFileSync(authFilePath, content, "utf8");
2162
3072
  }
2163
- const componentPath = import_path20.default.resolve(
3073
+ const componentPath = import_path28.default.resolve(
2164
3074
  __dirname,
2165
3075
  "./template/email/reset-password.tsx"
2166
3076
  );
2167
- const destinationPath = import_path20.default.join(srcPath, "components", "email");
2168
- if (!import_fs20.default.existsSync(destinationPath)) {
2169
- import_fs20.default.mkdirSync(destinationPath, { recursive: true });
3077
+ const destinationPath = import_path28.default.join(srcPath, "components", "email");
3078
+ if (!import_fs28.default.existsSync(destinationPath)) {
3079
+ import_fs28.default.mkdirSync(destinationPath, { recursive: true });
2170
3080
  }
2171
- const emailDestinationPath = import_path20.default.join(
3081
+ const emailDestinationPath = import_path28.default.join(
2172
3082
  destinationPath,
2173
3083
  "reset-password.tsx"
2174
3084
  );
2175
- if (import_fs20.default.existsSync(componentPath)) {
2176
- import_fs20.default.copyFileSync(componentPath, emailDestinationPath);
3085
+ if (import_fs28.default.existsSync(componentPath)) {
3086
+ import_fs28.default.copyFileSync(componentPath, emailDestinationPath);
2177
3087
  }
2178
- const forgetComponentPath = import_path20.default.resolve(
3088
+ const forgetComponentPath = import_path28.default.resolve(
2179
3089
  __dirname,
2180
3090
  "./template/TanstackState/components/ForgetComponent.tsx"
2181
3091
  );
2182
- const componentsDestinationPath = import_path20.default.join(
3092
+ const componentsDestinationPath = import_path28.default.join(
2183
3093
  srcPath,
2184
3094
  "components",
2185
3095
  "authverse"
2186
3096
  );
2187
- if (!import_fs20.default.existsSync(componentsDestinationPath)) {
2188
- import_fs20.default.mkdirSync(componentsDestinationPath, { recursive: true });
3097
+ if (!import_fs28.default.existsSync(componentsDestinationPath)) {
3098
+ import_fs28.default.mkdirSync(componentsDestinationPath, { recursive: true });
2189
3099
  }
2190
- const forgetDestinationPath = import_path20.default.join(
3100
+ const forgetDestinationPath = import_path28.default.join(
2191
3101
  componentsDestinationPath,
2192
3102
  "ForgetComponent.tsx"
2193
3103
  );
2194
- if (import_fs20.default.existsSync(forgetComponentPath)) {
2195
- import_fs20.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
3104
+ if (import_fs28.default.existsSync(forgetComponentPath)) {
3105
+ import_fs28.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
2196
3106
  }
2197
- const resetComponentPath = import_path20.default.resolve(
3107
+ const resetComponentPath = import_path28.default.resolve(
2198
3108
  __dirname,
2199
3109
  "./template/TanstackState/components/ResetComponent.tsx"
2200
3110
  );
2201
- const resetDestinationPath = import_path20.default.join(
3111
+ const resetDestinationPath = import_path28.default.join(
2202
3112
  componentsDestinationPath,
2203
3113
  "ResetComponent.tsx"
2204
3114
  );
2205
- if (import_fs20.default.existsSync(resetComponentPath)) {
2206
- import_fs20.default.copyFileSync(resetComponentPath, resetDestinationPath);
3115
+ if (import_fs28.default.existsSync(resetComponentPath)) {
3116
+ import_fs28.default.copyFileSync(resetComponentPath, resetDestinationPath);
2207
3117
  }
2208
- const authTemplatePath = import_path20.default.resolve(
3118
+ const authTemplatePath = import_path28.default.resolve(
2209
3119
  __dirname,
2210
3120
  "./template/TanstackState/routes/auth"
2211
3121
  );
2212
- const routesDestinationPath = import_path20.default.join(srcPath, "routes", "auth");
2213
- if (!import_fs20.default.existsSync(routesDestinationPath)) {
2214
- import_fs20.default.mkdirSync(routesDestinationPath, { recursive: true });
3122
+ const routesDestinationPath = import_path28.default.join(srcPath, "routes", "auth");
3123
+ if (!import_fs28.default.existsSync(routesDestinationPath)) {
3124
+ import_fs28.default.mkdirSync(routesDestinationPath, { recursive: true });
2215
3125
  }
2216
- const forgetPageDestinationPath = import_path20.default.join(
3126
+ const forgetPageDestinationPath = import_path28.default.join(
2217
3127
  routesDestinationPath,
2218
3128
  "forget.tsx"
2219
3129
  );
2220
- import_fs20.default.copyFileSync(
3130
+ import_fs28.default.copyFileSync(
2221
3131
  `${authTemplatePath}/forget.tsx`,
2222
3132
  forgetPageDestinationPath
2223
3133
  );
2224
- const resetPageDestinationPath = import_path20.default.join(
3134
+ const resetPageDestinationPath = import_path28.default.join(
2225
3135
  routesDestinationPath,
2226
3136
  "reset-password.tsx"
2227
3137
  );
2228
- import_fs20.default.copyFileSync(
3138
+ import_fs28.default.copyFileSync(
2229
3139
  `${authTemplatePath}/reset-password.tsx`,
2230
3140
  resetPageDestinationPath
2231
3141
  );
2232
3142
  console.log(
2233
- import_chalk21.default.green("Successfully added forget and reset-password pages")
3143
+ import_chalk29.default.green("Successfully added forget and reset-password pages")
2234
3144
  );
2235
3145
  } else {
2236
3146
  console.log(
2237
- import_chalk21.default.red("Could not find emailAndPassword configuration in auth.ts")
3147
+ import_chalk29.default.red("Could not find emailAndPassword configuration in auth.ts")
2238
3148
  );
2239
3149
  }
2240
3150
  } catch (error) {
2241
- console.log(import_chalk21.default.red("Error adding sendResetPassword:"), error);
3151
+ console.log(import_chalk29.default.red("Error adding sendResetPassword:"), error);
2242
3152
  }
2243
3153
  };
2244
3154
 
2245
3155
  // cli/forget.ts
2246
- var import_chalk22 = __toESM(require("chalk"), 1);
3156
+ var import_chalk30 = __toESM(require("chalk"), 1);
2247
3157
  var forget = async () => {
2248
3158
  const { framework, error } = await getFramework();
2249
3159
  if (error) {
2250
- console.log(import_chalk22.default.red(error));
3160
+ console.log(import_chalk30.default.red(error));
2251
3161
  return;
2252
3162
  }
2253
3163
  if (framework === "Next js") {
@@ -2259,31 +3169,31 @@ var forget = async () => {
2259
3169
  };
2260
3170
 
2261
3171
  // cli/verification.ts
2262
- var import_chalk25 = __toESM(require("chalk"), 1);
3172
+ var import_chalk33 = __toESM(require("chalk"), 1);
2263
3173
 
2264
3174
  // script/verifyNext.ts
2265
- var import_chalk23 = __toESM(require("chalk"), 1);
2266
- var import_fs21 = __toESM(require("fs"), 1);
2267
- var import_path21 = __toESM(require("path"), 1);
2268
- var import_url19 = require("url");
2269
- var import_meta19 = {};
3175
+ var import_chalk31 = __toESM(require("chalk"), 1);
3176
+ var import_fs29 = __toESM(require("fs"), 1);
3177
+ var import_path29 = __toESM(require("path"), 1);
3178
+ var import_url27 = require("url");
3179
+ var import_meta27 = {};
2270
3180
  var verifyNext = async () => {
2271
3181
  try {
2272
3182
  const projectDir = process.cwd();
2273
- const __filename = (0, import_url19.fileURLToPath)(import_meta19.url);
2274
- const __dirname = import_path21.default.dirname(__filename);
2275
- const srcPath = import_path21.default.join(projectDir, "src");
2276
- const folder = import_fs21.default.existsSync(srcPath) ? "src" : "";
2277
- const emailFilePath = import_path21.default.join(projectDir, folder, "lib", "email.ts");
2278
- if (!import_fs21.default.existsSync(emailFilePath)) {
3183
+ const __filename = (0, import_url27.fileURLToPath)(import_meta27.url);
3184
+ const __dirname = import_path29.default.dirname(__filename);
3185
+ const srcPath = import_path29.default.join(projectDir, "src");
3186
+ const folder = import_fs29.default.existsSync(srcPath) ? "src" : "";
3187
+ const emailFilePath = import_path29.default.join(projectDir, folder, "lib", "email.ts");
3188
+ if (!import_fs29.default.existsSync(emailFilePath)) {
2279
3189
  await email();
2280
3190
  }
2281
- const authFilePath = import_path21.default.join(projectDir, folder, "lib", "auth.ts");
2282
- if (!import_fs21.default.existsSync(authFilePath)) {
2283
- console.log(import_chalk23.default.red("auth.ts file not found."));
3191
+ const authFilePath = import_path29.default.join(projectDir, folder, "lib", "auth.ts");
3192
+ if (!import_fs29.default.existsSync(authFilePath)) {
3193
+ console.log(import_chalk31.default.red("auth.ts file not found."));
2284
3194
  return;
2285
3195
  }
2286
- let content = import_fs21.default.readFileSync(authFilePath, "utf8");
3196
+ let content = import_fs29.default.readFileSync(authFilePath, "utf8");
2287
3197
  if (content.includes("emailAndPassword: {")) {
2288
3198
  const start = content.indexOf("emailAndPassword: {");
2289
3199
  let end = start;
@@ -2343,47 +3253,47 @@ var verifyNext = async () => {
2343
3253
  `;
2344
3254
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2345
3255
  }
2346
- import_fs21.default.writeFileSync(authFilePath, content, "utf8");
2347
- const templatePath = import_path21.default.resolve(
3256
+ import_fs29.default.writeFileSync(authFilePath, content, "utf8");
3257
+ const templatePath = import_path29.default.resolve(
2348
3258
  __dirname,
2349
3259
  "./template/email/EmailVerification.tsx"
2350
3260
  );
2351
- const componentsDir = import_path21.default.join(projectDir, folder, "components", "email");
2352
- if (!import_fs21.default.existsSync(componentsDir)) {
2353
- import_fs21.default.mkdirSync(componentsDir, { recursive: true });
3261
+ const componentsDir = import_path29.default.join(projectDir, folder, "components", "email");
3262
+ if (!import_fs29.default.existsSync(componentsDir)) {
3263
+ import_fs29.default.mkdirSync(componentsDir, { recursive: true });
2354
3264
  }
2355
- const destFile = import_path21.default.join(componentsDir, "EmailVerification.tsx");
2356
- if (import_fs21.default.existsSync(templatePath) && !import_fs21.default.existsSync(destFile)) {
2357
- import_fs21.default.copyFileSync(templatePath, destFile);
3265
+ const destFile = import_path29.default.join(componentsDir, "EmailVerification.tsx");
3266
+ if (import_fs29.default.existsSync(templatePath) && !import_fs29.default.existsSync(destFile)) {
3267
+ import_fs29.default.copyFileSync(templatePath, destFile);
2358
3268
  }
2359
- console.log(import_chalk23.default.green("Email verification successfully configured"));
3269
+ console.log(import_chalk31.default.green("Email verification successfully configured"));
2360
3270
  } catch (error) {
2361
- console.log(import_chalk23.default.red(String(error)));
3271
+ console.log(import_chalk31.default.red(String(error)));
2362
3272
  }
2363
3273
  };
2364
3274
 
2365
3275
  // script/verifyTanstack.ts
2366
- var import_chalk24 = __toESM(require("chalk"), 1);
2367
- var import_fs22 = __toESM(require("fs"), 1);
2368
- var import_path22 = __toESM(require("path"), 1);
2369
- var import_url20 = require("url");
2370
- var import_meta20 = {};
3276
+ var import_chalk32 = __toESM(require("chalk"), 1);
3277
+ var import_fs30 = __toESM(require("fs"), 1);
3278
+ var import_path30 = __toESM(require("path"), 1);
3279
+ var import_url28 = require("url");
3280
+ var import_meta28 = {};
2371
3281
  var verifyTanstack = async () => {
2372
3282
  try {
2373
3283
  const projectDir = process.cwd();
2374
- const __filename = (0, import_url20.fileURLToPath)(import_meta20.url);
2375
- const __dirname = import_path22.default.dirname(__filename);
2376
- const srcPath = import_path22.default.join(projectDir, "src");
2377
- const emailFilePath = import_path22.default.join(srcPath, "lib", "email.ts");
2378
- if (!import_fs22.default.existsSync(emailFilePath)) {
3284
+ const __filename = (0, import_url28.fileURLToPath)(import_meta28.url);
3285
+ const __dirname = import_path30.default.dirname(__filename);
3286
+ const srcPath = import_path30.default.join(projectDir, "src");
3287
+ const emailFilePath = import_path30.default.join(srcPath, "lib", "email.ts");
3288
+ if (!import_fs30.default.existsSync(emailFilePath)) {
2379
3289
  await email();
2380
3290
  }
2381
- const authFilePath = import_path22.default.join(srcPath, "lib", "auth.ts");
2382
- if (!import_fs22.default.existsSync(authFilePath)) {
2383
- console.log(import_chalk24.default.red("auth.ts file not found."));
3291
+ const authFilePath = import_path30.default.join(srcPath, "lib", "auth.ts");
3292
+ if (!import_fs30.default.existsSync(authFilePath)) {
3293
+ console.log(import_chalk32.default.red("auth.ts file not found."));
2384
3294
  return;
2385
3295
  }
2386
- let content = import_fs22.default.readFileSync(authFilePath, "utf8");
3296
+ let content = import_fs30.default.readFileSync(authFilePath, "utf8");
2387
3297
  if (content.includes("emailAndPassword: {")) {
2388
3298
  const start = content.indexOf("emailAndPassword: {");
2389
3299
  let end = start;
@@ -2443,22 +3353,22 @@ var verifyTanstack = async () => {
2443
3353
  `;
2444
3354
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2445
3355
  }
2446
- import_fs22.default.writeFileSync(authFilePath, content, "utf8");
2447
- const templatePath = import_path22.default.resolve(
3356
+ import_fs30.default.writeFileSync(authFilePath, content, "utf8");
3357
+ const templatePath = import_path30.default.resolve(
2448
3358
  __dirname,
2449
3359
  "./template/email/EmailVerification.tsx"
2450
3360
  );
2451
- const componentsDir = import_path22.default.join(srcPath, "components", "email");
2452
- if (!import_fs22.default.existsSync(componentsDir)) {
2453
- import_fs22.default.mkdirSync(componentsDir, { recursive: true });
3361
+ const componentsDir = import_path30.default.join(srcPath, "components", "email");
3362
+ if (!import_fs30.default.existsSync(componentsDir)) {
3363
+ import_fs30.default.mkdirSync(componentsDir, { recursive: true });
2454
3364
  }
2455
- const destFile = import_path22.default.join(componentsDir, "EmailVerification.tsx");
2456
- if (import_fs22.default.existsSync(templatePath) && !import_fs22.default.existsSync(destFile)) {
2457
- import_fs22.default.copyFileSync(templatePath, destFile);
3365
+ const destFile = import_path30.default.join(componentsDir, "EmailVerification.tsx");
3366
+ if (import_fs30.default.existsSync(templatePath) && !import_fs30.default.existsSync(destFile)) {
3367
+ import_fs30.default.copyFileSync(templatePath, destFile);
2458
3368
  }
2459
- console.log(import_chalk24.default.green("Email verification successfully configured"));
3369
+ console.log(import_chalk32.default.green("Email verification successfully configured"));
2460
3370
  } catch (error) {
2461
- console.log(import_chalk24.default.red(String(error)));
3371
+ console.log(import_chalk32.default.red(String(error)));
2462
3372
  }
2463
3373
  };
2464
3374
 
@@ -2467,7 +3377,7 @@ var verification = async () => {
2467
3377
  try {
2468
3378
  const { framework, error } = await getFramework();
2469
3379
  if (error) {
2470
- console.log(import_chalk25.default.red(error));
3380
+ console.log(import_chalk33.default.red(error));
2471
3381
  return;
2472
3382
  }
2473
3383
  if (framework === "Next js") {
@@ -2477,17 +3387,17 @@ var verification = async () => {
2477
3387
  await verifyTanstack();
2478
3388
  }
2479
3389
  } catch (error) {
2480
- console.log(import_chalk25.default.red(error.message));
3390
+ console.log(import_chalk33.default.red(error.message));
2481
3391
  }
2482
3392
  };
2483
3393
 
2484
3394
  // cli/initCmd.ts
2485
- var import_chalk26 = __toESM(require("chalk"), 1);
3395
+ var import_chalk34 = __toESM(require("chalk"), 1);
2486
3396
  var initCmd = async (cmd) => {
2487
3397
  try {
2488
3398
  const { framework, error } = await getFramework();
2489
3399
  if (error) {
2490
- console.log(import_chalk26.default.red(error));
3400
+ console.log(import_chalk34.default.red(error));
2491
3401
  return;
2492
3402
  }
2493
3403
  if (framework === "Next js" && cmd.orm === "prisma") {
@@ -2517,12 +3427,12 @@ var initCmd = async (cmd) => {
2517
3427
  });
2518
3428
  }
2519
3429
  } catch (error) {
2520
- console.log(import_chalk26.default.red(error));
3430
+ console.log(import_chalk34.default.red(error));
2521
3431
  }
2522
3432
  };
2523
3433
 
2524
3434
  // index.ts
2525
- var packageJson = JSON.parse((0, import_fs23.readFileSync)("./package.json", "utf8"));
3435
+ var packageJson = JSON.parse((0, import_fs31.readFileSync)("./package.json", "utf8"));
2526
3436
  var program = new import_commander.Command();
2527
3437
  program.name("authverse").description("CLI tool for creating authverse projects").version(
2528
3438
  packageJson.version || "1.0.0",
@@ -2536,7 +3446,7 @@ program.command("init").description("Select project template and configuration")
2536
3446
  await initCmd(cmd);
2537
3447
  }
2538
3448
  });
2539
- program.command("add <oauth>").description("Add a new authentication provider").action(async (oauth) => {
3449
+ program.command("oauth <oauth>").description("Add a new authentication OAuth").action(async (oauth) => {
2540
3450
  await Oauth({ oauth });
2541
3451
  });
2542
3452
  program.command("forget").description("Forget stored configurations").action(async () => {