diff --git a/packages/create-pds/src/index.ts b/packages/create-pds/src/index.ts index bdcd12fd..16c1ac71 100644 --- a/packages/create-pds/src/index.ts +++ b/packages/create-pds/src/index.ts @@ -78,7 +78,11 @@ function runCommand( }); } -async function copyTemplateDir(src: string, dest: string): Promise { +async function copyTemplateDir( + src: string, + dest: string, + pm: PackageManager, +): Promise { await mkdir(dest, { recursive: true }); const entries = await readdir(src, { withFileTypes: true }); @@ -86,6 +90,9 @@ async function copyTemplateDir(src: string, dest: string): Promise { const srcPath = join(src, entry.name); let destName = entry.name; + // Skip pnpm-specific files if not using pnpm + if (destName === "pnpm-workspace.yaml" && pm !== "pnpm") continue; + // Rename dotfiles (npm strips them from packages) if (destName === "gitignore") destName = ".gitignore"; else if (destName === "env.example") destName = ".env.example"; @@ -95,7 +102,7 @@ async function copyTemplateDir(src: string, dest: string): Promise { const destPath = join(dest, destName); if (entry.isDirectory()) { - await copyTemplateDir(srcPath, destPath); + await copyTemplateDir(srcPath, destPath, pm); } else { await cp(srcPath, destPath); } @@ -266,7 +273,7 @@ const main = defineCommand({ spinner.start("Copying template..."); const templateDir = join(__dirname, "..", "templates", "pds-worker"); - await copyTemplateDir(templateDir, targetDir); + await copyTemplateDir(templateDir, targetDir, pm); // Replace placeholders in package.json await replaceInFile(join(targetDir, "package.json"), { diff --git a/packages/create-pds/templates/pds-worker/pnpm-workspace.yaml b/packages/create-pds/templates/pds-worker/pnpm-workspace.yaml new file mode 100644 index 00000000..57d1a3d3 --- /dev/null +++ b/packages/create-pds/templates/pds-worker/pnpm-workspace.yaml @@ -0,0 +1,4 @@ +allowBuilds: + esbuild: true + sharp: false + workerd: true