Skip to content

Commit 5a412f8

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

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
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-
repoNameOfRepository,
2928
githubApiUnauthorized,
3029
} from "./githubREST.mjs";
3130
import { unxzFile, unzipFile } from "./downloadHelpers.mjs";
@@ -43,6 +42,7 @@ import {
4342
HTTP_STATUS_OK,
4443
HTTP_STATUS_UNAUTHORIZED,
4544
ownerOfRepository,
45+
repoNameOfRepository,
4646
WINDOWS_ARM64_PYTHON_DOWNLOAD_URL,
4747
WINDOWS_X86_PYTHON_DOWNLOAD_URL,
4848
} from "./sharedConstants.mjs";

src/utils/githubREST.mts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
HTTP_STATUS_OK,
1717
HTTP_STATUS_UNAUTHORIZED,
1818
ownerOfRepository,
19+
repoNameOfRepository,
1920
} from "./sharedConstants.mjs";
2021

2122
/**
@@ -37,28 +38,6 @@ export type GithubReleaseAssetData = {
3738
id: number;
3839
};
3940

40-
/**
41-
* Convert a GithubRepository enum value to the url friendly name
42-
* of the repository on GitHub it represents.
43-
*
44-
* @param repository The repository to get the name of
45-
* @returns The name of the repository on GitHub
46-
*/
47-
export function repoNameOfRepository(repository: GithubRepository): string {
48-
switch (repository) {
49-
case GithubRepository.picoSDK:
50-
return "pico-sdk";
51-
case GithubRepository.cmake:
52-
return "CMake";
53-
case GithubRepository.ninja:
54-
return "ninja";
55-
case GithubRepository.tools:
56-
return "pico-sdk-tools";
57-
case GithubRepository.picotool:
58-
return "picotool";
59-
}
60-
}
61-
6241
/**
6342
* Interface for authorization headers to include in a request.
6443
*/

src/utils/sharedConstants.mts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,28 @@ export function ownerOfRepository(repository: GithubRepository): string {
7979
}
8080
}
8181

82+
/**
83+
* Convert a GithubRepository enum value to the url friendly name
84+
* of the repository on GitHub it represents.
85+
*
86+
* @param repository The repository to get the name of
87+
* @returns The name of the repository on GitHub
88+
*/
89+
export function repoNameOfRepository(repository: GithubRepository): string {
90+
switch (repository) {
91+
case GithubRepository.picoSDK:
92+
return "pico-sdk";
93+
case GithubRepository.cmake:
94+
return "CMake";
95+
case GithubRepository.ninja:
96+
return "ninja";
97+
case GithubRepository.tools:
98+
return "pico-sdk-tools";
99+
case GithubRepository.picotool:
100+
return "picotool";
101+
}
102+
}
103+
82104
// NOTE: The primary rate limit for unauthenticated requests is 60 requests per hour.
83105
export const SDK_REPOSITORY_URL = "https://github.com/raspberrypi/pico-sdk.git";
84106
export const NINJA_REPOSITORY_URL = "https://github.com/ninja-build/ninja.git";

0 commit comments

Comments
 (0)