Skip to content

Commit a7c2fc5

Browse files
committed
feat: Added ability to select package manager
Added the ability to select the package manager that is needed when building a project.
1 parent 20d1967 commit a7c2fc5

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"scripts": {
1313
"build": "tsc",
14+
"start": "node dist/cli.js",
1415
"test": "jest"
1516
},
1617
"jest": {

src/cli.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ program
7272
cloneArgs.push(...template.options);
7373
}
7474
cloneArgs.push(templateRepoUrl, projectPath);
75-
await execa('git', cloneArgs);
75+
await execa('git', cloneArgs, { stdio: 'inherit' });
7676
console.log('✅ Template cloned successfully.');
7777

7878
// Remove the .git folder from the *new* project
@@ -128,9 +128,10 @@ program
128128
console.log('ℹ️ No package.json found in template, skipping customization.');
129129
}
130130

131+
const packageManager = template.packageManager || "npm";
131132
// Install dependencies
132133
console.log('📦 Installing dependencies... (This may take a moment)');
133-
await execa('npm', ['install'], { cwd: projectPath });
134+
await execa(packageManager, ['install'], { cwd: projectPath, stdio: 'inherit' });
134135
console.log('✅ Dependencies installed.');
135136

136137
// Let the user know the project was created successfully

src/templates.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ const templates = [
22
{
33
name: "starter",
44
description: "A starter template for Patternfly react typescript project",
5-
repo: "https://github.com/patternfly/patternfly-react-seed.git"
5+
repo: "https://github.com/patternfly/patternfly-react-seed.git",
6+
packageManager: "yarn"
67
},
78
{
89
name: "compass-starter",
910
description: "A starter template for Patternfly compass theme typescript project",
1011
repo: "https://github.com/patternfly/patternfly-react-seed.git",
11-
options: ["--single-branch", "--branch", "compass_theme"]
12+
options: ["--single-branch", "--branch", "compass_theme"],
13+
packageManager: "yarn"
1214
},
1315
{
1416
name: "nextjs-starter",
1517
description: "A starter template for Patternfly nextjs project",
16-
repo: "git@github.com:patternfly/patternfly-nextjs-seed.git"
18+
repo: "git@github.com:patternfly/patternfly-nextjs-seed.git",
19+
packageManager: "yarn"
1720
},
1821
{
1922
name: "ai_enabled_starter",

0 commit comments

Comments
 (0)