create-db 1.0.3-pr45-DC-4829-source-flag-17135144702.0 → 1.0.3-pr45-DC-4829-source-flag-17136895926.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 +6 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -126,14 +126,12 @@ async function parseArgs() {
126
126
  "list-regions",
127
127
  "interactive",
128
128
  "json",
129
- "source",
130
129
  ];
131
130
  const shorthandMap = {
132
131
  r: "region",
133
132
  i: "interactive",
134
133
  h: "help",
135
134
  j: "json",
136
- s: "source",
137
135
  };
138
136
 
139
137
  const exitWithError = (message) => {
@@ -156,8 +154,6 @@ async function parseArgs() {
156
154
  exitWithError("Missing value for --region flag.");
157
155
  flags.region = region;
158
156
  i++;
159
- } else if (flag === "source") {
160
- flags.source = true;
161
157
  } else {
162
158
  flags[flag] = true;
163
159
  }
@@ -176,8 +172,6 @@ async function parseArgs() {
176
172
  exitWithError("Missing value for -r flag.");
177
173
  flags.region = region;
178
174
  i++;
179
- } else if (mappedFlag === "source") {
180
- flags.source = true;
181
175
  } else {
182
176
  flags[mappedFlag] = true;
183
177
  }
@@ -197,8 +191,6 @@ async function parseArgs() {
197
191
  exitWithError("Missing value for -r flag.");
198
192
  flags.region = region;
199
193
  i++;
200
- } else if (mappedFlag === "source") {
201
- flags.source = true;
202
194
  } else {
203
195
  flags[mappedFlag] = true;
204
196
  }
@@ -522,22 +514,10 @@ async function main() {
522
514
 
523
515
  const { flags } = await parseArgs();
524
516
 
525
- let source;
526
- if (flags.source) {
527
- const userEnvVars = readUserEnvFile();
528
- const userCwd = process.cwd();
529
- const envPath = path.join(userCwd, '.env');
530
-
531
- if (fs.existsSync(envPath)) {
532
- const ctaVars = [];
533
- if (userEnvVars.CTA_VERSION) ctaVars.push(`v${userEnvVars.CTA_VERSION}`);
534
- if (userEnvVars.CTA_FRAMEWORK) ctaVars.push(userEnvVars.CTA_FRAMEWORK);
535
- if (userEnvVars.CTA_FRAMEWORK_VERSION) ctaVars.push(`fv${userEnvVars.CTA_FRAMEWORK_VERSION}`);
536
-
537
- if (ctaVars.length > 0) {
538
- source = ctaVars.join('-');
539
- }
540
- }
517
+ let source;
518
+ const userEnvVars = readUserEnvFile();
519
+ if (userEnvVars.PRISMA_ACTOR_NAME && userEnvVars.PRISMA_ACTOR_PROJECT) {
520
+ source = `${userEnvVars.PRISMA_ACTOR_NAME}/${userEnvVars.PRISMA_ACTOR_PROJECT}`;
541
521
  }
542
522
 
543
523
  try {
@@ -551,7 +531,7 @@ async function main() {
551
531
  "has-help-flag": rawArgs.includes("--help") || rawArgs.includes("-h"),
552
532
  "has-list-regions-flag": rawArgs.includes("--list-regions"),
553
533
  "has-json-flag": rawArgs.includes("--json") || rawArgs.includes("-j"),
554
- "has-source-flag": rawArgs.includes("--source") || rawArgs.includes("-s"),
534
+ "has-source-from-env": !!source,
555
535
  "node-version": process.version,
556
536
  platform: process.platform,
557
537
  arch: process.arch,
@@ -601,26 +581,7 @@ async function main() {
601
581
  } catch (error) {}
602
582
  }
603
583
 
604
- if (flags.source) {
605
- const userCwd = process.cwd();
606
- const envPath = path.join(userCwd, '.env');
607
-
608
- if (!fs.existsSync(envPath)) {
609
- console.error(chalk.red("Error: Source not configured correctly."));
610
- process.exit(1);
611
- }
612
-
613
- const userEnvVars = readUserEnvFile();
614
- const ctaVars = [];
615
- if (userEnvVars.CTA_VERSION) ctaVars.push(`v${userEnvVars.CTA_VERSION}`);
616
- if (userEnvVars.CTA_FRAMEWORK) ctaVars.push(userEnvVars.CTA_FRAMEWORK);
617
- if (userEnvVars.CTA_FRAMEWORK_VERSION) ctaVars.push(`fv${userEnvVars.CTA_FRAMEWORK_VERSION}`);
618
-
619
- if (ctaVars.length === 0) {
620
- console.error(chalk.red("Error: Source not configured correctly."));
621
- process.exit(1);
622
- }
623
- }
584
+
624
585
 
625
586
  if (flags.interactive) {
626
587
  chooseRegionPrompt = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-db",
3
- "version": "1.0.3-pr45-DC-4829-source-flag-17135144702.0",
3
+ "version": "1.0.3-pr45-DC-4829-source-flag-17136895926.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": "",