Skip to content

Commit 665bee3

Browse files
committed
Bump dependencies
1 parent 2e1220d commit 665bee3

File tree

7 files changed

+31
-25
lines changed

7 files changed

+31
-25
lines changed

src/app/download/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { getData as getRepoData } from "@/app/repositories/page";
21
import byteSize from "byte-size";
32
import SyntaxHighlight from "@/app/datasets/syntax";
43
// @ts-ignore
5-
import contents from "raw-loader!public/download.sh";
4+
import contents from "raw-loader!@public/download.sh";
65
// @ts-ignore
76
import example from "raw-loader!./example.sh";
87

98
// @ts-ignore
109
import example_2 from "raw-loader!./example_2.sh";
10+
import { getData as getRepoData } from "@/utils";
1111

1212
export default async function Download() {
1313
const repoData = await getRepoData();

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import TotalStats from "@/app/stats/total_stats";
22
import getStats from "@/app/stats/stats";
3-
import { getData as getRepoData } from "@/app/repositories/page";
43
import byteSize from "byte-size";
4+
import { getData as getRepoData } from "@/utils";
55

66
export default async function Home() {
77
const data = await getStats();

src/app/projects/page.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
"use client";
22
import { useRouter, useSearchParams } from "next/navigation";
33
import { useEffect, useMemo, useState } from "react";
4-
import Fuse from "fuse.js";
4+
import {default as Fuse, FuseIndex} from "fuse.js";
55
import { useDebounce } from "use-debounce";
66
import sampleSize from "lodash.samplesize";
77
import useSWRImmutable from "swr/immutable";
8-
import FuseIndex = Fuse.FuseIndex;
98

109
const ASSET_PATH = "https://data.py-code.org" //(process.env.NEXT_PUBLIC_ASSET_PATH || "").replace("http://", "https://");
1110

@@ -58,6 +57,7 @@ export default function ProjectsList() {
5857
console.time(`search ${debouncedSearch}`);
5958
let result = fuse.search(debouncedSearch, { limit: 50 });
6059
console.timeEnd(`search ${debouncedSearch}`);
60+
// @ts-ignore
6161
return result.map(({ item }) => item);
6262
} else if (debouncedSearch.length == 0 && isClient) {
6363
// Select 10 random packages
@@ -148,7 +148,9 @@ export default function ProjectsList() {
148148
</tr>
149149
</thead>
150150
<tbody>
151-
{searchResults.map((p) => {
151+
{
152+
// @ts-ignore
153+
searchResults.map((p) => {
152154
return (
153155
<tr key={p}>
154156
<th>

src/app/repositories/[name]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { getData } from "@/app/repositories/page";
21
import parseIso from "date-fns/parseISO";
32
import format from "date-fns/format";
43
import byteSize from "byte-size";
4+
import { getData } from "@/utils";
55

66
export default async function RepositoryDetail({ params }: { params: { name: string } }) {
77
const data = await getData();

src/app/repositories/page.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ import byteSize from "byte-size";
22
import parseIso from "date-fns/parseISO";
33
import format from "date-fns/format";
44
import differenceInDays from "date-fns/differenceInDays";
5-
import fs from "fs";
6-
import path from "path";
75
import RepoStats from "@/app/repositories/repo-stats";
8-
9-
const allRepoData = JSON.parse(
10-
fs.readFileSync(path.join(process.cwd(), "src/data/repositories_with_releases.json"), "utf-8"),
11-
) as RepoData[];
6+
import { getData } from "@/utils";
127

138
export default async function RepositoriesList() {
149
const data = await getData();
@@ -83,14 +78,3 @@ export type RepoData = {
8378
projects: Map<string, number>;
8479
};
8580

86-
export async function getData(): Promise<RepoData[]> {
87-
return allRepoData as RepoData[];
88-
// const res = await fetch('https://raw.githubusercontent.com/pypi-data/data/main/stats/repositories_with_releases.json')
89-
//
90-
// if (!res.ok) {
91-
// // This will activate the closest `error.js` Error Boundary
92-
// throw new Error('Failed to fetch data')
93-
// }
94-
//
95-
// return res.json()
96-
}

src/utils.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import fs from "fs";
2+
import path from "path";
3+
import { RepoData } from "@/app/repositories/page";
4+
5+
const allRepoData = JSON.parse(
6+
fs.readFileSync(path.join(process.cwd(), "src/data/repositories_with_releases.json"), "utf-8"),
7+
) as RepoData[];
8+
9+
export async function getData(): Promise<RepoData[]> {
10+
return allRepoData as RepoData[];
11+
// const res = await fetch('https://raw.githubusercontent.com/pypi-data/data/main/stats/repositories_with_releases.json')
12+
//
13+
// if (!res.ok) {
14+
// // This will activate the closest `error.js` Error Boundary
15+
// throw new Error('Failed to fetch data')
16+
// }
17+
//
18+
// return res.json()
19+
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
}
2121
],
2222
"paths": {
23-
"@/*": ["./src/*"]
23+
"@/*": ["./src/*"],
24+
"@public/*": ["./public/*"]
2425
}
2526
},
2627
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],

0 commit comments

Comments
 (0)