Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
bun.lockb
14 changes: 11 additions & 3 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ const MOTION_PRIMITIVES_REGISTRY_URL =
'https://raw.githubusercontent.com/ibelick/motion-primitives/main/public/c/registry.json';
const MOTION_PRIMITIVES_BASE_URL =
'https://raw.githubusercontent.com/ibelick/motion-primitives/main/';
const TARGET_DIR = 'components/motion-primitives';

// support for src dir
const TARGET_DIR = existsSync('src')
? 'src/components/motion-primitives'
: 'components/motion-primitives';

interface FileEntry {
path: string;
Expand Down Expand Up @@ -61,6 +65,8 @@ function detectPackageManager(): string {
return 'yarn';
} else if (existsSync('pnpm-lock.yaml')) {
return 'pnpm';
} else if (existsSync('bun.lockb')) {
return 'bun';
} else {
return 'npm'; // Default to npm
}
Expand All @@ -80,7 +86,9 @@ function installDependencies(dependencies: string[]): boolean {
? `yarn add ${dependencies.join(' ')}`
: packageManager === 'pnpm'
? `pnpm add ${dependencies.join(' ')}`
: `npm install ${dependencies.join(' ')}`;
: packageManager === 'bun'
? `bun add ${dependencies.join(' ')}`
: `npm install ${dependencies.join(' ')}`;

execSync(installCommand, { stdio: 'ignore' });
spinner.succeed(
Expand All @@ -91,7 +99,7 @@ function installDependencies(dependencies: string[]): boolean {
spinner.fail(`Failed to install dependencies: ${error}`);
console.log('\nPlease install them manually:');
console.log(
`${packageManager === 'yarn' ? 'yarn add' : packageManager === 'pnpm' ? 'pnpm add' : 'npm install'} ${dependencies.join(' ')}`
`${packageManager === 'yarn' ? 'yarn add' : packageManager === 'pnpm' ? 'pnpm add' : packageManager === 'bun' ? 'bun add' : 'npm install'} ${dependencies.join(' ')}`
);
return false;
}
Expand Down