@sidgaikwad/db-setup 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAQA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAmF3D"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAUA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CA6F3D"}
package/dist/index.js CHANGED
@@ -5914,6 +5914,563 @@ async function setupEnvironment(databaseUrl) {
5914
5914
  showDatabaseUrl(databaseUrl, config.variableName);
5915
5915
  }
5916
5916
 
5917
+ // src/providers/render.ts
5918
+ import { spawnSync as spawnSync5 } from "child_process";
5919
+ var openBrowser = (url) => {
5920
+ const platform = process.platform;
5921
+ let command;
5922
+ if (platform === "darwin") {
5923
+ command = "open";
5924
+ } else if (platform === "win32") {
5925
+ command = "start";
5926
+ } else {
5927
+ command = "xdg-open";
5928
+ }
5929
+ spawnSync5(command, [url], { shell: true, stdio: "ignore" });
5930
+ };
5931
+ var ensureRenderCli = async () => {
5932
+ const check = spawnSync5("render", ["--version"], {
5933
+ encoding: "utf-8",
5934
+ shell: true,
5935
+ stdio: "pipe"
5936
+ });
5937
+ if (check.status !== 0) {
5938
+ console.log(source_default.yellowBright(`
5939
+ ⚠️ Render CLI is not installed.`));
5940
+ const shouldInstall = await esm_default2({
5941
+ message: "Would you like to install Render CLI automatically?",
5942
+ default: true
5943
+ });
5944
+ if (!shouldInstall) {
5945
+ return false;
5946
+ }
5947
+ console.log(source_default.blueBright(`
5948
+ Installing Render CLI...`));
5949
+ const install = spawnSync5("npm", ["install", "-g", "render"], {
5950
+ shell: true,
5951
+ stdio: "inherit"
5952
+ });
5953
+ if (install.status !== 0) {
5954
+ console.log(source_default.red(`
5955
+ ❌ Failed to install Render CLI automatically.`));
5956
+ console.log(source_default.yellow(`
5957
+ Please install manually:`));
5958
+ console.log(source_default.white(" npm install -g render"));
5959
+ console.log(source_default.white(" or"));
5960
+ console.log(source_default.white(" brew install renderinc/tap/render"));
5961
+ return false;
5962
+ }
5963
+ console.log(source_default.greenBright(`
5964
+ ✅ Render CLI installed successfully!`));
5965
+ return true;
5966
+ }
5967
+ return true;
5968
+ };
5969
+ var setupRenderManually = async () => {
5970
+ console.log(source_default.blueBright(`
5971
+ \uD83D\uDCDD Manual Render PostgreSQL Setup
5972
+ `));
5973
+ console.log(source_default.cyan(`Follow these steps to create your database:
5974
+ `));
5975
+ console.log(source_default.white("1. Go to: https://dashboard.render.com/new/database"));
5976
+ console.log(source_default.white("2. Click 'New PostgreSQL'"));
5977
+ console.log(source_default.white("3. Choose a name and region"));
5978
+ console.log(source_default.white("4. Select the 'Free' plan (or your preferred plan)"));
5979
+ console.log(source_default.white("5. Click 'Create Database'"));
5980
+ console.log(source_default.white("6. Once created, find the 'External Database URL' section"));
5981
+ console.log(source_default.white(`7. Copy the connection string
5982
+ `));
5983
+ const shouldOpenBrowser = await esm_default2({
5984
+ message: "Would you like to open Render dashboard in your browser?",
5985
+ default: true
5986
+ });
5987
+ if (shouldOpenBrowser) {
5988
+ openBrowser("https://dashboard.render.com/new/database");
5989
+ console.log(source_default.greenBright(`
5990
+ ✅ Browser opened!`));
5991
+ }
5992
+ console.log(source_default.yellow(`
5993
+ ⏳ Waiting for you to create the database...
5994
+ `));
5995
+ const databaseUrl = await esm_default3({
5996
+ message: source_default.cyan("Paste your External Database URL here:"),
5997
+ validate: (inputValue) => {
5998
+ if (!inputValue || inputValue.trim().length === 0) {
5999
+ return "Connection string cannot be empty";
6000
+ }
6001
+ if (!inputValue.startsWith("postgres://") && !inputValue.startsWith("postgresql://")) {
6002
+ return "Invalid PostgreSQL connection string. Should start with postgres:// or postgresql://";
6003
+ }
6004
+ return true;
6005
+ }
6006
+ });
6007
+ return databaseUrl;
6008
+ };
6009
+ var checkRenderAuth = async () => {
6010
+ console.log(source_default.blueBright(`
6011
+ Checking Render authentication...`));
6012
+ const authCheck = spawnSync5("render", ["whoami"], {
6013
+ encoding: "utf-8",
6014
+ shell: true,
6015
+ stdio: "pipe"
6016
+ });
6017
+ if (authCheck.status !== 0) {
6018
+ console.log(source_default.yellowBright("Not logged in to Render."));
6019
+ console.log(source_default.blueBright(`
6020
+ To authenticate with Render:`));
6021
+ console.log(source_default.cyan(`Opening authentication flow...
6022
+ `));
6023
+ const loginResult = spawnSync5("render", ["login"], {
6024
+ stdio: "inherit",
6025
+ shell: true
6026
+ });
6027
+ if (loginResult.status !== 0) {
6028
+ console.log(source_default.red(`
6029
+ ❌ Authentication failed.`));
6030
+ return false;
6031
+ }
6032
+ console.log(source_default.greenBright(`
6033
+ ✅ Successfully authenticated with Render!`));
6034
+ return true;
6035
+ }
6036
+ console.log(source_default.greenBright("✅ Already logged in to Render."));
6037
+ return true;
6038
+ };
6039
+ var getRenderRegions = () => {
6040
+ return [
6041
+ { name: "\uD83C\uDDFA\uD83C\uDDF8 Oregon (US West)", value: "oregon" },
6042
+ { name: "\uD83C\uDDFA\uD83C\uDDF8 Ohio (US East)", value: "ohio" },
6043
+ { name: "\uD83C\uDDEA\uD83C\uDDFA Frankfurt (Europe)", value: "frankfurt" },
6044
+ { name: "\uD83C\uDDF8\uD83C\uDDEC Singapore (Asia)", value: "singapore" }
6045
+ ];
6046
+ };
6047
+ var createRenderDatabaseCLI = async (name, region) => {
6048
+ console.log(source_default.blueBright(`
6049
+ Creating Render PostgreSQL database '${name}'...`));
6050
+ const createResult = spawnSync5("render", [
6051
+ "services",
6052
+ "create",
6053
+ "postgres",
6054
+ "--name",
6055
+ name,
6056
+ "--region",
6057
+ region,
6058
+ "--plan",
6059
+ "free"
6060
+ ], {
6061
+ encoding: "utf-8",
6062
+ shell: true,
6063
+ stdio: "inherit"
6064
+ });
6065
+ if (createResult.status !== 0) {
6066
+ console.error(source_default.red(`
6067
+ ❌ Failed to create Render database.`));
6068
+ throw new Error("Database creation failed");
6069
+ }
6070
+ console.log(source_default.blueBright(`
6071
+ ⏳ Waiting for database to provision (this may take 2-3 minutes)...`));
6072
+ console.log(source_default.dim(`You can also check status at: https://dashboard.render.com
6073
+ `));
6074
+ await new Promise((resolve2) => setTimeout(resolve2, 1e4));
6075
+ console.log(source_default.blueBright(`
6076
+ Fetching connection string...`));
6077
+ console.log(source_default.yellow("Please check your Render dashboard for the External Database URL."));
6078
+ console.log(source_default.cyan(`https://dashboard.render.com
6079
+ `));
6080
+ const databaseUrl = await esm_default3({
6081
+ message: source_default.cyan("Paste your External Database URL:"),
6082
+ validate: (inputValue) => {
6083
+ if (!inputValue || !inputValue.startsWith("postgres")) {
6084
+ return "Invalid PostgreSQL connection string";
6085
+ }
6086
+ return true;
6087
+ }
6088
+ });
6089
+ return databaseUrl;
6090
+ };
6091
+ var setupRender = async () => {
6092
+ console.log(source_default.magentaBright(`
6093
+ ================ Render PostgreSQL Setup ================
6094
+ `));
6095
+ const hasRenderCli = await ensureRenderCli();
6096
+ if (!hasRenderCli) {
6097
+ console.log(source_default.blueBright(`
6098
+ \uD83D\uDD04 Switching to manual setup...
6099
+ `));
6100
+ const databaseUrl = await setupRenderManually();
6101
+ console.log(source_default.greenBright(`
6102
+ ✅ Render PostgreSQL configured successfully!`));
6103
+ console.log(source_default.greenBright(`
6104
+ Your DATABASE_URL is:
6105
+ ${databaseUrl}
6106
+ `));
6107
+ console.log(source_default.yellow("--------------------------------"));
6108
+ return databaseUrl;
6109
+ }
6110
+ const isAuthenticated = await checkRenderAuth();
6111
+ if (!isAuthenticated) {
6112
+ console.log(source_default.yellow(`
6113
+ ⚠️ Switching to manual setup due to authentication issues...
6114
+ `));
6115
+ const databaseUrl = await setupRenderManually();
6116
+ console.log(source_default.greenBright(`
6117
+ ✅ Render PostgreSQL configured successfully!`));
6118
+ console.log(source_default.greenBright(`
6119
+ Your DATABASE_URL is:
6120
+ ${databaseUrl}
6121
+ `));
6122
+ console.log(source_default.yellow("--------------------------------"));
6123
+ return databaseUrl;
6124
+ }
6125
+ const regions = getRenderRegions();
6126
+ const selectedRegion = await esm_default4({
6127
+ message: source_default.cyan("Choose your Render region:"),
6128
+ default: "oregon",
6129
+ choices: regions
6130
+ });
6131
+ const dbName = await esm_default3({
6132
+ message: source_default.cyan("Enter a name for your database:"),
6133
+ default: "zerostarter-db",
6134
+ validate: (inputValue) => {
6135
+ if (!inputValue || inputValue.trim().length === 0) {
6136
+ return "Database name cannot be empty";
6137
+ }
6138
+ if (!/^[a-z0-9-]+$/.test(inputValue)) {
6139
+ return "Database name must contain only lowercase letters, numbers, and hyphens";
6140
+ }
6141
+ return true;
6142
+ }
6143
+ });
6144
+ try {
6145
+ const databaseUrl = await createRenderDatabaseCLI(dbName, selectedRegion);
6146
+ console.log(source_default.greenBright(`
6147
+ ✅ Render PostgreSQL created successfully!`));
6148
+ console.log(source_default.greenBright(`
6149
+ Your DATABASE_URL is:
6150
+ ${databaseUrl}
6151
+ `));
6152
+ console.log(source_default.yellow("--------------------------------"));
6153
+ return databaseUrl;
6154
+ } catch (error) {
6155
+ console.log(source_default.yellow(`
6156
+ ⚠️ CLI setup failed. Switching to manual setup...
6157
+ `));
6158
+ const databaseUrl = await setupRenderManually();
6159
+ console.log(source_default.greenBright(`
6160
+ ✅ Render PostgreSQL configured successfully!`));
6161
+ console.log(source_default.greenBright(`
6162
+ Your DATABASE_URL is:
6163
+ ${databaseUrl}
6164
+ `));
6165
+ console.log(source_default.yellow("--------------------------------"));
6166
+ return databaseUrl;
6167
+ }
6168
+ };
6169
+
6170
+ // src/providers/vercel.ts
6171
+ import { spawnSync as spawnSync6 } from "child_process";
6172
+ import * as fs from "fs";
6173
+ import * as path from "path";
6174
+ var openBrowser2 = (url) => {
6175
+ const platform = process.platform;
6176
+ let command;
6177
+ if (platform === "darwin") {
6178
+ command = "open";
6179
+ } else if (platform === "win32") {
6180
+ command = "start";
6181
+ } else {
6182
+ command = "xdg-open";
6183
+ }
6184
+ spawnSync6(command, [url], { shell: true, stdio: "ignore" });
6185
+ };
6186
+ var ensureVercelCli = async () => {
6187
+ const check = spawnSync6("vercel", ["--version"], {
6188
+ encoding: "utf-8",
6189
+ shell: true,
6190
+ stdio: "pipe"
6191
+ });
6192
+ if (check.status !== 0) {
6193
+ console.log(source_default.yellowBright(`
6194
+ ⚠️ Vercel CLI is not installed.`));
6195
+ const shouldInstall = await esm_default2({
6196
+ message: "Would you like to install Vercel CLI automatically?",
6197
+ default: true
6198
+ });
6199
+ if (!shouldInstall) {
6200
+ return false;
6201
+ }
6202
+ console.log(source_default.blueBright(`
6203
+ Installing Vercel CLI...`));
6204
+ const install = spawnSync6("npm", ["install", "-g", "vercel"], {
6205
+ shell: true,
6206
+ stdio: "inherit"
6207
+ });
6208
+ if (install.status !== 0) {
6209
+ console.log(source_default.red(`
6210
+ ❌ Failed to install Vercel CLI automatically.`));
6211
+ console.log(source_default.yellow(`
6212
+ Please install manually:`));
6213
+ console.log(source_default.white(" npm install -g vercel"));
6214
+ return false;
6215
+ }
6216
+ console.log(source_default.greenBright(`
6217
+ ✅ Vercel CLI installed successfully!`));
6218
+ return true;
6219
+ }
6220
+ return true;
6221
+ };
6222
+ var checkVercelAuth = () => {
6223
+ console.log(source_default.blueBright(`
6224
+ Checking Vercel authentication...`));
6225
+ const authCheck = spawnSync6("vercel", ["whoami"], {
6226
+ encoding: "utf-8",
6227
+ shell: true,
6228
+ stdio: "pipe"
6229
+ });
6230
+ if (authCheck.status !== 0) {
6231
+ console.log(source_default.yellowBright("Not logged in to Vercel."));
6232
+ console.log(source_default.blueBright(`
6233
+ To authenticate with Vercel:`));
6234
+ console.log(source_default.cyan(`Opening authentication flow...
6235
+ `));
6236
+ const loginResult = spawnSync6("vercel", ["login"], {
6237
+ stdio: "inherit",
6238
+ shell: true
6239
+ });
6240
+ if (loginResult.status !== 0) {
6241
+ console.log(source_default.red(`
6242
+ ❌ Authentication failed.`));
6243
+ return false;
6244
+ }
6245
+ console.log(source_default.greenBright(`
6246
+ ✅ Successfully authenticated with Vercel!`));
6247
+ return true;
6248
+ }
6249
+ console.log(source_default.greenBright("✅ Already logged in to Vercel."));
6250
+ return true;
6251
+ };
6252
+ var setupVercelProject = () => {
6253
+ console.log(source_default.blueBright(`
6254
+ Linking to Vercel project...`));
6255
+ console.log(source_default.cyan(`You'll be prompted to select or create a Vercel project.
6256
+ `));
6257
+ const linkResult = spawnSync6("vercel", ["link"], {
6258
+ encoding: "utf-8",
6259
+ shell: true,
6260
+ stdio: "inherit",
6261
+ cwd: process.cwd()
6262
+ });
6263
+ if (linkResult.status !== 0) {
6264
+ console.log(source_default.red(`
6265
+ ❌ Failed to link Vercel project.`));
6266
+ return false;
6267
+ }
6268
+ console.log(source_default.greenBright(`
6269
+ ✅ Project linked successfully!`));
6270
+ return true;
6271
+ };
6272
+ var createVercelDatabase = async (name) => {
6273
+ console.log(source_default.blueBright(`
6274
+ Creating Vercel Postgres database '${name}'...`));
6275
+ console.log(source_default.cyan(`The Vercel CLI will guide you through the setup process.
6276
+ `));
6277
+ const createResult = spawnSync6("vercel", ["postgres", "create", "--cwd", process.cwd()], {
6278
+ encoding: "utf-8",
6279
+ shell: true,
6280
+ stdio: "inherit"
6281
+ });
6282
+ if (createResult.status !== 0) {
6283
+ console.error(source_default.red(`
6284
+ ❌ Failed to create Vercel Postgres database.`));
6285
+ throw new Error("Database creation failed");
6286
+ }
6287
+ console.log(source_default.greenBright(`
6288
+ ✅ Database created!`));
6289
+ console.log(source_default.blueBright(`
6290
+ Fetching connection string...`));
6291
+ await new Promise((resolve2) => setTimeout(resolve2, 5000));
6292
+ const envResult = spawnSync6("vercel", ["env", "pull", ".env.vercel.local"], {
6293
+ encoding: "utf-8",
6294
+ shell: true,
6295
+ stdio: "pipe",
6296
+ cwd: process.cwd()
6297
+ });
6298
+ if (envResult.status === 0) {
6299
+ try {
6300
+ const envPath = path.join(process.cwd(), ".env.vercel.local");
6301
+ if (fs.existsSync(envPath)) {
6302
+ const envContent = fs.readFileSync(envPath, "utf-8");
6303
+ const postgresUrlMatch = envContent.match(/POSTGRES_URL="?([^"\n]+)"?/);
6304
+ if (postgresUrlMatch && postgresUrlMatch[1]) {
6305
+ console.log(source_default.greenBright("✅ Connection string retrieved!"));
6306
+ try {
6307
+ fs.unlinkSync(envPath);
6308
+ } catch (e) {}
6309
+ return postgresUrlMatch[1];
6310
+ }
6311
+ }
6312
+ } catch (error) {
6313
+ console.log(source_default.dim("Could not read .env file automatically."));
6314
+ }
6315
+ }
6316
+ console.log(source_default.yellow(`
6317
+ ⚠️ Could not automatically fetch connection string.`));
6318
+ console.log(source_default.cyan(`
6319
+ Please follow these steps:`));
6320
+ console.log(source_default.white("1. Go to: https://vercel.com/dashboard/stores"));
6321
+ console.log(source_default.white(`2. Find your database`));
6322
+ console.log(source_default.white("3. Go to the '.env.local' tab"));
6323
+ console.log(source_default.white(`4. Copy the POSTGRES_URL value
6324
+ `));
6325
+ const shouldOpen = await esm_default2({
6326
+ message: "Open Vercel dashboard now?",
6327
+ default: true
6328
+ });
6329
+ if (shouldOpen) {
6330
+ openBrowser2("https://vercel.com/dashboard/stores");
6331
+ console.log(source_default.greenBright(`✅ Browser opened!
6332
+ `));
6333
+ }
6334
+ const databaseUrl = await esm_default3({
6335
+ message: source_default.cyan("Paste your POSTGRES_URL here:"),
6336
+ validate: (inputValue) => {
6337
+ if (!inputValue || !inputValue.startsWith("postgres")) {
6338
+ return "Invalid PostgreSQL connection string";
6339
+ }
6340
+ return true;
6341
+ }
6342
+ });
6343
+ return databaseUrl;
6344
+ };
6345
+ var setupVercelManually = async () => {
6346
+ console.log(source_default.blueBright(`
6347
+ \uD83D\uDCDD Vercel Postgres Setup
6348
+ `));
6349
+ console.log(source_default.cyan(`Follow these steps to create your database:
6350
+ `));
6351
+ console.log(source_default.white("1. Click 'Create Database' on the page that opens"));
6352
+ console.log(source_default.white("2. Select 'Postgres' as the database type"));
6353
+ console.log(source_default.white("3. Choose a name and region for your database"));
6354
+ console.log(source_default.white("4. Click 'Create'"));
6355
+ console.log(source_default.white("5. Once created, go to the '.env.local' tab"));
6356
+ console.log(source_default.white(`6. Copy the POSTGRES_URL value
6357
+ `));
6358
+ const shouldOpenBrowser = await esm_default2({
6359
+ message: "Open Vercel dashboard in your browser?",
6360
+ default: true
6361
+ });
6362
+ if (shouldOpenBrowser) {
6363
+ openBrowser2("https://vercel.com/dashboard/stores");
6364
+ console.log(source_default.greenBright("✅ Browser opened!"));
6365
+ } else {
6366
+ console.log(source_default.cyan(`
6367
+ Go to: https://vercel.com/dashboard/stores`));
6368
+ }
6369
+ console.log(source_default.yellow(`
6370
+ ⏳ Waiting for you to create the database...
6371
+ `));
6372
+ const databaseUrl = await esm_default3({
6373
+ message: source_default.cyan("Paste your POSTGRES_URL here:"),
6374
+ validate: (inputValue) => {
6375
+ if (!inputValue || inputValue.trim().length === 0) {
6376
+ return "Connection string cannot be empty";
6377
+ }
6378
+ if (!inputValue.startsWith("postgres://") && !inputValue.startsWith("postgresql://")) {
6379
+ return "Invalid PostgreSQL connection string. Should start with postgres:// or postgresql://";
6380
+ }
6381
+ return true;
6382
+ }
6383
+ });
6384
+ return databaseUrl;
6385
+ };
6386
+ var setupVercel = async () => {
6387
+ console.log(source_default.magentaBright(`
6388
+ ================ Vercel Postgres Setup ================
6389
+ `));
6390
+ const hasVercelCli = await ensureVercelCli();
6391
+ if (!hasVercelCli) {
6392
+ console.log(source_default.blueBright(`
6393
+ \uD83D\uDD04 Switching to manual setup...
6394
+ `));
6395
+ const databaseUrl = await setupVercelManually();
6396
+ console.log(source_default.greenBright(`
6397
+ ✅ Vercel Postgres configured successfully!`));
6398
+ console.log(source_default.greenBright(`
6399
+ Your DATABASE_URL is:
6400
+ ${databaseUrl}
6401
+ `));
6402
+ console.log(source_default.yellow("--------------------------------"));
6403
+ return databaseUrl;
6404
+ }
6405
+ const isAuthenticated = checkVercelAuth();
6406
+ if (!isAuthenticated) {
6407
+ console.log(source_default.yellow(`
6408
+ ⚠️ Switching to manual setup due to authentication issues...
6409
+ `));
6410
+ const databaseUrl = await setupVercelManually();
6411
+ console.log(source_default.greenBright(`
6412
+ ✅ Vercel Postgres configured successfully!`));
6413
+ console.log(source_default.greenBright(`
6414
+ Your DATABASE_URL is:
6415
+ ${databaseUrl}
6416
+ `));
6417
+ console.log(source_default.yellow("--------------------------------"));
6418
+ return databaseUrl;
6419
+ }
6420
+ const projectLinked = setupVercelProject();
6421
+ if (!projectLinked) {
6422
+ console.log(source_default.yellow(`
6423
+ ⚠️ Could not link project. Switching to manual setup...
6424
+ `));
6425
+ const databaseUrl = await setupVercelManually();
6426
+ console.log(source_default.greenBright(`
6427
+ ✅ Vercel Postgres configured successfully!`));
6428
+ console.log(source_default.greenBright(`
6429
+ Your DATABASE_URL is:
6430
+ ${databaseUrl}
6431
+ `));
6432
+ console.log(source_default.yellow("--------------------------------"));
6433
+ return databaseUrl;
6434
+ }
6435
+ const dbName = await esm_default3({
6436
+ message: source_default.cyan("Enter a name for your database:"),
6437
+ default: "zerostarter-db",
6438
+ validate: (inputValue) => {
6439
+ if (!inputValue || inputValue.trim().length === 0) {
6440
+ return "Database name cannot be empty";
6441
+ }
6442
+ if (!/^[a-z0-9-_]+$/.test(inputValue)) {
6443
+ return "Database name must contain only lowercase letters, numbers, hyphens, and underscores";
6444
+ }
6445
+ return true;
6446
+ }
6447
+ });
6448
+ try {
6449
+ const databaseUrl = await createVercelDatabase(dbName);
6450
+ console.log(source_default.greenBright(`
6451
+ ✅ Vercel Postgres created successfully!`));
6452
+ console.log(source_default.greenBright(`
6453
+ Your DATABASE_URL is:
6454
+ ${databaseUrl}
6455
+ `));
6456
+ console.log(source_default.yellow("--------------------------------"));
6457
+ return databaseUrl;
6458
+ } catch (error) {
6459
+ console.log(source_default.yellow(`
6460
+ ⚠️ CLI setup failed. Switching to manual setup...
6461
+ `));
6462
+ const databaseUrl = await setupVercelManually();
6463
+ console.log(source_default.greenBright(`
6464
+ ✅ Vercel Postgres configured successfully!`));
6465
+ console.log(source_default.greenBright(`
6466
+ Your DATABASE_URL is:
6467
+ ${databaseUrl}
6468
+ `));
6469
+ console.log(source_default.yellow("--------------------------------"));
6470
+ return databaseUrl;
6471
+ }
6472
+ };
6473
+
5917
6474
  // src/database.ts
