create-better-t-stack 2.39.0-canary.bae99c30 → 2.40.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.
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-CHXGSisf.js → src-DO2f6nII.js} +61 -18
- package/package.json +4 -3
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1347,7 +1347,7 @@ const getLatestCLIVersion = () => {
|
|
|
1347
1347
|
*/
|
|
1348
1348
|
function isTelemetryEnabled() {
|
|
1349
1349
|
const BTS_TELEMETRY_DISABLED = process.env.BTS_TELEMETRY_DISABLED;
|
|
1350
|
-
const BTS_TELEMETRY = "
|
|
1350
|
+
const BTS_TELEMETRY = "1";
|
|
1351
1351
|
if (BTS_TELEMETRY_DISABLED !== void 0) return BTS_TELEMETRY_DISABLED !== "1";
|
|
1352
1352
|
if (BTS_TELEMETRY !== void 0) return BTS_TELEMETRY === "1";
|
|
1353
1353
|
return true;
|
|
@@ -1355,8 +1355,8 @@ function isTelemetryEnabled() {
|
|
|
1355
1355
|
|
|
1356
1356
|
//#endregion
|
|
1357
1357
|
//#region src/utils/analytics.ts
|
|
1358
|
-
const POSTHOG_API_KEY = "
|
|
1359
|
-
const POSTHOG_HOST = "
|
|
1358
|
+
const POSTHOG_API_KEY = "phc_8ZUxEwwfKMajJLvxz1daGd931dYbQrwKNficBmsdIrs";
|
|
1359
|
+
const POSTHOG_HOST = "https://us.i.posthog.com";
|
|
1360
1360
|
function generateSessionId() {
|
|
1361
1361
|
const rand = Math.random().toString(36).slice(2);
|
|
1362
1362
|
const now = Date.now().toString(36);
|
|
@@ -4697,25 +4697,61 @@ async function setupNeonPostgres(config) {
|
|
|
4697
4697
|
|
|
4698
4698
|
//#endregion
|
|
4699
4699
|
//#region src/helpers/database-providers/prisma-postgres-setup.ts
|
|
4700
|
+
const AVAILABLE_REGIONS = [
|
|
4701
|
+
{
|
|
4702
|
+
value: "ap-southeast-1",
|
|
4703
|
+
label: "Asia Pacific (Singapore)"
|
|
4704
|
+
},
|
|
4705
|
+
{
|
|
4706
|
+
value: "ap-northeast-1",
|
|
4707
|
+
label: "Asia Pacific (Tokyo)"
|
|
4708
|
+
},
|
|
4709
|
+
{
|
|
4710
|
+
value: "eu-central-1",
|
|
4711
|
+
label: "Europe (Frankfurt)"
|
|
4712
|
+
},
|
|
4713
|
+
{
|
|
4714
|
+
value: "eu-west-3",
|
|
4715
|
+
label: "Europe (Paris)"
|
|
4716
|
+
},
|
|
4717
|
+
{
|
|
4718
|
+
value: "us-east-1",
|
|
4719
|
+
label: "US East (N. Virginia)"
|
|
4720
|
+
},
|
|
4721
|
+
{
|
|
4722
|
+
value: "us-west-1",
|
|
4723
|
+
label: "US West (N. California)"
|
|
4724
|
+
}
|
|
4725
|
+
];
|
|
4700
4726
|
async function setupWithCreateDb(serverDir, packageManager, orm) {
|
|
4701
4727
|
try {
|
|
4702
|
-
log.info("Starting Prisma Postgres setup. Please follow the instructions below:");
|
|
4703
|
-
const
|
|
4704
|
-
|
|
4728
|
+
log.info("Starting Prisma Postgres setup with create-db. Please follow the instructions below:");
|
|
4729
|
+
const selectedRegion = await select({
|
|
4730
|
+
message: "Select your preferred region:",
|
|
4731
|
+
options: AVAILABLE_REGIONS,
|
|
4732
|
+
initialValue: "ap-southeast-1"
|
|
4733
|
+
});
|
|
4734
|
+
if (isCancel(selectedRegion)) return null;
|
|
4735
|
+
const createDbCommand = getPackageExecutionCommand(packageManager, `create-db@latest --json --region ${selectedRegion}`);
|
|
4736
|
+
const s = spinner();
|
|
4737
|
+
s.start("Creating Prisma Postgres database...");
|
|
4738
|
+
const { stdout } = await execa(createDbCommand, {
|
|
4705
4739
|
cwd: serverDir,
|
|
4706
|
-
stdio: "inherit",
|
|
4707
4740
|
shell: true
|
|
4708
4741
|
});
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
}
|
|
4717
|
-
|
|
4718
|
-
return {
|
|
4742
|
+
s.stop("Database created successfully!");
|
|
4743
|
+
let createDbResponse;
|
|
4744
|
+
try {
|
|
4745
|
+
createDbResponse = JSON.parse(stdout);
|
|
4746
|
+
} catch {
|
|
4747
|
+
consola$1.error("Failed to parse create-db response");
|
|
4748
|
+
return null;
|
|
4749
|
+
}
|
|
4750
|
+
const databaseUrl = orm === "drizzle" ? createDbResponse.directConnectionString : createDbResponse.connectionString;
|
|
4751
|
+
return {
|
|
4752
|
+
databaseUrl,
|
|
4753
|
+
claimUrl: createDbResponse.claimUrl
|
|
4754
|
+
};
|
|
4719
4755
|
} catch (error) {
|
|
4720
4756
|
if (error instanceof Error) consola$1.error(error.message);
|
|
4721
4757
|
return null;
|
|
@@ -4755,6 +4791,11 @@ async function writeEnvFile$1(projectDir, config) {
|
|
|
4755
4791
|
value: config?.databaseUrl ?? "postgresql://postgres:postgres@localhost:5432/mydb?schema=public",
|
|
4756
4792
|
condition: true
|
|
4757
4793
|
}];
|
|
4794
|
+
if (config?.claimUrl) variables.push({
|
|
4795
|
+
key: "CLAIM_URL",
|
|
4796
|
+
value: config.claimUrl,
|
|
4797
|
+
condition: true
|
|
4798
|
+
});
|
|
4758
4799
|
await addEnvVariablesToFile(envPath, variables);
|
|
4759
4800
|
} catch (_error) {
|
|
4760
4801
|
consola$1.error("Failed to update environment configuration");
|
|
@@ -4841,7 +4882,9 @@ async function setupPrismaPostgres(config) {
|
|
|
4841
4882
|
await addDotenvImportToPrismaConfig(projectDir);
|
|
4842
4883
|
await addPrismaAccelerateExtension(serverDir);
|
|
4843
4884
|
}
|
|
4844
|
-
|
|
4885
|
+
const connectionType = orm === "drizzle" ? "direct connection" : "Prisma Accelerate";
|
|
4886
|
+
log.success(pc.green(`Prisma Postgres database configured successfully with ${connectionType}!`));
|
|
4887
|
+
if (prismaConfig.claimUrl) log.info(pc.blue(`Claim URL saved to .env: ${prismaConfig.claimUrl}`));
|
|
4845
4888
|
} else {
|
|
4846
4889
|
await writeEnvFile$1(projectDir);
|
|
4847
4890
|
displayManualSetupInstructions$1();
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.40.0",
|
|
4
4
|
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Aman Varshney",
|
|
8
8
|
"bin": {
|
|
9
|
-
"create-better-t-stack": "
|
|
9
|
+
"create-better-t-stack": "dist/cli.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"templates",
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
},
|
|
60
60
|
"exports": {
|
|
61
61
|
".": {
|
|
62
|
-
"
|
|
62
|
+
"types": "./dist/index.d.ts",
|
|
63
|
+
"import": "./dist/index.js"
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|