Skip to content

🎥 Make videos programmatically with React

fix on macos

Jonny Burgere77185ebf013
diff --git a/packages/create-video/src/init.ts b/packages/create-video/src/init.ts
index 4787996d25..46f29c3f20 100644
--- a/packages/create-video/src/init.ts
+++ b/packages/create-video/src/init.ts
@@ -17,9 +17,9 @@ import {resolveProjectRoot} from './resolve-project-root';
import {selectTemplate} from './select-template';
import {yesOrNo} from './yesno';
-const gitExists = (commandToCheck: string) => {
+const gitExists = (commandToCheck: string, argsToCheck: string[]) => {
try {
- execa.sync(commandToCheck);
+ execa.sync(commandToCheck, argsToCheck);
return true;
} catch (err) {
return false;
@@ -28,13 +28,14 @@ const gitExists = (commandToCheck: string) => {
export const checkGitAvailability = async (
cwd: string,
- commandToCheck: string
+ commandToCheck: string,
+ argsToCheck: string[]
): Promise<
| {type: 'no-git-repo'}
| {type: 'is-git-repo'; location: string}
| {type: 'git-not-installed'}
> => {
- if (!gitExists(commandToCheck)) {
+ if (!gitExists(commandToCheck, argsToCheck)) {
return {type: 'git-not-installed'};
}
diff --git a/packages/create-video/src/test/git-status.test.ts b/packages/create-video/src/test/git-status.test.ts
index e67231007b..3a76c08d3d 100644
--- a/packages/create-video/src/test/git-status.test.ts
+++ b/packages/create-video/src/test/git-status.test.ts
@@ -3,7 +3,9 @@ import {expect, test} from 'vitest';
import {checkGitAvailability} from '../init';
test('Get git status', async () => {
- const status = await checkGitAvailability(process.cwd(), 'git --version');
+ const status = await checkGitAvailability(process.cwd(), 'git', [
+ '--version',
+ ]);
expect(status).toEqual({
type: 'is-git-repo',
location: path.posix
@@ -17,13 +19,15 @@ test('Get git status', async () => {
const status2 = await checkGitAvailability(
path.dirname(status.location),
- 'git --version'
+ 'git',
+ ['--version']
);
expect(status2).toEqual({type: 'no-git-repo'});
const status3 = await checkGitAvailability(
path.dirname(status.location),
- 'wronggitbinary --version'
+ 'wronggitbinary',
+ ['--version']
);
expect(status3).toEqual({type: 'git-not-installed'});
});