Skip to content

Commit 56551be

Browse files
committed
Move githubREST constants and update cache generation
Signed-off-by: paulober <[email protected]>
1 parent 0e71ab7 commit 56551be

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

src/utils/download.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
type GithubReleaseAssetData,
2626
getGithubReleaseByTag,
2727
getAuthorizationHeaders,
28-
ownerOfRepository,
2928
repoNameOfRepository,
3029
githubApiUnauthorized,
3130
} from "./githubREST.mjs";
@@ -43,6 +42,7 @@ import {
4342
HTTP_STATUS_FORBIDDEN,
4443
HTTP_STATUS_OK,
4544
HTTP_STATUS_UNAUTHORIZED,
45+
ownerOfRepository,
4646
WINDOWS_ARM64_PYTHON_DOWNLOAD_URL,
4747
WINDOWS_X86_PYTHON_DOWNLOAD_URL,
4848
} from "./sharedConstants.mjs";

src/utils/githubREST.mts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
HTTP_STATUS_NOT_MODIFIED,
1616
HTTP_STATUS_OK,
1717
HTTP_STATUS_UNAUTHORIZED,
18+
ownerOfRepository,
1819
} from "./sharedConstants.mjs";
1920

2021
/**
@@ -36,25 +37,6 @@ export type GithubReleaseAssetData = {
3637
id: number;
3738
};
3839

39-
/**
40-
* Get the url friendly owner of a repository on GitHub.
41-
*
42-
* @param repository The repository to get the owner of
43-
* @returns The owner of the repository on GitHub
44-
*/
45-
export function ownerOfRepository(repository: GithubRepository): string {
46-
switch (repository) {
47-
case GithubRepository.picoSDK:
48-
case GithubRepository.tools:
49-
case GithubRepository.picotool:
50-
return "raspberrypi";
51-
case GithubRepository.cmake:
52-
return "Kitware";
53-
case GithubRepository.ninja:
54-
return "ninja-build";
55-
}
56-
}
57-
5840
/**
5941
* Convert a GithubRepository enum value to the url friendly name
6042
* of the repository on GitHub it represents.

src/utils/sharedConstants.mts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ export enum GithubRepository {
6060
picotool = 4,
6161
}
6262

63+
/**
64+
* Get the url friendly owner of a repository on GitHub.
65+
*
66+
* @param repository The repository to get the owner of
67+
* @returns The owner of the repository on GitHub
68+
*/
69+
export function ownerOfRepository(repository: GithubRepository): string {
70+
switch (repository) {
71+
case GithubRepository.picoSDK:
72+
case GithubRepository.tools:
73+
case GithubRepository.picotool:
74+
return "raspberrypi";
75+
case GithubRepository.cmake:
76+
return "Kitware";
77+
case GithubRepository.ninja:
78+
return "ninja-build";
79+
}
80+
}
81+
6382
// NOTE: The primary rate limit for unauthenticated requests is 60 requests per hour.
6483
export const SDK_REPOSITORY_URL = "https://github.com/raspberrypi/pico-sdk.git";
6584
export const NINJA_REPOSITORY_URL = "https://github.com/ninja-build/ninja.git";

0 commit comments

Comments
 (0)