From a7c2fc5aa397f50851efb0ecb73d27c7704c33ab Mon Sep 17 00:00:00 2001 From: Donald Labaj Date: Thu, 29 Jan 2026 12:15:33 -0500 Subject: [PATCH] feat: Added ability to select package manager Added the ability to select the package manager that is needed when building a project. --- package.json | 1 + src/cli.ts | 5 +++-- src/templates.ts | 9 ++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 10a3a2e..52abb66 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "scripts": { "build": "tsc", + "start": "node dist/cli.js", "test": "jest" }, "jest": { diff --git a/src/cli.ts b/src/cli.ts index aaaa4ae..ed56c19 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -72,7 +72,7 @@ program cloneArgs.push(...template.options); } cloneArgs.push(templateRepoUrl, projectPath); - await execa('git', cloneArgs); + await execa('git', cloneArgs, { stdio: 'inherit' }); console.log('✅ Template cloned successfully.'); // Remove the .git folder from the *new* project @@ -128,9 +128,10 @@ program console.log('â„šī¸ No package.json found in template, skipping customization.'); } + const packageManager = template.packageManager || "npm"; // Install dependencies console.log('đŸ“Ļ Installing dependencies... (This may take a moment)'); - await execa('npm', ['install'], { cwd: projectPath }); + await execa(packageManager, ['install'], { cwd: projectPath, stdio: 'inherit' }); console.log('✅ Dependencies installed.'); // Let the user know the project was created successfully diff --git a/src/templates.ts b/src/templates.ts index 57a8e16..fef58e3 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -2,18 +2,21 @@ const templates = [ { name: "starter", description: "A starter template for Patternfly react typescript project", - repo: "https://github.com/patternfly/patternfly-react-seed.git" + repo: "https://github.com/patternfly/patternfly-react-seed.git", + packageManager: "yarn" }, { name: "compass-starter", description: "A starter template for Patternfly compass theme typescript project", repo: "https://github.com/patternfly/patternfly-react-seed.git", - options: ["--single-branch", "--branch", "compass_theme"] + options: ["--single-branch", "--branch", "compass_theme"], + packageManager: "yarn" }, { name: "nextjs-starter", description: "A starter template for Patternfly nextjs project", - repo: "git@github.com:patternfly/patternfly-nextjs-seed.git" + repo: "git@github.com:patternfly/patternfly-nextjs-seed.git", + packageManager: "yarn" }, { name: "ai_enabled_starter",