create-db 1.0.8-pr51-DC-4933-env-flag-17282359601.0 → 1.0.8-pr51-DC-4933-env-flag-17293580791.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -194,7 +194,7 @@ Options:
194
194
  ${chalk.yellow("--json, -j")} Output machine-readable JSON and exit
195
195
  ${chalk.yellow("--list-regions")} List available regions and exit
196
196
  ${chalk.yellow("--help, -h")} Show this help message
197
- ${chalk.yellow("--env, -e")} Outputs DATABASE_URL to the terminal
197
+ ${chalk.yellow("--env, -e")} Prints DATABASE_URL to the terminal
198
198
 
199
199
  Examples:
200
200
  ${chalk.gray(`npx ${CLI_NAME} --region us-east-1`)}
@@ -202,6 +202,7 @@ Examples:
202
202
  ${chalk.gray(`npx ${CLI_NAME} --interactive`)}
203
203
  ${chalk.gray(`npx ${CLI_NAME} -i`)}
204
204
  ${chalk.gray(`npx ${CLI_NAME} --json --region us-east-1`)}
205
+ ${chalk.gray(`npx ${CLI_NAME} --env --region us-east-1`)}
205
206
  `);
206
207
  process.exit(0);
207
208
  }
@@ -539,6 +540,7 @@ async function createDatabase(name, region, userAgent, silent = false) {
539
540
  error: "api_error",
540
541
  message: result.error.message || "Unknown error",
541
542
  details: result.error,
543
+ status: result.error.status ?? resp.status,
542
544
  };
543
545
  }
544
546
 
@@ -637,6 +639,7 @@ async function main() {
637
639
  "has-help-flag": rawArgs.includes("--help") || rawArgs.includes("-h"),
638
640
  "has-list-regions-flag": rawArgs.includes("--list-regions"),
639
641
  "has-json-flag": rawArgs.includes("--json") || rawArgs.includes("-j"),
642
+ "has-env-flag": rawArgs.includes("--env") || rawArgs.includes("-e"),
640
643
  "has-user-agent-from-env": !!userAgent,
641
644
  "node-version": process.version,
642
645
  platform: process.platform,
@@ -649,8 +652,11 @@ async function main() {
649
652
  }
650
653
 
651
654
  let name = new Date().toISOString();
652
- let userLocation = await detectUserLocation();
653
- let region = getRegionClosestToLocation(userLocation) || "us-east-1";
655
+ let region = flags.region || "us-east-1";
656
+ if (!flags.region || !flags.interactive) {
657
+ const userLocation = await detectUserLocation();
658
+ region = getRegionClosestToLocation(userLocation) || region;
659
+ }
654
660
  let chooseRegionPrompt = false;
655
661
 
656
662
  if (flags.help) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-db",
3
- "version": "1.0.8-pr51-DC-4933-env-flag-17282359601.0",
3
+ "version": "1.0.8-pr51-DC-4933-env-flag-17293580791.0",
4
4
  "description": "Instantly create a temporary Prisma Postgres database with one command, then claim and persist it in your Prisma Data Platform project when ready.",
5
5
  "main": "index.js",
6
6
  "author": "",