create-better-t-stack 2.22.8 → 2.22.10

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/dist/index.js +30 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3609,7 +3609,7 @@ This project uses Convex as a backend. You'll need to set up Convex before runni
3609
3609
  ${packageManagerRunCmd} dev:setup
3610
3610
  \`\`\`
3611
3611
 
3612
- Follow the prompts to create a new Convex project and connect it to your application.` : generateDatabaseSetup(database, auth, packageManagerRunCmd, orm)}
3612
+ Follow the prompts to create a new Convex project and connect it to your application.` : generateDatabaseSetup(database, auth, packageManagerRunCmd, orm, options.dbSetup)}
3613
3613
 
3614
3614
  Then, run the development server:
3615
3615
 
@@ -3764,15 +3764,16 @@ function generateFeaturesList(database, auth, addons, orm, runtime, frontend, ba
3764
3764
  else if (addon === "turborepo") addonsList.push("- **Turborepo** - Optimized monorepo build system");
3765
3765
  return addonsList.join("\n");
3766
3766
  }
3767
- function generateDatabaseSetup(database, _auth, packageManagerRunCmd, orm) {
3767
+ function generateDatabaseSetup(database, _auth, packageManagerRunCmd, orm, dbSetup) {
3768
3768
  if (database === "none") return "";
3769
3769
  let setup = "## Database Setup\n\n";
3770
3770
  if (database === "sqlite") setup += `This project uses SQLite${orm === "drizzle" ? " with Drizzle ORM" : orm === "prisma" ? " with Prisma" : ` with ${orm}`}.
3771
3771
 
3772
3772
  1. Start the local SQLite database:
3773
- \`\`\`bash
3773
+ ${dbSetup === "d1" ? "Local development for a Cloudflare D1 database will already be running as part of the `wrangler dev` command." : `\`\`\`bash
3774
3774
  cd apps/server && ${packageManagerRunCmd} db:local
3775
3775
  \`\`\`
3776
+ `}
3776
3777
 
3777
3778
  2. Update your \`.env\` file in the \`apps/server\` directory with the appropriate connection details if needed.
3778
3779
  `;
@@ -3840,6 +3841,29 @@ function generateScriptsList(packageManagerRunCmd, database, orm, _auth, hasNati
3840
3841
  return scripts;
3841
3842
  }
3842
3843
 
3844
+ //#endregion
3845
+ //#region src/helpers/project-generation/git.ts
3846
+ async function initializeGit(projectDir, useGit) {
3847
+ if (!useGit) return;
3848
+ const gitVersionResult = await $({
3849
+ cwd: projectDir,
3850
+ reject: false,
3851
+ stderr: "pipe"
3852
+ })`git --version`;
3853
+ if (gitVersionResult.exitCode !== 0) {
3854
+ log.warn(pc.yellow("Git is not installed"));
3855
+ return;
3856
+ }
3857
+ const result = await $({
3858
+ cwd: projectDir,
3859
+ reject: false,
3860
+ stderr: "pipe"
3861
+ })`git init`;
3862
+ if (result.exitCode !== 0) throw new Error(`Git initialization failed: ${result.stderr}`);
3863
+ await $({ cwd: projectDir })`git add -A`;
3864
+ await $({ cwd: projectDir })`git commit -m ${"Initial commit"}`;
3865
+ }
3866
+
3843
3867
  //#endregion
3844
3868
  //#region src/helpers/project-generation/post-installation.ts
3845
3869
  function displayPostInstallInstructions(config) {
@@ -3852,7 +3876,7 @@ function displayPostInstallInstructions(config) {
3852
3876
  const tauriInstructions = addons?.includes("tauri") ? getTauriInstructions(runCmd) : "";
3853
3877
  const lintingInstructions = hasHuskyOrBiome ? getLintingInstructions(runCmd) : "";
3854
3878
  const nativeInstructions = frontend?.includes("native-nativewind") || frontend?.includes("native-unistyles") ? getNativeInstructions(isConvex) : "";
3855
- const pwaInstructions = addons?.includes("pwa") && (frontend?.includes("react-router") || frontend?.includes("tanstack-router")) ? getPwaInstructions() : "";
3879
+ const pwaInstructions = addons?.includes("pwa") && frontend?.includes("react-router") ? getPwaInstructions() : "";
3856
3880
  const starlightInstructions = addons?.includes("starlight") ? getStarlightInstructions(runCmd) : "";
3857
3881
  const hasWeb = frontend?.some((f) => [
3858
3882
  "tanstack-router",
@@ -4087,7 +4111,7 @@ async function updateServerPackageJson(projectDir, options) {
4087
4111
  if (!serverPackageJson.scripts) serverPackageJson.scripts = {};
4088
4112
  const scripts = serverPackageJson.scripts;
4089
4113
  if (options.database !== "none") {
4090
- if (options.database === "sqlite" && options.orm === "drizzle") scripts["db:local"] = "turso dev --db-file local.db";
4114
+ if (options.database === "sqlite" && options.orm === "drizzle" && options.dbSetup !== "d1") scripts["db:local"] = "turso dev --db-file local.db";
4091
4115
  if (options.orm === "prisma") {
4092
4116
  scripts["db:push"] = "prisma db push --schema ./prisma/schema";
4093
4117
  scripts["db:studio"] = "prisma studio";
@@ -4110,24 +4134,6 @@ async function updateConvexPackageJson(projectDir, options) {
4110
4134
  if (!convexPackageJson.scripts) convexPackageJson.scripts = {};
4111
4135
  await fs.writeJson(convexPackageJsonPath, convexPackageJson, { spaces: 2 });
4112
4136
  }
4113
- async function initializeGit(projectDir, useGit) {
4114
- if (!useGit) return;
4115
- const gitVersionResult = await $({
4116
- cwd: projectDir,
4117
- reject: false,
4118
- stderr: "pipe"
4119
- })`git --version`;
4120
- if (gitVersionResult.exitCode !== 0) {
4121
- log.warn(pc.yellow("Git is not installed"));
4122
- return;
4123
- }
4124
- const result = await $({
4125
- cwd: projectDir,
4126
- reject: false,
4127
- stderr: "pipe"
4128
- })`git init`;
4129
- if (result.exitCode !== 0) throw new Error(`Git initialization failed: ${result.stderr}`);
4130
- }
4131
4137
 
4132
4138
  //#endregion
4133
4139
  //#region src/helpers/project-generation/create-project.ts
@@ -4159,7 +4165,6 @@ async function createProject(options) {
4159
4165
  await updatePackageConfigurations(projectDir, options);
4160
4166
  await createReadme(projectDir, options);
4161
4167
  await writeBtsConfig(options);
4162
- await initializeGit(projectDir, options.git);
4163
4168
  log.success("Project template successfully scaffolded!");
4164
4169
  if (options.install) {
4165
4170
  await installDependencies({
@@ -4168,6 +4173,7 @@ async function createProject(options) {
4168
4173
  });
4169
4174
  await generateCloudflareWorkerTypes(options);
4170
4175
  }
4176
+ await initializeGit(projectDir, options.git);
4171
4177
  displayPostInstallInstructions({
4172
4178
  ...options,
4173
4179
  depsInstalled: options.install
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "2.22.8",
3
+ "version": "2.22.10",
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",