Skip to content

Commit

Permalink
feat: add pnpm version check
Browse files Browse the repository at this point in the history
  • Loading branch information
maneike committed Nov 19, 2024
1 parent 8f1ece2 commit 26497bd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/core/installMachine/installSteps/turbo/create.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { execAsync } from '../../../utils/execAsync';
import { logger } from '../../../utils/logger';

const checkPnpmVersion = async () => {
await logger.withSpinner('turborepo', 'Checking pnpm version...', async (spinner) => {
try {
// Run the command to check the pnpm version
const { stdout } = await execAsync('pnpm --version');
spinner.succeed(`Found pnpm version ${stdout.trim()}.`);
} catch (error) {
spinner.fail('Failed to find pnpm version. Visit https://pnpm.io/installation to install pnpm.');
console.error(error);
}
});
};

export const createTurboRepo = async (name: string) => {
await logger.withSpinner('turborepo', 'Initializing...', async (spinner) => {
try {
// Check the pnpm version
await checkPnpmVersion();
// Run the command to create a turbo repo
await execAsync(`npx create-turbo@latest ${name} -m pnpm`);
spinner.succeed('Initialized!');
} catch (error) {
Expand Down

0 comments on commit 26497bd

Please sign in to comment.