Skip to content

Commit 196cf25

Browse files
committed
Move to scripts directory
1 parent a867640 commit 196cf25

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/get-github-info.ts renamed to scripts/get-github-info/get-github-info.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import grayMatter from "gray-matter"
44
import {
55
getGitHubStats,
66
type GitHubInfo,
7-
} from "../scripts/sort-libraries/get-github-stats"
7+
} from "../sort-libraries/get-github-stats"
8+
9+
const DATA_PATH = new URL("./github-stats.json", import.meta.url).pathname
10+
const CODE_DIR = new URL("../../src/code", import.meta.url).pathname
811

912
async function main() {
10-
const filePaths = await fg("./src/code/**/*.md")
13+
const filePaths = await fg("./**/*.md", { cwd: CODE_DIR, absolute: true })
1114

1215
const errors: Error[] = []
1316

@@ -57,8 +60,7 @@ async function main() {
5760
// If it errored for some reason, we don't do anything.
5861
// If we got it, we overwrite.
5962
{
60-
const dataPath = "./src/github-stats.json"
61-
const data = await fs.readFile(dataPath, "utf8")
63+
const data = await fs.readFile(DATA_PATH, "utf8")
6264
const existingStats = JSON.parse(data) as Record<string, object>
6365

6466
const result: Record<string, object> = {}
@@ -79,7 +81,7 @@ async function main() {
7981
result[repoName] = newState.get(repoName)!
8082
}
8183

82-
await fs.writeFile(dataPath, JSON.stringify(result, null, 2))
84+
await fs.writeFile(DATA_PATH, JSON.stringify(result, null, 2))
8385
}
8486
}
8587

File renamed without changes.

scripts/get-github-info/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "./get-github-info"

0 commit comments

Comments
 (0)