5918
6475
  async function handleDatabaseSetup() {
5919
6476
  console.log(source_default.magentaBright(`
@@ -5929,6 +6486,8 @@ async function handleDatabaseSetup() {
5929
6486
  value: "supabase"
5930
6487
  },
5931
6488
  { name: "Railway (Platform as a Service)", value: "railway" },
6489
+ { name: "Render (Cloud Hosting Platform)", value: "render" },
6490
+ { name: "Vercel Postgres (Serverless PostgreSQL)", value: "vercel" },
5932
6491
  { name: "Local PostgreSQL (Docker)", value: "local" },
5933
6492
  { name: "I already have a DATABASE_URL", value: "manual" },
5934
6493
  { name: "I'll configure later", value: "later" }
@@ -5945,6 +6504,12 @@ async function handleDatabaseSetup() {
5945
6504
  case "railway":
5946
6505
  databaseUrl = await setupRailway();
5947
6506
  break;
6507
+ case "render":
6508
+ databaseUrl = await setupRender();
6509
+ break;
6510
+ case "vercel":
6511
+ databaseUrl = await setupVercel();
6512
+ break;
5948
6513
  case "local":
5949
6514
  databaseUrl = await setupLocalDocker();
5950
6515
  break;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Main function to set up Render PostgreSQL
3
+ */
4
+ export declare const setupRender: () => Promise<string>;
5
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/providers/render.ts"],"names":[],"mappings":"AA+OA;;GAEG;AACH,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,MAAM,CA0FlD,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Main function to set up Vercel Postgres
3
+ */
4
+ export declare const setupVercel: () => Promise<string>;
5
+ //# sourceMappingURL=vercel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercel.d.ts","sourceRoot":"","sources":["../../src/providers/vercel.ts"],"names":[],"mappings":"AAuRA;;GAEG;AACH,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,MAAM,CAuGlD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sidgaikwad/db-setup",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Interactive CLI for setting up PostgreSQL databases with multiple providers (Neon, Supabase, Railway, Local)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",