fix pnpm workspace

This commit is contained in:
Aman Varshney
2025-03-24 21:38:53 +05:30
parent 58041ad484
commit 53be1b8213
3 changed files with 21 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"create-better-t-stack": patch
---
fix pnpm workspace

View File

@@ -1,7 +1,8 @@
import path from "node:path";
import { $ } from "execa";
import fs from "fs-extra";
import type { ProjectConfig, ProjectDatabase, ProjectOrm } from "../types";
import { PKG_ROOT } from "../constants";
import type { ProjectConfig } from "../types";
export async function updatePackageConfigurations(
projectDir: string,
@@ -30,6 +31,18 @@ async function updateRootPackageJson(
}
await fs.writeJson(rootPackageJsonPath, packageJson, { spaces: 2 });
if (options.packageManager === "pnpm") {
const pnpmWorkspaceTemplatePath = path.join(
PKG_ROOT,
"template/with-pnpm/pnpm-workspace.yaml",
);
const targetWorkspacePath = path.join(projectDir, "pnpm-workspace.yaml");
if (await fs.pathExists(pnpmWorkspaceTemplatePath)) {
await fs.copy(pnpmWorkspaceTemplatePath, targetWorkspacePath);
}
}
}
}

View File

@@ -0,0 +1,2 @@
packages:
- "packages/*"