Skip to content

🎥 Make videos programmatically with React

get git config

Jonny Burgere2c3e18f868a
diff --git a/packages/cli/src/get-github-repository.ts b/packages/cli/src/get-github-repository.ts
index 5901b8c539..35e534fff3 100644
--- a/packages/cli/src/get-github-repository.ts
+++ b/packages/cli/src/get-github-repository.ts
@@ -84,6 +84,15 @@ export const normalizeGitRemoteUrl = (url: string): ParsedGitRemote | null => {
};
}
+ const gitHubMatchWithoutGit = url.match(/https:\/\/github.com\/(.*)\/(.*)/);
+ if (gitHubMatchWithoutGit) {
+ return {
+ type: 'github',
+ name: gitHubMatchWithoutGit[2],
+ org: gitHubMatchWithoutGit[1],
+ };
+ }
+
return null;
};
diff --git a/packages/cli/src/test/get-github-repo.test.ts b/packages/cli/src/test/get-github-repo.test.ts
index 28256edfac..8830b8bbea 100644
--- a/packages/cli/src/test/get-github-repo.test.ts
+++ b/packages/cli/src/test/get-github-repo.test.ts
@@ -9,11 +9,12 @@ import {
test('Get GitHub repo', () => {
const gitConfig = getGitConfig(__dirname);
- console.log(gitConfig);
- expect(getGitRemoteOrigin(gitConfig as string)).toEqual({
- remote: 'origin',
- url: 'https://github.com/remotion-dev/remotion.git',
- });
+ const origin = getGitRemoteOrigin(gitConfig as string);
+ expect(origin?.remote).toEqual('origin');
+ expect(
+ origin?.url === 'https://github.com/remotion-dev/remotion.git' ||
+ origin?.url === 'https://github.com/remotion-dev/remotion',
+ ).toEqual(true);
});
test('Should normalize SSH URLs', () => {
@@ -36,6 +37,16 @@ test('Should normalize HTTPS URLs', () => {
});
});
+test('Should normalize HTTPS URLs without .git', () => {
+ expect(
+ normalizeGitRemoteUrl('https://github.com/remotion-dev/remotion'),
+ ).toEqual({
+ type: 'github',
+ org: 'remotion-dev',
+ name: 'remotion',
+ });
+});
+
test('Should get Gif Ref', () => {
expect(typeof getGifRef() === 'string').toBe(true);
});